Search cancel button is hard to activate with a tap gesture even if touch adjustment is enabled.
https://bugs.webkit.org/show_bug.cgi?id=91894
Patch by Kevin Ellis <kevers@chromium.org> on 2012-07-27
Reviewed by Antonio Gomes.
Source/WebCore:
Update check for determining if a node responds to tap gestures.
Previously, the cancel button was being discarded as a candidate for
touch adjustment if the touch area clipped the text input region
because the candidate pruning process failed to account for the cancel
button having a default mouse handler. Possibly an interim fix,
depending on resolution to 92093.
Test: touchadjustment/search-cancel.html
* page/TouchAdjustment.cpp:
(TouchAdjustment):
(WebCore::TouchAdjustment::nodeRespondsToTapGesture):
LayoutTests:
Add test for touch adjustment in the vicinity of a search cancel button.
Prior to the patch, the cancel button was pruned as a candidate if the
touch area clipped the input field.
* touchadjustment/search-cancel-expected.txt: Added.
* touchadjustment/search-cancel.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@123919 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/page/TouchAdjustment.cpp b/Source/WebCore/page/TouchAdjustment.cpp
index 2183b6d..85cb61e 100644
--- a/Source/WebCore/page/TouchAdjustment.cpp
+++ b/Source/WebCore/page/TouchAdjustment.cpp
@@ -25,6 +25,7 @@
#include "FloatPoint.h"
#include "FloatQuad.h"
#include "FrameView.h"
+#include "HTMLInputElement.h"
#include "HTMLLabelElement.h"
#include "HTMLNames.h"
#include "IntPoint.h"
@@ -75,6 +76,12 @@
if (element->hasTagName(HTMLNames::labelTag) && static_cast<HTMLLabelElement*>(element)->control())
return true;
}
+ Element* shadowHost = node->shadowHost();
+ if (shadowHost && shadowHost->hasTagName(HTMLNames::inputTag)) {
+ HTMLInputElement* input = static_cast<HTMLInputElement*>(shadowHost);
+ if (!input->readOnly() && !input->disabled())
+ return true;
+ }
// FIXME: Implement hasDefaultEventHandler and use that instead of all of the above checks.
if (node->hasEventListeners()