⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278300 in webkit


Ignore:
Timestamp:
Jun 1, 2021, 3:52:26 AM (5 years ago)
Author:
svillar@igalia.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r278295 r278300  
     12021-05-27  Sergio Villar Senin  <svillar@igalia.com>
     2
     3        Improve if condition in RenderReplaced::computeReplacedLogicalWidth
     4        https://bugs.webkit.org/show_bug.cgi?id=226325
     5
     6        Reviewed by Darin Adler.
     7
     8        Removed the check for intrinsicRatio as we're already inside a block in which intrinsicRatio
     9        is true. Also switched the position of the two conditions in the OR clause as it allows us
     10        to remove the check for computedHeightIsAuto. Last but not least, used a ternary operator
     11        to initialize the value of boxSizing instead of the if clause.
     12
     13        No new tests as there is no change in functionality.
     14
     15        * rendering/RenderReplaced.cpp:
     16        (WebCore::RenderReplaced::computeReplacedLogicalWidth const):
     17
    1182021-05-31  Dean Jackson  <dino@apple.com>
    219
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r278253 r278300  
    562562            // 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
    563563            // of 'width' is: (used height) * (intrinsic ratio)
    564             if (intrinsicRatio && ((computedHeightIsAuto && !hasIntrinsicWidth && hasIntrinsicHeight) || !computedHeightIsAuto)) {
     564            if (!computedHeightIsAuto || (!hasIntrinsicWidth && hasIntrinsicHeight)) {
    565565                LayoutUnit estimatedUsedWidth = hasIntrinsicWidth ? LayoutUnit(constrainedSize.width()) : computeConstrainedLogicalWidth(shouldComputePreferred);
    566566                LayoutUnit logicalHeight = computeReplacedLogicalHeight(std::optional<LayoutUnit>(estimatedUsedWidth));
    567                 BoxSizing boxSizing = BoxSizing::ContentBox;
    568                 if (style().hasAspectRatio())
    569                     boxSizing = style().boxSizingForAspectRatio();
     567                BoxSizing boxSizing = style().hasAspectRatio() ? style().boxSizingForAspectRatio() : BoxSizing::ContentBox;
    570568                return computeReplacedLogicalWidthRespectingMinMaxWidth(resolveWidthForRatio(borderAndPaddingLogicalHeight(), borderAndPaddingLogicalWidth(), logicalHeight, intrinsicRatio, boxSizing), shouldComputePreferred);
    571569            }
    572570
    573            
    574571            // If 'height' and 'width' both have computed values of 'auto' and the
    575572            // element has an intrinsic ratio but no intrinsic height or width, then
Note: See TracChangeset for help on using the changeset viewer.