Bug 104653 - Web Inspector: Duplicate emulated touch events in iframe
Summary: Web Inspector: Duplicate emulated touch events in iframe
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alexander Pavlov (apavlov)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-11 02:52 PST by Alexander Pavlov (apavlov)
Modified: 2012-12-11 05:01 PST (History)
10 users (show)

See Also:


Attachments
Patch (5.18 KB, patch)
2012-12-11 03:01 PST, Alexander Pavlov (apavlov)
vsevik: review+
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander Pavlov (apavlov) 2012-12-11 02:52:02 PST
Steps to reproduce the problem:
1. Save the following to a html file, and open in browser.

<html><body><script>
    window.addEventListener('DOMContentLoaded', function() {
        var e;
        if (location.hash == '#iframe') {
            e = document.createElement('div');
            e.innerHTML = 'touchstarting this element will fire a spurious event in Chrome using "Emulate touch events".';
            e.addEventListener('touchstart', function() {
                console.log("touchstart event");
            });
            e.addEventListener('touchend', function() {
                console.log("touchend event");
            });
        }
        else {
            e = document.createElement('IFRAME');
            e.src = "#iframe";
        }
        document.body.appendChild(e);
    });
</script></body></html>

2. Open the Developer Console and enable 'emulate touch events' (Settings sprocket, Overrides).
3. Click on the div element within the iframe

What is the expected behavior?
The developer console to show 'touchstart event' and 'touchend event' once per click.

What went wrong?
The events are fired exactly twice for each click.

Upstreaming http://code.google.com/p/chromium/issues/detail?id=164510

The issue is that the synthetic touch events are dispatched for all frames in the hierarchy, down to the one containing the hit element.
Comment 1 Alexander Pavlov (apavlov) 2012-12-11 03:01:22 PST
Created attachment 178760 [details]
Patch
Comment 2 WebKit Review Bot 2012-12-11 04:10:32 PST
Comment on attachment 178760 [details]
Patch

Attachment 178760 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/15259455

New failing tests:
inspector-protocol/debugger-terminate-dedicated-worker-while-paused.html
Comment 3 Vsevolod Vlasov 2012-12-11 04:20:39 PST
Comment on attachment 178760 [details]
Patch

Consider adding bail out for mouse events on scroll bar.
Comment 4 Vsevolod Vlasov 2012-12-11 04:21:24 PST
Comment on attachment 178760 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=178760&action=review

> Source/WebCore/page/EventHandler.cpp:4062
> +    LayoutPoint documentPoint = documentPointForWindowPoint(m_frame, event.position());

MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);

> Source/WebCore/page/EventHandler.cpp:4065
> +    RefPtr<Frame> subframe = subframeForHitTestResult(mev);

if (subframeForHitTestResult(mev))
    return false;
Comment 5 Alexander Pavlov (apavlov) 2012-12-11 05:01:57 PST
Committed r137295: <http://trac.webkit.org/changeset/137295>