Closed Bug 210238 Opened 23 years ago Closed 21 years ago

Dead code removal in htmlparser/src/nsElementTable.cpp

Categories

(Core :: DOM: HTML Parser, defect)

defect
Not set
trivial

Tracking

()

VERIFIED FIXED

People

(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)

Details

Attachments

(1 file, 2 obsolete files)

Dead code removal in htmlparser/src/nsElementTable.cpp: int nsHTMLElement::GetSynonymousGroups(eHTMLTags aTag) { int result=0; int theGroup=gHTMLElements[aTag].mParentBits; switch(theGroup) { case kPhrase: case kSpecial: case kFontStyle: case kHTMLContent: case kHeadContent: case kHeadMisc: case kFormControl: case kPreformatted: case kHeading: case kBlockMisc: case kBlock: case kList: case kPCDATA: case kExtensions: case kTable: case kSelf: case kInlineEntity: case kBlockEntity: case kFlowEntity: case kAllTags: default: break; } if(eHTMLTag_font==aTag) //hack for backward compatibility result&=kFontStyle; return result; } That 'switch' seems pretty useless to me, let's remove it, giving: int nsHTMLElement::GetSynonymousGroups(eHTMLTags aTag) { int result=0; if(eHTMLTag_font==aTag) //hack for backward compatibility result&=kFontStyle; return result; } Hmm, 'result&=kFontStyle' will always be zero, right? I suggest we just remove this function and update the callers (only one). Patch coming up...
Attached patch Patch rev. 1 (obsolete) — — Splinter Review
Attachment #126208 - Flags: review?(harishd)
Comment on attachment 126208 [details] [diff] [review] Patch rev. 1 Why not get rid of > static > PRInt32 GetIndexOfChildOrSynonym(nsDTDContext& aContext,eHTMLTags aChildTag) { and have the current callers call nsHTMLElement::GetIndexOfChildOrSynonym directly?
Attached patch Patch rev. 2 (obsolete) — — Splinter Review
As David suggested above
Attachment #126208 - Attachment is obsolete: true
Attachment #126208 - Flags: review?(harishd)
Attachment #126232 - Flags: review?(harishd)
Comment on attachment 126232 [details] [diff] [review] Patch rev. 2 >Index: htmlparser/src/nsElementTable.cpp >=================================================================== >RCS file: /cvsroot/mozilla/htmlparser/src/nsElementTable.cpp,v >retrieving revision 3.150 >diff -u -r3.150 nsElementTable.cpp >--- htmlparser/src/nsElementTable.cpp 11 Jun 2003 04:24:22 -0000 3.150 >+++ htmlparser/src/nsElementTable.cpp 22 Jun 2003 14:28:51 -0000 >@@ -1474,56 +1474,8 @@ > if(theSynTags) { > theChildIndex=LastOf(aContext,*theSynTags); > } >- else{ >- PRInt32 theGroup=nsHTMLElement::GetSynonymousGroups(aChildTag); >- if(theGroup) { >- theChildIndex=aContext.GetCount(); >- while(-1<--theChildIndex) { >- eHTMLTags theTag=aContext[theChildIndex]; >- if(gHTMLElements[theTag].IsMemberOf(theGroup)) { >- break; >- } >- } >- } >- } > } > return theChildIndex; >-} >- >-int nsHTMLElement::GetSynonymousGroups(eHTMLTags aTag) { >- int result=0; >- >- int theGroup=gHTMLElements[aTag].mParentBits; >- switch(theGroup) { >- >- case kPhrase: >- case kSpecial: >- case kFontStyle: >- case kHTMLContent: >- case kHeadContent: >- case kHeadMisc: >- case kFormControl: >- case kPreformatted: >- case kHeading: >- case kBlockMisc: >- case kBlock: >- case kList: >- case kPCDATA: >- case kExtensions: >- case kTable: >- case kSelf: >- case kInlineEntity: >- case kBlockEntity: >- case kFlowEntity: >- case kAllTags: >- default: >- break; >- } >- >- if(eHTMLTag_font==aTag) //hack for backward compatibility >- result&=kFontStyle; >- >- return result; > } > Why are you removing these lines?
Since |nsHTMLElement::GetSynonymousGroups| doesn't do anything useful (it always returns zero) I see no point in keeping it. See explanation in comment 0.
The comment "hack for backward compatibility" concerns me. I believe result&=kFontStyle; should have been result = kFontStyle. What do you think?
Attachment #126232 - Flags: review?(harishd)
My point is that the code *currently* doesn't do anything, so it should be removed. Activating this code now, as suggested in comment 6 seems riscy.
Attachment #170327 - Flags: review?(mrbkap)
Comment on attachment 170327 [details] [diff] [review] Patch rev. 3 (updated to trunk, no changes since rev. 2) It would have been nice to figure out what bug that "hack for backwards compatibility" was trying to fix, but it hasn't worked for 4 or so years (and of course bonsai is useless in that file), so r=mrbkap
Attachment #170327 - Flags: review?(mrbkap) → review+
Attachment #170327 - Flags: superreview?(dbaron)
Attachment #170327 - Flags: superreview?(dbaron) → superreview+
Checked in 2005-01-16 09:07 PDT -> FIXED
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Verified FIXED using LXR for code inspection.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: