Title: [148453] trunk
Revision
148453
Author
rob...@webkit.org
Date
2013-04-15 11:23:37 -0700 (Mon, 15 Apr 2013)

Log Message

An inline element with an absolutely positioned child does not correctly calculate/render padding and margin
https://bugs.webkit.org/show_bug.cgi?id=47554

Reviewed by David Hyatt.

Source/WebCore:

When looking for padding/margin to add from the start of a child's parent skip past any leading positioned siblings as
we don't add the padding/margin of the common parent when skipping past them in |skipLeadingWhitespace|. We
don't need to worry about the case of trailing positioned objects as we will account for their parent's
border/margin/padding when we encounter them in |nextSegmentBreak|.

Test: fast/inline/padding-before-leading-positioned-element-contributes-width.html

* rendering/RenderBlockLineLayout.cpp:
(WebCore::previousInFlowSibling):
(WebCore):
(WebCore::inlineLogicalWidth):

LayoutTests:

* fast/inline/padding-before-leading-positioned-element-contributes-width-expected.txt: Added.
* fast/inline/padding-before-leading-positioned-element-contributes-width.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148452 => 148453)


--- trunk/LayoutTests/ChangeLog	2013-04-15 18:16:19 UTC (rev 148452)
+++ trunk/LayoutTests/ChangeLog	2013-04-15 18:23:37 UTC (rev 148453)
@@ -1,3 +1,13 @@
+2013-04-15  Robert Hogan  <rob...@webkit.org>
+
+        An inline element with an absolutely positioned child does not correctly calculate/render padding and margin
+        https://bugs.webkit.org/show_bug.cgi?id=47554
+
+        Reviewed by David Hyatt.
+
+        * fast/inline/padding-before-leading-positioned-element-contributes-width-expected.txt: Added.
+        * fast/inline/padding-before-leading-positioned-element-contributes-width.html: Added.
+
 2013-04-15  Alexey Proskuryakov  <a...@apple.com>
 
         Flaky Test: http/tests/ssl/ping-with-unsafe-redirect.html

Added: trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width-expected.txt (0 => 148453)


--- trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width-expected.txt	2013-04-15 18:23:37 UTC (rev 148453)
@@ -0,0 +1,4 @@
+https://bugs.webkit.org/show_bug.cgi?id=47554: All the black boxes should be inside the blue rectangle.
+
+X XX XX XX
+PASS

Added: trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width.html (0 => 148453)


--- trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width.html	                        (rev 0)
+++ trunk/LayoutTests/fast/inline/padding-before-leading-positioned-element-contributes-width.html	2013-04-15 18:23:37 UTC (rev 148453)
@@ -0,0 +1,34 @@
+<!doctype html>
+<html>
+  <head>
+    <style>
+      #container {
+        border: 1px solid blue;
+        width: 200px;
+      }
+      span {
+        font: 18px Ahem;
+        line-height: 30px;
+      }
+      .item {
+        padding-left: 26px;
+      }
+      .item span {
+        position: absolute;
+      }
+    </style>
+    <script src=""
+  </head>
+  <body>
+    <p>https://bugs.webkit.org/show_bug.cgi?id=47554: All the black boxes should be inside the blue rectangle.</p>
+    <div id="container" data-expected-height=62>
+        <span class="item"><span></span>X</span>
+        <span class="item">XX XX XX</span>
+    </div>
+    <script>
+        checkLayout('#container');
+    </script>
+  </body>
+</html>
+
+

Modified: trunk/Source/WebCore/ChangeLog (148452 => 148453)


--- trunk/Source/WebCore/ChangeLog	2013-04-15 18:16:19 UTC (rev 148452)
+++ trunk/Source/WebCore/ChangeLog	2013-04-15 18:23:37 UTC (rev 148453)
@@ -1,3 +1,22 @@
+2013-04-15  Robert Hogan  <rob...@webkit.org>
+
+        An inline element with an absolutely positioned child does not correctly calculate/render padding and margin
+        https://bugs.webkit.org/show_bug.cgi?id=47554
+
+        Reviewed by David Hyatt.
+
+        When looking for padding/margin to add from the start of a child's parent skip past any leading positioned siblings as 
+        we don't add the padding/margin of the common parent when skipping past them in |skipLeadingWhitespace|. We
+        don't need to worry about the case of trailing positioned objects as we will account for their parent's
+        border/margin/padding when we encounter them in |nextSegmentBreak|.
+
+        Test: fast/inline/padding-before-leading-positioned-element-contributes-width.html
+
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::previousInFlowSibling):
+        (WebCore):
+        (WebCore::inlineLogicalWidth):
+
 2013-04-15  pe...@outlook.com  <pe...@outlook.com>
 
         [WinCairo] Compile fix.

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (148452 => 148453)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-04-15 18:16:19 UTC (rev 148452)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-04-15 18:23:37 UTC (rev 148453)
@@ -350,6 +350,14 @@
     return checkSide;
 }
 
+static RenderObject* previousInFlowSibling(RenderObject* child)
+{
+    child = child->previousSibling();
+    while (child && child->isOutOfFlowPositioned())
+        child = child->previousSibling();
+    return child;
+}
+
 static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, bool end = true)
 {
     unsigned lineDepth = 1;
@@ -358,7 +366,7 @@
     while (parent->isRenderInline() && lineDepth++ < cMaxLineDepth) {
         RenderInline* parentAsRenderInline = toRenderInline(parent);
         if (!isEmptyInline(parentAsRenderInline)) {
-            if (start && shouldAddBorderPaddingMargin(child->previousSibling(), start))
+            if (start && shouldAddBorderPaddingMargin(previousInFlowSibling(child), start))
                 extraWidth += borderPaddingMarginStart(parentAsRenderInline);
             if (end && shouldAddBorderPaddingMargin(child->nextSibling(), end))
                 extraWidth += borderPaddingMarginEnd(parentAsRenderInline);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to