RESOLVED FIXED 221881
Prepare for adding relative color support
https://bugs.webkit.org/show_bug.cgi?id=221881
Summary Prepare for adding relative color support
Sam Weinig
Reported 2021-02-14 15:38:16 PST
Prepare for adding relative color support
Attachments
Patch (70.25 KB, patch)
2021-02-14 15:52 PST, Sam Weinig
no flags
Patch (70.69 KB, patch)
2021-02-14 16:03 PST, Sam Weinig
no flags
Patch (71.36 KB, patch)
2021-02-14 16:15 PST, Sam Weinig
no flags
Patch (71.75 KB, patch)
2021-02-14 16:27 PST, Sam Weinig
ews-feeder: commit-queue-
Patch (71.75 KB, patch)
2021-02-14 19:04 PST, Sam Weinig
no flags
Patch (77.51 KB, patch)
2021-02-14 20:11 PST, Sam Weinig
no flags
Patch (76.67 KB, patch)
2021-02-15 10:32 PST, Sam Weinig
no flags
Patch for landing (1.36 KB, patch)
2021-02-15 13:10 PST, Michael Catanzaro
no flags
Sam Weinig
Comment 1 2021-02-14 15:52:53 PST Comment hidden (obsolete)
Sam Weinig
Comment 2 2021-02-14 16:03:30 PST Comment hidden (obsolete)
Sam Weinig
Comment 3 2021-02-14 16:15:14 PST Comment hidden (obsolete)
Sam Weinig
Comment 4 2021-02-14 16:27:24 PST Comment hidden (obsolete)
Sam Weinig
Comment 5 2021-02-14 19:04:01 PST Comment hidden (obsolete)
Sam Weinig
Comment 6 2021-02-14 20:11:54 PST
Darin Adler
Comment 7 2021-02-15 08:41:10 PST
Comment on attachment 420267 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420267&action=review > Source/WebCore/css/parser/CSSParser.cpp:120 > - return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, HTMLStandardMode); > + return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, strictCSSParserContext()); Rationale for going from "standard mode" to "strict"? > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:699 > + return clampTo<double>(*alphaParameter, 0.0, 1.0); Should not need the <double> here. > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:712 > + if (auto number = consumeNumberRaw(range)) > + return *number; > + > + return WTF::nullopt; Doesn’t seem like we need an if here. Just a return. > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:723 > +enum class RGBComponentType { > + Number, > + Percentage > +}; Looks better on a single line? > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:736 > +enum class RGBOrHSLSeparatorSyntax { > + Commas, > + WhitespaceSlash > +}; Looks better on a single line? > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:760 > + if (auto alphaParameter = consumeNumberOrPercentDividedBy100Raw(args)) > + return *alphaParameter; > + > + return WTF::nullopt; Doesn’t seem like we need an if here. Just a return. > Source/WebCore/editing/cocoa/DataDetection.mm:603 > + hsla.lightness = 50.0f; How do you know you found all the places that depend on the old range?
EWS
Comment 8 2021-02-15 08:42:17 PST
ChangeLog entry in Tools/ChangeLog contains OOPS!.
Darin Adler
Comment 9 2021-02-15 09:21:18 PST
Comment on attachment 420267 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420267&action=review >> Source/WebCore/css/parser/CSSParser.cpp:120 >> + return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, strictCSSParserContext()); > > Rationale for going from "standard mode" to "strict"? Oh, wait, I guess those are two names for the same sort of thing. Somehow I thought "standard" was the non-strict.
Sam Weinig
Comment 10 2021-02-15 10:27:17 PST
(In reply to Darin Adler from comment #7) > Comment on attachment 420267 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=420267&action=review > > > Source/WebCore/css/parser/CSSParser.cpp:120 > > - return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, HTMLStandardMode); > > + return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, strictCSSParserContext()); > > Rationale for going from "standard mode" to "strict"? strictCSSParserContext() is just a CSSParserContext with HTMLStandardMode. const CSSParserContext& strictCSSParserContext() { static MainThreadNeverDestroyed<CSSParserContext> strictContext(HTMLStandardMode); return strictContext; } So it should behave the same. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:699 > > + return clampTo<double>(*alphaParameter, 0.0, 1.0); > > Should not need the <double> here. Fixed. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:712 > > + if (auto number = consumeNumberRaw(range)) > > + return *number; > > + > > + return WTF::nullopt; > > Doesn’t seem like we need an if here. Just a return. Good point. Fixed. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:723 > > +enum class RGBComponentType { > > + Number, > > + Percentage > > +}; > > Looks better on a single line? Fixed. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:736 > > +enum class RGBOrHSLSeparatorSyntax { > > + Commas, > > + WhitespaceSlash > > +}; > > Looks better on a single line? Fixed. > > > Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:760 > > + if (auto alphaParameter = consumeNumberOrPercentDividedBy100Raw(args)) > > + return *alphaParameter; > > + > > + return WTF::nullopt; > > Doesn’t seem like we need an if here. Just a return. Fixed. > > > Source/WebCore/editing/cocoa/DataDetection.mm:603 > > + hsla.lightness = 50.0f; > > How do you know you found all the places that depend on the old range? Searched for all uses of HSLA in the code. Since you explicit conversion is needed it's pretty easy to find them all. Thanks for the review.
Sam Weinig
Comment 11 2021-02-15 10:32:22 PST
EWS
Comment 12 2021-02-15 11:24:18 PST
Committed r272870: <https://commits.webkit.org/r272870> All reviewed patches have been landed. Closing bug and clearing flags on attachment 420330 [details].
Radar WebKit Bug Importer
Comment 13 2021-02-15 11:25:16 PST
Michael Catanzaro
Comment 14 2021-02-15 13:10:02 PST
Reopening to attach new patch.
Michael Catanzaro
Comment 15 2021-02-15 13:10:29 PST
Created attachment 420353 [details] Patch for landing
EWS
Comment 16 2021-02-15 13:40:51 PST
Committed r272876: <https://commits.webkit.org/r272876> All reviewed patches have been landed. Closing bug and clearing flags on attachment 420353 [details].
Fujii Hironori
Comment 17 2021-02-18 22:44:11 PST
Comment on attachment 420330 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420330&action=review > Source/WebCore/css/parser/CSSParser.cpp:120 > + return CSSPropertyParserHelpers::consumeColorWorkerSafe(range, strictCSSParserContext()); You can't use strictCSSParserContext in parseColorWorkerSafe. See Bug 222156.
Note You need to log in before you can comment on or make changes to this bug.