OLD | NEW |
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 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // |m_touchSequenceDocument|. | 253 // |m_touchSequenceDocument|. |
253 if (m_touchSequenceDocument && (!touchInfo.touchNode | 254 if (m_touchSequenceDocument && (!touchInfo.touchNode |
254 || &touchInfo.touchNode->document() != m_touchSequenceDocument))
{ | 255 || &touchInfo.touchNode->document() != m_touchSequenceDocument))
{ |
255 if (m_touchSequenceDocument->frame()) { | 256 if (m_touchSequenceDocument->frame()) { |
256 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD
ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); | 257 LayoutPoint framePoint = roundedLayoutPoint(m_touchSequenceD
ocument->frame()->view()->rootFrameToContents(touchInfo.point.pos())); |
257 result = EventHandler::hitTestResultInFrame(m_touchSequenceD
ocument->frame(), framePoint, hitType); | 258 result = EventHandler::hitTestResultInFrame(m_touchSequenceD
ocument->frame(), framePoint, hitType); |
258 Node* node = result.innerNode(); | 259 Node* node = result.innerNode(); |
259 if (!node) | 260 if (!node) |
260 continue; | 261 continue; |
261 if (isHTMLCanvasElement(node)) { | 262 if (isHTMLCanvasElement(node)) { |
262 std::pair<Element*, String> regionInfo = toHTMLCanvasEle
ment(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); | 263 HitTestCanvasResult* hitTestCanvasResult = toHTMLCanvasE
lement(node)->getControlAndIdIfHitRegionExists(result.pointInInnerNodeFrame()); |
263 if (regionInfo.first) | 264 if (hitTestCanvasResult->getControl()) |
264 node = regionInfo.first; | 265 node = hitTestCanvasResult->getControl(); |
265 touchInfo.region = regionInfo.second; | 266 touchInfo.region = hitTestCanvasResult->getId(); |
266 } | 267 } |
267 // Touch events should not go to text nodes. | 268 // Touch events should not go to text nodes. |
268 if (node->isTextNode()) | 269 if (node->isTextNode()) |
269 node = FlatTreeTraversal::parent(*node); | 270 node = FlatTreeTraversal::parent(*node); |
270 touchInfo.touchNode = node; | 271 touchInfo.touchNode = node; |
271 } else { | 272 } else { |
272 continue; | 273 continue; |
273 } | 274 } |
274 } | 275 } |
275 if (!touchInfo.touchNode) | 276 if (!touchInfo.touchNode) |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; | 534 feature = UseCounter::TouchEndDuringScrollUserGestureUtilized; |
534 break; | 535 break; |
535 default: | 536 default: |
536 NOTREACHED(); | 537 NOTREACHED(); |
537 return; | 538 return; |
538 } | 539 } |
539 Deprecation::countDeprecation(m_frame, feature); | 540 Deprecation::countDeprecation(m_frame, feature); |
540 } | 541 } |
541 | 542 |
542 } // namespace blink | 543 } // namespace blink |
OLD | NEW |