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

Side by Side Diff: third_party/WebKit/Source/core/input/TouchEventManager.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/TouchEventManager.h" 5 #include "core/input/TouchEventManager.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/events/TouchEvent.h" 8 #include "core/events/TouchEvent.h"
9 #include "core/frame/Deprecation.h" 9 #include "core/frame/Deprecation.h"
10 #include "core/frame/EventHandlerRegistry.h" 10 #include "core/frame/EventHandlerRegistry.h"
11 #include "core/frame/FrameHost.h" 11 #include "core/frame/FrameHost.h"
12 #include "core/frame/FrameView.h" 12 #include "core/frame/FrameView.h"
13 #include "core/html/HTMLCanvasElement.h" 13 #include "core/html/HTMLCanvasElement.h"
14 #include "core/input/EventHandler.h" 14 #include "core/input/EventHandler.h"
15 #include "core/input/TouchActionUtil.h" 15 #include "core/input/TouchActionUtil.h"
16 #include "core/layout/HitTestCanvasResult.h"
16 #include "core/page/ChromeClient.h" 17 #include "core/page/ChromeClient.h"
17 #include "core/page/Page.h" 18 #include "core/page/Page.h"
18 #include "platform/Histogram.h" 19 #include "platform/Histogram.h"
19 #include "platform/PlatformTouchEvent.h" 20 #include "platform/PlatformTouchEvent.h"
20 #include "wtf/CurrentTime.h" 21 #include "wtf/CurrentTime.h"
21 #include "wtf/PtrUtil.h" 22 #include "wtf/PtrUtil.h"
22 #include <memory> 23 #include <memory>
23 24
24 25
25 namespace blink { 26 namespace blink {
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 // |m_touchSequenceDocument|. 244 // |m_touchSequenceDocument|.
244 if (m_touchSequenceDocument && (!touchInfo.touchNode 245 if (m_touchSequenceDocument && (!touchInfo.touchNode
245 || &touchInfo.touchNode->document() != m_touchSequenceDocument)) { 246 || &touchInfo.touchNode->document() != m_touchSequenceDocument)) {
246 if (m_touchSequenceDocument->frame()) { 247 if (m_touchSequenceDocument->frame()) {
247 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); 248 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos()));
248 result = EventHandler::hitTestResultInFrame(m_touchSequenceD ocument->frame(), framePoint, hitType); 249 result = EventHandler::hitTestResultInFrame(m_touchSequenceD ocument->frame(), framePoint, hitType);
249 Node* node = result.innerNode(); 250 Node* node = result.innerNode();
250 if (!node) 251 if (!node)
251 continue; 252 continue;
252 if (isHTMLCanvasElement(node)) { 253 if (isHTMLCanvasElement(node)) {
253 std::pair<Element*, String> regionInfo = toHTMLCanvasEle ment(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); 254 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasE lement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame());
254 if (regionInfo.first) 255 if (hitTestCanvasResult->getControl())
255 node = regionInfo.first; 256 node = hitTestCanvasResult->getControl();
256 touchInfo.region = regionInfo.second; 257 touchInfo.region = hitTestCanvasResult->getId();
257 } 258 }
258 // Touch events should not go to text nodes. 259 // Touch events should not go to text nodes.
259 if (node->isTextNode()) 260 if (node->isTextNode())
260 node = FlatTreeTraversal::parent(*node); 261 node = FlatTreeTraversal::parent(*node);
261 touchInfo.touchNode = node; 262 touchInfo.touchNode = node;
262 } else { 263 } else {
263 continue; 264 continue;
264 } 265 }
265 } 266 }
266 if (!touchInfo.touchNode) 267 if (!touchInfo.touchNode)
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; 524 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized;
524 break; 525 break;
525 default: 526 default:
526 NOTREACHED(); 527 NOTREACHED();
527 return; 528 return;
528 } 529 }
529 Deprecation::countDeprecation(m_frame, feature); 530 Deprecation::countDeprecation(m_frame, feature);
530 } 531 }
531 532
532 } // namespace blink 533 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698