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

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

Issue 2229743003: add HitTestCanvasResult Class instend of std::pair<Element*, String> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add HitTestCanvasResult Class instend of std::pair<Element*, String> Created 4 years, 4 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/input/PointerEventManager.h" 5 #include "core/input/PointerEventManager.h"
6 6
7 #include "core/dom/ElementTraversal.h" 7 #include "core/dom/ElementTraversal.h"
8 #include "core/dom/shadow/FlatTreeTraversal.h" 8 #include "core/dom/shadow/FlatTreeTraversal.h"
9 #include "core/events/MouseEvent.h" 9 #include "core/events/MouseEvent.h"
10 #include "core/frame/FrameView.h" 10 #include "core/frame/FrameView.h"
11 #include "core/frame/UseCounter.h" 11 #include "core/frame/UseCounter.h"
12 #include "core/html/HTMLCanvasElement.h" 12 #include "core/html/HTMLCanvasElement.h"
13 #include "core/input/EventHandler.h" 13 #include "core/input/EventHandler.h"
14 #include "core/input/TouchActionUtil.h" 14 #include "core/input/TouchActionUtil.h"
15 #include "core/layout/HitTestCanvasResult.h"
15 #include "core/page/ChromeClient.h" 16 #include "core/page/ChromeClient.h"
16 #include "core/page/Page.h" 17 #include "core/page/Page.h"
17 #include "platform/PlatformTouchEvent.h" 18 #include "platform/PlatformTouchEvent.h"
18 19
19 namespace blink { 20 namespace blink {
20 21
21 namespace { 22 namespace {
22 23
23 size_t toPointerTypeIndex(WebPointerProperties::PointerType t) { return static_c ast<size_t>(t); } 24 size_t toPointerTypeIndex(WebPointerProperties::PointerType t) { return static_c ast<size_t>(t); }
24 25
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 // before firing the event. 418 // before firing the event.
418 if (touchInfo.point.state() == PlatformTouchPoint::TouchPressed 419 if (touchInfo.point.state() == PlatformTouchPoint::TouchPressed
419 || !m_pendingPointerCaptureTarget.contains(pointerId)) { 420 || !m_pendingPointerCaptureTarget.contains(pointerId)) {
420 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEv ent | HitTestRequest::ReadOnly | HitTestRequest::Active; 421 HitTestRequest::HitTestRequestType hitType = HitTestRequest::TouchEv ent | HitTestRequest::ReadOnly | HitTestRequest::Active;
421 LayoutPoint pagePoint = roundedLayoutPoint(m_frame->view()->rootFram eToContents(touchInfo.point.pos())); 422 LayoutPoint pagePoint = roundedLayoutPoint(m_frame->view()->rootFram eToContents(touchInfo.point.pos()));
422 HitTestResult hitTestTesult = m_frame->eventHandler().hitTestResultA tPoint(pagePoint, hitType); 423 HitTestResult hitTestTesult = m_frame->eventHandler().hitTestResultA tPoint(pagePoint, hitType);
423 Node* node = hitTestTesult.innerNode(); 424 Node* node = hitTestTesult.innerNode();
424 if (node) { 425 if (node) {
425 touchInfo.targetFrame = node->document().frame(); 426 touchInfo.targetFrame = node->document().frame();
426 if (isHTMLCanvasElement(node)) { 427 if (isHTMLCanvasElement(node)) {
427 std::pair<Element*, String> regionInfo = toHTMLCanvasElement (node)->getControlAndIdIfHitRegionExists(hitTestTesult.pointInInnerNodeFrame()); 428 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasEleme nt(node)->getControlAndIdIfHitRegionExists(hitTestTesult.pointInInnerNodeFrame() );
428 if (regionInfo.first) 429 if (hitTestCanvasResult->getControl())
429 node = regionInfo.first; 430 node = hitTestCanvasResult->getControl();
430 touchInfo.region = regionInfo.second; 431 touchInfo.region = hitTestCanvasResult->getId();
431 } 432 }
432 // TODO(crbug.com/612456): We need to investigate whether pointe r 433 // TODO(crbug.com/612456): We need to investigate whether pointe r
433 // events should go to text nodes or not. If so we need to 434 // events should go to text nodes or not. If so we need to
434 // update the mouse code as well. Also this logic looks similar 435 // update the mouse code as well. Also this logic looks similar
435 // to the one in TouchEventManager. We should be able to 436 // to the one in TouchEventManager. We should be able to
436 // refactor it better after this investigation. 437 // refactor it better after this investigation.
437 if (node->isTextNode()) 438 if (node->isTextNode())
438 node = FlatTreeTraversal::parent(*node); 439 node = FlatTreeTraversal::parent(*node);
439 touchInfo.touchNode = node; 440 touchInfo.touchNode = node;
440 441
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
804 { 805 {
805 visitor->trace(m_frame); 806 visitor->trace(m_frame);
806 visitor->trace(m_nodeUnderPointer); 807 visitor->trace(m_nodeUnderPointer);
807 visitor->trace(m_pointerCaptureTarget); 808 visitor->trace(m_pointerCaptureTarget);
808 visitor->trace(m_pendingPointerCaptureTarget); 809 visitor->trace(m_pendingPointerCaptureTarget);
809 visitor->trace(m_touchEventManager); 810 visitor->trace(m_touchEventManager);
810 } 811 }
811 812
812 813
813 } // namespace blink 814 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698