<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181484] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181484">181484</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-13 12:24:01 -0700 (Fri, 13 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Provide API for assistive tech to ignore DOM key event handlers
https://bugs.webkit.org/show_bug.cgi?id=142059

Patch by Doug Russell &lt;d_russell@apple.com&gt; on 2015-03-13
Reviewed by Beth Dakin.

Assistive technology applications on the desktop are heavily dependent on keyboard navigation being reliable. This is greatly hindered by sites that handle key events without updating keyboard selection and then consume the event. It is important for assistive technology apps to allow users to decide to ignore these handlers that are incorrect for their purposes.

This can be fixed by exposing, via a new accessibility attribute, a way to decide, for a given WebCore::Frame, to pre-empt DOM dispatch and instead let accessibility caret browsing take place.

Source/WebCore:

Test: platform/mac/accessibility/prevent-keyboard-event-dispatch.html

* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::preventKeyboardDOMEventDispatch):
(WebCore::AccessibilityObject::setPreventKeyboardDOMEventDispatch):
* accessibility/AccessibilityObject.h:
* accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
(-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
(-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
(-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
(-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
* dom/Element.cpp:
(WebCore::Element::dispatchKeyEvent):
* page/EventHandler.cpp:
(WebCore::EventHandler::keyEvent):
(WebCore::handleKeyboardSelectionMovement):
(WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility):
* page/EventHandler.h:
* page/Settings.in:

LayoutTests:

* accessibility/parent-delete-expected.txt:
* platform/mac/accessibility/document-attributes-expected.txt:
* platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt: Added.
* platform/mac/accessibility/prevent-keyboard-event-dispatch.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilityparentdeleteexpectedtxt">trunk/LayoutTests/accessibility/parent-delete-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitydocumentattributesexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjectcpp">trunk/Source/WebCore/accessibility/AccessibilityObject.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityObjecth">trunk/Source/WebCore/accessibility/AccessibilityObject.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm">trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlerh">trunk/Source/WebCore/page/EventHandler.h</a></li>
<li><a href="#trunkSourceWebCorepageSettingsin">trunk/Source/WebCore/page/Settings.in</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitypreventkeyboardeventdispatchexpectedtxt">trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt</a></li>
<li><a href="#trunkLayoutTestsplatformmacaccessibilitypreventkeyboardeventdispatchhtml">trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/LayoutTests/ChangeLog        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-03-13  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Provide API for assistive tech to ignore DOM key event handlers
+        https://bugs.webkit.org/show_bug.cgi?id=142059
+
+        Reviewed by Beth Dakin.
+
+        Assistive technology applications on the desktop are heavily dependent on keyboard navigation being reliable. This is greatly hindered by sites that handle key events without updating keyboard selection and then consume the event. It is important for assistive technology apps to allow users to decide to ignore these handlers that are incorrect for their purposes.
+
+        This can be fixed by exposing, via a new accessibility attribute, a way to decide, for a given WebCore::Frame, to pre-empt DOM dispatch and instead let accessibility caret browsing take place.
+
+        * accessibility/parent-delete-expected.txt:
+        * platform/mac/accessibility/document-attributes-expected.txt:
+        * platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt: Added.
+        * platform/mac/accessibility/prevent-keyboard-event-dispatch.html: Added.
+
</ins><span class="cx"> 2015-03-13  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         XMLHttpRequests should not prevent a page from entering PageCache
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilityparentdeleteexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/parent-delete-expected.txt (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/parent-delete-expected.txt        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/LayoutTests/accessibility/parent-delete-expected.txt        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -28,5 +28,6 @@
</span><span class="cx"> AXLoadingProgress: 1
</span><span class="cx"> AXURL: LayoutTests/accessibility/parent-delete.html
</span><span class="cx"> AXCaretBrowsingEnabled: 0
</span><ins>+AXPreventKeyboardDOMEventDispatch: 0
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitydocumentattributesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/LayoutTests/platform/mac/accessibility/document-attributes-expected.txt        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> AXLoadingProgress: 1
</span><span class="cx"> AXURL: LayoutTests/platform/mac/accessibility/document-attributes.html
</span><span class="cx"> AXCaretBrowsingEnabled: 0
</span><ins>+AXPreventKeyboardDOMEventDispatch: 0
</ins><span class="cx"> AXElementBusy: 0
</span><span class="cx"> 
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitypreventkeyboardeventdispatchexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt (0 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch-expected.txt        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -0,0 +1,29 @@
</span><ins>+1
+
+2
+
+2
+
+This tests ignoring javascript key handlers that consume key events.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS webArea.role is 'AXRole: AXWebArea'
+PASS caretBrowsingEnabled(webArea) is false
+PASS accessibilityController.enhancedAccessibilityEnabled is false
+PASS preventKeyboardDOMEventDispatch(webArea) is false
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 1'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 1'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 1'
+PASS keycount() is '2'
+PASS accessibilityController.enhancedAccessibilityEnabled is true
+PASS preventKeyboardDOMEventDispatch(webArea) is true
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 1'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 1'
+PASS elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue is 'AXValue: 2'
+PASS keycount() is '2'
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsplatformmacaccessibilitypreventkeyboardeventdispatchhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch.html (0 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch.html                                (rev 0)
+++ trunk/LayoutTests/platform/mac/accessibility/prevent-keyboard-event-dispatch.html        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+    &lt;script src=&quot;../../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;resources/accessibility-helper.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body id=&quot;body&quot; onkeydown=&quot;return keydown();&quot;&gt;
+    &lt;script&gt;
+    function preventKeyboardDOMEventDispatch(webArea) {
+        return webArea.boolAttributeValue(&quot;AXPreventKeyboardDOMEventDispatch&quot;);
+    }
+    function setPreventKeyboardDOMEventDispatch(webArea, value) {
+        webArea.setBoolAttributeValue(&quot;AXPreventKeyboardDOMEventDispatch&quot;, value);
+    }
+    function keydown(event) {
+        var element = document.getElementById(&quot;keydowncount&quot;);
+        element.innerHTML = parseInt(element.innerHTML) + 1;
+        return false;
+    }
+    function keycount() {
+        return document.getElementById(&quot;keydowncount&quot;).innerHTML;
+    }
+    &lt;/script&gt;
+    &lt;div&gt;
+        &lt;p&gt;1&lt;/p&gt;
+        &lt;p&gt;2&lt;/p&gt;
+        &lt;p id=&quot;keydowncount&quot;&gt;0&lt;p&gt;
+    &lt;/div&gt;
+    &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
+    &lt;script&gt;
+    description(&quot;This tests ignoring javascript key handlers that consume key events.&quot;);
+    if (window.testRunner) {
+
+        testRunner.dumpAsText();
+
+        if (window.accessibilityController &amp;&amp; window.eventSender) {
+
+            var webArea = clearSelectionAndFocusOnWebArea();
+            accessibilityController.enableEnhancedAccessibility(false);
+            shouldBe(&quot;accessibilityController.enhancedAccessibilityEnabled&quot;, &quot;false&quot;);
+            setPreventKeyboardDOMEventDispatch(webArea, false);
+            shouldBe(&quot;preventKeyboardDOMEventDispatch(webArea)&quot;, &quot;false&quot;);
+
+            // Arrowing before enabling AX and ignore dom handlers won't move the caret
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 1'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 1'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 1'&quot;);
+
+            // Validate that the handler received 2 keys events
+            shouldBe(&quot;keycount()&quot;, &quot;'2'&quot;);
+
+            // Enable enhanced accessibility (necessary for accessibility specific selection handling).
+            accessibilityController.enableEnhancedAccessibility(true);
+            shouldBe(&quot;accessibilityController.enhancedAccessibilityEnabled&quot;, &quot;true&quot;);
+
+            // Enable IgnoreDOMKeyEventHandlers so that the javascript handler will be skipped
+            setPreventKeyboardDOMEventDispatch(webArea, true);
+            shouldBe(&quot;preventKeyboardDOMEventDispatch(webArea)&quot;, &quot;true&quot;);
+
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 1'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 1'&quot;);
+            eventSender.keyDown(&quot;rightArrow&quot;);
+            shouldBe(&quot;elementAtStartMarkerOfSelectedTextMarkerRange(webArea).stringValue&quot;, &quot;'AXValue: 2'&quot;);
+
+            // Validate that the handler didn't receive any more key events
+            shouldBe(&quot;keycount()&quot;, &quot;'2'&quot;);
+
+            setPreventKeyboardDOMEventDispatch(webArea, false);
+        }
+    }
+    &lt;/script&gt;
+    &lt;script src=&quot;../../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/ChangeLog        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2015-03-13  Doug Russell  &lt;d_russell@apple.com&gt;
+
+        AX: Provide API for assistive tech to ignore DOM key event handlers
+        https://bugs.webkit.org/show_bug.cgi?id=142059
+
+        Reviewed by Beth Dakin.
+
+        Assistive technology applications on the desktop are heavily dependent on keyboard navigation being reliable. This is greatly hindered by sites that handle key events without updating keyboard selection and then consume the event. It is important for assistive technology apps to allow users to decide to ignore these handlers that are incorrect for their purposes.
+
+        This can be fixed by exposing, via a new accessibility attribute, a way to decide, for a given WebCore::Frame, to pre-empt DOM dispatch and instead let accessibility caret browsing take place.
+
+        Test: platform/mac/accessibility/prevent-keyboard-event-dispatch.html
+
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::preventKeyboardDOMEventDispatch):
+        (WebCore::AccessibilityObject::setPreventKeyboardDOMEventDispatch):
+        * accessibility/AccessibilityObject.h:
+        * accessibility/mac/WebAccessibilityObjectWrapperMac.mm:
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeNames]):
+        (-[WebAccessibilityObjectWrapper accessibilityAttributeValue:]):
+        (-[WebAccessibilityObjectWrapper accessibilityIsAttributeSettable:]):
+        (-[WebAccessibilityObjectWrapper _accessibilitySetValue:forAttribute:]):
+        * dom/Element.cpp:
+        (WebCore::Element::dispatchKeyEvent):
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::keyEvent):
+        (WebCore::handleKeyboardSelectionMovement):
+        (WebCore::EventHandler::handleKeyboardSelectionMovementForAccessibility):
+        * page/EventHandler.h:
+        * page/Settings.in:
+
</ins><span class="cx"> 2015-03-09  Conrad Shultz  &lt;conrad_shultz@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Allow clients to selectively disable plug-ins
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -2605,4 +2605,20 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+bool AccessibilityObject::preventKeyboardDOMEventDispatch() const
+{
+    Frame* frame = this-&gt;frame();
+    return frame &amp;&amp; frame-&gt;settings().preventKeyboardDOMEventDispatch();
+}
+
+void AccessibilityObject::setPreventKeyboardDOMEventDispatch(bool on)
+{
+    Frame* frame = this-&gt;frame();
+    if (!frame)
+        return;
+    frame-&gt;settings().setPreventKeyboardDOMEventDispatch(on);
+}
+#endif
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -978,6 +978,11 @@
</span><span class="cx">     // other operations update type operations
</span><span class="cx">     void updateBackingStore();
</span><span class="cx">     
</span><ins>+#if PLATFORM(COCOA)
+    bool preventKeyboardDOMEventDispatch() const;
+    void setPreventKeyboardDOMEventDispatch(bool);
+#endif
+    
</ins><span class="cx"> #if PLATFORM(COCOA) &amp;&amp; !PLATFORM(IOS)
</span><span class="cx">     bool caretBrowsingEnabled() const;
</span><span class="cx">     void setCaretBrowsingEnabled(bool);
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilitymacWebAccessibilityObjectWrapperMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/accessibility/mac/WebAccessibilityObjectWrapperMac.mm        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -464,6 +464,10 @@
</span><span class="cx"> #define NSAccessibilityMathPrescriptsAttribute @&quot;AXMathPrescripts&quot;
</span><span class="cx"> #define NSAccessibilityMathPostscriptsAttribute @&quot;AXMathPostscripts&quot;
</span><span class="cx"> 
</span><ins>+#ifndef NSAccessibilityPreventKeyboardDOMEventDispatchAttribute
+#define NSAccessibilityPreventKeyboardDOMEventDispatchAttribute @&quot;AXPreventKeyboardDOMEventDispatch&quot;
+#endif
+
</ins><span class="cx"> #ifndef NSAccessibilityCaretBrowsingEnabledAttribute
</span><span class="cx"> #define NSAccessibilityCaretBrowsingEnabledAttribute @&quot;AXCaretBrowsingEnabled&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -1359,6 +1363,7 @@
</span><span class="cx">         [tempArray addObject:NSAccessibilityLoadingProgressAttribute];
</span><span class="cx">         [tempArray addObject:NSAccessibilityURLAttribute];
</span><span class="cx">         [tempArray addObject:NSAccessibilityCaretBrowsingEnabledAttribute];
</span><ins>+        [tempArray addObject:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute];
</ins><span class="cx">         webAreaAttrs = [[NSArray alloc] initWithArray:tempArray];
</span><span class="cx">         [tempArray release];
</span><span class="cx">     }
</span><span class="lines">@@ -2958,6 +2963,9 @@
</span><span class="cx">     if ([attributeName isEqualToString:@&quot;AXDRTElementIdAttribute&quot;])
</span><span class="cx">         return m_object-&gt;getAttribute(idAttr);
</span><span class="cx">     
</span><ins>+    if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute])
+        return [NSNumber numberWithBool:m_object-&gt;preventKeyboardDOMEventDispatch()];
+    
</ins><span class="cx">     if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
</span><span class="cx">         return [NSNumber numberWithBool:m_object-&gt;caretBrowsingEnabled()];
</span><span class="cx">     
</span><span class="lines">@@ -3033,6 +3041,9 @@
</span><span class="cx">     if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
</span><span class="cx">         return YES;
</span><span class="cx">     
</span><ins>+    if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute])
+        return YES;
+    
</ins><span class="cx">     if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
</span><span class="cx">         return YES;
</span><span class="cx">     
</span><span class="lines">@@ -3352,6 +3363,8 @@
</span><span class="cx">             m_object-&gt;setSelectedRows(selectedRows);
</span><span class="cx">     } else if ([attributeName isEqualToString:NSAccessibilityGrabbedAttribute])
</span><span class="cx">         m_object-&gt;setARIAGrabbed([number boolValue]);
</span><ins>+    else if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityPreventKeyboardDOMEventDispatchAttribute])
+        m_object-&gt;setPreventKeyboardDOMEventDispatch([number boolValue]);
</ins><span class="cx">     else if (m_object-&gt;isWebArea() &amp;&amp; [attributeName isEqualToString:NSAccessibilityCaretBrowsingEnabledAttribute])
</span><span class="cx">         m_object-&gt;setCaretBrowsingEnabled([number boolValue]);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/dom/Element.cpp        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -39,6 +39,7 @@
</span><span class="cx"> #include &quot;ElementIterator.h&quot;
</span><span class="cx"> #include &quot;ElementRareData.h&quot;
</span><span class="cx"> #include &quot;EventDispatcher.h&quot;
</span><ins>+#include &quot;EventHandler.h&quot;
</ins><span class="cx"> #include &quot;FlowThreadController.h&quot;
</span><span class="cx"> #include &quot;FocusController.h&quot;
</span><span class="cx"> #include &quot;FocusEvent.h&quot;
</span><span class="lines">@@ -289,6 +290,10 @@
</span><span class="cx"> bool Element::dispatchKeyEvent(const PlatformKeyboardEvent&amp; platformEvent)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;KeyboardEvent&gt; event = KeyboardEvent::create(platformEvent, document().defaultView());
</span><ins>+    if (Frame* frame = document().frame()) {
+        if (frame-&gt;eventHandler().accessibilityPreventsEventPropogation(event.get()))
+            event-&gt;stopPropagation();
+    }
</ins><span class="cx">     return EventDispatcher::dispatchEvent(this, event) &amp;&amp; !event-&gt;defaultHandled();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -3087,6 +3087,9 @@
</span><span class="cx">         keydown-&gt;setTarget(element);
</span><span class="cx">         keydown-&gt;setDefaultHandled();
</span><span class="cx">     }
</span><ins>+    
+    if (accessibilityPreventsEventPropogation(keydown.get()))
+        keydown-&gt;stopPropagation();
</ins><span class="cx"> 
</span><span class="cx">     element-&gt;dispatchEvent(keydown, IGNORE_EXCEPTION);
</span><span class="cx">     // If frame changed as a result of keydown dispatch, then return early to avoid sending a subsequent keypress message to the new frame.
</span><span class="lines">@@ -3230,6 +3233,27 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool EventHandler::accessibilityPreventsEventPropogation(KeyboardEvent* event)
+{
+#if PLATFORM(COCOA)
+    if (!AXObjectCache::accessibilityEnhancedUserInterfaceEnabled())
+        return false;
+
+    if (!m_frame.settings().preventKeyboardDOMEventDispatch())
+        return false;
+
+    // Check for key events that are relevant to accessibility: tab and arrows keys that change focus
+    if (event-&gt;keyIdentifier() == &quot;U+0009&quot;)
+        return true;
+    FocusDirection direction = focusDirectionForKey(event-&gt;keyIdentifier());
+    if (direction != FocusDirectionNone)
+        return true;
+#else
+    UNUSED_PARAM(event);
+#endif
+    return false;
+}
+
</ins><span class="cx"> void EventHandler::defaultKeyboardEventHandler(KeyboardEvent* event)
</span><span class="cx"> {
</span><span class="cx">     if (event-&gt;type() == eventNames().keydownEvent) {
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.h (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.h        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/page/EventHandler.h        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -239,6 +239,7 @@
</span><span class="cx">     WEBCORE_EXPORT bool keyEvent(const PlatformKeyboardEvent&amp;);
</span><span class="cx">     void defaultKeyboardEventHandler(KeyboardEvent*);
</span><span class="cx"> 
</span><ins>+    bool accessibilityPreventsEventPropogation(KeyboardEvent*);
</ins><span class="cx">     WEBCORE_EXPORT void handleKeyboardSelectionMovementForAccessibility(KeyboardEvent*);
</span><span class="cx"> 
</span><span class="cx">     bool handleTextInputEvent(const String&amp; text, Event* underlyingEvent = 0, TextEventInputType = TextEventInputKeyboard);
</span></span></pre></div>
<a id="trunkSourceWebCorepageSettingsin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/Settings.in (181483 => 181484)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/Settings.in        2015-03-13 18:58:32 UTC (rev 181483)
+++ trunk/Source/WebCore/page/Settings.in        2015-03-13 19:24:01 UTC (rev 181484)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> loadsSiteIconsIgnoringImageLoadingSetting initial=false
</span><span class="cx"> 
</span><span class="cx"> caretBrowsingEnabled initial=false
</span><ins>+preventKeyboardDOMEventDispatch initial=false
</ins><span class="cx"> localStorageEnabled initial=false
</span><span class="cx"> allowUniversalAccessFromFileURLs initial=true
</span><span class="cx"> allowFileAccessFromFileURLs initial=true
</span></span></pre>
</div>
</div>

</body>
</html>