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

Unified Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 2813903006: Fix frame coordinate translation issue with scroll views. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
index dfce5182a8173185557ecc8d4d5e719928dacb2c..ad9aa19e129a9810780408a2ad54de0603dea9ee 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -761,11 +761,16 @@ void WebPluginContainerImpl::handleDragEvent(MouseEvent* event) {
}
void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) {
- WebFloatPoint absoluteRootFrameLocation =
- event->nativeEvent().positionInRootFrame();
+ WebFloatPoint absoluteLocation = event->nativeEvent().positionInRootFrame();
+ FrameView* view = toFrameView(parent());
+ // Translate the root frame position to content coordinates.
+ if (view) {
+ absoluteLocation = view->rootFrameToContents(absoluteLocation);
+ }
+
IntPoint localPoint =
roundedIntPoint(m_element->layoutObject()->absoluteToLocal(
- absoluteRootFrameLocation, UseTransforms));
+ absoluteLocation, UseTransforms));
WebMouseWheelEvent translatedEvent = event->nativeEvent().flattenTransform();
translatedEvent.x = localPoint.x();
translatedEvent.y = localPoint.y();
@@ -826,12 +831,17 @@ void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) {
WebTouchEvent transformedEvent = event->nativeEvent()->flattenTransform();
+ FrameView* view = toFrameView(parent());
+
for (unsigned i = 0; i < transformedEvent.touchesLength; ++i) {
- WebFloatPoint absoluteRootFrameLocation =
- transformedEvent.touches[i].position;
+ WebFloatPoint absoluteLocation = transformedEvent.touches[i].position;
+ // Translate the root frame position to content coordinates.
+ if (view) {
+ absoluteLocation = view->rootFrameToContents(absoluteLocation);
+ }
IntPoint localPoint =
roundedIntPoint(m_element->layoutObject()->absoluteToLocal(
- absoluteRootFrameLocation, UseTransforms));
+ absoluteLocation, UseTransforms));
transformedEvent.touches[i].position.x = localPoint.x();
transformedEvent.touches[i].position.y = localPoint.y();
}

Powered by Google App Engine
This is Rietveld 408576698