Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(614)

Side by Side Diff: Source/WebCore/page/EventHandler.cpp

Issue 12561004: Merge 144608 "Web Inspector: touchmove not emulated inside iframe" (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1410/
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 return 0; 1604 return 0;
1605 1605
1606 return layer; 1606 return layer;
1607 } 1607 }
1608 1608
1609 bool EventHandler::mouseMoved(const PlatformMouseEvent& event) 1609 bool EventHandler::mouseMoved(const PlatformMouseEvent& event)
1610 { 1610 {
1611 RefPtr<FrameView> protector(m_frame->view()); 1611 RefPtr<FrameView> protector(m_frame->view());
1612 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration); 1612 MaximumDurationTracker maxDurationTracker(&m_maxMouseMovedDuration);
1613 1613
1614
1615 #if ENABLE(TOUCH_EVENTS)
1616 // FIXME: this should be moved elsewhere to also be able to dispatch touchca ncel events.
1617 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(event);
1618 if (defaultPrevented)
1619 return true;
1620 #endif
1621
1622 HitTestResult hoveredNode = HitTestResult(LayoutPoint()); 1614 HitTestResult hoveredNode = HitTestResult(LayoutPoint());
1623 bool result = handleMouseMoveEvent(event, &hoveredNode); 1615 bool result = handleMouseMoveEvent(event, &hoveredNode);
1624 1616
1625 Page* page = m_frame->page(); 1617 Page* page = m_frame->page();
1626 if (!page) 1618 if (!page)
1627 return result; 1619 return result;
1628 1620
1629 if (RenderLayer* layer = layerForNode(hoveredNode.innerNode())) { 1621 if (RenderLayer* layer = layerForNode(hoveredNode.innerNode())) {
1630 if (FrameView* frameView = m_frame->view()) { 1622 if (FrameView* frameView = m_frame->view()) {
1631 if (frameView->containsScrollableArea(layer)) 1623 if (frameView->containsScrollableArea(layer))
(...skipping 19 matching lines...) Expand all
1651 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi tTestResult* hoveredNode, bool onlyUpdateScrollbars) 1643 bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& mouseEvent, Hi tTestResult* hoveredNode, bool onlyUpdateScrollbars)
1652 { 1644 {
1653 // in Radar 3703768 we saw frequent crashes apparently due to the 1645 // in Radar 3703768 we saw frequent crashes apparently due to the
1654 // part being null here, which seems impossible, so check for nil 1646 // part being null here, which seems impossible, so check for nil
1655 // but also assert so that we can try to figure this out in debug 1647 // but also assert so that we can try to figure this out in debug
1656 // builds, if it happens. 1648 // builds, if it happens.
1657 ASSERT(m_frame); 1649 ASSERT(m_frame);
1658 if (!m_frame) 1650 if (!m_frame)
1659 return false; 1651 return false;
1660 1652
1653 #if ENABLE(TOUCH_EVENTS)
1654 bool defaultPrevented = dispatchSyntheticTouchEventIfEnabled(mouseEvent);
1655 if (defaultPrevented)
1656 return true;
1657 #endif
1658
1661 RefPtr<FrameView> protector(m_frame->view()); 1659 RefPtr<FrameView> protector(m_frame->view());
1662 1660
1663 setLastKnownMousePosition(mouseEvent); 1661 setLastKnownMousePosition(mouseEvent);
1664 1662
1665 if (m_hoverTimer.isActive()) 1663 if (m_hoverTimer.isActive())
1666 m_hoverTimer.stop(); 1664 m_hoverTimer.stop();
1667 1665
1668 cancelFakeMouseMoveEvent(); 1666 cancelFakeMouseMoveEvent();
1669 1667
1670 #if ENABLE(SVG) 1668 #if ENABLE(SVG)
(...skipping 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
4002 4000
4003 bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent & event) 4001 bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent & event)
4004 { 4002 {
4005 if (!m_frame || !m_frame->settings() || !m_frame->settings()->isTouchEventEm ulationEnabled()) 4003 if (!m_frame || !m_frame->settings() || !m_frame->settings()->isTouchEventEm ulationEnabled())
4006 return false; 4004 return false;
4007 4005
4008 PlatformEvent::Type eventType = event.type(); 4006 PlatformEvent::Type eventType = event.type();
4009 if (eventType != PlatformEvent::MouseMoved && eventType != PlatformEvent::Mo usePressed && eventType != PlatformEvent::MouseReleased) 4007 if (eventType != PlatformEvent::MouseMoved && eventType != PlatformEvent::Mo usePressed && eventType != PlatformEvent::MouseReleased)
4010 return false; 4008 return false;
4011 4009
4010 HitTestRequest request(HitTestRequest::Active);
4011 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
4012 if (mev.scrollbar() || subframeForHitTestResult(mev))
4013 return false;
4014
4015 // The order is important. This check should follow the subframe test: http: //webkit.org/b/111292.
4012 if (eventType == PlatformEvent::MouseMoved && !m_touchPressed) 4016 if (eventType == PlatformEvent::MouseMoved && !m_touchPressed)
4013 return true; 4017 return true;
4014 4018
4015 HitTestRequest request(HitTestRequest::Active);
4016 MouseEventWithHitTestResults mev = prepareMouseEvent(request, event);
4017
4018 if (mev.scrollbar() || subframeForHitTestResult(mev))
4019 return false;
4020
4021 SyntheticSingleTouchEvent touchEvent(event); 4019 SyntheticSingleTouchEvent touchEvent(event);
4022 return handleTouchEvent(touchEvent); 4020 return handleTouchEvent(touchEvent);
4023 } 4021 }
4024 4022
4025 #endif 4023 #endif
4026 4024
4027 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event) 4025 void EventHandler::setLastKnownMousePosition(const PlatformMouseEvent& event)
4028 { 4026 {
4029 m_mousePositionIsUnknown = false; 4027 m_mousePositionIsUnknown = false;
4030 m_lastKnownMousePosition = event.position(); 4028 m_lastKnownMousePosition = event.position();
4031 m_lastKnownMouseGlobalPosition = event.globalPosition(); 4029 m_lastKnownMouseGlobalPosition = event.globalPosition();
4032 } 4030 }
4033 4031
4034 } // namespace WebCore 4032 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/fast/events/touch/resources/emulated-touch-iframe2.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698