[webkit-reviews] review granted: [Bug 224664] The implicit aspect-ratio from width and height attributes with float value is not accurate enough : [Attachment 426335] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Apr 17 15:50:48 PDT 2021


Darin Adler <darin at apple.com> has granted cathiechen <cathiechen at igalia.com>'s
request for review:
Bug 224664: The implicit aspect-ratio from width and height attributes with
float value is not accurate enough
https://bugs.webkit.org/show_bug.cgi?id=224664

Attachment 426335: Patch

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




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

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

Looks good, but we can do better.

> Source/WebCore/rendering/RenderReplaced.cpp:506
> +	   float attributeWidth =
parseValidHTMLFloatingPointNumber(node->getAttribute(HTMLNames::widthAttr)).val
ueOr(0);
> +	   float attributeHeight =
parseValidHTMLFloatingPointNumber(node->getAttribute(HTMLNames::heightAttr)).va
lueOr(0);

The parseValidHTMLFloatingPointNumber function returns an Optional<double>. But
this code truncates that double to a float, then divides as float, then
converts back to double. I suggest using auto here, or double and not involving
single-precision float at all.


More information about the webkit-reviews mailing list