2010-11-30 Daniel Bates <dbates@rim.com>
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Nov 2010 21:57:16 +0000 (21:57 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 30 Nov 2010 21:57:16 +0000 (21:57 +0000)
        Reviewed by David Hyatt.

        Focused <area> should use CSS properties of <area> instead of associated <img>
        https://bugs.webkit.org/show_bug.cgi?id=49888

        Fixes an issue where the CSS properties of an <area> were not used when
        the <area> was focused.

        Currently, when focusing an <area> (say by pressing option + tab in Mac
        Safari) we use the CSS style information for the <img> associated with
        the <area>. Instead, we should use the CSS style information for the
        focused <area>. In particular, this will make the us honor the outline-
        color property of a focused <area> when drawing its focus ring.

        Tests: fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html
               fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html
               fast/images/imagemap-focus-ring-outline-color.html

        * rendering/RenderImage.cpp:
        (WebCore::RenderImage::paintFocusRing): Use the style information of
        the focused <area> when drawing the focus ring for it.
2010-11-30  Daniel Bates  <dbates@rim.com>

        Reviewed by David Hyatt.

        Focused <area> should use CSS properties of <area> instead of associated <img>
        https://bugs.webkit.org/show_bug.cgi?id=49888

        Updated the test result for test fast/images/imagemap-focus-ring.html. Added
        test to verify that the color of the focus ring for a focused <area> is
        the outline-color specified by the :focus pseudo-class .

        Also, added tests to ensure that outline-color is not inherited (by default) as per
        section 18.4 of the CSS 2.1 spec <http://www.w3.org/TR/CSS2/ui.html#dynamic-outlines>,
        unless explicitly inherited.

        * fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html: Added.
        * fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html: Added.
        * fast/images/imagemap-focus-ring-outline-color.html: Added.
        * platform/mac/fast/images/imagemap-focus-ring-expected.checksum: Updated result.
        * platform/mac/fast/images/imagemap-focus-ring-expected.png: Ditto.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.checksum: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.txt: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.checksum: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.txt: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png: Added.
        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.txt: Added.

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

17 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html [new file with mode: 0644]
LayoutTests/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html [new file with mode: 0644]
LayoutTests/fast/images/imagemap-focus-ring-outline-color.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-expected.checksum
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-expected.png
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/rendering/RenderImage.cpp

index 45e672b..adc23c3 100644 (file)
@@ -1,3 +1,33 @@
+2010-11-30  Daniel Bates  <dbates@rim.com>
+
+        Reviewed by David Hyatt.
+
+        Focused <area> should use CSS properties of <area> instead of associated <img>
+        https://bugs.webkit.org/show_bug.cgi?id=49888
+
+        Updated the test result for test fast/images/imagemap-focus-ring.html. Added
+        test to verify that the color of the focus ring for a focused <area> is
+        the outline-color specified by the :focus pseudo-class .
+
+        Also, added tests to ensure that outline-color is not inherited (by default) as per
+        section 18.4 of the CSS 2.1 spec <http://www.w3.org/TR/CSS2/ui.html#dynamic-outlines>,
+        unless explicitly inherited.
+
+        * fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html: Added.
+        * fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html: Added.
+        * fast/images/imagemap-focus-ring-outline-color.html: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-expected.checksum: Updated result.
+        * platform/mac/fast/images/imagemap-focus-ring-expected.png: Ditto.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.checksum: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.txt: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.checksum: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.txt: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png: Added.
+        * platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.txt: Added.
+
 2010-11-30  Ojan Vafai  <ojan@chromium.org>
 
         [chromium] Update expectations to de-orange the builders.
diff --git a/LayoutTests/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html b/LayoutTests/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html
new file mode 100644 (file)
index 0000000..de9103d
--- /dev/null
@@ -0,0 +1,22 @@
+<html>
+<head>
+<style>
+map { outline-color: green; }
+area:focus { outline-color: inherit; }
+</style>
+<script>
+window.onload = function()
+{
+    document.getElementById("area").focus();
+}
+</script>
+</head>
+<body>
+<p>Assuming the port-specific theme draws focus rings, this test can be used to ensure that the focus ring color for an &lt;area&gt; can be explicitly inherited from &lt;map&gt;. This test PASSED if a green-colored focus ring is drawn around the &lt;area&gt; in the imagemap (below).</p>
+<map name="imagemap">
+    <area id="area" shape="rect" coords="0,0,128,128" href="#dummy"/>
+</map>
+<img src="imagemap.jpg" width="128" height="128" usemap="#imagemap" />
+</body>
+</head>
+</html>
diff --git a/LayoutTests/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html b/LayoutTests/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html
new file mode 100644 (file)
index 0000000..e3bd236
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+<style>
+map { outline-color: red; }
+</style>
+<script>
+window.onload = function()
+{
+    document.getElementById("area").focus();
+}
+</script>
+</head>
+<body>
+<p>Assuming the port-specific theme draws focus rings, this test can be used to ensure that the focus ring color is not inherited for an &lt;area&gt; (by default) as per <a href="http://www.w3.org/TR/CSS2/ui.html#dynamic-outlines">section 18.4 "Dynamic outlines: the 'outline' property" of the CSS2.1 spec</a>. This test FAILED if a red-colored focus ring is drawn around the &lt;area&gt; in the imagemap (below).</p>
+<map name="imagemap">
+    <area id="area" shape="rect" coords="0,0,128,128" href="#dummy"/>
+</map>
+<img src="imagemap.jpg" width="128" height="128" usemap="#imagemap" />
+</body>
+</head>
+</html>
diff --git a/LayoutTests/fast/images/imagemap-focus-ring-outline-color.html b/LayoutTests/fast/images/imagemap-focus-ring-outline-color.html
new file mode 100644 (file)
index 0000000..d513be2
--- /dev/null
@@ -0,0 +1,21 @@
+<html>
+<head>
+<style>
+area:focus { outline-color: green; }
+</style>
+<script>
+window.onload = function()
+{
+    document.getElementById("area").focus();
+}
+</script>
+</head>
+<body>
+<p>Assuming the port-specific theme draws focus rings, this test can be used to ensure that a focus ring is drawn for an &lt;area&gt;. This test PASSED if a green-colored focus ring is drawn around the &lt;area&gt; in the imagemap (below).</p>
+<map name="imagemap">
+    <area id="area" shape="rect" coords="0,0,128,128" href="#dummy"/>
+</map>
+<img src="imagemap.jpg" width="128" height="128" usemap="#imagemap" />
+</body>
+</head>
+</html>
index 8930283..3da4b40 100644 (file)
Binary files a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-expected.png and b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.checksum b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.checksum
new file mode 100644 (file)
index 0000000..ae371ea
--- /dev/null
@@ -0,0 +1 @@
+34542356965831f59d8902d19e94b26f
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png
new file mode 100644 (file)
index 0000000..5aafe65
Binary files /dev/null and b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.txt b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-expected.txt
new file mode 100644 (file)
index 0000000..67bd44e
--- /dev/null
@@ -0,0 +1,16 @@
+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
+      RenderBlock {P} at (0,0) size 784x36
+        RenderText {#text} at (0,0) size 776x36
+          text run at (0,0) width 776: "Assuming the port-specific theme draws focus rings, this test can be used to ensure that a focus ring is drawn for an <area>."
+          text run at (0,18) width 642: "This test PASSED if a green-colored focus ring is drawn around the <area> in the imagemap (below)."
+      RenderBlock (anonymous) at (0,52) size 784x128
+        RenderInline {MAP} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderImage {IMG} at (0,0) size 128x128
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.checksum b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.checksum
new file mode 100644 (file)
index 0000000..4550fd5
--- /dev/null
@@ -0,0 +1 @@
+de5081183e5a8aeb05247d4d99307d87
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png
new file mode 100644 (file)
index 0000000..e74be91
Binary files /dev/null and b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.txt b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map-expected.txt
new file mode 100644 (file)
index 0000000..fec65f1
--- /dev/null
@@ -0,0 +1,17 @@
+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
+      RenderBlock {P} at (0,0) size 784x54
+        RenderText {#text} at (0,0) size 769x54
+          text run at (0,0) width 762: "Assuming the port-specific theme draws focus rings, this test can be used to ensure that the focus ring color for an <area>"
+          text run at (0,18) width 769: "can be explicitly inherited from <map>. This test PASSED if a green-colored focus ring is drawn around the <area> in the"
+          text run at (0,36) width 122: "imagemap (below)."
+      RenderBlock (anonymous) at (0,70) size 784x128
+        RenderInline {MAP} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderImage {IMG} at (0,0) size 128x128
+        RenderText {#text} at (0,0) size 0x0
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.checksum
new file mode 100644 (file)
index 0000000..7be5562
--- /dev/null
@@ -0,0 +1 @@
+c6c9e1e279354d77e34722d88dd09e13
\ No newline at end of file
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png
new file mode 100644 (file)
index 0000000..9ee1287
Binary files /dev/null and b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.txt b/LayoutTests/platform/mac/fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map-expected.txt
new file mode 100644 (file)
index 0000000..081b4ff
--- /dev/null
@@ -0,0 +1,22 @@
+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
+      RenderBlock {P} at (0,0) size 784x54
+        RenderText {#text} at (0,0) size 770x36
+          text run at (0,0) width 770: "Assuming the port-specific theme draws focus rings, this test can be used to ensure that the focus ring color is not inherited"
+          text run at (0,18) width 207: "for an <area> (by default) as per "
+        RenderInline {A} at (0,0) size 467x18 [color=#0000EE]
+          RenderText {#text} at (207,18) size 467x18
+            text run at (207,18) width 467: "section 18.4 \"Dynamic outlines: the 'outline' property\" of the CSS2.1 spec"
+        RenderText {#text} at (674,18) size 735x36
+          text run at (674,18) width 61: ". This test"
+          text run at (0,36) width 567: "FAILED if a red-colored focus ring is drawn around the <area> in the imagemap (below)."
+      RenderBlock (anonymous) at (0,70) size 784x128
+        RenderInline {MAP} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+          RenderText {#text} at (0,0) size 0x0
+        RenderText {#text} at (0,0) size 0x0
+        RenderImage {IMG} at (0,0) size 128x128
+        RenderText {#text} at (0,0) size 0x0
index 310671f..e79174a 100644 (file)
@@ -1,3 +1,27 @@
+2010-11-30  Daniel Bates  <dbates@rim.com>
+
+        Reviewed by David Hyatt.
+
+        Focused <area> should use CSS properties of <area> instead of associated <img>
+        https://bugs.webkit.org/show_bug.cgi?id=49888
+
+        Fixes an issue where the CSS properties of an <area> were not used when
+        the <area> was focused.
+
+        Currently, when focusing an <area> (say by pressing option + tab in Mac
+        Safari) we use the CSS style information for the <img> associated with
+        the <area>. Instead, we should use the CSS style information for the
+        focused <area>. In particular, this will make the us honor the outline-
+        color property of a focused <area> when drawing its focus ring.
+
+        Tests: fast/images/imagemap-focus-ring-outline-color-explicitly-inherited-from-map.html
+               fast/images/imagemap-focus-ring-outline-color-not-inherited-from-map.html
+               fast/images/imagemap-focus-ring-outline-color.html
+
+        * rendering/RenderImage.cpp:
+        (WebCore::RenderImage::paintFocusRing): Use the style information of
+        the focused <area> when drawing the focus ring for it.
+
 2010-11-30  Tony Chang  <tony@chromium.org>
 
         Reviewed by James Robinson.
index 376ffef..34799f4 100644 (file)
@@ -357,8 +357,9 @@ void RenderImage::paintFocusRing(PaintInfo& paintInfo, const RenderStyle* style)
         HTMLAreaElement* areaElement = static_cast<HTMLAreaElement*>(areas->item(k));
         if (focusedNode != areaElement)
             continue;
-        
-        paintInfo.context->drawFocusRing(areaElement->getPath(this), style->outlineWidth(), style->outlineOffset(), style->visitedDependentColor(CSSPropertyOutlineColor));
+
+        RenderStyle* styleToUse = areaElement->computedStyle();
+        paintInfo.context->drawFocusRing(areaElement->getPath(this), styleToUse->outlineWidth(), styleToUse->outlineOffset(), styleToUse->visitedDependentColor(CSSPropertyOutlineColor));
         break;
     }
 }