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

Changeset 273785 in webkit


Ignore:
Timestamp:
Mar 2, 2021, 7:08:15 PM (6 years ago)
Author:
Alan Coon
Message:

Cherry-pick r273264. rdar://problem/74952900

REGRESSION (r266695): twitch.tv: when in fullscreen, WebKit continually does 350ms layouts. Firefox and Chrome do not
​https://bugs.webkit.org/show_bug.cgi?id=222202
<rdar://problem/74537782>

Reviewed by Simon Fraser.

PerformanceTests:

New performance test for nested column flexboxes with percentage heights.

  • Layout/nested-column-flexboxes-relative-height.html: Added.

Source/WebCore:

The problem was that we were doing the initial layout for the children of the flex container twice in those cases where
the child inline axis was not the main axis (for example with column flex containers in horizontal writing modes).
Refactored the code (specially the way we clear overriding sizes) so that we only do it once. This saves tons of layouts
in pages with nested column flexboxes with relative heights.

No new tests as there is no change in functionality, we're removing duplicate extra layouts. We're however adding a new
performance test for column flexboxes with percentage heights. With this patch we go from 3.5 layout/s to 145 layout/s
which is ~4000% better.

Inspired by Blink's crrev.com/c/1614058 by <​cbiesinger@chromium.org>.

  • rendering/RenderFlexibleBox.cpp: (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Do not unconditionally clear overriding sizes. Also removed relayoutChildren which is now unused. Do not layout the item, that should have been done in computeInnerFlexBaseSizeForChild() before. Added ASSERTs to verify that child's intrinsic main size was cached as a consequence of the previous layout. (WebCore::RenderFlexibleBox::constructFlexItem): Do not pass relayoutChildren to computeInnerFlexBaseSizeForChild. Also no need to update it after laying out the child.
  • rendering/RenderFlexibleBox.h:

git-svn-id: ​https://svn.webkit.org/repository/webkit/trunk@273264 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-612.1.5-branch
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-612.1.5-branch/LayoutTests/TestExpectations

    r273203 r273785  
    39163916webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-012.html [ ImageOnlyFailure ]
    39173917webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-015.html [ ImageOnlyFailure ]
    3918 webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-017.html [ ImageOnlyFailure ]
     3918webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-column-017.html [ Failure ]
    39193919webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-007.html [ ImageOnlyFailure ]
    39203920webkit.org/b/219343 imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-img-row-010.html [ ImageOnlyFailure ]
  • branches/safari-612.1.5-branch/PerformanceTests/ChangeLog

    r273122 r273785  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273264. rdar://problem/74952900
     4
     5    REGRESSION (r266695): twitch.tv: when in fullscreen, WebKit continually does 350ms layouts. Firefox and Chrome do not
     6    https://bugs.webkit.org/show_bug.cgi?id=222202
     7    <rdar://problem/74537782>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    PerformanceTests:
     12   
     13    New performance test for nested column flexboxes with percentage heights.
     14   
     15    * Layout/nested-column-flexboxes-relative-height.html: Added.
     16   
     17    Source/WebCore:
     18   
     19    The problem was that we were doing the initial layout for the children of the flex container twice in those cases where
     20    the child inline axis was not the main axis (for example with column flex containers in horizontal writing modes).
     21    Refactored the code (specially the way we clear overriding sizes) so that we only do it once. This saves tons of layouts
     22    in pages with nested column flexboxes with relative heights.
     23   
     24    No new tests as there is no change in functionality, we're removing duplicate extra layouts. We're however adding a new
     25    performance test for column flexboxes with percentage heights. With this patch we go from 3.5 layout/s to 145 layout/s
     26    which is ~4000% better.
     27   
     28    Inspired by Blink's crrev.com/c/1614058 by <cbiesinger@chromium.org>.
     29   
     30    * rendering/RenderFlexibleBox.cpp:
     31    (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Do not unconditionally clear overriding sizes. Also removed
     32    relayoutChildren which is now unused. Do not layout the item, that should have been done in
     33    computeInnerFlexBaseSizeForChild() before. Added ASSERTs to verify that child's intrinsic main size was cached as
     34    a consequence of the previous layout.
     35    (WebCore::RenderFlexibleBox::constructFlexItem): Do not pass relayoutChildren to computeInnerFlexBaseSizeForChild. Also no
     36    need to update it after laying out the child.
     37    * rendering/RenderFlexibleBox.h:
     38   
     39   
     40    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     41
     42    2021-02-22  Sergio Villar Senin  <svillar@igalia.com>
     43
     44            REGRESSION (r266695): twitch.tv: when in fullscreen, WebKit continually does 350ms layouts. Firefox and Chrome do not
     45            https://bugs.webkit.org/show_bug.cgi?id=222202
     46            <rdar://problem/74537782>
     47
     48            Reviewed by Simon Fraser.
     49
     50            New performance test for nested column flexboxes with percentage heights.
     51
     52            * Layout/nested-column-flexboxes-relative-height.html: Added.
     53
    1542021-02-18  Myles C. Maxfield  <mmaxfield@apple.com>
    255
  • branches/safari-612.1.5-branch/Source/WebCore/ChangeLog

    r273227 r273785  
     12021-03-02  Alan Coon  <alancoon@apple.com>
     2
     3        Cherry-pick r273264. rdar://problem/74952900
     4
     5    REGRESSION (r266695): twitch.tv: when in fullscreen, WebKit continually does 350ms layouts. Firefox and Chrome do not
     6    https://bugs.webkit.org/show_bug.cgi?id=222202
     7    <rdar://problem/74537782>
     8   
     9    Reviewed by Simon Fraser.
     10   
     11    PerformanceTests:
     12   
     13    New performance test for nested column flexboxes with percentage heights.
     14   
     15    * Layout/nested-column-flexboxes-relative-height.html: Added.
     16   
     17    Source/WebCore:
     18   
     19    The problem was that we were doing the initial layout for the children of the flex container twice in those cases where
     20    the child inline axis was not the main axis (for example with column flex containers in horizontal writing modes).
     21    Refactored the code (specially the way we clear overriding sizes) so that we only do it once. This saves tons of layouts
     22    in pages with nested column flexboxes with relative heights.
     23   
     24    No new tests as there is no change in functionality, we're removing duplicate extra layouts. We're however adding a new
     25    performance test for column flexboxes with percentage heights. With this patch we go from 3.5 layout/s to 145 layout/s
     26    which is ~4000% better.
     27   
     28    Inspired by Blink's crrev.com/c/1614058 by <cbiesinger@chromium.org>.
     29   
     30    * rendering/RenderFlexibleBox.cpp:
     31    (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Do not unconditionally clear overriding sizes. Also removed
     32    relayoutChildren which is now unused. Do not layout the item, that should have been done in
     33    computeInnerFlexBaseSizeForChild() before. Added ASSERTs to verify that child's intrinsic main size was cached as
     34    a consequence of the previous layout.
     35    (WebCore::RenderFlexibleBox::constructFlexItem): Do not pass relayoutChildren to computeInnerFlexBaseSizeForChild. Also no
     36    need to update it after laying out the child.
     37    * rendering/RenderFlexibleBox.h:
     38   
     39   
     40    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@273264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     41
     42    2021-02-22  Sergio Villar Senin  <svillar@igalia.com>
     43
     44            REGRESSION (r266695): twitch.tv: when in fullscreen, WebKit continually does 350ms layouts. Firefox and Chrome do not
     45            https://bugs.webkit.org/show_bug.cgi?id=222202
     46            <rdar://problem/74537782>
     47
     48            Reviewed by Simon Fraser.
     49
     50            The problem was that we were doing the initial layout for the children of the flex container twice in those cases where
     51            the child inline axis was not the main axis (for example with column flex containers in horizontal writing modes).
     52            Refactored the code (specially the way we clear overriding sizes) so that we only do it once. This saves tons of layouts
     53            in pages with nested column flexboxes with relative heights.
     54
     55            No new tests as there is no change in functionality, we're removing duplicate extra layouts. We're however adding a new
     56            performance test for column flexboxes with percentage heights. With this patch we go from 3.5 layout/s to 145 layout/s
     57            which is ~4000% better.
     58
     59            Inspired by Blink's crrev.com/c/1614058 by <cbiesinger@chromium.org>.
     60
     61            * rendering/RenderFlexibleBox.cpp:
     62            (WebCore::RenderFlexibleBox::computeInnerFlexBaseSizeForChild): Do not unconditionally clear overriding sizes. Also removed
     63            relayoutChildren which is now unused. Do not layout the item, that should have been done in
     64            computeInnerFlexBaseSizeForChild() before. Added ASSERTs to verify that child's intrinsic main size was cached as
     65            a consequence of the previous layout.
     66            (WebCore::RenderFlexibleBox::constructFlexItem): Do not pass relayoutChildren to computeInnerFlexBaseSizeForChild. Also no
     67            need to update it after laying out the child.
     68            * rendering/RenderFlexibleBox.h:
     69
    1702021-02-21  Andres Gonzalez  <andresg_22@apple.com>
    271
  • branches/safari-612.1.5-branch/Source/WebCore/rendering/RenderFlexibleBox.cpp

    r273193 r273785  
    895895
    896896   
    897 LayoutUnit RenderFlexibleBox::computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding, bool relayoutChildren)
    898 {
    899     child.clearOverridingContentSize();
    900    
     897LayoutUnit RenderFlexibleBox::computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding)
     898{
    901899    Length flexBasis = flexBasisForChild(child);
    902900    if (childMainSizeIsDefinite(child, flexBasis))
    … …  
    908906    }
    909907
    910     // The flex basis is indefinite (=auto), so we need to compute the actual
    911     // width of the child. For the logical width axis we just use the preferred
    912     // width; for the height we need to lay out the child.
     908    // The flex basis is indefinite (=auto), so we need to compute the actual width of the child.
    913909    LayoutUnit mainAxisExtent;
    914910    if (!mainAxisIsChildInlineAxis(child)) {
    915         updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child);
    916         if (child.needsLayout() || relayoutChildren || !m_intrinsicSizeAlongMainAxis.contains(&child)) {
    917             if (!child.needsLayout())
    918                 child.setChildNeedsLayout(MarkOnlyThis);
    919             child.layoutIfNeeded();
    920             cacheChildMainSize(child);
    921         }
     911        ASSERT(!child.needsLayout());
     912        ASSERT(m_intrinsicSizeAlongMainAxis.contains(&child));
    922913        mainAxisExtent = m_intrinsicSizeAlongMainAxis.get(&child);
    923914    } else {
    … …  
    12721263FlexItem RenderFlexibleBox::constructFlexItem(RenderBox& child, bool relayoutChildren)
    12731264{
     1265    child.clearOverridingContentSize();
    12741266    if (childHasIntrinsicMainAxisSize(child)) {
    12751267        // If this condition is true, then computeMainAxisExtentForChild will call
    … …  
    12901282            child.layoutIfNeeded();
    12911283            cacheChildMainSize(child);
    1292             relayoutChildren = false;
    12931284            child.clearOverridingContainingBlockContentSize();
    12941285        }
    … …  
    12961287   
    12971288    LayoutUnit borderAndPadding = isHorizontalFlow() ? child.horizontalBorderAndPaddingExtent() : child.verticalBorderAndPaddingExtent();
    1298     LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(child, borderAndPadding, relayoutChildren);
     1289    LayoutUnit childInnerFlexBaseSize = computeInnerFlexBaseSizeForChild(child, borderAndPadding);
    12991290    LayoutUnit childMinMaxAppliedMainAxisExtent = adjustChildSizeForMinAndMax(child, childInnerFlexBaseSize);
    13001291    LayoutUnit margin = isHorizontalFlow() ? child.horizontalMarginExtent() : child.verticalMarginExtent();
  • branches/safari-612.1.5-branch/Source/WebCore/rendering/RenderFlexibleBox.h

    r273072 r273785  
    145145    LayoutUnit computeMainSizeFromAspectRatioUsing(const RenderBox& child, Length crossSizeLength) const;
    146146    void setFlowAwareLocationForChild(RenderBox& child, const LayoutPoint&);
    147     LayoutUnit computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding, bool relayoutChildren);
     147    LayoutUnit computeInnerFlexBaseSizeForChild(RenderBox& child, LayoutUnit mainAxisBorderAndPadding);
    148148    void adjustAlignmentForChild(RenderBox& child, LayoutUnit);
    149149    ItemPosition alignmentForChild(const RenderBox& child) const;
Note: See TracChangeset for help on using the changeset viewer.