Chromium Code Reviews| 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/EventHandlerRegistry.h" | 9 #include "core/frame/EventHandlerRegistry.h" |
| 10 #include "core/frame/FrameHost.h" | 10 #include "core/frame/FrameHost.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 PlatformTouchPoint::TouchState pointState = point.state(); | 170 PlatformTouchPoint::TouchState pointState = point.state(); |
| 171 | 171 |
| 172 if (touchInfo.consumed) | 172 if (touchInfo.consumed) |
| 173 continue; | 173 continue; |
| 174 | 174 |
| 175 Touch* touch = Touch::create( | 175 Touch* touch = Touch::create( |
| 176 touchInfo.targetFrame.get(), | 176 touchInfo.targetFrame.get(), |
| 177 touchInfo.touchNode.get(), | 177 touchInfo.touchNode.get(), |
| 178 point.id(), | 178 point.id(), |
| 179 point.screenPos(), | 179 point.screenPos(), |
| 180 touchInfo.adjustedPagePoint, | 180 touchInfo.contentPoint, |
| 181 touchInfo.adjustedRadius, | 181 touchInfo.adjustedRadius, |
| 182 point.rotationAngle(), | 182 point.rotationAngle(), |
| 183 point.force(), | 183 point.force(), |
| 184 touchInfo.region); | 184 touchInfo.region); |
| 185 | 185 |
| 186 // Ensure this target's touch list exists, even if it ends up empty, so | 186 // Ensure this target's touch list exists, even if it ends up empty, so |
| 187 // it can always be passed to TouchEvent::Create below. | 187 // it can always be passed to TouchEvent::Create below. |
| 188 TargetTouchesHeapMap::iterator targetTouchesIterator = touchesByTarget.f ind(touchInfo.touchNode.get()); | 188 TargetTouchesHeapMap::iterator targetTouchesIterator = touchesByTarget.f ind(touchInfo.touchNode.get()); |
| 189 if (targetTouchesIterator == touchesByTarget.end()) { | 189 if (targetTouchesIterator == touchesByTarget.end()) { |
| 190 touchesByTarget.set(touchInfo.touchNode.get(), TouchList::create()); | 190 touchesByTarget.set(touchInfo.touchNode.get(), TouchList::create()); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 372 touchNode = m_touchSequenceDocument; | 372 touchNode = m_touchSequenceDocument; |
| 373 targetFrame = m_touchSequenceDocument->frame(); | 373 targetFrame = m_touchSequenceDocument->frame(); |
| 374 } | 374 } |
| 375 ASSERT(targetFrame); | 375 ASSERT(targetFrame); |
| 376 | 376 |
| 377 // pagePoint should always be in the target element's document coordinat es. | 377 // pagePoint should always be in the target element's document coordinat es. |
| 378 FloatPoint pagePoint = targetFrame->view()->rootFrameToContents( | 378 FloatPoint pagePoint = targetFrame->view()->rootFrameToContents( |
| 379 touchInfo.point.pos()); | 379 touchInfo.point.pos()); |
| 380 float scaleFactor = 1.0f / targetFrame->pageZoomFactor(); | 380 float scaleFactor = 1.0f / targetFrame->pageZoomFactor(); |
| 381 | 381 |
| 382 FloatPoint scrollPosition = targetFrame->view()->scrollPosition(); | |
| 383 | |
| 382 touchInfo.touchNode = touchNode; | 384 touchInfo.touchNode = touchNode; |
| 383 touchInfo.targetFrame = targetFrame; | 385 touchInfo.targetFrame = targetFrame; |
| 384 touchInfo.adjustedPagePoint = pagePoint.scaledBy(scaleFactor); | 386 touchInfo.contentPoint = pagePoint.scaledBy(scaleFactor); |
| 387 touchInfo.framePoint = touchInfo.contentPoint; | |
| 388 touchInfo.framePoint.moveBy(scrollPosition.scaledBy(-scaleFactor)); | |
|
bokan
2016/05/09 18:13:08
Use Frame::contentsToFrame rather than manually mo
Navid Zolghadr
2016/05/09 18:59:04
Done.
| |
| 385 touchInfo.adjustedRadius = touchInfo.point.radius().scaledBy(scaleFactor ); | 389 touchInfo.adjustedRadius = touchInfo.point.radius().scaledBy(scaleFactor ); |
| 386 touchInfo.knownTarget = knownTarget; | 390 touchInfo.knownTarget = knownTarget; |
| 387 touchInfo.consumed = false; | 391 touchInfo.consumed = false; |
| 388 touchInfo.region = regionID; | 392 touchInfo.region = regionID; |
| 389 } | 393 } |
| 390 } | 394 } |
| 391 | 395 |
| 392 bool TouchEventManager::generateTouchInfosAfterHittest( | 396 bool TouchEventManager::generateTouchInfosAfterHittest( |
| 393 const PlatformTouchEvent& event, | 397 const PlatformTouchEvent& event, |
| 394 HeapVector<TouchInfo>& touchInfos) | 398 HeapVector<TouchInfo>& touchInfos) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 } | 508 } |
| 505 | 509 |
| 506 DEFINE_TRACE(TouchEventManager) | 510 DEFINE_TRACE(TouchEventManager) |
| 507 { | 511 { |
| 508 visitor->trace(m_frame); | 512 visitor->trace(m_frame); |
| 509 visitor->trace(m_touchSequenceDocument); | 513 visitor->trace(m_touchSequenceDocument); |
| 510 visitor->trace(m_targetForTouchID); | 514 visitor->trace(m_targetForTouchID); |
| 511 } | 515 } |
| 512 | 516 |
| 513 } // namespace blink | 517 } // namespace blink |
| OLD | NEW |