[css-shapes] shape-outside does not properly handle the container and the float havin...
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 23:27:15 +0000 (23:27 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 2 Oct 2013 23:27:15 +0000 (23:27 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122243

Reviewed by Alexandru Chiculita.

Source/WebCore:

The margin box offset needs to be computed based on the writing mode
of the container, not the writihg mode of the float itself. This
patch makes that happen.

Test: fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html

* rendering/shapes/ShapeOutsideInfo.cpp:
(WebCore::ShapeOutsideInfo::updateDeltasForContainingBlockLine):

LayoutTests:

Test that the margins and width are properly computed in the case of
different writing modes.

* fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@156806 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes-expected.html [new file with mode: 0644]
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

index 9c36fa6..2a33dce 100644 (file)
@@ -1,3 +1,16 @@
+2013-10-02  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        [css-shapes] shape-outside does not properly handle the container and the float having different writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=122243
+
+        Reviewed by Alexandru Chiculita.
+
+        Test that the margins and width are properly computed in the case of
+        different writing modes.
+
+        * fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes-expected.html: Added.
+        * fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html: Added.
+
 2013-10-02  Tim Horton  <timothy_horton@apple.com>
 
         Unreviewed rebaseline, try to add newlines back that keep disappearing on me.
diff --git a/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes-expected.html b/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes-expected.html
new file mode 100644 (file)
index 0000000..939df71
--- /dev/null
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<title>shape-outside on floats with a different writing mode in the float and the container</title>
+<style>
+    .container {
+        font: 20px/1 Ahem;
+        line-height: 20px;
+    }
+    .float {
+        height: 20px;
+        width: 40px;
+        margin: 0px 20px;
+        background-color: red;
+        color: green;
+        float: left;
+    }
+</style>
+<body>
+    <p><a href="https://bugs.webkit.org/show_bug.cgi?id=122243">Bug 122243</a> - [css-shapes] shape-outside does not properly handle the container and the float having different writing modes</p>
+    <p>You should see a single green square. You should not see any red.</p>
+    <div class="container">
+        <div class="float">XX</div>
+    </div>
+</body>
diff --git a/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html b/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html
new file mode 100644 (file)
index 0000000..f9c98a3
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<title>shape-outside on floats with a different writing mode in the float and the container</title>
+<style>
+    .container {
+        font: 20px/1 Ahem;
+        line-height: 20px;
+        color: green;
+    }
+    .float {
+        -webkit-writing-mode: vertical-lr;
+        -webkit-shape-outside: rectangle(-20px, 0, 20px, 20px);
+        height: 20px;
+        width: 40px;
+        margin: 0px 20px;
+        background-color: red;
+        float: left;
+    }
+</style>
+<body>
+    <p><a href="https://bugs.webkit.org/show_bug.cgi?id=122243">Bug 122243</a> - [css-shapes] shape-outside does not properly handle the container and the float having different writing modes</p>
+    <p>You should see a single green square. You should not see any red.</p>
+    <div class="container">
+        <div class="float"></div>
+        XX
+    </div>
+</body>
index 92e4217..e4e3214 100644 (file)
@@ -1,3 +1,19 @@
+2013-10-02  Bem Jones-Bey  <bjonesbe@adobe.com>
+
+        [css-shapes] shape-outside does not properly handle the container and the float having different writing modes
+        https://bugs.webkit.org/show_bug.cgi?id=122243
+
+        Reviewed by Alexandru Chiculita.
+
+        The margin box offset needs to be computed based on the writing mode
+        of the container, not the writihg mode of the float itself. This
+        patch makes that happen.
+
+        Test: fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html
+
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::ShapeOutsideInfo::updateDeltasForContainingBlockLine):
+
 2013-10-02  Andreas Kling  <akling@apple.com>
 
         Remove Qt-specific code in WebCore/{bindings,bridge,loader,icon,testing}.
index 077920a..8639f76 100644 (file)
@@ -67,14 +67,14 @@ void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlock* con
         if (lineOverlapsShapeBounds()) {
             SegmentList segments = computeSegmentsForLine(lineTopInShapeCoordinates, lineHeight);
             if (segments.size()) {
-                m_leftMarginBoxDelta = segments[0].logicalLeft + m_renderer->marginStart();
-                m_rightMarginBoxDelta = segments[segments.size()-1].logicalRight - m_renderer->logicalWidth() - m_renderer->marginEnd();
+                m_leftMarginBoxDelta = segments.first().logicalLeft + containingBlock->marginStartForChild(m_renderer);
+                m_rightMarginBoxDelta = segments.last().logicalRight - containingBlock->logicalWidthForChild(m_renderer) - containingBlock->marginEndForChild(m_renderer);
                 return;
             }
         }
 
-        m_leftMarginBoxDelta = m_renderer->logicalWidth() + m_renderer->marginStart();
-        m_rightMarginBoxDelta = -m_renderer->logicalWidth() - m_renderer->marginEnd();
+        m_leftMarginBoxDelta = containingBlock->logicalWidthForChild(m_renderer) + containingBlock->marginStartForChild(m_renderer);
+        m_rightMarginBoxDelta = -containingBlock->logicalWidthForChild(m_renderer) - containingBlock->marginEndForChild(m_renderer);
     }
 }