Title: [194002] trunk
Revision
194002
Author
[email protected]
Date
2015-12-11 19:26:36 -0800 (Fri, 11 Dec 2015)

Log Message

ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
https://bugs.webkit.org/show_bug.cgi?id=151201

Reviewed by Simon Fraser.

Drawing empty rect is a waste.

Source/WebCore:

Test: fast/borders/empty-drawrect-assert-after-pixelsnap.html

* rendering/RenderElement.cpp:
(WebCore::RenderElement::drawLineForBoxSide):

LayoutTests:

* fast/borders/empty-drawrect-assert-after-pixelsnap-expected.txt: Added.
* fast/borders/empty-drawrect-assert-after-pixelsnap.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (194001 => 194002)


--- trunk/LayoutTests/ChangeLog	2015-12-12 02:26:45 UTC (rev 194001)
+++ trunk/LayoutTests/ChangeLog	2015-12-12 03:26:36 UTC (rev 194002)
@@ -1,3 +1,15 @@
+2015-12-11  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
+        https://bugs.webkit.org/show_bug.cgi?id=151201
+
+        Reviewed by Simon Fraser.
+
+        Drawing empty rect is a waste.
+
+        * fast/borders/empty-drawrect-assert-after-pixelsnap-expected.txt: Added.
+        * fast/borders/empty-drawrect-assert-after-pixelsnap.html: Added.
+
 2015-12-11  Jiewen Tan  <[email protected]>
 
         Strip out Referer header when requesting subresources or following links for documents with "Content-Disposition: attachment"

Added: trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap-expected.txt (0 => 194002)


--- trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap-expected.txt	2015-12-12 03:26:36 UTC (rev 194002)
@@ -0,0 +1,2 @@
+Pass if no assert in debug.
+

Added: trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap.html (0 => 194002)


--- trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/empty-drawrect-assert-after-pixelsnap.html	2015-12-12 03:26:36 UTC (rev 194002)
@@ -0,0 +1,16 @@
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+<style>
+h3 {
+    border-top : 1px solid red;
+}
+* {
+    padding-inline-start : 91%;
+    -webkit-padding-start : 91%;
+    margin: auto auto;
+}
+</style>
+Pass if no assert in debug.
+<h3><dt><h3></h3></dt></h3>

Modified: trunk/Source/WebCore/ChangeLog (194001 => 194002)


--- trunk/Source/WebCore/ChangeLog	2015-12-12 02:26:45 UTC (rev 194001)
+++ trunk/Source/WebCore/ChangeLog	2015-12-12 03:26:36 UTC (rev 194002)
@@ -1,3 +1,17 @@
+2015-12-11  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
+        https://bugs.webkit.org/show_bug.cgi?id=151201
+
+        Reviewed by Simon Fraser.
+
+        Drawing empty rect is a waste.
+
+        Test: fast/borders/empty-drawrect-assert-after-pixelsnap.html
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::drawLineForBoxSide):
+
 2015-12-11  Jiewen Tan  <[email protected]>
 
         Strip out Referer header when requesting subresources or following links for documents with "Content-Disposition: attachment"

Modified: trunk/Source/WebCore/rendering/RenderElement.cpp (194001 => 194002)


--- trunk/Source/WebCore/rendering/RenderElement.cpp	2015-12-12 02:26:45 UTC (rev 194001)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp	2015-12-12 03:26:36 UTC (rev 194002)
@@ -1825,6 +1825,13 @@
 
 void RenderElement::drawLineForBoxSide(GraphicsContext& graphicsContext, const FloatRect& rect, BoxSide side, Color color, EBorderStyle borderStyle, float adjacentWidth1, float adjacentWidth2, bool antialias) const
 {
+    auto drawBorderRect = [&graphicsContext] (const FloatRect& rect)
+    {
+        if (rect.isEmpty())
+            return;
+        graphicsContext.drawRect(rect);
+    };
+
     float x1 = rect.x();
     float x2 = rect.maxX();
     float y1 = rect.y();
@@ -1879,13 +1886,13 @@
             switch (side) {
             case BSTop:
             case BSBottom:
-                graphicsContext.drawRect(snapRectToDevicePixels(x1, y1, length, thirdOfThickness, deviceScaleFactor));
-                graphicsContext.drawRect(snapRectToDevicePixels(x1, y2 - thirdOfThickness, length, thirdOfThickness, deviceScaleFactor));
+                drawBorderRect(snapRectToDevicePixels(x1, y1, length, thirdOfThickness, deviceScaleFactor));
+                drawBorderRect(snapRectToDevicePixels(x1, y2 - thirdOfThickness, length, thirdOfThickness, deviceScaleFactor));
                 break;
             case BSLeft:
             case BSRight:
-                graphicsContext.drawRect(snapRectToDevicePixels(x1, y1, thirdOfThickness, length, deviceScaleFactor));
-                graphicsContext.drawRect(snapRectToDevicePixels(x2 - thirdOfThickness, y1, thirdOfThickness, length, deviceScaleFactor));
+                drawBorderRect(snapRectToDevicePixels(x1, y1, thirdOfThickness, length, deviceScaleFactor));
+                drawBorderRect(snapRectToDevicePixels(x2 - thirdOfThickness, y1, thirdOfThickness, length, deviceScaleFactor));
                 break;
             }
 
@@ -2025,7 +2032,7 @@
             graphicsContext.setFillColor(color);
             bool wasAntialiased = graphicsContext.shouldAntialias();
             graphicsContext.setShouldAntialias(antialias);
-            graphicsContext.drawRect(snapRectToDevicePixels(x1, y1, x2 - x1, y2 - y1, deviceScaleFactor));
+            drawBorderRect(snapRectToDevicePixels(x1, y1, x2 - x1, y2 - y1, deviceScaleFactor));
             graphicsContext.setShouldAntialias(wasAntialiased);
             graphicsContext.setStrokeStyle(oldStrokeStyle);
             return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to