Title: [278300] trunk/Source/WebCore
Revision
278300
Author
[email protected]
Date
2021-06-01 03:52:26 -0700 (Tue, 01 Jun 2021)

Log Message

Improve if condition in RenderReplaced::computeReplacedLogicalWidth
https://bugs.webkit.org/show_bug.cgi?id=226325

Reviewed by Darin Adler.

Removed the check for intrinsicRatio as we're already inside a block in which intrinsicRatio
is true. Also switched the position of the two conditions in the OR clause as it allows us
to remove the check for computedHeightIsAuto. Last but not least, used a ternary operator
to initialize the value of boxSizing instead of the if clause.

No new tests as there is no change in functionality.

* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeReplacedLogicalWidth const):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (278299 => 278300)


--- trunk/Source/WebCore/ChangeLog	2021-06-01 08:42:48 UTC (rev 278299)
+++ trunk/Source/WebCore/ChangeLog	2021-06-01 10:52:26 UTC (rev 278300)
@@ -1,3 +1,20 @@
+2021-05-27  Sergio Villar Senin  <[email protected]>
+
+        Improve if condition in RenderReplaced::computeReplacedLogicalWidth
+        https://bugs.webkit.org/show_bug.cgi?id=226325
+
+        Reviewed by Darin Adler.
+
+        Removed the check for intrinsicRatio as we're already inside a block in which intrinsicRatio
+        is true. Also switched the position of the two conditions in the OR clause as it allows us
+        to remove the check for computedHeightIsAuto. Last but not least, used a ternary operator
+        to initialize the value of boxSizing instead of the if clause.
+
+        No new tests as there is no change in functionality.
+
+        * rendering/RenderReplaced.cpp:
+        (WebCore::RenderReplaced::computeReplacedLogicalWidth const):
+
 2021-05-31  Dean Jackson  <[email protected]>
 
         [WebXR] Attach IOSurface to WebXROpaqueFramebuffer

Modified: trunk/Source/WebCore/rendering/RenderReplaced.cpp (278299 => 278300)


--- trunk/Source/WebCore/rendering/RenderReplaced.cpp	2021-06-01 08:42:48 UTC (rev 278299)
+++ trunk/Source/WebCore/rendering/RenderReplaced.cpp	2021-06-01 10:52:26 UTC (rev 278300)
@@ -561,16 +561,13 @@
             // If 'height' and 'width' both have computed values of 'auto' and the element has no intrinsic width, but does have an intrinsic height and intrinsic ratio;
             // or if 'width' has a computed value of 'auto', 'height' has some other computed value, and the element does have an intrinsic ratio; then the used value
             // of 'width' is: (used height) * (intrinsic ratio)
-            if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !computedHeightIsAuto)) {
+            if (!computedHeightIsAuto || (!hasIntrinsicWidth && hasIntrinsicHeight)) {
                 LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred);
                 LayoutUnit logicalHeight = computeReplacedLogicalHeight(std::optional<LayoutUnit>(estimatedUsedWidth));
-                BoxSizing boxSizing = BoxSizing::ContentBox;
-                if (style().hasAspectRatio())
-                    boxSizing = style().boxSizingForAspectRatio();
+                BoxSizing boxSizing = style().hasAspectRatio() ? style().boxSizingForAspectRatio() : BoxSizing::ContentBox;
                 return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio, boxSizing), shouldComputePreferred);
             }
 
-            
             // If 'height' and 'width' both have computed values of 'auto' and the
             // element has an intrinsic ratio but no intrinsic height or width, then
             // the used value of 'width' is undefined in CSS 2.1. However, it is
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to