Title: [172010] trunk
Revision
172010
Author
[email protected]
Date
2014-08-04 15:17:19 -0700 (Mon, 04 Aug 2014)

Log Message

[CSS Shapes] shape-margin not respected when it extends beyond an explicitly set margin
https://bugs.webkit.org/show_bug.cgi?id=135308

Reviewed by Dean Jackson.

Source/WebCore:
When a zero height line is supplied and the image shape extends into
the margin box (only possible when a shape-margin is supplied), then
only an empty interval was being returned. This patch makes it
properly return the interval for the line in question.

Test: fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html

* rendering/shapes/RasterShape.cpp:
(WebCore::RasterShape::getExcludedIntervals): Handle the zero height
line case.

LayoutTests:
Test case based on the one supplied by Rebecca Hauck in the bug
report.

* fast/shapes/resources/square.png: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-shape-margin-expected.html: Added.
* fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (172009 => 172010)


--- trunk/LayoutTests/ChangeLog	2014-08-04 22:04:39 UTC (rev 172009)
+++ trunk/LayoutTests/ChangeLog	2014-08-04 22:17:19 UTC (rev 172010)
@@ -1,3 +1,17 @@
+2014-08-04  Bem Jones-Bey  <[email protected]>
+
+        [CSS Shapes] shape-margin not respected when it extends beyond an explicitly set margin
+        https://bugs.webkit.org/show_bug.cgi?id=135308
+
+        Reviewed by Dean Jackson.
+
+        Test case based on the one supplied by Rebecca Hauck in the bug
+        report.
+
+        * fast/shapes/resources/square.png: Added.
+        * fast/shapes/shape-outside-floats/shape-outside-image-shape-margin-expected.html: Added.
+        * fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html: Added.
+
 2014-08-04  Zalan Bujtas  <[email protected]>
 
         Subpixel rendering: InlineTextBox mistakenly rounds offset value before painting.

Added: trunk/LayoutTests/fast/shapes/resources/square.png


(Binary files differ)
Property changes on: trunk/LayoutTests/fast/shapes/resources/square.png ___________________________________________________________________

Added: svn:mime-type

Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin-expected.html (0 => 172010)


--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin-expected.html	2014-08-04 22:17:19 UTC (rev 172010)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>CSS Reference File</title>
+    <link rel="author" title="Rebecca Hauck" href=""
+    <style type="text/css">
+        #container {
+            position: absolute;
+            top: 170px;
+        }
+        #shape-ref-div {
+            width: 50px;
+            height: 100px;
+            background-color: rgb(0, 100, 0);
+        }
+        #line {
+            width: 100px;
+            height: 1px;
+            background-color: black;
+        }
+    </style>
+</head>
+<body>
+    <p>
+        The test passes if the green rectangle is below the line. There should be no red.
+    </p>
+    <div id="container">
+        <div id="line"><div>
+        <div id="shape-ref-div"></div>
+    </div>
+</body>
+</html>
+
+
+

Added: trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html (0 => 172010)


--- trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html	2014-08-04 22:17:19 UTC (rev 172010)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <title>CSS Test: Image shape with margin-right + shape-margin on a left float</title>
+    <link rel="author" title="Rebecca Hauck" href=""
+    <link rel="help" href=""
+    <link rel="help" href=""
+    <link rel="help" href=""
+    <meta name="flags" content="ahem image"/>
+    <meta name="assert" content="This test verifies that the image shape that defines the float
+                                 area is clipped to the float's margin box and respects the
+                                 shape-margin extending beyond the margin-right, causing the
+                                 text to be pushed below the defined shape."/>
+    <style type="text/css">
+        .container {
+              position: relative;
+              font-family: Ahem;
+              font-size: 50px;
+              line-height: 50px;
+        }
+        #test {
+            width: 100px;
+            height: 100px;
+            color: rgb(0, 100, 0);
+        }
+        #shape-div {
+            float: left;
+            width: 50px;
+            height: 180px;
+            -webkit-shape-margin: 20px;
+            -webkit-shape-outside: url(../resources/square.png);
+            margin-right: 10px;
+        }
+        #ref {
+            position: absolute;
+            top: 170px;
+        }
+        #line {
+            width: 100px;
+            height: 1px;
+            background-color: black;
+        }
+         #failure {
+            width: 50px;
+            height: 99px;
+            background-color: red;
+            z-index: -1;
+        }
+    </style>
+</head>
+<body>
+    <p>
+        The test passes if the green rectangle is below the line. There should be no red.
+    </p>
+    <div id="ref">
+        <div id="line"></div>
+        <div id="failure"></div>
+    </div>
+    <div id="test" class="container">
+        <div id="shape-div"></div>
+        x x
+    </div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (172009 => 172010)


--- trunk/Source/WebCore/ChangeLog	2014-08-04 22:04:39 UTC (rev 172009)
+++ trunk/Source/WebCore/ChangeLog	2014-08-04 22:17:19 UTC (rev 172010)
@@ -1,3 +1,21 @@
+2014-08-04  Bem Jones-Bey  <[email protected]>
+
+        [CSS Shapes] shape-margin not respected when it extends beyond an explicitly set margin
+        https://bugs.webkit.org/show_bug.cgi?id=135308
+
+        Reviewed by Dean Jackson.
+
+        When a zero height line is supplied and the image shape extends into
+        the margin box (only possible when a shape-margin is supplied), then
+        only an empty interval was being returned. This patch makes it
+        properly return the interval for the line in question.
+
+        Test: fast/shapes/shape-outside-floats/shape-outside-image-shape-margin.html
+
+        * rendering/shapes/RasterShape.cpp:
+        (WebCore::RasterShape::getExcludedIntervals): Handle the zero height
+        line case.
+
 2014-08-04  Zalan Bujtas  <[email protected]>
 
         Subpixel rendering: InlineTextBox mistakenly rounds offset value before painting.

Modified: trunk/Source/WebCore/rendering/shapes/RasterShape.cpp (172009 => 172010)


--- trunk/Source/WebCore/rendering/shapes/RasterShape.cpp	2014-08-04 22:04:39 UTC (rev 172009)
+++ trunk/Source/WebCore/rendering/shapes/RasterShape.cpp	2014-08-04 22:17:19 UTC (rev 172010)
@@ -165,8 +165,12 @@
     y2 = std::min(y2, intervals.bounds().maxY());
     IntShapeInterval excludedInterval;
 
-    for (int y = y1; y < y2;  y++)
-        excludedInterval.unite(intervals.intervalAt(y));
+    if (y1 == y2)
+        excludedInterval = intervals.intervalAt(y1);
+    else {
+        for (int y = y1; y < y2;  y++)
+            excludedInterval.unite(intervals.intervalAt(y));
+    }
 
     result.append(LineSegment(excludedInterval.x1(), excludedInterval.x2()));
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to