Title: [145044] trunk
Revision
145044
Author
ta...@google.com
Date
2013-03-06 23:52:44 -0800 (Wed, 06 Mar 2013)

Log Message

Box-shadow displayed improperly with border-radius.
https://bugs.webkit.org/show_bug.cgi?id=111256

Reviewed by Simon Fraser.

Source/WebCore:

RoundedRect::adjustRadii doesn't adjust radii correctly, because
the method compares maxRadiusWidth with maxRadiusHeight. However,
we have to compare maxRadiusWidth / rect.width() with
maxRadiusHeight / rect.height().

Test: fast/borders/border-radius-with-box-shadow-01.html

* platform/graphics/RoundedRect.cpp:
(WebCore::RoundedRect::adjustRadii):
Should check which ratio is smaller.

LayoutTests:

* fast/borders/border-radius-with-box-shadow-01-expected.txt: Added.
* fast/borders/border-radius-with-box-shadow-01.html: Added.
* platform/chromium-linux/fast/borders/border-radius-with-box-shadow-01-expected.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (145043 => 145044)


--- trunk/LayoutTests/ChangeLog	2013-03-07 07:49:06 UTC (rev 145043)
+++ trunk/LayoutTests/ChangeLog	2013-03-07 07:52:44 UTC (rev 145044)
@@ -1,3 +1,14 @@
+2013-03-06  Takashi Sakamoto  <ta...@google.com>
+
+        Box-shadow displayed improperly with border-radius.
+        https://bugs.webkit.org/show_bug.cgi?id=111256
+
+        Reviewed by Simon Fraser.
+
+        * fast/borders/border-radius-with-box-shadow-01-expected.txt: Added.
+        * fast/borders/border-radius-with-box-shadow-01.html: Added.
+        * platform/chromium-linux/fast/borders/border-radius-with-box-shadow-01-expected.png: Added.
+
 2013-03-06  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r144726.

Added: trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01-expected.txt (0 => 145044)


--- trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01-expected.txt	2013-03-07 07:52:44 UTC (rev 145044)
@@ -0,0 +1,6 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x106
+  RenderBlock {HTML} at (0,0) size 800x106
+    RenderBody {BODY} at (8,8) size 784x90
+      RenderBlock {DIV} at (0,0) size 400x90

Added: trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01.html (0 => 145044)


--- trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/border-radius-with-box-shadow-01.html	2013-03-07 07:52:44 UTC (rev 145044)
@@ -0,0 +1,17 @@
+<!doctype html>
+<html>
+<head>
+<style>
+#target {
+    width: 400px;
+    height: 90px;
+    box-shadow: 0 0 25px -5px #777777;
+    border-radius: 0 0 95px 95px;
+}
+</style>
+</head>
+<body>
+  <!-- [bug 111256] Box-shadow displayed improperly with border-radius. -->
+  <div id="target"></div>
+</body>
+</html>

Added: trunk/LayoutTests/platform/chromium-linux/fast/borders/border-radius-with-box-shadow-01-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/fast/borders/border-radius-with-box-shadow-01-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (145043 => 145044)


--- trunk/Source/WebCore/ChangeLog	2013-03-07 07:49:06 UTC (rev 145043)
+++ trunk/Source/WebCore/ChangeLog	2013-03-07 07:52:44 UTC (rev 145044)
@@ -1,3 +1,21 @@
+2013-03-06  Takashi Sakamoto  <ta...@google.com>
+
+        Box-shadow displayed improperly with border-radius.
+        https://bugs.webkit.org/show_bug.cgi?id=111256
+
+        Reviewed by Simon Fraser.
+
+        RoundedRect::adjustRadii doesn't adjust radii correctly, because
+        the method compares maxRadiusWidth with maxRadiusHeight. However,
+        we have to compare maxRadiusWidth / rect.width() with
+        maxRadiusHeight / rect.height().
+
+        Test: fast/borders/border-radius-with-box-shadow-01.html
+
+        * platform/graphics/RoundedRect.cpp:
+        (WebCore::RoundedRect::adjustRadii):
+        Should check which ratio is smaller.
+
 2013-03-06  Mike West  <mk...@chromium.org>
 
         [V8] Preprocess constant values to avoid a "static_cast<signed int>" in CodeGeneratorV8.

Modified: trunk/Source/WebCore/platform/graphics/RoundedRect.cpp (145043 => 145044)


--- trunk/Source/WebCore/platform/graphics/RoundedRect.cpp	2013-03-07 07:49:06 UTC (rev 145043)
+++ trunk/Source/WebCore/platform/graphics/RoundedRect.cpp	2013-03-07 07:52:44 UTC (rev 145044)
@@ -166,10 +166,14 @@
 {
     int maxRadiusWidth = std::max(m_radii.topLeft().width() + m_radii.topRight().width(), m_radii.bottomLeft().width() + m_radii.bottomRight().width());
     int maxRadiusHeight = std::max(m_radii.topLeft().height() + m_radii.bottomLeft().height(), m_radii.topRight().height() + m_radii.bottomRight().height());
-    if (maxRadiusWidth > maxRadiusHeight)
-        m_radii.scale(static_cast<float>(m_rect.width()) / maxRadiusWidth);
-    else
-        m_radii.scale(static_cast<float>(m_rect.height()) / maxRadiusHeight);
+
+    if (maxRadiusWidth <= 0 || maxRadiusHeight <= 0) {
+        m_radii.scale(0.0f);
+        return;
+    }
+    float widthRatio = static_cast<float>(m_rect.width()) / maxRadiusWidth;
+    float heightRatio = static_cast<float>(m_rect.height()) / maxRadiusHeight;
+    m_radii.scale(widthRatio < heightRatio ? widthRatio : heightRatio);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to