Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a8423b21e22119ea0cf0fe9dd72c8e3de2ebcfa1
      
https://github.com/WebKit/WebKit/commit/a8423b21e22119ea0cf0fe9dd72c8e3de2ebcfa1
  Author: Alan Baradlay <[email protected]>
  Date:   2026-04-30 (Thu, 30 Apr 2026)

  Changed paths:
    M Source/WebCore/rendering/RenderFlexibleBox.cpp

  Log Message:
  -----------
  Clean up computeMainSizeFromAspectRatioUsing to separate intrinsic vs CSS 
aspect ratio paths
https://bugs.webkit.org/show_bug.cgi?id=313738

Reviewed by Sammy Gill.

This function figures out how tall (or wide) a flex item should be based on its
aspect ratio and its known cross size. It handles three different cases but the
old code tangled them together with a shared variable that meant "cross-axis
border + padding" in one branch and "main-axis border + padding" in the other.

The refactor splits them into three explicit paths, each with its own return:

1. Intrinsic ratio (like an image) - strip border+padding from the cross size
   if needed, multiply by ratio.
2. CSS ratio with content-box - strip border + padding from cross size, multiply
   by ratio. Has a FIXME because it always strips even when the value is already
   content-box.
3. CSS ratio with border-box - multiply border-box cross size by ratio, then
   subtract main-axis border + padding so the caller gets a content-box result.

No behavior change.

* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::computeMainSizeFromAspectRatioUsing):

Canonical link: https://commits.webkit.org/312397@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to