2011-01-23 MORITA Hajime <morrita@google.com>
authormorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Jan 2011 04:23:44 +0000 (04:23 +0000)
committermorrita@google.com <morrita@google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 31 Jan 2011 04:23:44 +0000 (04:23 +0000)
        Reviewed by Eric Seidel.

        REGRESSION: Inset shadow with too large border radius misses rounded corner.
        https://bugs.webkit.org/show_bug.cgi?id=52800

        * fast/box-shadow/inset-with-extraordinary-radii-and-border.html: Added.
        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.checksum: Added.
        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png: Added.
        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.txt: Added.
2011-01-23  MORITA Hajime  <morrita@google.com>

        Reviewed by Eric Seidel.

        REGRESSION: Inset shadow with too large border radius misses rounded corner.
        https://bugs.webkit.org/show_bug.cgi?id=52800

        The refactoring on r76083 broke the invariant between border
        IntRect and its radii because RoundedIntRect::setRect() is called
        after getRoundedInnerBorderWithBorderWidths(), which enforces the
        invariant. Th rounded-rect clipping code verifies the invariant,
        and discard the invalid radii, that results broken paintings.

        This change moved setRect() before
        getRoundedInnerBorderWithBorderWidths() not to modify the valid
        RoundedIntRect value.

        Test: fast/box-shadow/inset-with-extraordinary-radii-and-border.html

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@77105 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/box-shadow/inset-with-extraordinary-radii-and-border.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderBoxModelObject.cpp

index 7621fb0..a79fee7 100644 (file)
@@ -1,3 +1,15 @@
+2011-01-23  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Eric Seidel.
+
+        REGRESSION: Inset shadow with too large border radius misses rounded corner.
+        https://bugs.webkit.org/show_bug.cgi?id=52800
+
+        * fast/box-shadow/inset-with-extraordinary-radii-and-border.html: Added.
+        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.checksum: Added.
+        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png: Added.
+        * platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.txt: Added.
+
 2011-01-30  Simon Fraser  <simon.fraser@apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/LayoutTests/fast/box-shadow/inset-with-extraordinary-radii-and-border.html b/LayoutTests/fast/box-shadow/inset-with-extraordinary-radii-and-border.html
new file mode 100644 (file)
index 0000000..3af050e
--- /dev/null
@@ -0,0 +1,47 @@
+<html>
+<head>
+<style>
+body { background-color: black; }
+
+.test {
+    border-radius: 40px;
+    -webkit-box-shadow: inset white 0 0 0 15px;
+    border: 4px solid green;
+    background-color: blue;
+    margin: 20px;
+}
+
+#test0 {
+    height: 70px;
+    width: 70px;
+    float: left;
+}
+
+#test1 {
+    height: 100px;
+    width: 70px;
+    float: left;
+}
+
+#test2 {
+    height: 70px;
+    width: 100px;
+    float: right;
+}
+
+#test3 {
+    height: 100px;
+    width: 100px;
+    float: right;
+}
+
+</style>
+</head>
+<body>
+<div>
+  <div class="test" id="test0"></div>
+  <div class="test" id="test1"></div>
+  <div class="test" id="test2"></div>
+  <div class="test" id="test3"></div>
+</div>
+</body>
diff --git a/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.checksum b/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.checksum
new file mode 100644 (file)
index 0000000..5390fac
--- /dev/null
@@ -0,0 +1 @@
+22de9eff940a1547914d350c89436887
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png b/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png
new file mode 100644 (file)
index 0000000..1130c66
Binary files /dev/null and b/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.txt b/LayoutTests/platform/mac/fast/box-shadow/inset-with-extraordinary-radii-and-border-expected.txt
new file mode 100644 (file)
index 0000000..95a1e78
--- /dev/null
@@ -0,0 +1,10 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x584 [bgcolor=#000000]
+      RenderBlock {DIV} at (0,0) size 784x0
+        RenderBlock (floating) {DIV} at (20,20) size 78x78 [bgcolor=#0000FF] [border: (4px solid #008000)]
+        RenderBlock (floating) {DIV} at (138,20) size 78x108 [bgcolor=#0000FF] [border: (4px solid #008000)]
+        RenderBlock (floating) {DIV} at (656,20) size 108x78 [bgcolor=#0000FF] [border: (4px solid #008000)]
+        RenderBlock (floating) {DIV} at (508,20) size 108x108 [bgcolor=#0000FF] [border: (4px solid #008000)]
index 3d6571a..8eb1a02 100644 (file)
@@ -1,3 +1,25 @@
+2011-01-23  MORITA Hajime  <morrita@google.com>
+
+        Reviewed by Eric Seidel.
+
+        REGRESSION: Inset shadow with too large border radius misses rounded corner.
+        https://bugs.webkit.org/show_bug.cgi?id=52800
+
+        The refactoring on r76083 broke the invariant between border
+        IntRect and its radii because RoundedIntRect::setRect() is called
+        after getRoundedInnerBorderWithBorderWidths(), which enforces the
+        invariant. Th rounded-rect clipping code verifies the invariant,
+        and discard the invalid radii, that results broken paintings.
+        
+        This change moved setRect() before
+        getRoundedInnerBorderWithBorderWidths() not to modify the valid
+        RoundedIntRect value.
+        
+        Test: fast/box-shadow/inset-with-extraordinary-radii-and-border.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintBoxShadow):
+
 2011-01-30  Simon Fraser  <simon.fraser@apple.com>
 
         Attempt to fix Windows build by adding ShadowBlur.cpp/h to the
index 61fc4ad..0180b85 100644 (file)
@@ -1585,17 +1585,18 @@ void RenderBoxModelObject::paintBoxShadow(GraphicsContext* context, int tx, int
     RoundedIntRect border(tx, ty, w, h);
     bool hasBorderRadius = s->hasBorderRadius();
     bool isHorizontal = s->isHorizontalWritingMode();
-    if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) {
-        RoundedIntRect::Radii radii = ((shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect())).radii();
-        border.includeLogicalEdges(radii, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
-    }
-   
+
     if (shadowStyle == Inset)
         border.setRect(IntRect(border.rect().x() + (includeLogicalLeftEdge || !isHorizontal ? borderLeft() : 0),
                                border.rect().y() + (includeLogicalLeftEdge || isHorizontal ? borderTop() : 0),
                                border.rect().width() - ((includeLogicalLeftEdge || !isHorizontal) ? borderLeft() : 0) - ((includeLogicalRightEdge || !isHorizontal) ? borderRight() : 0),
                                border.rect().height() - ((includeLogicalLeftEdge || isHorizontal) ? borderTop() : 0) - ((includeLogicalRightEdge || isHorizontal) ? borderBottom() : 0)));
 
+    if (hasBorderRadius && (includeLogicalLeftEdge || includeLogicalRightEdge)) {
+        RoundedIntRect::Radii radii = ((shadowStyle == Inset) ? s->getRoundedInnerBorderWithBorderWidths(border.rect(), borderTop(), borderBottom(), borderLeft(), borderRight()) : s->getRoundedBorderFor(border.rect())).radii();
+        border.includeLogicalEdges(radii, isHorizontal, includeLogicalLeftEdge, includeLogicalRightEdge);
+    }
+
     bool hasOpaqueBackground = s->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && s->visitedDependentColor(CSSPropertyBackgroundColor).alpha() == 255;
     for (const ShadowData* shadow = s->boxShadow(); shadow; shadow = shadow->next()) {
         if (shadow->style() != shadowStyle)