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

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

Issue 2814473003: Fix frame coordinate translation issue with scroll views. (Closed)
Patch Set: Add unittest 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 7802cd487bbc30deeef86de85c1bef7fb4cb9b58..04138dd602db31c35c883e04d8729e8f55785fc4 100644
--- a/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebPluginContainerImpl.cpp
@@ -710,6 +710,8 @@ void WebPluginContainerImpl::HandleMouseEvent(MouseEvent* event) {
// in the call to HandleEvent. See http://b/issue?id=1362948
FrameView* parent_view = ToFrameView(Parent());
+ // TODO(dtapuska): Move WebMouseEventBuilder into the anonymous namespace
+ // in this class.
WebMouseEventBuilder transformed_event(
ToFrameView(Parent()), LayoutItem(element_->GetLayoutObject()), *event);
if (transformed_event.GetType() == WebInputEvent::kUndefined)
@@ -767,6 +769,14 @@ void WebPluginContainerImpl::HandleDragEvent(MouseEvent* event) {
void WebPluginContainerImpl::HandleWheelEvent(WheelEvent* event) {
WebFloatPoint absolute_root_frame_location =
bokan 2017/04/12 17:28:44 This (and below) should now be called absolute_loc
dtapuska 2017/04/12 19:02:56 Done.
event->NativeEvent().PositionInRootFrame();
+
+ FrameView* view = ToFrameView(Parent());
+ // Translate the root frame position to content coordinates.
+ if (view) {
+ absolute_root_frame_location =
+ view->RootFrameToContents(absolute_root_frame_location);
+ }
+
IntPoint local_point =
RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal(
absolute_root_frame_location, kUseTransforms));
@@ -830,9 +840,18 @@ void WebPluginContainerImpl::HandleTouchEvent(TouchEvent* event) {
WebTouchEvent transformed_event =
event->NativeEvent()->FlattenTransform();
+ FrameView* view = ToFrameView(Parent());
+
for (unsigned i = 0; i < transformed_event.touches_length; ++i) {
WebFloatPoint absolute_root_frame_location =
transformed_event.touches[i].position;
+
+ // Translate the root frame position to content coordinates.
+ if (view) {
+ absolute_root_frame_location =
+ view->RootFrameToContents(absolute_root_frame_location);
+ }
+
IntPoint local_point =
RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal(
absolute_root_frame_location, kUseTransforms));

Powered by Google App Engine
This is Rietveld 408576698