Title: [140570] trunk
Revision
140570
Author
[email protected]
Date
2013-01-23 12:15:12 -0800 (Wed, 23 Jan 2013)

Log Message

Abspos Inline block not positioned correctly in text-aligned container
https://bugs.webkit.org/show_bug.cgi?id=105695

Reviewed by Ojan Vafai.

Source/WebCore:

Inline positioned elements should still obey the text-alignment of their container
even when we don't do a line layout.

Test: fast/text/container-align-with-inlines.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::adjustPositionedBlock):
(WebCore::RenderBlock::updateStaticInlinePositionForChild):
(WebCore):
* rendering/RenderBlock.h:
(RenderBlock):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::setStaticPositions):

LayoutTests:

* fast/text/container-align-with-inlines-expected.txt: Added.
* fast/text/container-align-with-inlines.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140569 => 140570)


--- trunk/LayoutTests/ChangeLog	2013-01-23 20:13:00 UTC (rev 140569)
+++ trunk/LayoutTests/ChangeLog	2013-01-23 20:15:12 UTC (rev 140570)
@@ -1,3 +1,13 @@
+2013-01-23  Robert Hogan  <[email protected]>
+
+        Abspos Inline block not positioned correctly in text-aligned container
+        https://bugs.webkit.org/show_bug.cgi?id=105695
+
+        Reviewed by Ojan Vafai.
+
+        * fast/text/container-align-with-inlines-expected.txt: Added.
+        * fast/text/container-align-with-inlines.html: Added.
+
 2013-01-23  Alexis Menard  <[email protected]>
 
         transition-property accepts incorrect "all, none" as value

Added: trunk/LayoutTests/fast/text/container-align-with-inlines-expected.txt (0 => 140570)


--- trunk/LayoutTests/fast/text/container-align-with-inlines-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/text/container-align-with-inlines-expected.txt	2013-01-23 20:15:12 UTC (rev 140570)
@@ -0,0 +1,6 @@
+The blue box should be right-aligned. You will need to scroll right to see it.
+https://bugs.webkit.org/show_bug.cgi?id=105695
+XXX
+
+XXX
+Success

Added: trunk/LayoutTests/fast/text/container-align-with-inlines.html (0 => 140570)


--- trunk/LayoutTests/fast/text/container-align-with-inlines.html	                        (rev 0)
+++ trunk/LayoutTests/fast/text/container-align-with-inlines.html	2013-01-23 20:15:12 UTC (rev 140570)
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <style>
+            p {background:black; }
+            div.reference {position: absolute; display: inline; background: blue; color: blue;}
+            body {margin: 0px;}
+        </style>
+    </head>
+    <body>
+    The blue box should be right-aligned. You will need to scroll right to see it.<br>
+    https://bugs.webkit.org/show_bug.cgi?id=105695
+    <div id='container' style="text-align: right">
+        <p>XXX</p><div id="test" class="reference">XXX</div>
+    </div>
+    <div id="output">Failure</div>
+    <script>
+        if (window.testRunner) {
+          testRunner.dumpAsText();
+        }
+        var testEl = document.getElementById('test'); 
+        if (testEl.offsetLeft == document.getElementById('container').offsetWidth)
+            output.innerHTML = 'Success'; 
+    </script>
+    </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (140569 => 140570)


--- trunk/Source/WebCore/ChangeLog	2013-01-23 20:13:00 UTC (rev 140569)
+++ trunk/Source/WebCore/ChangeLog	2013-01-23 20:15:12 UTC (rev 140570)
@@ -1,3 +1,24 @@
+2013-01-23  Robert Hogan  <[email protected]>
+
+        Abspos Inline block not positioned correctly in text-aligned container
+        https://bugs.webkit.org/show_bug.cgi?id=105695
+
+        Reviewed by Ojan Vafai.
+
+        Inline positioned elements should still obey the text-alignment of their container
+        even when we don't do a line layout.
+
+        Test: fast/text/container-align-with-inlines.html
+
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::adjustPositionedBlock):
+        (WebCore::RenderBlock::updateStaticInlinePositionForChild):
+        (WebCore):
+        * rendering/RenderBlock.h:
+        (RenderBlock):
+        * rendering/RenderBlockLineLayout.cpp:
+        (WebCore::setStaticPositions):
+
 2013-01-23  Eric Seidel  <[email protected]>
 
         Remove DocType support from MarkupTokenBase now that NEW_XML is gone

Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (140569 => 140570)


--- trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-01-23 20:13:00 UTC (rev 140569)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp	2013-01-23 20:15:12 UTC (rev 140570)
@@ -1751,7 +1751,7 @@
     bool hasStaticBlockPosition = child->style()->hasStaticBlockPosition(isHorizontal);
     
     LayoutUnit logicalTop = logicalHeight();
-    setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop));
+    updateStaticInlinePositionForChild(child, logicalTop);
 
     if (!marginInfo.canCollapseWithMarginBefore()) {
         // Positioned blocks don't collapse margins, so add the margin provided by
@@ -7408,6 +7408,14 @@
     return flowThread->regionAtBlockOffset(offsetFromLogicalTopOfFirstPage() + blockOffset, true);
 }
 
+void RenderBlock::updateStaticInlinePositionForChild(RenderBox* child, LayoutUnit logicalTop)
+{
+    if (child->style()->isOriginalDisplayInlineType())
+        setStaticInlinePositionForChild(child, logicalTop, startAlignedOffsetForLine(logicalTop, false));
+    else
+        setStaticInlinePositionForChild(child, logicalTop, startOffsetForContent(logicalTop));
+}
+
 void RenderBlock::setStaticInlinePositionForChild(RenderBox* child, LayoutUnit blockOffset, LayoutUnit inlinePosition)
 {
     if (inRenderFlowThread()) {

Modified: trunk/Source/WebCore/rendering/RenderBlock.h (140569 => 140570)


--- trunk/Source/WebCore/rendering/RenderBlock.h	2013-01-23 20:13:00 UTC (rev 140569)
+++ trunk/Source/WebCore/rendering/RenderBlock.h	2013-01-23 20:15:12 UTC (rev 140570)
@@ -424,6 +424,7 @@
     LayoutUnit endOffsetForContent() const { return !style()->isLeftToRightDirection() ? logicalLeftOffsetForContent() : logicalWidth() - logicalRightOffsetForContent(); }
     
     void setStaticInlinePositionForChild(RenderBox*, LayoutUnit blockOffset, LayoutUnit inlinePosition);
+    void updateStaticInlinePositionForChild(RenderBox*, LayoutUnit logicalTop);
 
     LayoutUnit computeStartPositionDeltaForChildAvoidingFloats(const RenderBox* child, LayoutUnit childMarginStart, RenderRegion* = 0, LayoutUnit offsetFromLogicalTopOfFirstPage = 0);
 

Modified: trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp (140569 => 140570)


--- trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-23 20:13:00 UTC (rev 140569)
+++ trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp	2013-01-23 20:15:12 UTC (rev 140570)
@@ -1071,11 +1071,7 @@
         toRenderInline(containerBlock)->layer()->setStaticInlinePosition(block->startAlignedOffsetForLine(blockHeight, false));
         toRenderInline(containerBlock)->layer()->setStaticBlockPosition(blockHeight);
     }
-
-    if (child->style()->isOriginalDisplayInlineType())
-        block->setStaticInlinePositionForChild(child, blockHeight, block->startAlignedOffsetForLine(blockHeight, false));
-    else
-        block->setStaticInlinePositionForChild(child, blockHeight, block->startOffsetForContent(blockHeight));
+    block->updateStaticInlinePositionForChild(child, blockHeight);
     child->layer()->setStaticBlockPosition(blockHeight);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to