[CSS Shapes] Lines that don't intersect shape-outside should ignore both left and...
authorbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Oct 2013 22:54:57 +0000 (22:54 +0000)
committerbjonesbe@adobe.com <bjonesbe@adobe.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 9 Oct 2013 22:54:57 +0000 (22:54 +0000)
https://bugs.webkit.org/show_bug.cgi?id=122570

Reviewed by Alexandru Chiculita.

Source/WebCore:

Due to an oversight, the left margin on left floats and the right
margin on right floats was having an effect on lines that did not
intersect the shape (but did intersect the margin box of the float).
By the spec, lines that do not intersect the shape should act as if
the float isn't there, so those margins should have no effect on
those lines. This patch fixes this.

No new tests, it is covered by the existing tests now that they have
been fixed to have the proper behavior.

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

LayoutTests:

Update tests to work with the proper behavior for margins. Yes, the
tests were not correct before.

* csswg/contributors/adobe/submitted/shapes/shape-outside/resources/w3c-import.log:
* csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-000.html:
* csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-007.html:
* csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-009.html:
* csswg/contributors/adobe/submitted/shapes/shape-outside/w3c-import.log:
* fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html:

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

LayoutTests/ChangeLog
LayoutTests/csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-000.html
LayoutTests/csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-007.html
LayoutTests/csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-009.html
LayoutTests/fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html
Source/WebCore/ChangeLog
Source/WebCore/rendering/shapes/ShapeOutsideInfo.cpp

index f81d07f..2d01ce1 100644 (file)
@@ -1,5 +1,22 @@
 2013-10-09  Bem Jones-Bey  <bjonesbe@adobe.com>
 
+        [CSS Shapes] Lines that don't intersect shape-outside should ignore both left and right margins
+        https://bugs.webkit.org/show_bug.cgi?id=122570
+
+        Reviewed by Alexandru Chiculita.
+
+        Update tests to work with the proper behavior for margins. Yes, the
+        tests were not correct before.
+
+        * csswg/contributors/adobe/submitted/shapes/shape-outside/resources/w3c-import.log:
+        * csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-000.html:
+        * csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-007.html:
+        * csswg/contributors/adobe/submitted/shapes/shape-outside/shape-outside-floats-margin-009.html:
+        * csswg/contributors/adobe/submitted/shapes/shape-outside/w3c-import.log:
+        * fast/shapes/shape-outside-floats/shape-outside-floats-different-writing-modes.html:
+
+2013-10-09  Bem Jones-Bey  <bjonesbe@adobe.com>
+
         [CSS Shapes] Clip shape-outside to the bottom of the margin box
         https://bugs.webkit.org/show_bug.cgi?id=122562
 
index c61bde1..346643b 100644 (file)
 
 <body>
     <p>This should display two green bars, with white squares on opposite sides.</p>
-    <div class="container">
-        <div id="float-left">
+    <div class="container" style="text-align: right">
+        <div id="float-right">
         </div>
         XXXX
     </div>
     <div class="container">
-        <div id="float-right">
+        <div id="float-left">
         </div>
         XXXX
     </div>
index 572d1d7..26aa29e 100644 (file)
 
 <body>
     <p>This should display two green bars, with white squares on opposite sides.</p>
-    <div class="container">
-        <div id="float-left">
+    <div class="container" style="text-align: right">
+        <div id="float-right">
         </div>
         XXXX
     </div>
     <div class="container">
-        <div id="float-right">
+        <div id="float-left">
         </div>
         XXXX
     </div>
index 8097f82..451d15f 100644 (file)
 
 <body>
     <p>This should display two green bars, with white squares on opposite sides.</p>
-    <div class="container">
-        <div id="float-left">
+    <div class="container" style="text-align: right">
+        <div id="float-right">
         </div>
         XXXX
     </div>
-    <div class="container" style="text-align: right">
-        <div id="float-right">
+    <div class="container">
+        <div id="float-left">
         </div>
         XXXX
     </div>
index f9c98a3..e46075f 100644 (file)
@@ -8,7 +8,7 @@
     }
     .float {
         -webkit-writing-mode: vertical-lr;
-        -webkit-shape-outside: rectangle(-20px, 0, 20px, 20px);
+        -webkit-shape-outside: rectangle(0px, -20px, 20px, 20px);
         height: 20px;
         width: 40px;
         margin: 0px 20px;
index f87f171..60c1bc4 100644 (file)
@@ -1,5 +1,25 @@
 2013-10-09  Bem Jones-Bey  <bjonesbe@adobe.com>
 
+        [CSS Shapes] Lines that don't intersect shape-outside should ignore both left and right margins
+        https://bugs.webkit.org/show_bug.cgi?id=122570
+
+        Reviewed by Alexandru Chiculita.
+
+        Due to an oversight, the left margin on left floats and the right
+        margin on right floats was having an effect on lines that did not
+        intersect the shape (but did intersect the margin box of the float).
+        By the spec, lines that do not intersect the shape should act as if
+        the float isn't there, so those margins should have no effect on
+        those lines. This patch fixes this.
+
+        No new tests, it is covered by the existing tests now that they have
+        been fixed to have the proper behavior.
+
+        * rendering/shapes/ShapeOutsideInfo.cpp:
+        (WebCore::ShapeOutsideInfo::updateDeltasForContainingBlockLine):
+
+2013-10-09  Bem Jones-Bey  <bjonesbe@adobe.com>
+
         [CSS Shapes] Clip shape-outside to the bottom of the margin box
         https://bugs.webkit.org/show_bug.cgi?id=122562
 
index 8639f76..4d337d3 100644 (file)
@@ -73,8 +73,15 @@ void ShapeOutsideInfo::updateDeltasForContainingBlockLine(const RenderBlock* con
             }
         }
 
-        m_leftMarginBoxDelta = containingBlock->logicalWidthForChild(m_renderer) + containingBlock->marginStartForChild(m_renderer);
-        m_rightMarginBoxDelta = -containingBlock->logicalWidthForChild(m_renderer) - containingBlock->marginEndForChild(m_renderer);
+        // Lines that do not overlap the shape should act as if the float
+        // wasn't there for layout purposes. So we set the deltas to remove the
+        // entire width of the float. 
+        // FIXME: The latest CSS Shapes spec says that in this case, the
+        // content should interact with previously stacked floats on the line
+        // as if this outermost float did not exist. Perhaps obviously, this
+        // solution cannot do that, and will be revisted with bug 122576.
+        m_leftMarginBoxDelta = floatingObject->logicalWidth(containingBlock->isHorizontalWritingMode());
+        m_rightMarginBoxDelta = -floatingObject->logicalWidth(containingBlock->isHorizontalWritingMode());
     }
 }