Changeset 140045 in webkit


Ignore:
Timestamp:
Jan 17, 2013 2:35:24 PM (11 years ago)
Author:
jchaffraix@webkit.org
Message:

[CSS Grid Layout] Updating -webkit-grid-rows or -webkit-grid-columns doesn't work as expected
https://bugs.webkit.org/show_bug.cgi?id=107062

Reviewed by Tony Chang.

Source/WebCore:

Tests: fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update.html

fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update.html

This change makes -webkit-grid-rows and -webkit-grid-columns dynamic change properly
relayout their children, thus making them work!

  • rendering/RenderGrid.cpp:

(WebCore::RenderGrid::layoutGridItems):
Fixed the logic to force a grid item relayout if the grid area size changes. This is the
safest approach as margins or paddings can also be a percent of the grid area's size.

  • rendering/style/RenderStyle.cpp:

(WebCore::RenderStyle::diff):
Fixed a dumb mistake.

LayoutTests:

  • fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update-expected.txt: Added.
  • fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update.html: Added.
  • fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update-expected.txt: Added.
  • fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update.html: Added.
Location:
trunk
Files:
4 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140041 r140045  
     12013-01-17  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        [CSS Grid Layout] Updating -webkit-grid-rows or -webkit-grid-columns doesn't work as expected
     4        https://bugs.webkit.org/show_bug.cgi?id=107062
     5
     6        Reviewed by Tony Chang.
     7
     8        * fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update-expected.txt: Added.
     9        * fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update.html: Added.
     10        * fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update-expected.txt: Added.
     11        * fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update.html: Added.
     12
    1132013-01-17  Alpha Lam  <hclam@chromium.org>
    214
  • trunk/Source/WebCore/ChangeLog

    r140044 r140045  
     12013-01-17  Julien Chaffraix  <jchaffraix@webkit.org>
     2
     3        [CSS Grid Layout] Updating -webkit-grid-rows or -webkit-grid-columns doesn't work as expected
     4        https://bugs.webkit.org/show_bug.cgi?id=107062
     5
     6        Reviewed by Tony Chang.
     7
     8        Tests: fast/css-grid-layout/percent-grid-item-in-percent-grid-track-update.html
     9               fast/css-grid-layout/percent-padding-margin-resolution-grid-item-update.html
     10
     11        This change makes -webkit-grid-rows and -webkit-grid-columns dynamic change properly
     12        relayout their children, thus making them work!
     13
     14        * rendering/RenderGrid.cpp:
     15        (WebCore::RenderGrid::layoutGridItems):
     16        Fixed the logic to force a grid item relayout if the grid area size changes. This is the
     17        safest approach as margins or paddings can also be a percent of the grid area's size.
     18
     19        * rendering/style/RenderStyle.cpp:
     20        (WebCore::RenderStyle::diff):
     21        Fixed a dumb mistake.
     22
    1232013-01-17  Timothy Hatcher  <timothy@apple.com>
    224
  • trunk/Source/WebCore/rendering/RenderGrid.cpp

    r140039 r140045  
    231231            // Because the grid area cannot be styled, we don't need to adjust
    232232            // the grid breadth to account for 'box-sizing'.
     233            LayoutUnit oldOverrideContainingBlockContentLogicalWidth = child->hasOverrideContainingBlockLogicalWidth() ? child->overrideContainingBlockContentLogicalWidth() : LayoutUnit();
     234            LayoutUnit oldOverrideContainingBlockContentLogicalHeight = child->hasOverrideContainingBlockLogicalHeight() ? child->overrideContainingBlockContentLogicalHeight() : LayoutUnit();
     235
     236            if (oldOverrideContainingBlockContentLogicalWidth != columnTracks[columnTrack].m_usedBreadth || oldOverrideContainingBlockContentLogicalHeight != rowTracks[rowTrack].m_usedBreadth)
     237                child->setNeedsLayout(true, MarkOnlyThis);
     238
    233239            child->setOverrideContainingBlockContentLogicalWidth(columnTracks[columnTrack].m_usedBreadth);
    234240            child->setOverrideContainingBlockContentLogicalHeight(rowTracks[rowTrack].m_usedBreadth);
     241
    235242        }
    236243
  • trunk/Source/WebCore/rendering/style/RenderStyle.cpp

    r138821 r140045  
    439439
    440440        if (rareNonInheritedData->m_grid.get() != other->rareNonInheritedData->m_grid.get()
    441             && rareNonInheritedData->m_gridItem.get() != other->rareNonInheritedData->m_gridItem.get())
     441            || rareNonInheritedData->m_gridItem.get() != other->rareNonInheritedData->m_gridItem.get())
    442442            return StyleDifferenceLayout;
    443443
Note: See TracChangeset for help on using the changeset viewer.