Title: [148210] trunk
Revision
148210
Author
[email protected]
Date
2013-04-11 09:38:32 -0700 (Thu, 11 Apr 2013)

Log Message

[Gtk] Combo boxes should be arrow-out-of-able similar to list boxes when caret-browsing is enabled.
https://bugs.webkit.org/show_bug.cgi?id=76796

Patch by Brian Holt <[email protected]> on 2013-04-11
Reviewed by Chris Fleizach.

Source/WebCore:

When using caret-browsing with the right and left arrows, the
behaviour of menuLists should be the same as listBoxes. This means
not default-handling the event and passing it up the stack instead.

* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::menuListDefaultEventHandler):

Tools:

Make the Gtk window for the DRT a toplevel so that it gets the
focus from the window manager when the test starts.

* DumpRenderTree/gtk/DumpRenderTree.cpp:
(main):

LayoutTests:

Adding a new test to verify that it is possible to arrow out of
combo boxes when caret browsing is enabled. Updated failing tests
to reflect changed accessibility events in the DRT.

* platform/gtk/accessibility/aria-slider-required-attributes-expected.txt: Updated.
* platform/gtk/accessibility/caret-browsing-select-focus-expected.txt: Added.
* platform/gtk/accessibility/caret-browsing-select-focus.html: Added.
* platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Updated.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (148209 => 148210)


--- trunk/LayoutTests/ChangeLog	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/LayoutTests/ChangeLog	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1,3 +1,19 @@
+2013-04-11  Brian Holt  <[email protected]>
+
+        [Gtk] Combo boxes should be arrow-out-of-able similar to list boxes when caret-browsing is enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=76796
+
+        Reviewed by Chris Fleizach.
+
+        Adding a new test to verify that it is possible to arrow out of
+        combo boxes when caret browsing is enabled. Updated failing tests
+        to reflect changed accessibility events in the DRT.
+
+        * platform/gtk/accessibility/aria-slider-required-attributes-expected.txt: Updated.
+        * platform/gtk/accessibility/caret-browsing-select-focus-expected.txt: Added.
+        * platform/gtk/accessibility/caret-browsing-select-focus.html: Added.
+        * platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt: Updated.
+
 2013-04-11  Dirk Schulze  <[email protected]>
 
         [CSS Shaders] Parse mix descriptor

Modified: trunk/LayoutTests/platform/gtk/accessibility/aria-slider-required-attributes-expected.txt (148209 => 148210)


--- trunk/LayoutTests/platform/gtk/accessibility/aria-slider-required-attributes-expected.txt	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/LayoutTests/platform/gtk/accessibility/aria-slider-required-attributes-expected.txt	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1,5 +1,3 @@
-Accessibility object emitted "focus-event = 1" / Name: "(No name)" / Role: 50
-Accessibility object emitted "state-change:focused = 1" / Name: "(No name)" / Role: 50
 Accessibility object emitted "state-change:busy = 0" / Name: "(No name)" / Role: 80
 Accessibility object emitted "property-change:accessible-value" / Name: "(No name)" / Role: 50
 Accessibility object emitted "property-change:accessible-value" / Name: "(No name)" / Role: 50

Added: trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus-expected.txt (0 => 148210)


--- trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus-expected.txt	2013-04-11 16:38:32 UTC (rev 148210)
@@ -0,0 +1,37 @@
+
+A paragraph with a single line
+
+This tests caret browsing for html select elements.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS axCombo.role is 'AXRole: AXComboBox'
+PASS axMenuItemFoo.role is 'AXRole: AXMenuItem'
+PASS axPar.role is 'AXRole: AXParagraph'
+PASS axCombo.isFocusable is true
+PASS axMenuItemFoo.isFocusable is false
+PASS axMenuItemBar.isFocusable is false
+PASS axMenuItemFoo.isSelectable is true
+PASS axMenuItemBar.isSelectable is true
+PASS axPar.isFocusable is true
+PASS axCombo.isFocused is false
+PASS axMenuItemFoo.isSelected is true
+PASS axMenuItemBar.isSelected is false
+PASS axPar.isFocused is false
+PASS axCombo.isFocused is true
+PASS axMenuItemFoo.isSelected is true
+PASS axMenuItemBar.isSelected is false
+PASS axPar.isFocused is false
+PASS axCombo.isFocused is true
+PASS axMenuItemFoo.isSelected is false
+PASS axMenuItemBar.isSelected is true
+PASS axPar.isFocused is false
+PASS axCombo.isFocused is false
+PASS axMenuItemFoo.isSelected is false
+PASS axMenuItemBar.isSelected is true
+PASS axPar.isFocused is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus.html (0 => 148210)


--- trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus.html	                        (rev 0)
+++ trunk/LayoutTests/platform/gtk/accessibility/caret-browsing-select-focus.html	2013-04-11 16:38:32 UTC (rev 148210)
@@ -0,0 +1,80 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body id="body">
+<select id="combo">
+<option value='foo'>foo</option>
+<option value='bar'>bar</option>
+</select>
+<p id="par1">A paragraph with a single line</p>
+<div id="console"></div>
+<script>
+description("This tests caret browsing for html select elements.");
+
+if (window.testRunner) {
+  testRunner.overridePreference("WebKitEnableCaretBrowsing", true);
+  testRunner.dumpAsText();
+
+  if (window.accessibilityController) {
+
+    document.getElementById("body").focus();
+    var webArea = accessibilityController.focusedElement;
+
+    var axCombo = webArea.childAtIndex(0).childAtIndex(0);
+    var axMenuItemFoo = axCombo.childAtIndex(0).childAtIndex(0);
+    var axMenuItemBar = axCombo.childAtIndex(0).childAtIndex(1);
+    var axPar = webArea.childAtIndex(1);
+
+    // Check roles and initial states
+    // Move the caret once to force the focus onto this toplevel
+    var par1 = document.getElementById("par1");
+    window.getSelection().setPosition(par1, 10);
+    eventSender.keyDown("rightArrow");
+    shouldBe("axCombo.role", "'AXRole: AXComboBox'");
+    shouldBe("axMenuItemFoo.role", "'AXRole: AXMenuItem'");
+    shouldBe("axPar.role", "'AXRole: AXParagraph'");
+    shouldBe("axCombo.isFocusable", "true");
+    shouldBe("axMenuItemFoo.isFocusable", "false");
+    shouldBe("axMenuItemBar.isFocusable", "false");
+    shouldBe("axMenuItemFoo.isSelectable", "true");
+    shouldBe("axMenuItemBar.isSelectable", "true");
+    shouldBe("axPar.isFocusable", "true");
+    shouldBe("axCombo.isFocused", "false");
+    shouldBe("axMenuItemFoo.isSelected", "true");
+    shouldBe("axMenuItemBar.isSelected", "false");
+    shouldBe("axPar.isFocused", "false");
+
+    // set the focus on the paragraph
+    // "Tab" into the combo
+    eventSender.keyDown('\t', ["shiftKey"]);
+    shouldBe("axCombo.isFocused", "true");
+    shouldBe("axMenuItemFoo.isSelected", "true");
+    shouldBe("axMenuItemBar.isSelected", "false");
+    shouldBe("axPar.isFocused", "false");
+
+    // Move to the next element in the combo box
+    eventSender.keyDown("downArrow");
+    shouldBe("axCombo.isFocused", "true");
+    shouldBe("axMenuItemFoo.isSelected", "false");
+    shouldBe("axMenuItemBar.isSelected", "true");
+    shouldBe("axPar.isFocused", "false");
+
+    // Press the right arrow to exit the combo (this moves to the html body).
+    // Then press the down arrow to enter the paragraph.
+    var combo = document.getElementById("combo");
+    eventSender.keyDown("rightArrow");
+    eventSender.keyDown("downArrow");
+    shouldBe("axCombo.isFocused", "false");
+    shouldBe("axMenuItemFoo.isSelected", "false");
+    shouldBe("axMenuItemBar.isSelected", "true");
+    shouldBe("axPar.isFocused", "true");
+
+  }
+}
+
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt (148209 => 148210)


--- trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/LayoutTests/platform/gtk/accessibility/combo-box-collapsed-selection-changed-expected.txt	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1,5 +1,3 @@
-Accessibility object emitted "focus-event = 1" / Name: "foo" / Role: 11
-Accessibility object emitted "state-change:focused = 1" / Name: "foo" / Role: 11
 Accessibility object emitted "focus-event = 1" / Name: "bar" / Role: 11
 Accessibility object emitted "state-change:focused = 1" / Name: "bar" / Role: 11
 Accessibility object emitted "state-change:selected = 1" / Name: "bar" / Role: 34

Modified: trunk/Source/WebCore/ChangeLog (148209 => 148210)


--- trunk/Source/WebCore/ChangeLog	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/Source/WebCore/ChangeLog	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1,3 +1,17 @@
+2013-04-11  Brian Holt  <[email protected]>
+
+        [Gtk] Combo boxes should be arrow-out-of-able similar to list boxes when caret-browsing is enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=76796
+
+        Reviewed by Chris Fleizach.
+
+        When using caret-browsing with the right and left arrows, the
+        behaviour of menuLists should be the same as listBoxes. This means
+        not default-handling the event and passing it up the stack instead.
+
+        * html/HTMLSelectElement.cpp:
+        (WebCore::HTMLSelectElement::menuListDefaultEventHandler):
+
 2013-04-11  Alexey Proskuryakov  <[email protected]>
 
         Remove some ResourceHandle.h includes

Modified: trunk/Source/WebCore/html/HTMLSelectElement.cpp (148209 => 148210)


--- trunk/Source/WebCore/html/HTMLSelectElement.cpp	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/Source/WebCore/html/HTMLSelectElement.cpp	2013-04-11 16:38:32 UTC (rev 148210)
@@ -52,6 +52,7 @@
 #include "RenderMenuList.h"
 #include "RenderTheme.h"
 #include "ScriptEventListener.h"
+#include "Settings.h"
 #include "SpatialNavigation.h"
 #include <wtf/text/StringBuilder.h>
 #include <wtf/unicode/Unicode.h>
@@ -1121,6 +1122,14 @@
         const Vector<HTMLElement*>& listItems = this->listItems();
         int listIndex = optionToListIndex(selectedIndex());
 
+        // When using caret browsing, we want to be able to move the focus
+        // out of the select element when user hits a left or right arrow key.
+        const Frame* frame = document()->frame();
+        if (frame && frame->settings() && frame->settings()->caretBrowsingEnabled()) {
+            if (keyIdentifier == "Left" || keyIdentifier == "Right")
+                return;
+        }
+
         if (keyIdentifier == "Down" || keyIdentifier == "Right")
             listIndex = nextValidIndex(listIndex, SkipForwards, 1);
         else if (keyIdentifier == "Up" || keyIdentifier == "Left")

Modified: trunk/Tools/ChangeLog (148209 => 148210)


--- trunk/Tools/ChangeLog	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/Tools/ChangeLog	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1,3 +1,16 @@
+2013-04-11  Brian Holt  <[email protected]>
+
+        [Gtk] Combo boxes should be arrow-out-of-able similar to list boxes when caret-browsing is enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=76796
+
+        Reviewed by Chris Fleizach.
+
+        Make the Gtk window for the DRT a toplevel so that it gets the
+        focus from the window manager when the test starts.
+
+        * DumpRenderTree/gtk/DumpRenderTree.cpp:
+        (main):
+
 2013-04-04  Allan Sandfeld Jensen  <[email protected]>
 
         Use CSS4 image-rendering to determing image scaling quality

Modified: trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp (148209 => 148210)


--- trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-04-11 16:32:24 UTC (rev 148209)
+++ trunk/Tools/DumpRenderTree/gtk/DumpRenderTree.cpp	2013-04-11 16:38:32 UTC (rev 148210)
@@ -1484,7 +1484,7 @@
     initializeGlobalsFromCommandLineOptions(argc, argv);
     initializeFonts();
 
-    window = gtk_window_new(GTK_WINDOW_POPUP);
+    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
 #ifdef GTK_API_VERSION_2
     container = gtk_hbox_new(TRUE, 0);
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to