Title: [210152] trunk
Revision
210152
Author
[email protected]
Date
2016-12-26 19:14:31 -0800 (Mon, 26 Dec 2016)

Log Message

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

Reviewed by Darin Adler.

Source/WebCore:

Make sure we don't paint empty rects.

Test: fast/lists/assert-on-empty-list-marker.html

* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::paint):

LayoutTests:

* fast/lists/assert-on-empty-list-marker-expected.txt: Added.
* fast/lists/assert-on-empty-list-marker.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (210151 => 210152)


--- trunk/LayoutTests/ChangeLog	2016-12-26 19:00:53 UTC (rev 210151)
+++ trunk/LayoutTests/ChangeLog	2016-12-27 03:14:31 UTC (rev 210152)
@@ -1,3 +1,13 @@
+2016-12-26  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
+        https://bugs.webkit.org/show_bug.cgi?id=163461
+
+        Reviewed by Darin Adler.
+
+        * fast/lists/assert-on-empty-list-marker-expected.txt: Added.
+        * fast/lists/assert-on-empty-list-marker.html: Added.
+
 2016-12-25  Chris Fleizach  <[email protected]>
 
         AX: Headers of table not read by VoiceOver

Added: trunk/LayoutTests/fast/lists/assert-on-empty-list-marker-expected.txt (0 => 210152)


--- trunk/LayoutTests/fast/lists/assert-on-empty-list-marker-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/lists/assert-on-empty-list-marker-expected.txt	2016-12-27 03:14:31 UTC (rev 210152)
@@ -0,0 +1,2 @@
+PASS if no ASSERT in debug.
+

Added: trunk/LayoutTests/fast/lists/assert-on-empty-list-marker.html (0 => 210152)


--- trunk/LayoutTests/fast/lists/assert-on-empty-list-marker.html	                        (rev 0)
+++ trunk/LayoutTests/fast/lists/assert-on-empty-list-marker.html	2016-12-27 03:14:31 UTC (rev 210152)
@@ -0,0 +1,14 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests that we don't assert on empty list markers.</title> 
+<script>
+  if (window.testRunner)
+    testRunner.dumpAsText();
+</script>
+</head>
+<body>
+PASS if no ASSERT in debug.
+<ul style=font-size:1px><ul><ul><li>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (210151 => 210152)


--- trunk/Source/WebCore/ChangeLog	2016-12-26 19:00:53 UTC (rev 210151)
+++ trunk/Source/WebCore/ChangeLog	2016-12-27 03:14:31 UTC (rev 210152)
@@ -1,3 +1,17 @@
+2016-12-26  Zalan Bujtas  <[email protected]>
+
+        ASSERTION FAILED: !rect.isEmpty() in WebCore::GraphicsContext::drawRect
+        https://bugs.webkit.org/show_bug.cgi?id=163461
+
+        Reviewed by Darin Adler.
+
+        Make sure we don't paint empty rects.
+
+        Test: fast/lists/assert-on-empty-list-marker.html
+
+        * rendering/RenderListMarker.cpp:
+        (WebCore::RenderListMarker::paint):
+
 2016-12-25  Chris Fleizach  <[email protected]>
 
         AX: Headers of table not read by VoiceOver

Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (210151 => 210152)


--- trunk/Source/WebCore/rendering/RenderListMarker.cpp	2016-12-26 19:00:53 UTC (rev 210151)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp	2016-12-27 03:14:31 UTC (rev 210152)
@@ -1189,14 +1189,16 @@
 
     LayoutRect box(boxOrigin, size());
     
-    FloatRect marker = getRelativeMarkerRect();
-    marker.moveBy(boxOrigin);
+    auto markerRect = getRelativeMarkerRect();
+    markerRect.moveBy(boxOrigin);
+    if (markerRect.isEmpty())
+        return;
 
     GraphicsContext& context = paintInfo.context();
 
     if (isImage()) {
-        if (RefPtr<Image> markerImage = m_image->image(this, marker.size()))
-            context.drawImage(*markerImage, marker);
+        if (RefPtr<Image> markerImage = m_image->image(this, markerRect.size()))
+            context.drawImage(*markerImage, markerRect);
         if (selectionState() != SelectionNone) {
             LayoutRect selRect = localSelectionRect();
             selRect.moveBy(boxOrigin);
@@ -1220,14 +1222,14 @@
     EListStyleType type = style().listStyleType();
     switch (type) {
         case Disc:
-            context.drawEllipse(marker);
+            context.drawEllipse(markerRect);
             return;
         case Circle:
             context.setFillColor(Color::transparent);
-            context.drawEllipse(marker);
+            context.drawEllipse(markerRect);
             return;
         case Square:
-            context.drawRect(marker);
+            context.drawRect(markerRect);
             return;
         case NoneListStyle:
             return;
@@ -1318,16 +1320,16 @@
 
     GraphicsContextStateSaver stateSaver(context, false);
     if (!style().isHorizontalWritingMode()) {
-        marker.moveBy(-boxOrigin);
-        marker = marker.transposedRect();
-        marker.moveBy(FloatPoint(box.x(), box.y() - logicalHeight()));
+        markerRect.moveBy(-boxOrigin);
+        markerRect = markerRect.transposedRect();
+        markerRect.moveBy(FloatPoint(box.x(), box.y() - logicalHeight()));
         stateSaver.save();
-        context.translate(marker.x(), marker.maxY());
+        context.translate(markerRect.x(), markerRect.maxY());
         context.rotate(static_cast<float>(deg2rad(90.)));
-        context.translate(-marker.x(), -marker.maxY());
+        context.translate(-markerRect.x(), -markerRect.maxY());
     }
 
-    FloatPoint textOrigin = FloatPoint(marker.x(), marker.y() + style().fontMetrics().ascent());
+    FloatPoint textOrigin = FloatPoint(markerRect.x(), markerRect.y() + style().fontMetrics().ascent());
     textOrigin = roundPointToDevicePixels(LayoutPoint(textOrigin), document().deviceScaleFactor(), style().isLeftToRightDirection());
 
     if (type == Asterisks || type == Footnotes)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to