Changeset 214039 in webkit


Ignore:
Timestamp:
Mar 16, 2017 6:13:01 AM (7 years ago)
Author:
Manuel Rego Casasnovas
Message:

[css-grid] Crash on debug removing a positioned child
https://bugs.webkit.org/show_bug.cgi?id=169739

Reviewed by Sergio Villar Senin.

Source/WebCore:

When we add or remove a positioned item we don't need to mark
the grid as dirty, because positioned items do not affect the layout
of the grid at all.

This was causing a crash when a positioned item was removed
after a layout. As after the positioned item was removed,
the method RenderGrid::layoutBlock() was not called,
so when the grid was repainted we got a crash.

Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::addChild): Add early return to avoid marking
the grid as dirty for positioned grid items.
(WebCore::RenderGrid::removeChild): Ditto.

LayoutTests:

Add new test that checks that adding and removing a positioned grid item
doesn't cause any crashes.

  • fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt: Added.
  • fast/css-grid-layout/grid-crash-remove-positioned-item.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r214038 r214039  
     12017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Crash on debug removing a positioned child
     4        https://bugs.webkit.org/show_bug.cgi?id=169739
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Add new test that checks that adding and removing a positioned grid item
     9        doesn't cause any crashes.
     10
     11        * fast/css-grid-layout/grid-crash-remove-positioned-item-expected.txt: Added.
     12        * fast/css-grid-layout/grid-crash-remove-positioned-item.html: Added.
     13
    1142017-03-16  Caio Lima  <ticaiolima@gmail.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r214037 r214039  
     12017-03-16  Manuel Rego Casasnovas  <rego@igalia.com>
     2
     3        [css-grid] Crash on debug removing a positioned child
     4        https://bugs.webkit.org/show_bug.cgi?id=169739
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        When we add or remove a positioned item we don't need to mark
     9        the grid as dirty, because positioned items do not affect the layout
     10        of the grid at all.
     11
     12        This was causing a crash when a positioned item was removed
     13        after a layout. As after the positioned item was removed,
     14        the method RenderGrid::layoutBlock() was not called,
     15        so when the grid was repainted we got a crash.
     16
     17        Test: fast/css-grid-layout/grid-crash-remove-positioned-item.html
     18
     19        * rendering/RenderGrid.cpp:
     20        (WebCore::RenderGrid::addChild): Add early return to avoid marking
     21        the grid as dirty for positioned grid items.
     22        (WebCore::RenderGrid::removeChild): Ditto.
     23
    1242017-03-16  Carlos Alberto Lopez Perez  <clopez@igalia.com>
    225
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r213480 r214039  
    7070    RenderBlock::addChild(newChild, beforeChild);
    7171
     72    // Positioned grid items do not take up space or otherwise participate in the layout of the grid,
     73    // for that reason we don't need to mark the grid as dirty when they are added.
     74    if (newChild->isOutOfFlowPositioned())
     75        return;
     76
    7277    // The grid needs to be recomputed as it might contain auto-placed items that
    7378    // will change their position.
     
    7883{
    7984    RenderBlock::removeChild(child);
     85
     86    // Positioned grid items do not take up space or otherwise participate in the layout of the grid,
     87    // for that reason we don't need to mark the grid as dirty when they are removed.
     88    if (child.isOutOfFlowPositioned())
     89        return;
    8090
    8191    // The grid needs to be recomputed as it might contain auto-placed items that
Note: See TracChangeset for help on using the changeset viewer.