Title: [132509] trunk
- Revision
- 132509
- Author
- [email protected]
- Date
- 2012-10-25 11:49:51 -0700 (Thu, 25 Oct 2012)
Log Message
Touch adjustment snaps to wrong target at a plugin boundary.
https://bugs.webkit.org/show_bug.cgi?id=99938
Patch by Kevin Ellis <[email protected]> on 2012-10-25
Reviewed by Antonio Gomes.
Source/WebCore:
Inidcate that an <embed> element can respond to
mouse click events, since mouse events are forwarded
to the plugin. Fixes touch adjustment at a plugin
boundary. Prior to the patch a clickable element
adjacent to the plugin would capture synthetic mouse
events from tap gestures that spanned the plugin
boundary.
Test: touchadjustment/plugin.html
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::willRespondToMouseClickEvents):
(WebCore):
* html/HTMLEmbedElement.h:
LayoutTests:
Test for touch adjustment at a plugin boundary.
Prior to the patch, plugins were not considered
candidates for touch adjustment.
* touchadjustment/plugin-expected.txt: Added.
* touchadjustment/plugin.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (132508 => 132509)
--- trunk/LayoutTests/ChangeLog 2012-10-25 18:48:32 UTC (rev 132508)
+++ trunk/LayoutTests/ChangeLog 2012-10-25 18:49:51 UTC (rev 132509)
@@ -1,3 +1,17 @@
+2012-10-25 Kevin Ellis <[email protected]>
+
+ Touch adjustment snaps to wrong target at a plugin boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=99938
+
+ Reviewed by Antonio Gomes.
+
+ Test for touch adjustment at a plugin boundary.
+ Prior to the patch, plugins were not considered
+ candidates for touch adjustment.
+
+ * touchadjustment/plugin-expected.txt: Added.
+ * touchadjustment/plugin.html: Added.
+
2012-10-25 Csaba Osztrogonác <[email protected]>
[Qt] Unreviewed gardening, skip failing tests to speedup testing.
Added: trunk/LayoutTests/touchadjustment/plugin-expected.txt (0 => 132509)
--- trunk/LayoutTests/touchadjustment/plugin-expected.txt (rev 0)
+++ trunk/LayoutTests/touchadjustment/plugin-expected.txt 2012-10-25 18:49:51 UTC (rev 132509)
@@ -0,0 +1,21 @@
+Tests touch-adjustment at a plugin boundary.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+Test direct hits.
+PASS adjusted node was EMBED#plugin.
+PASS adjusted node was BUTTON#button1.
+PASS adjusted node was BUTTON#button2.
+PASS adjusted node was BUTTON#button3.
+Test hits spanning the plugin boundary.
+PASS adjusted node was EMBED#plugin.
+PASS adjusted node was BUTTON#button1.
+PASS adjusted node was EMBED#plugin.
+PASS adjusted node was BUTTON#button2.
+PASS adjusted node was EMBED#plugin.
+PASS adjusted node was BUTTON#button3.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/touchadjustment/plugin.html (0 => 132509)
--- trunk/LayoutTests/touchadjustment/plugin.html (rev 0)
+++ trunk/LayoutTests/touchadjustment/plugin.html 2012-10-25 18:49:51 UTC (rev 132509)
@@ -0,0 +1,93 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Touch Adjustment : Plugin boundary - bug ????</title>
+ <script src=""
+ <script src=""
+ <style>
+ #plugin {
+ height: 160px;
+ margin-left: 10px;
+ margin-top: 10px;
+ width: 320px;
+ }
+ #toolbar {
+ -webkit-box-align: stretch;
+ -webkit-box-orient: horizontal;
+ display: -webkit-box;
+ margin-left: 10px;
+ }
+ </style>
+</head>
+<body>
+
+<div id=sandbox>
+ <embed id="plugin" type="Application/x-webkit-test-webplugin">
+ <div id="toolbar" _onckick_="function(){}">
+ <button id="button1">A</button>
+ <button id="button2">B</button>
+ <button id="button3">C</button>
+ </div>
+</div>
+
+<p id='description'></p>
+<div id='console'></div>
+
+<script>
+ // Set up shortcut access to elements
+ var ids = ['sandbox', 'plugin', 'toolbar', 'button1', 'button2', 'button3'];
+ var e = {};
+ ids.forEach(function(a) {
+ e[a] = document.getElementById(a);
+ });
+ var bounds = {};
+ ids.forEach(function(a) {
+ bounds[a] = findAbsoluteBounds(e[a]);
+ });
+
+ function testMidpoint(id)
+ {
+ var x = bounds[id].left + bounds[id].width / 2;
+ var y = bounds[id].top + bounds[id].height / 2;
+ testTouchPoint(touchPoint(x, y, 10), e[id]);
+ }
+
+ function testBoundary(buttonId)
+ {
+ var x = bounds[buttonId].left + bounds[buttonId].width / 2;
+ var y = (bounds['plugin'].top + bounds['plugin'].height + bounds[buttonId].top) / 2;
+ testTouchPoint(touchPoint(x, y - 5, 10), e['plugin']);
+ testTouchPoint(touchPoint(x, y + 5, 10), e[buttonId]);
+ }
+
+ function testDirectTouches()
+ {
+ debug('Test direct hits.');
+ testMidpoint('plugin');
+ testMidpoint('button1');
+ testMidpoint('button2');
+ testMidpoint('button3');
+ }
+
+ function testIndirectTouches()
+ {
+ debug('Test hits spanning the plugin boundary.');
+ testBoundary('button1');
+ testBoundary('button2');
+ testBoundary('button3');
+ }
+
+ function runTests()
+ {
+ if (window.testRunner && window.internals && internals.touchNodeAdjustedToBestClickableNode) {
+ description('Tests touch-adjustment at a plugin boundary.');
+ testDirectTouches();
+ testIndirectTouches();
+ e['sandbox'].style.display = 'none';
+ }
+ }
+ runTests();
+</script>
+<script src=""
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (132508 => 132509)
--- trunk/Source/WebCore/ChangeLog 2012-10-25 18:48:32 UTC (rev 132508)
+++ trunk/Source/WebCore/ChangeLog 2012-10-25 18:49:51 UTC (rev 132509)
@@ -1,3 +1,25 @@
+2012-10-25 Kevin Ellis <[email protected]>
+
+ Touch adjustment snaps to wrong target at a plugin boundary.
+ https://bugs.webkit.org/show_bug.cgi?id=99938
+
+ Reviewed by Antonio Gomes.
+
+ Inidcate that an <embed> element can respond to
+ mouse click events, since mouse events are forwarded
+ to the plugin. Fixes touch adjustment at a plugin
+ boundary. Prior to the patch a clickable element
+ adjacent to the plugin would capture synthetic mouse
+ events from tap gestures that spanned the plugin
+ boundary.
+
+ Test: touchadjustment/plugin.html
+
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::willRespondToMouseClickEvents):
+ (WebCore):
+ * html/HTMLEmbedElement.h:
+
2012-10-25 Ojan Vafai <[email protected]>
Get rid of ScriptController::clearForNavigation
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.cpp (132508 => 132509)
--- trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-10-25 18:48:32 UTC (rev 132508)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.cpp 2012-10-25 18:49:51 UTC (rev 132509)
@@ -78,6 +78,18 @@
return plugin ? plugin->canProcessDrag() : false;
}
+bool HTMLPlugInElement::willRespondToMouseClickEvents()
+{
+ if (disabled())
+ return false;
+ RenderObject* r = renderer();
+ if (!r)
+ return false;
+ if (!r->isEmbeddedObject() && !r->isWidget())
+ return false;
+ return true;
+}
+
void HTMLPlugInElement::detach()
{
m_instance.clear();
Modified: trunk/Source/WebCore/html/HTMLPlugInElement.h (132508 => 132509)
--- trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-10-25 18:48:32 UTC (rev 132508)
+++ trunk/Source/WebCore/html/HTMLPlugInElement.h 2012-10-25 18:49:51 UTC (rev 132509)
@@ -68,6 +68,8 @@
bool canProcessDrag() const;
+ virtual bool willRespondToMouseClickEvents() OVERRIDE;
+
protected:
HTMLPlugInElement(const QualifiedName& tagName, Document*);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes