Changeset 142889 in webkit


Ignore:
Timestamp:
Feb 14, 2013, 9:53:16 AM (12 years ago)
Author:
tony@chromium.org
Message:

Padding and border changes doesn't trigger relayout of children
https://bugs.webkit.org/show_bug.cgi?id=109639

Reviewed by Kent Tamura.

Source/WebCore:

In RenderBlock::layoutBlock, we only relayout our children if our logical width
changes. This misses cases where our logical width doesn't change (i.e., padding
or border changes), but our content width does change.

This is a more general case of bug 104997.

Test: fast/block/dynamic-padding-border.html

  • rendering/RenderBox.cpp:

(WebCore::borderOrPaddingLogicalWidthChanged): Only check if the logical width changed.
(WebCore::RenderBox::styleDidChange): Drop the border-box condition since this can happen
even without border-box box sizing.

LayoutTests:

  • fast/block/dynamic-padding-border-expected.txt: Added.
  • fast/block/dynamic-padding-border.html: Added.
  • fast/table/border-collapsing/cached-change-row-border-width-expected.txt: We should have been relaying

out the table when the border changed. The pixel results in this case is the same, but the
render tree shows the difference.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142886 r142889  
     12013-02-14  Tony Chang  <tony@chromium.org>
     2
     3        Padding and border changes doesn't trigger relayout of children
     4        https://bugs.webkit.org/show_bug.cgi?id=109639
     5
     6        Reviewed by Kent Tamura.
     7
     8        * fast/block/dynamic-padding-border-expected.txt: Added.
     9        * fast/block/dynamic-padding-border.html: Added.
     10        * fast/table/border-collapsing/cached-change-row-border-width-expected.txt: We should have been relaying
     11        out the table when the border changed. The pixel results in this case is the same, but the
     12        render tree shows the difference.
     13
    1142013-02-14  Vsevolod Vlasov  <vsevik@chromium.org>
    215
  • trunk/LayoutTests/fast/table/border-collapsing/cached-change-row-border-width-expected.txt

    r95852 r142889  
    77        RenderTableSection {TBODY} at (1,2) size 54x100
    88          RenderTableRow {TR} at (0,0) size 54x50 [border: (4px solid #FFFF00)]
    9             RenderTableCell {TD} at (0,23) size 54x4 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
     9            RenderTableCell {TD} at (0,22) size 54x6 [border: (2px solid #00FF00)] [r=0 c=0 rs=1 cs=1]
    1010          RenderTableRow {TR} at (0,50) size 54x50
    1111            RenderTableCell {TD} at (0,73) size 54x3 [border: (2px none #000000)] [r=1 c=0 rs=1 cs=1]
  • trunk/Source/WebCore/ChangeLog

    r142888 r142889  
     12013-02-14  Tony Chang  <tony@chromium.org>
     2
     3        Padding and border changes doesn't trigger relayout of children
     4        https://bugs.webkit.org/show_bug.cgi?id=109639
     5
     6        Reviewed by Kent Tamura.
     7
     8        In RenderBlock::layoutBlock, we only relayout our children if our logical width
     9        changes. This misses cases where our logical width doesn't change (i.e., padding
     10        or border changes), but our content width does change.
     11
     12        This is a more general case of bug 104997.
     13
     14        Test: fast/block/dynamic-padding-border.html
     15
     16        * rendering/RenderBox.cpp:
     17        (WebCore::borderOrPaddingLogicalWidthChanged): Only check if the logical width changed.
     18        (WebCore::RenderBox::styleDidChange): Drop the border-box condition since this can happen
     19        even without border-box box sizing.
     20
    1212013-02-14  Peter Rybin  <prybin@chromium.org>
    222
  • trunk/Source/WebCore/rendering/RenderBox.cpp

    r142816 r142889  
    233233}
    234234
    235 static bool borderWidthChanged(const RenderStyle* oldStyle, const RenderStyle* newStyle)
    236 {
    237     return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
    238         || oldStyle->borderTopWidth() != newStyle->borderTopWidth()
    239         || oldStyle->borderRightWidth() != newStyle->borderRightWidth()
    240         || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth();
     235static bool borderOrPaddingLogicalWidthChanged(const RenderStyle* oldStyle, const RenderStyle* newStyle)
     236{
     237    if (newStyle->isHorizontalWritingMode())
     238        return oldStyle->borderLeftWidth() != newStyle->borderLeftWidth()
     239            || oldStyle->borderRightWidth() != newStyle->borderRightWidth()
     240            || oldStyle->paddingLeft() != newStyle->paddingLeft()
     241            || oldStyle->paddingRight() != newStyle->paddingRight();
     242
     243    return oldStyle->borderTopWidth() != newStyle->borderTopWidth()
     244        || oldStyle->borderBottomWidth() != newStyle->borderBottomWidth()
     245        || oldStyle->paddingTop() != newStyle->paddingTop()
     246        || oldStyle->paddingBottom() != newStyle->paddingBottom();
    241247}
    242248
     
    315321#endif
    316322
    317     if (oldStyle && (newStyle->boxSizing() == BORDER_BOX || oldStyle->boxSizing() == BORDER_BOX) && diff == StyleDifferenceLayout
    318         && (newStyle->paddingBox() != oldStyle->paddingBox() || borderWidthChanged(oldStyle, newStyle))) {
     323    if (oldStyle && diff == StyleDifferenceLayout && borderOrPaddingLogicalWidthChanged(oldStyle, newStyle)) {
    319324        ASSERT(needsLayout());
    320325        for (RenderObject* child = firstChild(); child; child = child->nextSibling())
Note: See TracChangeset for help on using the changeset viewer.