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

Side by Side Diff: third_party/WebKit/Source/core/input/EventHandler.cpp

Issue 2586133003: Remove PlatformWheelEvent and use WebMouseWheelEvent instead (Closed)
Patch Set: Address comments Created 3 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights
3 * reserved. 3 * reserved.
4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) 4 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) 5 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies)
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 #include "core/page/FocusController.h" 81 #include "core/page/FocusController.h"
82 #include "core/page/FrameTree.h" 82 #include "core/page/FrameTree.h"
83 #include "core/page/Page.h" 83 #include "core/page/Page.h"
84 #include "core/page/TouchAdjustment.h" 84 #include "core/page/TouchAdjustment.h"
85 #include "core/page/scrolling/ScrollState.h" 85 #include "core/page/scrolling/ScrollState.h"
86 #include "core/paint/PaintLayer.h" 86 #include "core/paint/PaintLayer.h"
87 #include "core/style/ComputedStyle.h" 87 #include "core/style/ComputedStyle.h"
88 #include "core/style/CursorData.h" 88 #include "core/style/CursorData.h"
89 #include "core/svg/SVGDocumentExtensions.h" 89 #include "core/svg/SVGDocumentExtensions.h"
90 #include "platform/PlatformTouchEvent.h" 90 #include "platform/PlatformTouchEvent.h"
91 #include "platform/PlatformWheelEvent.h"
92 #include "platform/RuntimeEnabledFeatures.h" 91 #include "platform/RuntimeEnabledFeatures.h"
93 #include "platform/WindowsKeyboardCodes.h" 92 #include "platform/WindowsKeyboardCodes.h"
94 #include "platform/geometry/FloatPoint.h" 93 #include "platform/geometry/FloatPoint.h"
95 #include "platform/graphics/Image.h" 94 #include "platform/graphics/Image.h"
96 #include "platform/heap/Handle.h" 95 #include "platform/heap/Handle.h"
97 #include "platform/instrumentation/tracing/TraceEvent.h" 96 #include "platform/instrumentation/tracing/TraceEvent.h"
98 #include "platform/scroll/ScrollAnimatorBase.h" 97 #include "platform/scroll/ScrollAnimatorBase.h"
99 #include "platform/scroll/Scrollbar.h" 98 #include "platform/scroll/Scrollbar.h"
100 #include "public/platform/WebInputEvent.h" 99 #include "public/platform/WebInputEvent.h"
100 #include "public/platform/WebMouseWheelEvent.h"
101 #include "wtf/Assertions.h" 101 #include "wtf/Assertions.h"
102 #include "wtf/CurrentTime.h" 102 #include "wtf/CurrentTime.h"
103 #include "wtf/PtrUtil.h" 103 #include "wtf/PtrUtil.h"
104 #include "wtf/StdLibExtras.h" 104 #include "wtf/StdLibExtras.h"
105 #include <memory> 105 #include <memory>
106 106
107 namespace blink { 107 namespace blink {
108 108
109 namespace { 109 namespace {
110 110
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1263 mouseEventType == EventTypeNames::mousemove || 1263 mouseEventType == EventTypeNames::mousemove ||
1264 mouseEventType == EventTypeNames::mouseup); 1264 mouseEventType == EventTypeNames::mouseup);
1265 1265
1266 const auto& eventResult = m_pointerEventManager->sendMousePointerEvent( 1266 const auto& eventResult = m_pointerEventManager->sendMousePointerEvent(
1267 updateMouseEventTargetNode(targetNode), mouseEventType, mouseEvent, 1267 updateMouseEventTargetNode(targetNode), mouseEventType, mouseEvent,
1268 coalescedEvents); 1268 coalescedEvents);
1269 return eventResult; 1269 return eventResult;
1270 } 1270 }
1271 1271
1272 WebInputEventResult EventHandler::handleWheelEvent( 1272 WebInputEventResult EventHandler::handleWheelEvent(
1273 const PlatformWheelEvent& event) { 1273 const WebMouseWheelEvent& event) {
1274 #if OS(MACOSX) 1274 #if OS(MACOSX)
1275 // Filter Mac OS specific phases, usually with a zero-delta. 1275 // Filter Mac OS specific phases, usually with a zero-delta.
1276 // https://crbug.com/553732 1276 // https://crbug.com/553732
1277 // TODO(chongz): EventSender sends events with |PlatformWheelEventPhaseNone|, 1277 // TODO(chongz): EventSender sends events with
1278 // |WebMouseWheelEvent::PhaseNone|,
1278 // but it shouldn't. 1279 // but it shouldn't.
1279 const int kPlatformWheelEventPhaseNoEventMask = 1280 const int kWheelEventPhaseNoEventMask = WebMouseWheelEvent::PhaseEnded |
1280 PlatformWheelEventPhaseEnded | PlatformWheelEventPhaseCancelled | 1281 WebMouseWheelEvent::PhaseCancelled |
1281 PlatformWheelEventPhaseMayBegin; 1282 WebMouseWheelEvent::PhaseMayBegin;
1282 if ((event.phase() & kPlatformWheelEventPhaseNoEventMask) || 1283 if ((event.phase & kWheelEventPhaseNoEventMask) ||
1283 (event.momentumPhase() & kPlatformWheelEventPhaseNoEventMask)) 1284 (event.momentumPhase & kWheelEventPhaseNoEventMask))
1284 return WebInputEventResult::NotHandled; 1285 return WebInputEventResult::NotHandled;
1285 #endif 1286 #endif
1286 Document* doc = m_frame->document(); 1287 Document* doc = m_frame->document();
1287 1288
1288 if (doc->layoutViewItem().isNull()) 1289 if (doc->layoutViewItem().isNull())
1289 return WebInputEventResult::NotHandled; 1290 return WebInputEventResult::NotHandled;
1290 1291
1291 FrameView* view = m_frame->view(); 1292 FrameView* view = m_frame->view();
1292 if (!view) 1293 if (!view)
1293 return WebInputEventResult::NotHandled; 1294 return WebInputEventResult::NotHandled;
1294 1295
1295 LayoutPoint vPoint = view->rootFrameToContents(event.position()); 1296 LayoutPoint vPoint =
1297 view->rootFrameToContents(flooredIntPoint(event.positionInRootFrame()));
1296 1298
1297 HitTestRequest request(HitTestRequest::ReadOnly); 1299 HitTestRequest request(HitTestRequest::ReadOnly);
1298 HitTestResult result(request, vPoint); 1300 HitTestResult result(request, vPoint);
1299 doc->layoutViewItem().hitTest(result); 1301 doc->layoutViewItem().hitTest(result);
1300 1302
1301 Node* node = result.innerNode(); 1303 Node* node = result.innerNode();
1302 // Wheel events should not dispatch to text nodes. 1304 // Wheel events should not dispatch to text nodes.
1303 if (node && node->isTextNode()) 1305 if (node && node->isTextNode())
1304 node = FlatTreeTraversal::parent(*node); 1306 node = FlatTreeTraversal::parent(*node);
1305 1307
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 } 2125 }
2124 2126
2125 FrameHost* EventHandler::frameHost() const { 2127 FrameHost* EventHandler::frameHost() const {
2126 if (!m_frame->page()) 2128 if (!m_frame->page())
2127 return nullptr; 2129 return nullptr;
2128 2130
2129 return &m_frame->page()->frameHost(); 2131 return &m_frame->page()->frameHost();
2130 } 2132 }
2131 2133
2132 } // namespace blink 2134 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698