Title: [185459] trunk/Source/WebCore
Revision
185459
Author
[email protected]
Date
2015-06-11 10:20:53 -0700 (Thu, 11 Jun 2015)

Log Message

Simplify event handling logic for search cancel button
https://bugs.webkit.org/show_bug.cgi?id=145780

Reviewed by Darin Adler.

Following the patch for <https://bugs.webkit.org/show_bug.cgi?id=145774> we can take advantage
of the DOM click event to simplify the event handling logic for the search cancel button.
It is sufficient to listen for mousedown and click events instead of listening for mousedown
and mouseup events, capturing all events during drag, and using the hover state of the button
on mouse release together with a instance variable set on mouse press to determine whether
the cancel button was clicked.

As a side effect of removing the requirement that the search cancel button be hovered (a
workaround to ensure that the mouse was pressed and released on the button in absence of
listening for an explicit DOM click event) we can remove the accessibility-specific class,
AccessibilitySearchFieldCancelButton, that was primarily used to fake the hover state of
the button so that the accessibility machinery could simulate a click on it. Instead we
can add use the default accessibility machinery for clicking on an element.

No new tests since no functionality was changed.

* CMakeLists.txt: Remove reference to file AccessibilitySearchFieldButtons.cpp.
* WebCore.vcxproj/WebCore.vcxproj: Remove reference to files AccessibilitySearchFieldButtons.{cpp, h}.
* WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
* WebCore.xcodeproj/project.pbxproj: Ditto.
* accessibility/AXObjectCache.cpp:
(WebCore::createFromRenderer): Remove special-purpose logic that instantiated
AccessibilitySearchFieldCancelButton for the search cancel button. Instead we can make
use of the existing accessibility machinery to handle this button.
* accessibility/AccessibilityAllInOne.cpp: Remove #include of AccessibilitySearchFieldButtons.cpp
since the file is no longer needed.
* accessibility/AccessibilitySearchFieldButtons.cpp: Removed.
* accessibility/AccessibilitySearchFieldButtons.h: Removed.
* dom/Element.h:
(WebCore::Element::isSearchFieldCancelButtonElement): Deleted.
* html/shadow/TextControlInnerElements.cpp:
(WebCore::SearchFieldCancelButtonElement::SearchFieldCancelButtonElement): Set the ARIA role
and label attributes so that the accessibility system identifies the search cancel button as
a button and shows a description for the button, respectively.
(WebCore::SearchFieldCancelButtonElement::defaultEventHandler): Simplify the event handling logic
such that we clear the field when we receive a DOM click event (i.e. the mouse was pressed
and released on the button). Remove unused variable, oldValue. Substitute emptyString() for the
empty string literal in the call to HTMLInputElement::setValueForUser() to avoid an implicit
conversion to String. Also remove out-of-date comment that repeated what the code does.
(WebCore::SearchFieldCancelButtonElement::willDetachRenderers): Deleted. We no longer need to use
custom style resolve callbacks to reset the state of the EventHandler since we no longer need to
have the EventHandler dispatch all mouse events to us on mouse press.
* html/shadow/TextControlInnerElements.h:

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/WebCore/CMakeLists.txt (185458 => 185459)


--- trunk/Source/WebCore/CMakeLists.txt	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/CMakeLists.txt	2015-06-11 17:20:53 UTC (rev 185459)
@@ -1054,7 +1054,6 @@
     accessibility/AccessibilitySVGRoot.cpp
     accessibility/AccessibilityScrollView.cpp
     accessibility/AccessibilityScrollbar.cpp
-    accessibility/AccessibilitySearchFieldButtons.cpp
     accessibility/AccessibilitySlider.cpp
     accessibility/AccessibilitySpinButton.cpp
     accessibility/AccessibilityTable.cpp

Modified: trunk/Source/WebCore/ChangeLog (185458 => 185459)


--- trunk/Source/WebCore/ChangeLog	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/ChangeLog	2015-06-11 17:20:53 UTC (rev 185459)
@@ -1,3 +1,54 @@
+2015-06-11  Daniel Bates  <[email protected]>
+
+        Simplify event handling logic for search cancel button
+        https://bugs.webkit.org/show_bug.cgi?id=145780
+
+        Reviewed by Darin Adler.
+
+        Following the patch for <https://bugs.webkit.org/show_bug.cgi?id=145774> we can take advantage
+        of the DOM click event to simplify the event handling logic for the search cancel button.
+        It is sufficient to listen for mousedown and click events instead of listening for mousedown
+        and mouseup events, capturing all events during drag, and using the hover state of the button
+        on mouse release together with a instance variable set on mouse press to determine whether
+        the cancel button was clicked.
+
+        As a side effect of removing the requirement that the search cancel button be hovered (a
+        workaround to ensure that the mouse was pressed and released on the button in absence of
+        listening for an explicit DOM click event) we can remove the accessibility-specific class,
+        AccessibilitySearchFieldCancelButton, that was primarily used to fake the hover state of
+        the button so that the accessibility machinery could simulate a click on it. Instead we
+        can add use the default accessibility machinery for clicking on an element.
+
+        No new tests since no functionality was changed.
+
+        * CMakeLists.txt: Remove reference to file AccessibilitySearchFieldButtons.cpp.
+        * WebCore.vcxproj/WebCore.vcxproj: Remove reference to files AccessibilitySearchFieldButtons.{cpp, h}.
+        * WebCore.vcxproj/WebCore.vcxproj.filters: Ditto.
+        * WebCore.xcodeproj/project.pbxproj: Ditto.
+        * accessibility/AXObjectCache.cpp:
+        (WebCore::createFromRenderer): Remove special-purpose logic that instantiated
+        AccessibilitySearchFieldCancelButton for the search cancel button. Instead we can make
+        use of the existing accessibility machinery to handle this button.
+        * accessibility/AccessibilityAllInOne.cpp: Remove #include of AccessibilitySearchFieldButtons.cpp
+        since the file is no longer needed.
+        * accessibility/AccessibilitySearchFieldButtons.cpp: Removed.
+        * accessibility/AccessibilitySearchFieldButtons.h: Removed.
+        * dom/Element.h:
+        (WebCore::Element::isSearchFieldCancelButtonElement): Deleted.
+        * html/shadow/TextControlInnerElements.cpp:
+        (WebCore::SearchFieldCancelButtonElement::SearchFieldCancelButtonElement): Set the ARIA role
+        and label attributes so that the accessibility system identifies the search cancel button as
+        a button and shows a description for the button, respectively.
+        (WebCore::SearchFieldCancelButtonElement::defaultEventHandler): Simplify the event handling logic
+        such that we clear the field when we receive a DOM click event (i.e. the mouse was pressed
+        and released on the button). Remove unused variable, oldValue. Substitute emptyString() for the
+        empty string literal in the call to HTMLInputElement::setValueForUser() to avoid an implicit
+        conversion to String. Also remove out-of-date comment that repeated what the code does.
+        (WebCore::SearchFieldCancelButtonElement::willDetachRenderers): Deleted. We no longer need to use
+        custom style resolve callbacks to reset the state of the EventHandler since we no longer need to
+        have the EventHandler dispatch all mouse events to us on mouse press.
+        * html/shadow/TextControlInnerElements.h:
+
 2015-06-11  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r185453.

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (185458 => 185459)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj	2015-06-11 17:20:53 UTC (rev 185459)
@@ -7016,20 +7016,6 @@
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
     </ClCompile>
-    <ClCompile Include="..\accessibility\AccessibilitySearchFieldButtons.cpp">
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release_WinCairo|x64'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
-      <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
-    </ClCompile>
     <ClCompile Include="..\accessibility\AccessibilitySlider.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
@@ -19537,7 +19523,6 @@
     <ClInclude Include="..\accessibility\AccessibilityRenderObject.h" />
     <ClInclude Include="..\accessibility\AccessibilityScrollbar.h" />
     <ClInclude Include="..\accessibility\AccessibilityScrollView.h" />
-    <ClInclude Include="..\accessibility\AccessibilitySearchFieldButtons.h" />
     <ClInclude Include="..\accessibility\AccessibilitySlider.h" />
     <ClInclude Include="..\accessibility\AccessibilitySpinButton.h" />
     <ClInclude Include="..\accessibility\AccessibilitySVGRoot.h" />

Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (185458 => 185459)


--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters	2015-06-11 17:20:53 UTC (rev 185459)
@@ -6610,9 +6610,6 @@
     <ClCompile Include="..\rendering\ImageQualityController.cpp">
       <Filter>rendering</Filter>
     </ClCompile>
-    <ClCompile Include="..\accessibility\AccessibilitySearchFieldButtons.cpp">
-      <Filter>accessibility</Filter>
-    </ClCompile>
     <ClCompile Include="..\dom\ElementData.cpp">
       <Filter>dom</Filter>
     </ClCompile>
@@ -13997,9 +13994,6 @@
     <ClInclude Include="..\rendering\ImageQualityController.h">
       <Filter>rendering</Filter>
     </ClInclude>
-    <ClInclude Include="..\accessibility\AccessibilitySearchFieldButtons.h">
-      <Filter>accessibility</Filter>
-    </ClInclude>
     <ClInclude Include="..\dom\ElementAncestorIterator.h">
       <Filter>dom</Filter>
     </ClInclude>

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (185458 => 185459)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2015-06-11 17:20:53 UTC (rev 185459)
@@ -1402,7 +1402,6 @@
 		37F57AC41A50729300876F98 /* AccessibilityRenderObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2981CAA6131822EC00D12F2A /* AccessibilityRenderObject.cpp */; };
 		37F57AC51A50729700876F98 /* AccessibilityScrollbar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2981CAA7131822EC00D12F2A /* AccessibilityScrollbar.cpp */; };
 		37F57AC61A50729B00876F98 /* AccessibilityScrollView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2981CAA8131822EC00D12F2A /* AccessibilityScrollView.cpp */; };
-		37F57AC71A5072A100876F98 /* AccessibilitySearchFieldButtons.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 415B3A6917CBE172000FCCE8 /* AccessibilitySearchFieldButtons.cpp */; };
 		37F57AC81A5072BC00876F98 /* AccessibilitySlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2981CAA9131822EC00D12F2A /* AccessibilitySlider.cpp */; };
 		37F57AC91A5072CC00876F98 /* AccessibilitySVGRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AAC08CF015F941FC00F1E188 /* AccessibilitySVGRoot.cpp */; };
 		37F57ACA1A5072CF00876F98 /* AccessibilityTable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2981CAAA131822EC00D12F2A /* AccessibilityTable.cpp */; };
@@ -1453,7 +1452,6 @@
 		4150F9F212B6E0E70008C860 /* SliderThumbElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */; };
 		4157AF8012F1FB0400A8C6F5 /* MediaControlsApple.h in Headers */ = {isa = PBXBuildFile; fileRef = 4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */; };
 		4157AF8112F1FB0400A8C6F5 /* MediaControlsApple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */; };
-		415B3A6E17CBE267000FCCE8 /* AccessibilitySearchFieldButtons.h in Headers */ = {isa = PBXBuildFile; fileRef = 415B3A6A17CBE172000FCCE8 /* AccessibilitySearchFieldButtons.h */; };
 		4162A450101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */; };
 		4162A451101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 4162A44E101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h */; };
 		4162A454101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4162A453101145E300DFF3ED /* JSDedicatedWorkerGlobalScopeCustom.cpp */; };
@@ -8605,8 +8603,6 @@
 		4150F9F012B6E0E70008C860 /* SliderThumbElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SliderThumbElement.cpp; sourceTree = "<group>"; };
 		4157AF7E12F1FB0400A8C6F5 /* MediaControlsApple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaControlsApple.h; sourceTree = "<group>"; };
 		4157AF7F12F1FB0400A8C6F5 /* MediaControlsApple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaControlsApple.cpp; sourceTree = "<group>"; };
-		415B3A6917CBE172000FCCE8 /* AccessibilitySearchFieldButtons.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AccessibilitySearchFieldButtons.cpp; sourceTree = "<group>"; };
-		415B3A6A17CBE172000FCCE8 /* AccessibilitySearchFieldButtons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AccessibilitySearchFieldButtons.h; sourceTree = "<group>"; };
 		4162A44D101145AE00DFF3ED /* DedicatedWorkerGlobalScope.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DedicatedWorkerGlobalScope.cpp; sourceTree = "<group>"; };
 		4162A44E101145AE00DFF3ED /* DedicatedWorkerGlobalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DedicatedWorkerGlobalScope.h; sourceTree = "<group>"; };
 		4162A44F101145AE00DFF3ED /* DedicatedWorkerGlobalScope.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DedicatedWorkerGlobalScope.idl; sourceTree = "<group>"; };
@@ -15723,8 +15719,6 @@
 				93C4F6E91108F9A50099D0DB /* AccessibilityScrollbar.h */,
 				2981CAA8131822EC00D12F2A /* AccessibilityScrollView.cpp */,
 				29489FC512C00F0300D83F0F /* AccessibilityScrollView.h */,
-				415B3A6917CBE172000FCCE8 /* AccessibilitySearchFieldButtons.cpp */,
-				415B3A6A17CBE172000FCCE8 /* AccessibilitySearchFieldButtons.h */,
 				2981CAA9131822EC00D12F2A /* AccessibilitySlider.cpp */,
 				0709FC4D1025DEE30059CDBA /* AccessibilitySlider.h */,
 				29D7BCF51444AF580070619C /* AccessibilitySpinButton.cpp */,
@@ -23790,7 +23784,6 @@
 				29A812390FBB9C1D00510293 /* AccessibilityRenderObject.h in Headers */,
 				93C4F6EB1108F9A50099D0DB /* AccessibilityScrollbar.h in Headers */,
 				29489FC712C00F0300D83F0F /* AccessibilityScrollView.h in Headers */,
-				415B3A6E17CBE267000FCCE8 /* AccessibilitySearchFieldButtons.h in Headers */,
 				0709FC4E1025DEE30059CDBA /* AccessibilitySlider.h in Headers */,
 				29D7BCFA1444AF7D0070619C /* AccessibilitySpinButton.h in Headers */,
 				AAC08CF315F941FD00F1E188 /* AccessibilitySVGRoot.h in Headers */,
@@ -27599,7 +27592,6 @@
 				37F57AC41A50729300876F98 /* AccessibilityRenderObject.cpp in Sources */,
 				37F57AC51A50729700876F98 /* AccessibilityScrollbar.cpp in Sources */,
 				37F57AC61A50729B00876F98 /* AccessibilityScrollView.cpp in Sources */,
-				37F57AC71A5072A100876F98 /* AccessibilitySearchFieldButtons.cpp in Sources */,
 				37F57AC81A5072BC00876F98 /* AccessibilitySlider.cpp in Sources */,
 				29D7BCF61444AF580070619C /* AccessibilitySpinButton.cpp in Sources */,
 				37F57AC91A5072CC00876F98 /* AccessibilitySVGRoot.cpp in Sources */,

Modified: trunk/Source/WebCore/accessibility/AXObjectCache.cpp (185458 => 185459)


--- trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/accessibility/AXObjectCache.cpp	2015-06-11 17:20:53 UTC (rev 185459)
@@ -48,7 +48,6 @@
 #include "AccessibilitySVGRoot.h"
 #include "AccessibilityScrollView.h"
 #include "AccessibilityScrollbar.h"
-#include "AccessibilitySearchFieldButtons.h"
 #include "AccessibilitySlider.h"
 #include "AccessibilitySpinButton.h"
 #include "AccessibilityTable.h"
@@ -298,10 +297,6 @@
     if (is<RenderSVGRoot>(*renderer))
         return AccessibilitySVGRoot::create(renderer);
     
-    // Search field buttons
-    if (is<Element>(node) && downcast<Element>(*node).isSearchFieldCancelButtonElement())
-        return AccessibilitySearchFieldCancelButton::create(renderer);
-    
     if (is<RenderBoxModelObject>(*renderer)) {
         RenderBoxModelObject& cssBox = downcast<RenderBoxModelObject>(*renderer);
         if (is<RenderListBox>(cssBox))

Modified: trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp (185458 => 185459)


--- trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/accessibility/AccessibilityAllInOne.cpp	2015-06-11 17:20:53 UTC (rev 185459)
@@ -41,7 +41,6 @@
 #include "AccessibilitySVGRoot.cpp"
 #include "AccessibilityScrollView.cpp"
 #include "AccessibilityScrollbar.cpp"
-#include "AccessibilitySearchFieldButtons.cpp"
 #include "AccessibilitySlider.cpp"
 #include "AccessibilityTable.cpp"
 #include "AccessibilityTableCell.cpp"

Deleted: trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp (185458 => 185459)


--- trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.cpp	2015-06-11 17:20:53 UTC (rev 185459)
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "AccessibilitySearchFieldButtons.h"
-
-#include "LocalizedStrings.h"
-#include "RenderObject.h"
-
-namespace WebCore {
-
-Ref<AccessibilitySearchFieldCancelButton> AccessibilitySearchFieldCancelButton::create(RenderObject* renderer)
-{
-    return adoptRef(*new AccessibilitySearchFieldCancelButton(renderer));
-}
-
-AccessibilitySearchFieldCancelButton::AccessibilitySearchFieldCancelButton(RenderObject* renderer)
-    : AccessibilityRenderObject(renderer)
-{
-}
-
-String AccessibilitySearchFieldCancelButton::accessibilityDescription() const
-{
-#if PLATFORM(IOS)
-    return String();
-#else
-    return AXSearchFieldCancelButtonText();
-#endif
-}
-
-void AccessibilitySearchFieldCancelButton::accessibilityText(Vector<AccessibilityText>& textOrder)
-{
-    textOrder.append(AccessibilityText(accessibilityDescription(), AlternativeText));
-}
-
-bool AccessibilitySearchFieldCancelButton::press()
-{
-    Node* node = this->node();
-    if (!is<Element>(node))
-        return false;
-    
-    Element& element = downcast<Element>(*node);
-    // The default event handler on SearchFieldCancelButtonElement requires hover.
-    element.setHovered(true);
-    element.accessKeyAction(true);
-    return true;
-}
-
-bool AccessibilitySearchFieldCancelButton::computeAccessibilityIsIgnored() const
-{
-    return accessibilityIsIgnoredByDefault();
-}
-
-} // namespace WebCore

Deleted: trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h (185458 => 185459)


--- trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/accessibility/AccessibilitySearchFieldButtons.h	2015-06-11 17:20:53 UTC (rev 185459)
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef AccessibilitySearchFieldButtons_h
-#define AccessibilitySearchFieldButtons_h
-
-#include "AccessibilityRenderObject.h"
-
-namespace WebCore {
-
-class AccessibilitySearchFieldCancelButton final : public AccessibilityRenderObject {
-public:
-    static Ref<AccessibilitySearchFieldCancelButton> create(RenderObject*);
-    
-    virtual String accessibilityDescription() const override;
-    virtual void accessibilityText(Vector<AccessibilityText>&) override;
-    virtual bool press() override;
-    virtual AccessibilityRole roleValue() const override { return ButtonRole; }
-
-private:
-    explicit AccessibilitySearchFieldCancelButton(RenderObject*);
-
-    virtual bool computeAccessibilityIsIgnored() const override;
-};
-
-} // namespace WebCore
-
-#endif // AccessibilitySearchFieldButtons_h

Modified: trunk/Source/WebCore/dom/Element.h (185458 => 185459)


--- trunk/Source/WebCore/dom/Element.h	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/dom/Element.h	2015-06-11 17:20:53 UTC (rev 185459)
@@ -394,7 +394,6 @@
     virtual bool isInRange() const { return false; }
     virtual bool isOutOfRange() const { return false; }
     virtual bool isFrameElementBase() const { return false; }
-    virtual bool isSearchFieldCancelButtonElement() const { return false; }
 
     virtual bool canContainRangeEndPoint() const override;
 

Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp (185458 => 185459)


--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.cpp	2015-06-11 17:20:53 UTC (rev 185459)
@@ -28,12 +28,13 @@
 #include "TextControlInnerElements.h"
 
 #include "Document.h"
-#include "EventHandler.h"
 #include "EventNames.h"
 #include "Frame.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
+#include "LocalizedStrings.h"
 #include "MouseEvent.h"
+#include "PlatformMouseEvent.h"
 #include "RenderSearchField.h"
 #include "RenderTextControl.h"
 #include "RenderView.h"
@@ -170,10 +171,12 @@
 
 inline SearchFieldCancelButtonElement::SearchFieldCancelButtonElement(Document& document)
     : HTMLDivElement(divTag, document)
-    , m_capturing(false)
 {
     setPseudo(AtomicString("-webkit-search-cancel-button", AtomicString::ConstructFromLiteral));
-    setHasCustomStyleResolveCallbacks();
+#if !PLATFORM(IOS)
+    setAttribute(aria_labelAttr, AXSearchFieldCancelButtonText());
+#endif
+    setAttribute(roleAttr, AtomicString("button", AtomicString::ConstructFromLiteral));
 }
 
 Ref<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::create(Document& document)
@@ -181,17 +184,8 @@
     return adoptRef(*new SearchFieldCancelButtonElement(document));
 }
 
-void SearchFieldCancelButtonElement::willDetachRenderers()
-{
-    if (m_capturing) {
-        if (Frame* frame = document().frame())
-            frame->eventHandler().setCapturingMouseEventsElement(nullptr);
-    }
-}
-
 void SearchFieldCancelButtonElement::defaultEventHandler(Event* event)
 {
-    // If the element is visible, on mouseup, clear the value, and set selection
     RefPtr<HTMLInputElement> input(downcast<HTMLInputElement>(shadowHost()));
     if (!input || input->isDisabledOrReadOnly()) {
         if (!event->defaultHandled())
@@ -200,29 +194,15 @@
     }
 
     if (event->type() == eventNames().mousedownEvent && is<MouseEvent>(*event) && downcast<MouseEvent>(*event).button() == LeftButton) {
-        if (renderer() && renderer()->visibleToHitTesting()) {
-            if (Frame* frame = document().frame()) {
-                frame->eventHandler().setCapturingMouseEventsElement(this);
-                m_capturing = true;
-            }
-        }
         input->focus();
         input->select();
         event->setDefaultHandled();
     }
-    if (event->type() == eventNames().mouseupEvent && is<MouseEvent>(*event) && downcast<MouseEvent>(*event).button() == LeftButton) {
-        if (m_capturing) {
-            if (Frame* frame = document().frame()) {
-                frame->eventHandler().setCapturingMouseEventsElement(nullptr);
-                m_capturing = false;
-            }
-            if (hovered()) {
-                String oldValue = input->value();
-                input->setValueForUser("");
-                input->onSearch();
-                event->setDefaultHandled();
-            }
-        }
+
+    if (event->type() == eventNames().clickEvent) {
+        input->setValueForUser(emptyString());
+        input->onSearch();
+        event->setDefaultHandled();
     }
 
     if (!event->defaultHandled())

Modified: trunk/Source/WebCore/html/shadow/TextControlInnerElements.h (185458 => 185459)


--- trunk/Source/WebCore/html/shadow/TextControlInnerElements.h	2015-06-11 17:03:02 UTC (rev 185458)
+++ trunk/Source/WebCore/html/shadow/TextControlInnerElements.h	2015-06-11 17:20:53 UTC (rev 185459)
@@ -89,17 +89,13 @@
     static Ref<SearchFieldCancelButtonElement> create(Document&);
 
     virtual void defaultEventHandler(Event*) override;
-    virtual bool isSearchFieldCancelButtonElement() const override { return true; }
 #if !PLATFORM(IOS)
     virtual bool willRespondToMouseClickEvents() override;
 #endif
 
 private:
     SearchFieldCancelButtonElement(Document&);
-    virtual void willDetachRenderers() override;
     virtual bool isMouseFocusable() const override { return false; }
-
-    bool m_capturing;
 };
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to