AX: The input element with type="search" has no default focus outline
authorcfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Feb 2015 08:02:48 +0000 (08:02 +0000)
committercfleizach@apple.com <cfleizach@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 8 Feb 2015 08:02:48 +0000 (08:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=140326

Reviewed by Darin Adler.

Source/WebCore:

The platform RenderTheme takes care of the search field, and that code
was missing a check for whether the element was focused.

Test: fast/css/focus-ring-exists-for-search-field.html

* rendering/RenderThemeMac.mm:
(WebCore::RenderThemeMac::paintSearchField):

LayoutTests:

* fast/css/focus-ring-exists-for-search-field.html: Added.
* platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png: Added.
* platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/css/focus-ring-exists-for-search-field.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderThemeMac.mm

index 7e9e188..8b64481 100644 (file)
@@ -1,3 +1,14 @@
+2015-02-07  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: The input element with type="search" has no default focus outline
+        https://bugs.webkit.org/show_bug.cgi?id=140326
+
+        Reviewed by Darin Adler.
+
+        * fast/css/focus-ring-exists-for-search-field.html: Added.
+        * platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png: Added.
+        * platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt: Added.
+
 2015-02-07  Alexey Proskuryakov  <ap@apple.com>
 
         fullscreen/full-screen-plugin.html is very flaky on Yosemite WK2
diff --git a/LayoutTests/fast/css/focus-ring-exists-for-search-field.html b/LayoutTests/fast/css/focus-ring-exists-for-search-field.html
new file mode 100644 (file)
index 0000000..220faf8
--- /dev/null
@@ -0,0 +1,14 @@
+<html>
+<head>
+<script>
+window.onload = function()
+{
+    document.getElementById("search").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 around a search field.</p>
+<input type="search" id="search">
+</body>
+</html>
diff --git a/LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png b/LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png
new file mode 100644 (file)
index 0000000..6d2a8ca
Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.png differ
diff --git a/LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt b/LayoutTests/platform/mac/fast/css/focus-ring-exists-for-search-field-expected.txt
new file mode 100644 (file)
index 0000000..067176c
--- /dev/null
@@ -0,0 +1,19 @@
+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 757x36
+          text run at (0,0) width 757: "Assuming the port-specific theme draws focus rings, this test can be used to ensure that a focus ring is drawn around a"
+          text run at (0,18) width 78: "search field."
+      RenderBlock (anonymous) at (0,52) size 784x23
+        RenderTextControl {INPUT} at (2,2) size 158x19 [bgcolor=#FFFFFF] [border: (2px inset #000000)]
+          RenderFlexibleBox {DIV} at (3,3) size 152x13
+            RenderBlock {DIV} at (0,1) size 8x11
+            RenderBlock {DIV} at (8,0) size 131x13
+            RenderBlock {DIV} at (138,1) size 14x11
+        RenderText {#text} at (0,0) size 0x0
+layer at (21,65) size 130x13
+  RenderBlock {DIV} at (0,0) size 131x13
+caret: position 0 of child 0 {DIV} of child 1 {DIV} of child 0 {DIV} of {#document-fragment} of child 3 {INPUT} of body
index 5085387..a353e10 100644 (file)
@@ -1,3 +1,18 @@
+2015-02-07  Chris Fleizach  <cfleizach@apple.com>
+
+        AX: The input element with type="search" has no default focus outline
+        https://bugs.webkit.org/show_bug.cgi?id=140326
+
+        Reviewed by Darin Adler.
+
+        The platform RenderTheme takes care of the search field, and that code
+        was missing a check for whether the element was focused.
+
+        Test: fast/css/focus-ring-exists-for-search-field.html
+
+        * rendering/RenderThemeMac.mm:
+        (WebCore::RenderThemeMac::paintSearchField):
+
 2015-02-07  Tim Horton  <timothy_horton@apple.com>
 
         Add some dictionary lookup tests
index b2da6c2..d499114 100644 (file)
@@ -1572,11 +1572,17 @@ bool RenderThemeMac::paintSearchField(const RenderObject& o, const PaintInfo& pa
     // Set the search button to nil before drawing.  Then reset it so we can draw it later.
     [search setSearchButtonCell:nil];
 
-    [search drawWithFrame:NSRect(unzoomedRect) inView:documentViewFor(o)];
+    NSView *documentView = documentViewFor(o);
+    [search drawWithFrame:NSRect(unzoomedRect) inView:documentView];
 
     [search setControlView:nil];
     [search resetSearchButtonCell];
 
+    if (isFocused(o) && o.style().outlineStyleIsAuto()) {
+        if (wkDrawCellFocusRingWithFrameAtTime(search, NSRect(unzoomedRect), documentView, std::numeric_limits<double>::max()))
+            o.document().page()->focusController().setFocusedElementNeedsRepaint();
+    }
+    
     return false;
 }