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

Side by Side Diff: third_party/WebKit/Source/web/WebPluginContainerImpl.cpp

Issue 2814473003: 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 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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 case kTouchEventRequestTypeRaw: { 823 case kTouchEventRequestTypeRaw: {
824 if (!event->NativeEvent()) 824 if (!event->NativeEvent())
825 return; 825 return;
826 826
827 if (event->type() == EventTypeNames::touchstart) 827 if (event->type() == EventTypeNames::touchstart)
828 FocusPlugin(); 828 FocusPlugin();
829 829
830 WebTouchEvent transformed_event = 830 WebTouchEvent transformed_event =
831 event->NativeEvent()->FlattenTransform(); 831 event->NativeEvent()->FlattenTransform();
832 832
833 FrameView* view = ToFrameView(Parent());
834
833 for (unsigned i = 0; i < transformed_event.touches_length; ++i) { 835 for (unsigned i = 0; i < transformed_event.touches_length; ++i) {
834 WebFloatPoint absolute_root_frame_location = 836 WebFloatPoint absolute_root_frame_location =
835 transformed_event.touches[i].position; 837 transformed_event.touches[i].position;
838
839 // Translate the absolute position to content coordinates.
840 if (view) {
841 absolute_root_frame_location =
842 view->RootFrameToContents(absolute_root_frame_location);
843 }
844
836 IntPoint local_point = 845 IntPoint local_point =
837 RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal( 846 RoundedIntPoint(element_->GetLayoutObject()->AbsoluteToLocal(
838 absolute_root_frame_location, kUseTransforms)); 847 absolute_root_frame_location, kUseTransforms));
839 transformed_event.touches[i].position.x = local_point.X(); 848 transformed_event.touches[i].position.x = local_point.X();
840 transformed_event.touches[i].position.y = local_point.Y(); 849 transformed_event.touches[i].position.y = local_point.Y();
841 } 850 }
842 851
843 WebCursorInfo cursor_info; 852 WebCursorInfo cursor_info;
844 if (web_plugin_->HandleInputEvent(transformed_event, cursor_info) != 853 if (web_plugin_->HandleInputEvent(transformed_event, cursor_info) !=
845 WebInputEventResult::kNotHandled) 854 WebInputEventResult::kNotHandled)
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 ComputeClipRectsForPlugin(element_, window_rect, clip_rect, 1004 ComputeClipRectsForPlugin(element_, window_rect, clip_rect,
996 unobscured_rect); 1005 unobscured_rect);
997 } 1006 }
998 GetPluginOcclusions(element_, this->Parent(), FrameRect(), cut_out_rects); 1007 GetPluginOcclusions(element_, this->Parent(), FrameRect(), cut_out_rects);
999 // Convert to the plugin position. 1008 // Convert to the plugin position.
1000 for (size_t i = 0; i < cut_out_rects.size(); i++) 1009 for (size_t i = 0; i < cut_out_rects.size(); i++)
1001 cut_out_rects[i].Move(-FrameRect().X(), -FrameRect().Y()); 1010 cut_out_rects[i].Move(-FrameRect().X(), -FrameRect().Y());
1002 } 1011 }
1003 1012
1004 } // namespace blink 1013 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698