[webkit-reviews] review granted: [Bug 221164] Update consumeNumberRaw() to return an Optional<double> rather than using a bool/out parameter pattern : [Attachment 418783] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Jan 29 17:09:15 PST 2021


Darin Adler <darin at apple.com> has granted Sam Weinig <sam at webkit.org>'s request
for review:
Bug 221164: Update consumeNumberRaw() to return an Optional<double> rather than
using a bool/out parameter pattern
https://bugs.webkit.org/show_bug.cgi?id=221164

Attachment 418783: Patch

https://bugs.webkit.org/attachment.cgi?id=418783&action=review




--- Comment #2 from Darin Adler <darin at apple.com> ---
Comment on attachment 418783
  --> https://bugs.webkit.org/attachment.cgi?id=418783
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=418783&action=review

Seems like a helper that does a number or a percentage and converts the
percentage just by dividing by 100 would simplify code in a few different
places.

> Source/WebCore/css/parser/CSSPropertyParser.cpp:5038
> +	       if (auto num = consumeNumberRaw(m_range)) {

Could have expanded the name num to number since touching this code.

> Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp:780
> +	       alpha = clampTo<double>(*percent / 100.0f, 0.0, 1.0);

The "f" here seems wrong. Was in the old code too, but wrong.


More information about the webkit-reviews mailing list