Changeset 208586 in webkit


Ignore:
Timestamp:
Nov 11, 2016 3:08:39 AM (7 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
https://bugs.webkit.org/show_bug.cgi?id=163450

Reviewed by Darin Adler.

Source/WebCore:

The issue is that in the test case a simplifiedLayout() is performed.
So in RenderGrid::layoutBlock() we early return and the grid is not populated,
so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
in RenderGrid::layoutPositionedObject().

We should avoid to do a simplified layout if we have to layout
some positioned grid items and the grid is dirty.

The problem was not only the ASSERT, but the current behavior was wrong too.
As we didn't do a proper layout of the grid container, the positioned item
won't be placed on the expected position. Added tests verifying this.

Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html

fast/css-grid-layout/grid-simplified-layout-positioned.html

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
a simplified layout.
(WebCore::RenderBlock::simplifiedLayout): Extract initial check
into canPerformSimplifiedLayout().

  • rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
  • rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()

to verify that the grid is not dirty if we have to layout some positioned items.
(WebCore::RenderGrid::canPerformSimplifiedLayout):

  • rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.

LayoutTests:

The tests shouldn't crash in debug to verify that the bug is fixed.
On top of that the positioned grid items should appear in the right position too.

  • fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html: Added.
  • fast/css-grid-layout/grid-positioned-item-dynamic-change.html: Added.
  • fast/css-grid-layout/grid-simplified-layout-positioned-expected.html: Added.
  • fast/css-grid-layout/grid-simplified-layout-positioned.html: Added.
Location:
trunk
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r208585 r208586  
     12016-11-11  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
     4        https://bugs.webkit.org/show_bug.cgi?id=163450
     5
     6        Reviewed by Darin Adler.
     7
     8        The tests shouldn't crash in debug to verify that the bug is fixed.
     9        On top of that the positioned grid items should appear in the right position too.
     10
     11        * fast/css-grid-layout/grid-positioned-item-dynamic-change-expected.html: Added.
     12        * fast/css-grid-layout/grid-positioned-item-dynamic-change.html: Added.
     13        * fast/css-grid-layout/grid-simplified-layout-positioned-expected.html: Added.
     14        * fast/css-grid-layout/grid-simplified-layout-positioned.html: Added.
     15
    1162016-11-11  Antoine Quint  <graouts@apple.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r208585 r208586  
     12016-11-11  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] ASSERTION FAILED: !m_gridIsDirty in WebCore::RenderGrid::gridRowCount
     4        https://bugs.webkit.org/show_bug.cgi?id=163450
     5
     6        Reviewed by Darin Adler.
     7
     8        The issue is that in the test case a simplifiedLayout() is performed.
     9        So in RenderGrid::layoutBlock() we early return and the grid is not populated,
     10        so the m_gridIsDirty flag is not cleared when we try to check the size of the grid
     11        in RenderGrid::layoutPositionedObject().
     12
     13        We should avoid to do a simplified layout if we have to layout
     14        some positioned grid items and the grid is dirty.
     15
     16        The problem was not only the ASSERT, but the current behavior was wrong too.
     17        As we didn't do a proper layout of the grid container, the positioned item
     18        won't be placed on the expected position. Added tests verifying this.
     19
     20        Tests: fast/css-grid-layout/grid-positioned-item-dynamic-change.html
     21               fast/css-grid-layout/grid-simplified-layout-positioned.html
     22
     23        * rendering/RenderBlock.cpp:
     24        (WebCore::RenderBlock::canPerformSimplifiedLayout): Check if we can perform or not
     25        a simplified layout.
     26        (WebCore::RenderBlock::simplifiedLayout): Extract initial check
     27        into canPerformSimplifiedLayout().
     28        * rendering/RenderBlock.h: Add new header for canPerformSimplifiedLayout().
     29        * rendering/RenderGrid.cpp: Implement our own version of canPerformSimplifiedLayout()
     30        to verify that the grid is not dirty if we have to layout some positioned items.
     31        (WebCore::RenderGrid::canPerformSimplifiedLayout):
     32        * rendering/RenderGrid.h: Add canPerformSimplifiedLayout() header.
     33
    1342016-11-11  Antoine Quint  <graouts@apple.com>
    235
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r208555 r208586  
    13371337}
    13381338
     1339bool RenderBlock::canPerformSimplifiedLayout() const
     1340{
     1341    return (posChildNeedsLayout() || needsSimplifiedNormalFlowLayout()) && !normalChildNeedsLayout() && !selfNeedsLayout();
     1342}
     1343
    13391344bool RenderBlock::simplifiedLayout()
    13401345{
    1341     if ((!posChildNeedsLayout() && !needsSimplifiedNormalFlowLayout()) || normalChildNeedsLayout() || selfNeedsLayout())
     1346    if (!canPerformSimplifiedLayout())
    13421347        return false;
    13431348
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r208555 r208586  
    361361    virtual bool hasLineIfEmpty() const;
    362362   
     363    virtual bool canPerformSimplifiedLayout() const;
    363364    bool simplifiedLayout();
    364365    virtual void simplifiedNormalFlowLayout();
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r208531 r208586  
    445445        computeTrackSizesForDirection(ForRows, sizingData, availableSpaceForRows);
    446446    }
     447}
     448
     449bool RenderGrid::canPerformSimplifiedLayout() const
     450{
     451    // We cannot perform a simplified layout if the grid is dirty and we have
     452    // some positioned items to be laid out.
     453    if (m_gridIsDirty && posChildNeedsLayout())
     454        return false;
     455
     456    return RenderBlock::canPerformSimplifiedLayout();
    447457}
    448458
  • trunk/Source/WebCore/rendering/RenderGrid.h

    r208531 r208586  
    111111    GridTrackSizingDirection autoPlacementMinorAxisDirection() const;
    112112
     113    bool canPerformSimplifiedLayout() const final;
    113114    void prepareChildForPositionedLayout(RenderBox&);
    114115    void layoutPositionedObject(RenderBox&, bool relayoutChildren, bool fixedPositionObjectsOnly) override;
Note: See TracChangeset for help on using the changeset viewer.