Title: [110704] trunk/Source
Revision
110704
Author
[email protected]
Date
2012-03-14 08:37:33 -0700 (Wed, 14 Mar 2012)

Log Message

Region can acquire an empty span by subtracting an empty Region
https://bugs.webkit.org/show_bug.cgi?id=81074

Patch by Dana Jansens <[email protected]> on 2012-03-14
Reviewed by Anders Carlsson.

Source/WebCore:

Subtracting an empty Region B from a Region A can cause A to end
up with an empty span. This violates the rule that two Regions
that cover the exact same area should have equal spans and segments.

Unit test: RegionTest.emptySpan

* platform/graphics/Region.cpp:
(WebCore::Region::subtract):

Source/WebKit/chromium:

* tests/RegionTest.cpp:
(WebCore::TEST):
(WebCore):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110703 => 110704)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 15:31:56 UTC (rev 110703)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 15:37:33 UTC (rev 110704)
@@ -1,3 +1,19 @@
+2012-03-14  Dana Jansens  <[email protected]>
+
+        Region can acquire an empty span by subtracting an empty Region
+        https://bugs.webkit.org/show_bug.cgi?id=81074
+
+        Reviewed by Anders Carlsson.
+
+        Subtracting an empty Region B from a Region A can cause A to end
+        up with an empty span. This violates the rule that two Regions
+        that cover the exact same area should have equal spans and segments.
+
+        Unit test: RegionTest.emptySpan
+
+        * platform/graphics/Region.cpp:
+        (WebCore::Region::subtract):
+
 2012-03-14  Simon Hausmann  <[email protected]>
 
         [Textmap] Disable driver based BGRA swizzling for OpenGL/ES

Modified: trunk/Source/WebCore/platform/graphics/Region.cpp (110703 => 110704)


--- trunk/Source/WebCore/platform/graphics/Region.cpp	2012-03-14 15:31:56 UTC (rev 110703)
+++ trunk/Source/WebCore/platform/graphics/Region.cpp	2012-03-14 15:37:33 UTC (rev 110704)
@@ -500,6 +500,9 @@
 
 void Region::subtract(const Region& region)
 {
+    if (region.isEmpty())
+        return;
+
     Shape subtractedShape = Shape::subtractShapes(m_shape, region.m_shape);
 
     m_shape.swap(subtractedShape);

Modified: trunk/Source/WebKit/chromium/ChangeLog (110703 => 110704)


--- trunk/Source/WebKit/chromium/ChangeLog	2012-03-14 15:31:56 UTC (rev 110703)
+++ trunk/Source/WebKit/chromium/ChangeLog	2012-03-14 15:37:33 UTC (rev 110704)
@@ -1,3 +1,14 @@
+2012-03-14  Dana Jansens  <[email protected]>
+
+        Region can acquire an empty span by subtracting an empty Region
+        https://bugs.webkit.org/show_bug.cgi?id=81074
+
+        Reviewed by Anders Carlsson.
+
+        * tests/RegionTest.cpp:
+        (WebCore::TEST):
+        (WebCore):
+
 2012-03-13  Hajime Morrita  <[email protected]>
 
         Unreviewed, mark verifyCullChildLinesUpTopLeft() as failed.

Modified: trunk/Source/WebKit/chromium/tests/RegionTest.cpp (110703 => 110704)


--- trunk/Source/WebKit/chromium/tests/RegionTest.cpp	2012-03-14 15:31:56 UTC (rev 110703)
+++ trunk/Source/WebKit/chromium/tests/RegionTest.cpp	2012-03-14 15:37:33 UTC (rev 110704)
@@ -112,4 +112,16 @@
     TEST_BOTTOM_OF_RECT(r, 31, 40, 10, 10);
 }
 
+TEST(RegionTest, emptySpan)
+{
+    Region r;
+    r.unite(IntRect(5, 0, 10, 10));
+    r.unite(IntRect(0, 5, 10, 10));
+    r.subtract(IntRect(7, 7, 10, 0));
+
+    Vector<IntRect> rects = r.rects();
+    for (size_t i = 0; i < rects.size(); ++i)
+        EXPECT_FALSE(rects[i].isEmpty());
+}
+
 } // namespace
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to