<!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>[167024] 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/167024">167024</a></dd>
<dt>Author</dt> <dd>cfleizach@apple.com</dd>
<dt>Date</dt> <dd>2014-04-09 11:41:59 -0700 (Wed, 09 Apr 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>AX: Make AXPress much more reliable on the Web
https://bugs.webkit.org/show_bug.cgi?id=131426

Reviewed by Mario Sanchez Prada.

Source/WebCore: 

AXPress fails when an event handler is on a node higher in the parent chain than the focused node.

We need to make AXPress more reliable by 
    1) Using the element that is focused as the target of the event
    2) Search for the inner most control object when dispatching the event

Updated existing accessibility/press-works-on-control-types.html

* accessibility/AccessibilityMenuList.cpp:
(WebCore::AccessibilityMenuList::press):
* accessibility/AccessibilityMenuList.h:
* accessibility/AccessibilityMenuListPopup.cpp:
(WebCore::AccessibilityMenuListPopup::press):
* accessibility/AccessibilityMenuListPopup.h:
* accessibility/AccessibilityObject.cpp:
(WebCore::AccessibilityObject::press):
* accessibility/AccessibilityObject.h:
(WebCore::AccessibilityObject::performDefaultAction):
* accessibility/AccessibilitySearchFieldButtons.cpp:
(WebCore::AccessibilitySearchFieldCancelButton::press):
* accessibility/AccessibilitySearchFieldButtons.h:
* accessibility/AccessibilitySpinButton.cpp:
(WebCore::AccessibilitySpinButtonPart::press):
* accessibility/AccessibilitySpinButton.h:

LayoutTests: 

* accessibility/press-works-on-control-types-expected.txt:
* accessibility/press-works-on-control-types.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsaccessibilitypressworksoncontroltypesexpectedtxt">trunk/LayoutTests/accessibility/press-works-on-control-types-expected.txt</a></li>
<li><a href="#trunkLayoutTestsaccessibilitypressworksoncontroltypeshtml">trunk/LayoutTests/accessibility/press-works-on-control-types.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityMenuListcpp">trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityMenuListh">trunk/Source/WebCore/accessibility/AccessibilityMenuList.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityMenuListPopupcpp">trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilityMenuListPopuph">trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.h</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="#trunkSourceWebCoreaccessibilityAccessibilitySearchFieldButtonscpp">trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilitySearchFieldButtonsh">trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilitySpinButtoncpp">trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp</a></li>
<li><a href="#trunkSourceWebCoreaccessibilityAccessibilitySpinButtonh">trunk/Source/WebCore/accessibility/AccessibilitySpinButton.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/LayoutTests/ChangeLog        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-04-08  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: Make AXPress much more reliable on the Web
+        https://bugs.webkit.org/show_bug.cgi?id=131426
+
+        Reviewed by Mario Sanchez Prada.
+
+        * accessibility/press-works-on-control-types-expected.txt:
+        * accessibility/press-works-on-control-types.html:
+
</ins><span class="cx"> 2014-04-08  Oliver Hunt  &lt;oliver@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Rewrite Function.bind as a builtin
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitypressworksoncontroltypesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/press-works-on-control-types-expected.txt (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/press-works-on-control-types-expected.txt        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/LayoutTests/accessibility/press-works-on-control-types-expected.txt        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -7,12 +7,13 @@
</span><span class="cx"> menu item checkbox
</span><span class="cx"> menu item radio
</span><span class="cx"> list item
</span><ins>+
</ins><span class="cx"> This tests that when certain control type elements are pressed, a valid event is sent that references the right element.
</span><span class="cx"> 
</span><span class="cx"> On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
</span><span class="cx"> 
</span><span class="cx"> 
</span><del>-PASS eventSrcElement == document.getElementById('body') is true
</del><ins>+PASS eventSrcElement == document.getElementById('group') is true
</ins><span class="cx"> PASS eventSrcElement == document.getElementById('button') is true
</span><span class="cx"> PASS eventSrcElement == document.getElementById('tab') is true
</span><span class="cx"> PASS eventSrcElement == document.getElementById('radio') is true
</span><span class="lines">@@ -21,6 +22,7 @@
</span><span class="cx"> PASS eventSrcElement == document.getElementById('menuitemcheckbox') is true
</span><span class="cx"> PASS eventSrcElement == document.getElementById('menuitemradio') is true
</span><span class="cx"> PASS eventSrcElement == document.getElementById('listitem') is true
</span><ins>+PASS eventSrcElement == document.getElementById('subbutton') is true
</ins><span class="cx"> PASS successfullyParsed is true
</span><span class="cx"> 
</span><span class="cx"> TEST COMPLETE
</span></span></pre></div>
<a id="trunkLayoutTestsaccessibilitypressworksoncontroltypeshtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/accessibility/press-works-on-control-types.html (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/accessibility/press-works-on-control-types.html        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/LayoutTests/accessibility/press-works-on-control-types.html        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -14,6 +14,7 @@
</span><span class="cx"> &lt;div role=&quot;menuitemcheckbox&quot; id=&quot;menuitemcheckbox&quot; tabindex=&quot;0&quot;&gt;menu item checkbox&lt;/div&gt;
</span><span class="cx"> &lt;div role=&quot;menuitemradio&quot; id=&quot;menuitemradio&quot; tabindex=&quot;0&quot;&gt;menu item radio&lt;/div&gt;
</span><span class="cx"> &lt;div role=&quot;listitem&quot; id=&quot;listitem&quot; tabindex=&quot;0&quot;&gt;list item&lt;/div&gt;
</span><ins>+&lt;div role=&quot;button&quot; id=&quot;button2&quot; tabindex=&quot;0&quot;&gt;&lt;div&gt;&lt;button id=&quot;subbutton&quot;&gt;&lt;/div&gt;&lt;/div&gt;
</ins><span class="cx"> 
</span><span class="cx"> &lt;p id=&quot;description&quot;&gt;&lt;/p&gt;
</span><span class="cx"> &lt;div id=&quot;console&quot;&gt;&lt;/div&gt;
</span><span class="lines">@@ -27,10 +28,8 @@
</span><span class="cx">     function handlePress(e) {
</span><span class="cx">        eventSrcElement = e.srcElement;
</span><span class="cx"> 
</span><del>-       // First press was on the group element. That is not a control type and it should
-       // have caused the body to be the target element instead of the group element.
</del><span class="cx">        if (pressCount == 0)
</span><del>-          shouldBeTrue(&quot;eventSrcElement == document.getElementById('body')&quot;);
</del><ins>+          shouldBeTrue(&quot;eventSrcElement == document.getElementById('group')&quot;);
</ins><span class="cx">        else if (pressCount == 1)
</span><span class="cx">           shouldBeTrue(&quot;eventSrcElement == document.getElementById('button')&quot;);
</span><span class="cx">        else if (pressCount == 2)
</span><span class="lines">@@ -47,6 +46,8 @@
</span><span class="cx">           shouldBeTrue(&quot;eventSrcElement == document.getElementById('menuitemradio')&quot;);
</span><span class="cx">        else if (pressCount == 8)
</span><span class="cx">           shouldBeTrue(&quot;eventSrcElement == document.getElementById('listitem')&quot;);
</span><ins>+       else if (pressCount == 9)
+          shouldBeTrue(&quot;eventSrcElement == document.getElementById('subbutton')&quot;);
</ins><span class="cx"> 
</span><span class="cx">        pressCount++;
</span><span class="cx">     }
</span><span class="lines">@@ -55,7 +56,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (window.accessibilityController) {
</span><span class="cx"> 
</span><del>-        var items = new Array(&quot;group&quot;, &quot;button&quot;, &quot;tab&quot;, &quot;radio&quot;, &quot;checkbox&quot;, &quot;menuitem&quot;, &quot;menuitemcheckbox&quot;, &quot;menuitemradio&quot;, &quot;listitem&quot;);
</del><ins>+        var items = new Array(&quot;group&quot;, &quot;button&quot;, &quot;tab&quot;, &quot;radio&quot;, &quot;checkbox&quot;, &quot;menuitem&quot;, &quot;menuitemcheckbox&quot;, &quot;menuitemradio&quot;, &quot;listitem&quot;, &quot;button2&quot;);
</ins><span class="cx">         for (var k = 0; k &lt; items.length; k++) {
</span><span class="cx">            document.getElementById(items[k]).focus();
</span><span class="cx">            accessibilityController.focusedElement.press();
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/ChangeLog        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2014-04-08  Chris Fleizach  &lt;cfleizach@apple.com&gt;
+
+        AX: Make AXPress much more reliable on the Web
+        https://bugs.webkit.org/show_bug.cgi?id=131426
+
+        Reviewed by Mario Sanchez Prada.
+
+        AXPress fails when an event handler is on a node higher in the parent chain than the focused node.
+
+        We need to make AXPress more reliable by 
+            1) Using the element that is focused as the target of the event
+            2) Search for the inner most control object when dispatching the event
+
+        Updated existing accessibility/press-works-on-control-types.html
+
+        * accessibility/AccessibilityMenuList.cpp:
+        (WebCore::AccessibilityMenuList::press):
+        * accessibility/AccessibilityMenuList.h:
+        * accessibility/AccessibilityMenuListPopup.cpp:
+        (WebCore::AccessibilityMenuListPopup::press):
+        * accessibility/AccessibilityMenuListPopup.h:
+        * accessibility/AccessibilityObject.cpp:
+        (WebCore::AccessibilityObject::press):
+        * accessibility/AccessibilityObject.h:
+        (WebCore::AccessibilityObject::performDefaultAction):
+        * accessibility/AccessibilitySearchFieldButtons.cpp:
+        (WebCore::AccessibilitySearchFieldCancelButton::press):
+        * accessibility/AccessibilitySearchFieldButtons.h:
+        * accessibility/AccessibilitySpinButton.cpp:
+        (WebCore::AccessibilitySpinButtonPart::press):
+        * accessibility/AccessibilitySpinButton.h:
+
</ins><span class="cx"> 2014-04-09  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         ContentFilterMac is broken when NE_FILTER_SOURCE is enabled.
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityMenuListcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.cpp        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx">     return adoptRef(new AccessibilityMenuList(renderer));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AccessibilityMenuList::press() const
</del><ins>+bool AccessibilityMenuList::press()
</ins><span class="cx"> {
</span><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx">     RenderMenuList* menuList = static_cast&lt;RenderMenuList*&gt;(m_renderer);
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityMenuListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuList.h (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityMenuList.h        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuList.h        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx">     static PassRefPtr&lt;AccessibilityMenuList&gt; create(RenderMenuList* renderer);
</span><span class="cx"> 
</span><span class="cx">     virtual bool isCollapsed() const override;
</span><del>-    virtual bool press() const override;
</del><ins>+    virtual bool press() override;
</ins><span class="cx"> 
</span><span class="cx">     void didUpdateActiveOption(int optionIndex);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityMenuListPopupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.cpp        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -82,7 +82,7 @@
</span><span class="cx">     return option;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AccessibilityMenuListPopup::press() const
</del><ins>+bool AccessibilityMenuListPopup::press()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_parent)
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityMenuListPopuph"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.h (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.h        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityMenuListPopup.h        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     virtual AccessibilityRole roleValue() const override { return MenuListPopupRole; }
</span><span class="cx"> 
</span><span class="cx">     virtual bool isVisible() const override;
</span><del>-    virtual bool press() const override;
</del><ins>+    virtual bool press() override;
</ins><span class="cx">     virtual void addChildren() override;
</span><span class="cx">     virtual void childrenChanged() override;
</span><span class="cx">     virtual bool computeAccessibilityIsIgnored() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.cpp (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.cpp        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #include &quot;FrameSelection.h&quot;
</span><span class="cx"> #include &quot;HTMLNames.h&quot;
</span><span class="cx"> #include &quot;HTMLParserIdioms.h&quot;
</span><ins>+#include &quot;HitTestResult.h&quot;
</ins><span class="cx"> #include &quot;LocalizedStrings.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MathMLNames.h&quot;
</span><span class="lines">@@ -49,6 +50,7 @@
</span><span class="cx"> #include &quot;NotImplemented.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;RenderImage.h&quot;
</span><ins>+#include &quot;RenderLayer.h&quot;
</ins><span class="cx"> #include &quot;RenderListItem.h&quot;
</span><span class="cx"> #include &quot;RenderListMarker.h&quot;
</span><span class="cx"> #include &quot;RenderMenuList.h&quot;
</span><span class="lines">@@ -716,16 +718,44 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-bool AccessibilityObject::press() const
</del><ins>+bool AccessibilityObject::press()
</ins><span class="cx"> {
</span><ins>+    // The presence of the actionElement will confirm whether we should even attempt a press.
</ins><span class="cx">     Element* actionElem = actionElement();
</span><span class="cx">     if (!actionElem)
</span><span class="cx">         return false;
</span><span class="cx">     if (Frame* f = actionElem-&gt;document().frame())
</span><span class="cx">         f-&gt;loader().resetMultipleFormSubmissionProtection();
</span><span class="cx">     
</span><ins>+    // Hit test at this location to determine if there is a sub-node element that should act
+    // as the target of the action.
+    Element* hitTestElement = nullptr;
+    if (Document* document = this-&gt;document()) {
+        RenderView* renderView = document-&gt;renderView();
+        RenderLayer* layer = renderView-&gt;layer();
+        
+        HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AccessibilityHitTest);
+        HitTestResult hitTestResult = HitTestResult(clickPoint());
+        layer-&gt;hitTest(request, hitTestResult);
+        if (hitTestResult.innerNode()) {
+            Node* innerNode = hitTestResult.innerNode()-&gt;deprecatedShadowAncestorNode();
+            if (innerNode-&gt;isElementNode())
+                hitTestElement = toElement(innerNode);
+        }
+    }
+    
+    
+    // Prefer the actionElement instead of this node, if the actionElement is inside this node.
+    Element* pressElement = this-&gt;element();
+    if (!pressElement || actionElem-&gt;isDescendantOf(pressElement))
+        pressElement = actionElem;
+    
+    // Prefer the hit test element, if it is inside the target element.
+    if (hitTestElement &amp;&amp; hitTestElement-&gt;isDescendantOf(pressElement))
+        pressElement = hitTestElement;
+    
</ins><span class="cx">     UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture);
</span><del>-    actionElem-&gt;accessKeyAction(true);
</del><ins>+    pressElement-&gt;accessKeyAction(true);
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilityObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilityObject.h (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilityObject.h        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilityObject.h        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -722,8 +722,8 @@
</span><span class="cx">     virtual void setSelectedRows(AccessibilityChildrenVector&amp;) { }
</span><span class="cx">     
</span><span class="cx">     virtual void makeRangeVisible(const PlainTextRange&amp;) { }
</span><del>-    virtual bool press() const;
-    bool performDefaultAction() const { return press(); }
</del><ins>+    virtual bool press();
+    bool performDefaultAction() { return press(); }
</ins><span class="cx">     
</span><span class="cx">     virtual AccessibilityOrientation orientation() const;
</span><span class="cx">     virtual void increment() { }
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilitySearchFieldButtonscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     textOrder.append(AccessibilityText(accessibilityDescription(), AlternativeText));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AccessibilitySearchFieldCancelButton::press() const
</del><ins>+bool AccessibilitySearchFieldCancelButton::press()
</ins><span class="cx"> {
</span><span class="cx">     Node* node = this-&gt;node();
</span><span class="cx">     if (!node || !node-&gt;isElementNode())
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilitySearchFieldButtonsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -36,7 +36,7 @@
</span><span class="cx">     
</span><span class="cx">     virtual String accessibilityDescription() const override;
</span><span class="cx">     virtual void accessibilityText(Vector&lt;AccessibilityText&gt;&amp;) override;
</span><del>-    virtual bool press() const override;
</del><ins>+    virtual bool press() override;
</ins><span class="cx">     virtual AccessibilityRole roleValue() const override { return ButtonRole; }
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilitySpinButtoncpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilitySpinButton.cpp        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -130,7 +130,7 @@
</span><span class="cx">     return parentRect;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool AccessibilitySpinButtonPart::press() const
</del><ins>+bool AccessibilitySpinButtonPart::press()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_parent || !m_parent-&gt;isSpinButton())
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkSourceWebCoreaccessibilityAccessibilitySpinButtonh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/accessibility/AccessibilitySpinButton.h (167023 => 167024)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/accessibility/AccessibilitySpinButton.h        2014-04-09 18:25:42 UTC (rev 167023)
+++ trunk/Source/WebCore/accessibility/AccessibilitySpinButton.h        2014-04-09 18:41:59 UTC (rev 167024)
</span><span class="lines">@@ -68,7 +68,7 @@
</span><span class="cx">     AccessibilitySpinButtonPart();
</span><span class="cx">     bool m_isIncrementor : 1;
</span><span class="cx">     
</span><del>-    virtual bool press() const override;
</del><ins>+    virtual bool press() override;
</ins><span class="cx">     virtual AccessibilityRole roleValue() const override { return ButtonRole; }
</span><span class="cx">     virtual bool isSpinButtonPart() const override { return true; }
</span><span class="cx">     virtual LayoutRect elementRect() const override;
</span></span></pre>
</div>
</div>

</body>
</html>