Title: [167351] trunk
Revision
167351
Author
commit-qu...@webkit.org
Date
2014-04-16 10:19:23 -0700 (Wed, 16 Apr 2014)

Log Message

ASSERTION FAILED: x2 >= x1 in WebCore::RenderObject::drawLineForBoxSide
https://bugs.webkit.org/show_bug.cgi?id=127835

Source/WebCore:
In some cases when a negative margin and a positive padding are applied
together to the right and/or left side of the box, the logical width of
the borders can be set to a negative value, making the assertion fire.
The fix checks if the width or height of the box is negative, and if so,
it will not display the borders and shadows of the box.

Patch by Martin Hodovan <mhodo...@inf.u-szeged.hu> on 2014-04-16
Reviewed by Darin Adler.

Test: fast/css/padding-margin-negative-border.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintBorder):

LayoutTests:
Added test demonstrates four cases:
Test #1: Negative upper margin + positive upper padding
Test #2: Negative right margin + positive right padding (used to fail)
Test #3: Negative bottom margin + positive bottom padding
Test #4: Negative left margin + positive left padding (used to fail)

Patch by Martin Hodovan <mhodo...@inf.u-szeged.hu> on 2014-04-16
Reviewed by Darin Adler.

* fast/css/padding-margin-negative-border-expected.html: Added.
* fast/css/padding-margin-negative-border.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (167350 => 167351)


--- trunk/LayoutTests/ChangeLog	2014-04-16 17:17:11 UTC (rev 167350)
+++ trunk/LayoutTests/ChangeLog	2014-04-16 17:19:23 UTC (rev 167351)
@@ -1,3 +1,19 @@
+2014-04-16  Martin Hodovan  <mhodo...@inf.u-szeged.hu>
+
+        ASSERTION FAILED: x2 >= x1 in WebCore::RenderObject::drawLineForBoxSide
+        https://bugs.webkit.org/show_bug.cgi?id=127835
+
+        Added test demonstrates four cases:
+        Test #1: Negative upper margin + positive upper padding
+        Test #2: Negative right margin + positive right padding (used to fail)
+        Test #3: Negative bottom margin + positive bottom padding
+        Test #4: Negative left margin + positive left padding (used to fail)
+
+        Reviewed by Darin Adler.
+
+        * fast/css/padding-margin-negative-border-expected.html: Added.
+        * fast/css/padding-margin-negative-border.html: Added.
+
 2014-04-16  Jer Noble  <jer.no...@apple.com>
 
         [MSE] Seeks into buffered ranges will never complete.

Added: trunk/LayoutTests/fast/css/padding-margin-negative-border-expected.html (0 => 167351)


--- trunk/LayoutTests/fast/css/padding-margin-negative-border-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/padding-margin-negative-border-expected.html	2014-04-16 17:19:23 UTC (rev 167351)
@@ -0,0 +1,69 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <table style="width:700px">
+      <tr>
+        <td>top</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: -30px 0px 0px 0px;
+                padding: 1px 0px 0px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+      <tr>
+        <td>right</td>
+        <td style="width:400px">
+          <b style="border:solid;
+                    border-color:white">
+            <i style="
+                background-color:green;
+                margin: 0px -208px 0px 0px;
+                padding: 0px 1px 0px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+      <tr>
+        <td>bottom</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: 0px 0px -30px 0px;
+                padding: 0px 0px 1px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+        <td>left</td>
+        <td style="width:400px">
+          <b style="border:solid;
+                    border-color:white">
+            <i style="
+                background-color:green;
+                margin: 0px 0px 0px -208px;
+                padding: 0px 0px 0px 31px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>

Added: trunk/LayoutTests/fast/css/padding-margin-negative-border.html (0 => 167351)


--- trunk/LayoutTests/fast/css/padding-margin-negative-border.html	                        (rev 0)
+++ trunk/LayoutTests/fast/css/padding-margin-negative-border.html	2014-04-16 17:19:23 UTC (rev 167351)
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<html>
+  <body>
+    <table style="width:700px">
+      <tr>
+        <td>top</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: -30px 0px 0px 0px;
+                padding: 1px 0px 0px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+      <tr>
+        <td>right</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: 0px -208px 0px 0px;
+                padding: 0px 1px 0px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+      <tr>
+        <td>bottom</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: 0px 0px -30px 0px;
+                padding: 0px 0px 1px 0px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+
+    <table style="width:700px">
+        <td>left</td>
+        <td style="width:400px">
+          <b style="border:solid;">
+            <i style="
+                background-color:green;
+                margin: 0px 0px 0px -208px;
+                padding: 0px 0px 0px 31px;">
+                Here is some text.
+            </i>
+          </b>
+        </td>
+      </tr>
+    </table>
+  </body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (167350 => 167351)


--- trunk/Source/WebCore/ChangeLog	2014-04-16 17:17:11 UTC (rev 167350)
+++ trunk/Source/WebCore/ChangeLog	2014-04-16 17:19:23 UTC (rev 167351)
@@ -1,3 +1,21 @@
+2014-04-16  Martin Hodovan  <mhodo...@inf.u-szeged.hu>
+
+        ASSERTION FAILED: x2 >= x1 in WebCore::RenderObject::drawLineForBoxSide
+        https://bugs.webkit.org/show_bug.cgi?id=127835
+
+        In some cases when a negative margin and a positive padding are applied
+        together to the right and/or left side of the box, the logical width of
+        the borders can be set to a negative value, making the assertion fire.
+        The fix checks if the width or height of the box is negative, and if so,
+        it will not display the borders and shadows of the box.
+
+        Reviewed by Darin Adler.
+
+        Test: fast/css/padding-margin-negative-border.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBorder):
+
 2014-04-16  Jer Noble  <jer.no...@apple.com>
 
         [MSE] Seeks into buffered ranges will never complete.

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (167350 => 167351)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-16 17:17:11 UTC (rev 167350)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2014-04-16 17:19:23 UTC (rev 167351)
@@ -1719,6 +1719,9 @@
     RoundedRect outerBorder = style.getRoundedBorderFor(rect, &view(), includeLogicalLeftEdge, includeLogicalRightEdge);
     RoundedRect innerBorder = style.getRoundedInnerBorderFor(borderInnerRectAdjustedForBleedAvoidance(*graphicsContext, rect, bleedAvoidance), includeLogicalLeftEdge, includeLogicalRightEdge);
 
+    if (outerBorder.rect().isEmpty())
+        return;
+
     bool haveAlphaColor = false;
     bool haveAllSolidEdges = true;
     bool haveAllDoubleEdges = true;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to