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

Side by Side Diff: third_party/WebKit/Source/web/WebInputEventConversion.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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 return TransformWebTouchEvent(FrameScale(frame_view), 188 return TransformWebTouchEvent(FrameScale(frame_view),
189 FrameTranslation(frame_view), event); 189 FrameTranslation(frame_view), event);
190 } 190 }
191 191
192 WebMouseEventBuilder::WebMouseEventBuilder(const FrameView* plugin_parent, 192 WebMouseEventBuilder::WebMouseEventBuilder(const FrameView* plugin_parent,
193 const LayoutItem layout_item, 193 const LayoutItem layout_item,
194 const MouseEvent& event) { 194 const MouseEvent& event) {
195 if (event.NativeEvent()) { 195 if (event.NativeEvent()) {
196 *static_cast<WebMouseEvent*>(this) = 196 *static_cast<WebMouseEvent*>(this) =
197 event.NativeEvent()->FlattenTransform(); 197 event.NativeEvent()->FlattenTransform();
198 WebFloatPoint absolute_root_frame_location = PositionInRootFrame(); 198 WebFloatPoint absolute_root_frame_location = PositionInRootFrame();
mustaq 2017/04/12 15:38:38 Nit: after flattening, s/PositionInRootFrame()/Pos
bokan 2017/04/12 17:28:44 Isn't the transform what gets us from Widget to Ro
mustaq 2017/04/12 17:52:04 |PositionInRootFrame| is correct but I thought |Po
dtapuska 2017/04/12 19:02:56 Ya it is the same. But for readability sake we pro
199
200 // Translate the root frame position to content coordinates.
201 if (plugin_parent) {
bokan 2017/04/12 17:28:44 There seems to be only one call site and plugin_pa
dtapuska 2017/04/12 19:02:56 Done.
202 absolute_root_frame_location =
203 plugin_parent->RootFrameToContents(absolute_root_frame_location);
204 }
205
199 IntPoint local_point = RoundedIntPoint(layout_item.AbsoluteToLocal( 206 IntPoint local_point = RoundedIntPoint(layout_item.AbsoluteToLocal(
200 absolute_root_frame_location, kUseTransforms)); 207 absolute_root_frame_location, kUseTransforms));
201 SetPositionInWidget(local_point.X(), local_point.Y()); 208 SetPositionInWidget(local_point.X(), local_point.Y());
202 return; 209 return;
203 } 210 }
204 211
205 // Code below here can be removed once OOPIF ships. 212 // Code below here can be removed once OOPIF ships.
206 // OOPIF will prevent synthetic events being dispatched into 213 // OOPIF will prevent synthetic events being dispatched into
207 // other frames; but for now we allow the fallback to generate 214 // other frames; but for now we allow the fallback to generate
208 // WebMouseEvents from synthetic events. 215 // WebMouseEvents from synthetic events.
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
372 Vector<WebTouchEvent> result; 379 Vector<WebTouchEvent> result;
373 for (const auto& event : coalesced_events) { 380 for (const auto& event : coalesced_events) {
374 DCHECK(WebInputEvent::IsTouchEventType(event->GetType())); 381 DCHECK(WebInputEvent::IsTouchEventType(event->GetType()));
375 result.push_back(TransformWebTouchEvent( 382 result.push_back(TransformWebTouchEvent(
376 scale, translation, static_cast<const WebTouchEvent&>(*event))); 383 scale, translation, static_cast<const WebTouchEvent&>(*event)));
377 } 384 }
378 return result; 385 return result;
379 } 386 }
380 387
381 } // namespace blink 388 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698