Modified: trunk/LayoutTests/ChangeLog (123918 => 123919)
--- trunk/LayoutTests/ChangeLog 2012-07-27 21:48:42 UTC (rev 123918)
+++ trunk/LayoutTests/ChangeLog 2012-07-27 21:49:36 UTC (rev 123919)
@@ -1,3 +1,17 @@
+2012-07-27 Kevin Ellis <[email protected]>
+
+ 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
+
+ Reviewed by Antonio Gomes.
+
+ 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.
+
2012-07-27 Varun Jain <[email protected]>
Animated SVGs do not clear previous frame completely in hidpi mode.
Added: trunk/LayoutTests/touchadjustment/search-cancel-expected.txt (0 => 123919)
--- trunk/LayoutTests/touchadjustment/search-cancel-expected.txt (rev 0)
+++ trunk/LayoutTests/touchadjustment/search-cancel-expected.txt 2012-07-27 21:49:36 UTC (rev 123919)
@@ -0,0 +1,30 @@
+
+Test touch adjustment on a search field with a visible cancel button.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+
+Touch centered on cancel button but overlapping neighboring candidate.
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+
+Off-center touches enclosing cancel button.
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+
+Touches clipping left edge of cancel-button.
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+PASS targetContainsPoint is true
+PASS touchContainsPoint is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/touchadjustment/search-cancel.html (0 => 123919)
--- trunk/LayoutTests/touchadjustment/search-cancel.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/search-cancel.html 2012-07-27 21:49:36 UTC (rev 123919)
@@ -0,0 +1,142 @@
+<html>
+<head>
+<style>
+ input[type='search'] {
+ -webkit-appearance: none;
+ -webkit-box-sizing: border-box;
+ border: 1px solid #999;
+ padding: 5px;
+ }
+
+ input[type='search']::-webkit-search-cancel-button {
+ -webkit-appearance: none;
+ -webkit-box-sizing: border-box;
+ background: #999;
+ height: 10px;
+ margin: 0;
+ padding: 0;
+ width: 10px;
+ }
+</style>
+<script src=""
+
+</head>
+
+<body _onload_="runTests()">
+
+<div>
+ <input id="target" type="search" value="abcd"/>
+</div>
+
+<p id='description'></p>
+<div id='console'></div>
+
+<script>
+ var element;
+ var adjustedNode;
+ var adjustedPoint;
+ var inputBounds;
+ var cancelBounds;
+ var textContentBounds;
+ var touchBounds;
+ var targetBounds;
+ var targetContainsPoint;
+ var touchContainsPoint;
+
+ function findAbsolutePosition(node) {
+ var pos = {left: 0, top: 0};
+ do {
+ pos.left += node.offsetLeft;
+ pos.top += node.offsetTop;
+ } while (node = node.offsetParent);
+ return pos;
+ }
+
+ function runTouchTests() {
+ document.addEventListener('click', function() {}, false);
+
+ element = document.getElementById('target');
+ var pos = findAbsolutePosition(element);
+
+ var x = pos.left;
+ var y = pos.top;
+ var width = element.clientWidth;
+ var height = element.clientHeight;
+
+ inputBounds = {
+ x: x,
+ y: y,
+ width: width,
+ height: height
+ };
+
+ var touchRadius = 20;
+ var offset = touchRadius / 2;
+
+ // Center of cancel button.
+ var midX = x + width - 11;
+ var midY = y + height / 2;
+
+ cancelBounds = {
+ x: midX - 5,
+ y: midY - 5,
+ width: 10,
+ height: 10
+ };
+
+ textContentBounds = {
+ x: inputBounds.x,
+ y: inputBounds.y,
+ width: inputBounds.width - 16,
+ height: inputBounds.height
+ };
+
+ debug('\nTouch centered on cancel button but overlapping neighboring candidate.');
+ testTouch(midX, midY, touchRadius, cancelBounds);
+
+ debug('\nOff-center touches enclosing cancel button.');
+ testTouch(midX - offset, midY, touchRadius, cancelBounds);
+ testTouch(midX - offset, midY + offset, touchRadius, cancelBounds);
+ testTouch(midX - offset, midY - offset, touchRadius, cancelBounds);
+
+ debug('\nTouches clipping left edge of cancel-button.');
+ testTouch(midX - touchRadius - 2, midY, touchRadius, textContentBounds);
+ testTouch(midX - touchRadius - 2, midY - offset, touchRadius, textContentBounds);
+ testTouch(midX - touchRadius - 2, midY + offset, touchRadius, textContentBounds);
+ }
+
+ function testTouch(touchX, touchY, radius, bounds) {
+
+ targetBounds = bounds;
+
+ touchBounds = {
+ x: touchX - radius,
+ y: touchY - radius,
+ width: 2 * radius,
+ height: 2 * radius
+ };
+ adjustedPoint = internals.touchPositionAdjustedToBestClickableNode(touchBounds.x, touchBounds.y, touchBounds.width, touchBounds.height, document);
+ targetContainsPoint = containsPoint(targetBounds, adjustedPoint);
+ touchContainsPoint = containsPoint(touchBounds, adjustedPoint);
+ shouldBeTrue('targetContainsPoint');
+ shouldBeTrue('touchContainsPoint');
+ }
+
+ function containsPoint(bounds, point) {
+ return bounds.x <= point.x && bounds.y <= point.y && bounds.x + bounds.width >= point.x && bounds.y + bounds.height >= point.y;
+ }
+
+ function runTests()
+ {
+ if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
+ description('Test touch adjustment on a search field with a visible cancel button.');
+ testRunner.dumpAsText();
+ testRunner.waitUntilDone();
+ runTouchTests();
+ isSuccessfullyParsed();
+ testRunner.notifyDone();
+ }
+ }
+</script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (123918 => 123919)
--- trunk/Source/WebCore/ChangeLog 2012-07-27 21:48:42 UTC (rev 123918)
+++ trunk/Source/WebCore/ChangeLog 2012-07-27 21:49:36 UTC (rev 123919)
@@ -1,3 +1,23 @@
+2012-07-27 Kevin Ellis <[email protected]>
+
+ 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
+
+ Reviewed by Antonio Gomes.
+
+ 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):
+
2012-07-27 Varun Jain <[email protected]>
Animated SVGs do not clear previous frame completely in hidpi mode.
Modified: trunk/Source/WebCore/page/TouchAdjustment.cpp (123918 => 123919)
--- trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-07-27 21:48:42 UTC (rev 123918)
+++ trunk/Source/WebCore/page/TouchAdjustment.cpp 2012-07-27 21:49:36 UTC (rev 123919)
@@ -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()