WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
44622
implicitlyStyledElementShouldBeRemovedWhenApplyingStyle, removeHTMLFontStyle, and removeHTMLBidiEmbeddingStyle should be merged
https://bugs.webkit.org/show_bug.cgi?id=44622
Summary
implicitlyStyledElementShouldBeRemovedWhenApplyingStyle, removeHTMLFontStyle,...
Ryosuke Niwa
Reported
2010-08-25 10:40:46 PDT
implicitlyStyledElementShouldBeRemovedWhenApplyingStyle, removeHTMLFontStyle, and removeHTMLBidiEmbeddingStyle all share the same logic and should be merged int one function. Also it's required to fix the
bug 44560
.
Attachments
Patch
(13.57 KB, patch)
2010-08-25 15:58 PDT
,
Ryosuke Niwa
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Ryosuke Niwa
Comment 1
2010-08-25 15:58:59 PDT
Created
attachment 65492
[details]
Patch
Darin Adler
Comment 2
2010-08-26 12:53:44 PDT
Comment on
attachment 65492
[details]
Patch Seems OK to merge all of this into a single function.
> +enum EPushDownType {ShouldBePushedDown, ShouldNotBePushedDown };
Missing space after brace here.
> +struct CSSPropertyElementCorrespondance {
The word "correspondance" is spelled "correspondence". I'm not sure this is an "element correspondence". I think it's information about achieving the same effect as the property with HTML elements and attributes. Maybe given the context of the source file, HTMLEquivalent would be a suitable name for the structure and then HTMLEquivalents could be the name of the array?
> + {CSSPropertyFontWeight, false, CSSValueBold, &bTag, 0, ShouldBePushedDown},
You should have space before and after these braces.
> + for (size_t i = 0; i < sizeof(CSSPropertyElementMapping) / sizeof(CSSPropertyElementCorrespondance); i++) {
This code would be easier to read if you stuck CSSPropertyElementMapping[i] into a local variable. I would name the local variable "equivalents".
> + ASSERT(CSSPropertyElementMapping[i].element || CSSPropertyElementMapping[i].attribute); > + if (CSSPropertyElementMapping[i].element && !element->hasTagName(*CSSPropertyElementMapping[i].element)) > + continue; > + if (CSSPropertyElementMapping[i].attribute && !element->hasAttribute(*CSSPropertyElementMapping[i].attribute)) > + continue;
> + else if (styleValue->cssText() == mapValue->cssText()) > + continue; // If CSS value is primitive, then skip if they are equal.
This seems like an inefficient way to compare. Later we should look into this. Serializing just to check if equal seems wasteful.
Ryosuke Niwa
Comment 3
2010-08-26 15:04:49 PDT
Thanks for the review. (In reply to
comment #2
)
> (From update of
attachment 65492
[details]
) > Seems OK to merge all of this into a single function. > > > +enum EPushDownType {ShouldBePushedDown, ShouldNotBePushedDown }; > > Missing space after brace here.
Will fix.
> > +struct CSSPropertyElementCorrespondance { > > The word "correspondance" is spelled "correspondence".
Sorry about the typo. I badly need a spell checker on XCode.
> I'm not sure this is an "element correspondence". I think it's information about achieving the same effect as the property with HTML elements and attributes. Maybe given the context of the source file, HTMLEquivalent would be a suitable name for the structure and then HTMLEquivalents could be the name of the array?
I had an intention in using it in StyleChange as well but I guess we can rename it when I do that. Will rename to HTMLEquivalents and HTMLEquivalent as you suggested.
> > + {CSSPropertyFontWeight, false, CSSValueBold, &bTag, 0, ShouldBePushedDown}, > > You should have space before and after these braces.
Will fix.
> > + for (size_t i = 0; i < sizeof(CSSPropertyElementMapping) / sizeof(CSSPropertyElementCorrespondance); i++) { > > This code would be easier to read if you stuck CSSPropertyElementMapping[i] into a local variable. I would name the local variable "equivalents".
Will fix.
> > + else if (styleValue->cssText() == mapValue->cssText()) > > + continue; // If CSS value is primitive, then skip if they are equal. > > This seems like an inefficient way to compare. Later we should look into this. Serializing just to check if equal seems wasteful.
Yes, it's a unnecessary performance degression but because CSSValue doesn't have operator== or matches, we can do it any other way. I'm more than happy to add operator== or matches. It'll make a lot of things easier.
Ryosuke Niwa
Comment 4
2010-08-27 00:38:56 PDT
Landed as
http://trac.webkit.org/changeset/66186
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug