CSS 2.1 failure: outline-color-* tests fail
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2011 20:30:35 +0000 (20:30 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 10 Dec 2011 20:30:35 +0000 (20:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=71931

Source/WebCore:

Reviewed by Julien Chaffraix.

Test: css2.1/20110323/outline-color-001.html

WebKit didn't paint the top block in this series of tests because it ignored the outline
of objects with a zero size. Fix this by taking account of both offset and width of the
outline when deciding whether to paint it.

* rendering/RenderObject.cpp:
(WebCore::RenderObject::paintOutline): paint the outline even when the block has zero size

LayoutTests:

Add outline-color-001.htm to catch regressions against displaying outlines
on objects with zero size. The rest of the outline-color-* test series will
be landed separately.

Reviewed by Julien Chaffraix.

* css2.1/20110323/outline-color-001-expected.html: Added.
* css2.1/20110323/outline-color-001.htm: Added.

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

LayoutTests/ChangeLog
LayoutTests/css2.1/20110323/outline-color-001-expected.html [new file with mode: 0644]
LayoutTests/css2.1/20110323/outline-color-001.htm [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderObject.cpp

index e4fb6b1..da4f34e 100644 (file)
@@ -1,3 +1,17 @@
+2011-11-09  Robert Hogan  <robert@webkit.org>
+
+        CSS 2.1 failure: outline-color-* tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=71931
+
+        Add outline-color-001.htm to catch regressions against displaying outlines
+        on objects with zero size. The rest of the outline-color-* test series will
+        be landed separately.
+
+        Reviewed by Julien Chaffraix.
+
+        * css2.1/20110323/outline-color-001-expected.html: Added.
+        * css2.1/20110323/outline-color-001.htm: Added.
+
 2011-12-10  Alan Stearns  <stearns@adobe.com>
 
         Update test_expectations for chromium
diff --git a/LayoutTests/css2.1/20110323/outline-color-001-expected.html b/LayoutTests/css2.1/20110323/outline-color-001-expected.html
new file mode 100644 (file)
index 0000000..d9c2a20
--- /dev/null
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Outline-color set to '#00000'</title>
+        <style type="text/css">
+            #reference
+            {
+                background-color: black;
+                height: 100px;
+                width: 100px;
+                margin: 50px 0 0 50px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the two boxes below are the same color.</p>
+        <div id="reference"></div>
+        <div id="reference"></div>
+    </body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/css2.1/20110323/outline-color-001.htm b/LayoutTests/css2.1/20110323/outline-color-001.htm
new file mode 100644 (file)
index 0000000..e648f23
--- /dev/null
@@ -0,0 +1,33 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+    <head>
+        <title>CSS Test: Outline-color set to '#00000'</title>
+        <link rel="author" title="Microsoft" href="http://www.microsoft.com/">
+        <link rel="help" href="http://www.w3.org/TR/CSS21/ui.html#propdef-outline-color">
+        <link rel="help" href="http://www.w3.org/TR/CSS21/ui.html#dynamic-outlines">
+        <meta name="flags" content="invalid">
+        <meta name="assert" content="Outline color #00000 (invalid) falls back to a default color.">
+        <style type="text/css">
+            #div1
+            {
+                outline-color: #00000;
+                outline-style: solid;
+                outline-width: 50px;
+                margin: 100px 0 0 100px;
+                width: 0;
+            }
+            #reference
+            {
+                background-color: black;
+                height: 100px;
+                margin: 200px 0 0 50px;
+                width: 100px;
+            }
+        </style>
+    </head>
+    <body>
+        <p>Test passes if the two boxes below are the same color.</p>
+        <div id="div1"></div>
+        <div id="reference"></div>
+    </body>
+</html>
\ No newline at end of file
index fa57cd1..145e005 100644 (file)
@@ -1,3 +1,19 @@
+2011-11-09  Robert Hogan  <robert@webkit.org>
+
+        CSS 2.1 failure: outline-color-* tests fail
+        https://bugs.webkit.org/show_bug.cgi?id=71931
+
+        Reviewed by Julien Chaffraix.
+
+        Test: css2.1/20110323/outline-color-001.html
+
+        WebKit didn't paint the top block in this series of tests because it ignored the outline
+        of objects with a zero size. Fix this by taking account of both offset and width of the
+        outline when deciding whether to paint it. 
+
+        * rendering/RenderObject.cpp:
+        (WebCore::RenderObject::paintOutline): paint the outline even when the block has zero size
+
 2011-12-10   Arko Saha  <arko@motorola.com>
 
         Microdata: Fix compilation error in MICRODATA enabled build.
index d0f8a8b..a7102e1 100755 (executable)
@@ -1130,7 +1130,7 @@ void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRe
 
     Color outlineColor = styleToUse->visitedDependentColor(CSSPropertyOutlineColor);
 
-    LayoutUnit offset = styleToUse->outlineOffset();
+    LayoutUnit outlineOffset = styleToUse->outlineOffset();
 
     if (styleToUse->outlineStyleIsAuto() || hasOutlineAnnotation()) {
         if (!theme()->supportsFocusRing(styleToUse)) {
@@ -1143,14 +1143,15 @@ void RenderObject::paintOutline(GraphicsContext* graphicsContext, const LayoutRe
         return;
 
     LayoutRect inner = paintRect;
-    inner.inflate(offset);
-
-    if (inner.isEmpty())
-        return;
+    inner.inflate(outlineOffset);
 
     LayoutRect outer = inner;
     outer.inflate(outlineWidth);
 
+    // FIXME: This prevents outlines from painting inside the object. See bug 12042
+    if (outer.isEmpty())
+        return;
+
     bool useTransparencyLayer = outlineColor.hasAlpha();
     if (useTransparencyLayer) {
         if (outlineStyle == SOLID) {