Title: [140296] trunk
Revision
140296
Author
[email protected]
Date
2013-01-20 22:10:23 -0800 (Sun, 20 Jan 2013)

Log Message

Re-layout child blocks when border/padding of the box-sizing:border-box parent is updated
https://bugs.webkit.org/show_bug.cgi?id=104997

Reviewed by Tony Chang.

Source/WebCore:

When padding or border is updated for a parent block with
box-sizing:border-box and width, the width of its child block was not
updated.

Tests: fast/css/box-sizing-border-box-dynamic-padding-border-update.html
       fast/forms/text/text-padding-dynamic-change.html

* rendering/RenderBox.cpp:
(WebCore::RenderBox::styleDidChange):
If box-sizing of the old style and/or the new style is border-box and
padding or border is changed, apply setChildNeedsLayout(true) for child
boxes.

LayoutTests:

* fast/css/box-sizing-border-box-dynamic-padding-border-update-expected.txt: Added.
* fast/css/box-sizing-border-box-dynamic-padding-border-update.html: Added.
* fast/forms/text/text-padding-dynamic-change-expected.html: Added.
* fast/forms/text/text-padding-dynamic-change.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140295 => 140296)


--- trunk/LayoutTests/ChangeLog	2013-01-21 06:08:05 UTC (rev 140295)
+++ trunk/LayoutTests/ChangeLog	2013-01-21 06:10:23 UTC (rev 140296)
@@ -1,3 +1,15 @@
+2013-01-20  Kent Tamura  <[email protected]>
+
+        Re-layout child blocks when border/padding of the box-sizing:border-box parent is updated
+        https://bugs.webkit.org/show_bug.cgi?id=104997
+
+        Reviewed by Tony Chang.
+
+        * fast/css/box-sizing-border-box-dynamic-padding-border-update-expected.txt: Added.
+        * fast/css/box-sizing-border-box-dynamic-padding-border-update.html: Added.
+        * fast/forms/text/text-padding-dynamic-change-expected.html: Added.
+        * fast/forms/text/text-padding-dynamic-change.html: Added.
+
 2013-01-20  Sheriff Bot  <[email protected]>
 
         Unreviewed, rolling out r140290.

Added: trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update-expected.txt (0 => 140296)


--- trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update-expected.txt	2013-01-21 06:10:23 UTC (rev 140296)
@@ -0,0 +1,8 @@
+Test if child blocks are correctly laid out when padding/border of the box-sizing:border-box parent is updated.
+
+The quick brown fox jumps over the lazy dog.
+PASS
+The quick brown fox jumps over the lazy dog.
+PASS
+The quick brown fox jumps over the lazy dog.
+PASS

Added: trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update.html (0 => 140296)


--- trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/box-sizing-border-box-dynamic-padding-border-update.html	2013-01-21 06:10:23 UTC (rev 140296)
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<body>
+<p>Test if child blocks are correctly laid out when padding/border of the box-sizing:border-box parent is updated.</p>
+
+<div id="target1" style="width:100px; box-sizing:border-box; border:0 solid;">
+<div data-expected-width="50">The quick brown fox jumps over the lazy dog.</div>
+</div>
+<div id="target2" style="width:100px; box-sizing:border-box;">
+<div data-expected-width="50">The quick brown fox jumps over the lazy dog.</div>
+</div>
+<div id="target3" style="width:100px; box-sizing:border-box;">
+<div data-expected-width="50">The quick brown fox jumps over the lazy dog.</div>
+</div>
+<script src=""
+<script>
+document.body.offsetLeft;
+document.getElementById('target1').style.borderLeftWidth = '50px';
+document.getElementById('target2').style.paddingLeft = '50px';
+document.getElementById('target3').setAttribute('style', 'width:50px; box-sizing:content-box; border-left:50px solid;');
+checkLayout('#target1');
+checkLayout('#target2');
+checkLayout('#target3');
+</script>
+</body>

Added: trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change-expected.html (0 => 140296)


--- trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change-expected.html	2013-01-21 06:10:23 UTC (rev 140296)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<body>
+<input style="box-sizing:border-box; width:100px; text-align:right; padding-left:40px;" value="Hello world">
+<input style="box-sizing:border-box; width:100px; text-align:right; padding-left:40px;" placeholder="Hello world">
+<input style="box-sizing:border-box; width:100px; text-align:right; border-left-width:40px;" value="Hello world">
+<input style="box-sizing:border-box; width:100px; text-align:right; border-left-width:40px;" placeholder="Hello world">
+</body>

Added: trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change.html (0 => 140296)


--- trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change.html	                        (rev 0)
+++ trunk/LayoutTests/fast/forms/text/text-padding-dynamic-change.html	2013-01-21 06:10:23 UTC (rev 140296)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<body>
+<input id=text1 style="box-sizing:border-box; width:100px; text-align:right;" value="Hello world">
+<input id=text2 style="box-sizing:border-box; width:100px; text-align:right;" placeholder="Hello world">
+<input id=text3 style="box-sizing:border-box; width:100px; text-align:right;" value="Hello world">
+<input id=text4 style="box-sizing:border-box; width:100px; text-align:right;" placeholder="Hello world">
+<script>
+document.body.offsetLeft;
+document.getElementById('text1').style.paddingLeft = '40px';
+document.getElementById('text2').style.paddingLeft = '40px';
+document.getElementById('text3').style.borderLeftWidth = '40px';
+document.getElementById('text4').style.borderLeftWidth = '40px';
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (140295 => 140296)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 06:08:05 UTC (rev 140295)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 06:10:23 UTC (rev 140296)
@@ -1,3 +1,23 @@
+2013-01-20  Kent Tamura  <[email protected]>
+
+        Re-layout child blocks when border/padding of the box-sizing:border-box parent is updated
+        https://bugs.webkit.org/show_bug.cgi?id=104997
+
+        Reviewed by Tony Chang.
+
+        When padding or border is updated for a parent block with
+        box-sizing:border-box and width, the width of its child block was not
+        updated.
+
+        Tests: fast/css/box-sizing-border-box-dynamic-padding-border-update.html
+               fast/forms/text/text-padding-dynamic-change.html
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::styleDidChange):
+        If box-sizing of the old style and/or the new style is border-box and
+        padding or border is changed, apply setChildNeedsLayout(true) for child
+        boxes.
+
 2013-01-20  Kentaro Hara  <[email protected]>
 
         [V8] Remove custom V8ScriptProfileCustom::toV8()

Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (140295 => 140296)


--- trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-21 06:08:05 UTC (rev 140295)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp	2013-01-21 06:10:23 UTC (rev 140296)
@@ -305,6 +305,12 @@
 #if ENABLE(CSS_EXCLUSIONS)
     updateExclusionShapeOutsideInfoAfterStyleChange(style()->shapeOutside(), oldStyle ? oldStyle->shapeOutside() : 0);
 #endif
+
+    if (oldStyle && (newStyle->boxSizing() == BORDER_BOX || oldStyle->boxSizing() == BORDER_BOX)
+        && (newStyle->paddingBox() != oldStyle->paddingBox() || newStyle->border() != oldStyle->border())) {
+        for (RenderObject* child = firstChild(); child; child = child->nextSibling())
+            child->setChildNeedsLayout(true, MarkOnlyThis);
+    }
 }
 
 #if ENABLE(CSS_EXCLUSIONS)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to