Title: [178613] trunk
Revision
178613
Author
[email protected]
Date
2015-01-16 16:35:49 -0800 (Fri, 16 Jan 2015)

Log Message

When border-radius is present, inset/outset/groove/ridge border color changes.
https://bugs.webkit.org/show_bug.cgi?id=140551

Reviewed by Simon Fraser.

This patch applies the same color lighten/darken adjustment on the radius borders
that we use for non-radius border.

Source/WebCore:

Test: fast/borders/wrong-border-color-when-radius-is-present.html

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::drawBoxSideFromPath):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::calculateBorderStyleColor):
* rendering/RenderObject.h:

LayoutTests:

* fast/borders/wrong-border-color-when-radius-is-present-expected.html: Added.
* fast/borders/wrong-border-color-when-radius-is-present.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (178612 => 178613)


--- trunk/LayoutTests/ChangeLog	2015-01-17 00:12:50 UTC (rev 178612)
+++ trunk/LayoutTests/ChangeLog	2015-01-17 00:35:49 UTC (rev 178613)
@@ -1,3 +1,16 @@
+2015-01-16  Zalan Bujtas  <[email protected]>
+
+        When border-radius is present, inset/outset/groove/ridge border color changes.
+        https://bugs.webkit.org/show_bug.cgi?id=140551
+
+        Reviewed by Simon Fraser.
+
+        This patch applies the same color lighten/darken adjustment on the radius borders
+        that we use for non-radius border.
+
+        * fast/borders/wrong-border-color-when-radius-is-present-expected.html: Added.
+        * fast/borders/wrong-border-color-when-radius-is-present.html: Added.
+
 2015-01-16  Benjamin Poulain  <[email protected]>
 
         Add the alternative syntax for CSS Selector's descendant combinator (">>")

Added: trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present-expected.html (0 => 178613)


--- trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present-expected.html	2015-01-17 00:35:49 UTC (rev 178613)
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests if borders with border-radius use the same pair of dark, light colors as non-radius borders.</title>
+<style>
+  div {
+    border-color: green;
+    border-width: 2px;
+    width: 50px;
+    height: 50px;
+    margin: 10px;
+    position: relative;
+  }
+  
+  .hide {
+    width: 15px;
+    height: 15px;
+    background-color: red;
+    position: absolute;
+  }
+  
+</style>
+</head>
+<body>
+  <div style="border-style: inset"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: outset"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: groove"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: ridge"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+</body>
+</html>

Added: trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present.html (0 => 178613)


--- trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present.html	                        (rev 0)
+++ trunk/LayoutTests/fast/borders/wrong-border-color-when-radius-is-present.html	2015-01-17 00:35:49 UTC (rev 178613)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>This tests if borders with border-radius use the same pair of dark, light colors as non-radius borders.</title>
+<style>
+  div {
+    border-radius: 10px;
+    border-color: green;
+    border-width: 2px;
+    width: 50px;
+    height: 50px;
+    margin: 10px;
+    position: relative;
+  }
+  
+  .hide {
+    width: 15px;
+    height: 15px;
+    background-color: red;
+    position: absolute;
+  }
+  
+</style>
+</head>
+<body>
+  <div style="border-style: inset"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: outset"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: groove"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+  <div style="border-style: ridge"><p class=hide style="left: -5px; top: -21px;"></p><p class=hide style="left: 40px; top: -21px;"></p><p class=hide style="left: -5px; top: 24px;"></p><p class=hide style="left: 40px; top: 24px;"></p></div>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (178612 => 178613)


--- trunk/Source/WebCore/ChangeLog	2015-01-17 00:12:50 UTC (rev 178612)
+++ trunk/Source/WebCore/ChangeLog	2015-01-17 00:35:49 UTC (rev 178613)
@@ -1,3 +1,21 @@
+2015-01-16  Zalan Bujtas  <[email protected]>
+
+        When border-radius is present, inset/outset/groove/ridge border color changes.
+        https://bugs.webkit.org/show_bug.cgi?id=140551
+
+        Reviewed by Simon Fraser.
+
+        This patch applies the same color lighten/darken adjustment on the radius borders
+        that we use for non-radius border.
+
+        Test: fast/borders/wrong-border-color-when-radius-is-present.html
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::drawBoxSideFromPath):
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::calculateBorderStyleColor):
+        * rendering/RenderObject.h:
+
 2015-01-16  Pratik Solanki  <[email protected]>
 
         Web pages fail to load using public iOS WebKit; ASSERT(!isMainThread()) in

Modified: trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp (178612 => 178613)


--- trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-01-17 00:12:50 UTC (rev 178612)
+++ trunk/Source/WebCore/rendering/RenderBoxModelObject.cpp	2015-01-17 00:35:49 UTC (rev 178613)
@@ -2051,12 +2051,8 @@
         return;
     }
     case INSET:
-        if (side == BSTop || side == BSLeft)
-            color = color.dark();
-        break;
     case OUTSET:
-        if (side == BSBottom || side == BSRight)
-            color = color.dark();
+        calculateBorderStyleColor(borderStyle, side, color);
         break;
     default:
         break;

Modified: trunk/Source/WebCore/rendering/RenderObject.cpp (178612 => 178613)


--- trunk/Source/WebCore/rendering/RenderObject.cpp	2015-01-17 00:12:50 UTC (rev 178612)
+++ trunk/Source/WebCore/rendering/RenderObject.cpp	2015-01-17 00:35:49 UTC (rev 178613)
@@ -2458,6 +2458,7 @@
 
 void RenderObject::calculateBorderStyleColor(const EBorderStyle& style, const BoxSide& side, Color& color)
 {
+    ASSERT(style == INSET || style == OUTSET);
     // This values were derived empirically.
     const RGBA32 baseDarkColor = 0xFF202020;
     const RGBA32 baseLightColor = 0xFFEBEBEB;

Modified: trunk/Source/WebCore/rendering/RenderObject.h (178612 => 178613)


--- trunk/Source/WebCore/rendering/RenderObject.h	2015-01-17 00:12:50 UTC (rev 178612)
+++ trunk/Source/WebCore/rendering/RenderObject.h	2015-01-17 00:35:49 UTC (rev 178613)
@@ -869,11 +869,11 @@
 
     virtual RenderFlowThread* locateFlowThreadContainingBlock() const;
     void invalidateFlowThreadContainingBlockIncludingDescendants(RenderFlowThread* = nullptr);
+    static void calculateBorderStyleColor(const EBorderStyle&, const BoxSide&, Color&);
 
 private:
     void removeFromRenderFlowThread();
     void removeFromRenderFlowThreadIncludingDescendants(bool);
-    static void calculateBorderStyleColor(const EBorderStyle&, const BoxSide&, Color&);
     Node* generatingPseudoHostElement() const;
 
     virtual bool isWBR() const { ASSERT_NOT_REACHED(); return false; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to