[webkit-reviews] review granted: [Bug 249107] canonicalUnitTypeForCategory should handle percent category : [Attachment 464000] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Dec 11 23:24:08 PST 2022


Tim Nguyen (:ntim) <ntim at apple.com> has granted Antti Koivisto
<koivisto at iki.fi>'s request for review:
Bug 249107: canonicalUnitTypeForCategory should handle percent category
https://bugs.webkit.org/show_bug.cgi?id=249107

Attachment 464000: Patch

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




--- Comment #5 from Tim Nguyen (:ntim) <ntim at apple.com> ---
Comment on attachment 464000
  --> https://bugs.webkit.org/attachment.cgi?id=464000
Patch

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

> Source/WebCore/css/typedom/CSSUnitValue.cpp:161
>      auto canonicalUnit = [] (CSSUnitType unit) {
> -	   // FIXME: We probably want to change the definition of
canonicalUnitTypeForCategory so this lambda isn't necessary.
> -	   auto category = unitCategory(unit);
> -	   switch (category) {
> -	   case CSSUnitCategory::Percent:
> -	       return CSSUnitType::CSS_PERCENTAGE;
> -	   case CSSUnitCategory::Flex:
> -	       return CSSUnitType::CSS_FR;
> -	   default:
> -	       break;
> -	   }
> -	   auto result = canonicalUnitTypeForCategory(category);
> +	   auto result = canonicalUnitTypeForUnitType(unit);
>	   return result == CSSUnitType::CSS_UNKNOWN ? unit : result;
>      } (m_unit);

Do we really need this lambda? Can we just call `canonicalUnitTypeForUnitType`
directly ?


More information about the webkit-reviews mailing list