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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_aura.cc

Issue 2417463003: Account for failure of coordinate space transformations in browser (Closed)
Patch Set: Review comments addressed Created 4 years, 2 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_aura.h" 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h"
6 6
7 #include <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 2045 matching lines...) Expand 10 before | Expand all | Expand 10 after
2056 const ui::LatencyInfo& latency) { 2056 const ui::LatencyInfo& latency) {
2057 host_->ForwardTouchEventWithLatencyInfo(event, latency); 2057 host_->ForwardTouchEventWithLatencyInfo(event, latency);
2058 } 2058 }
2059 2059
2060 void RenderWidgetHostViewAura::ProcessGestureEvent( 2060 void RenderWidgetHostViewAura::ProcessGestureEvent(
2061 const blink::WebGestureEvent& event, 2061 const blink::WebGestureEvent& event,
2062 const ui::LatencyInfo& latency) { 2062 const ui::LatencyInfo& latency) {
2063 host_->ForwardGestureEventWithLatencyInfo(event, latency); 2063 host_->ForwardGestureEventWithLatencyInfo(event, latency);
2064 } 2064 }
2065 2065
2066 gfx::Point RenderWidgetHostViewAura::TransformPointToLocalCoordSpace( 2066 bool RenderWidgetHostViewAura::TransformPointToLocalCoordSpace(
2067 const gfx::Point& point, 2067 const gfx::Point& point,
2068 const cc::SurfaceId& original_surface) { 2068 const cc::SurfaceId& original_surface,
2069 gfx::Point transformed_point; 2069 gfx::Point* transformed_point) {
2070 // Transformations use physical pixels rather than DIP, so conversion 2070 // Transformations use physical pixels rather than DIP, so conversion
2071 // is necessary. 2071 // is necessary.
2072 gfx::Point point_in_pixels = 2072 gfx::Point point_in_pixels =
2073 gfx::ConvertPointToPixel(device_scale_factor_, point); 2073 gfx::ConvertPointToPixel(device_scale_factor_, point);
2074 transformed_point = delegated_frame_host_->TransformPointToLocalCoordSpace( 2074 if (!delegated_frame_host_->TransformPointToLocalCoordSpace(
2075 point_in_pixels, original_surface); 2075 point_in_pixels, original_surface, transformed_point))
2076 return gfx::ConvertPointToDIP(device_scale_factor_, transformed_point); 2076 return false;
2077 *transformed_point =
2078 gfx::ConvertPointToDIP(device_scale_factor_, *transformed_point);
2079 return true;
2077 } 2080 }
2078 2081
2079 gfx::Point RenderWidgetHostViewAura::TransformPointToCoordSpaceForView( 2082 bool RenderWidgetHostViewAura::TransformPointToCoordSpaceForView(
2080 const gfx::Point& point, 2083 const gfx::Point& point,
2081 RenderWidgetHostViewBase* target_view) { 2084 RenderWidgetHostViewBase* target_view,
2085 gfx::Point* transformed_point) {
2082 // In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion, 2086 // In TransformPointToLocalCoordSpace() there is a Point-to-Pixel conversion,
2083 // but it is not necessary here because the final target view is responsible 2087 // but it is not necessary here because the final target view is responsible
2084 // for converting before computing the final transform. 2088 // for converting before computing the final transform.
2085 return delegated_frame_host_->TransformPointToCoordSpaceForView(point, 2089 return delegated_frame_host_->TransformPointToCoordSpaceForView(
2086 target_view); 2090 point, target_view, transformed_point);
2087 } 2091 }
2088 2092
2089 void RenderWidgetHostViewAura::FocusedNodeChanged( 2093 void RenderWidgetHostViewAura::FocusedNodeChanged(
2090 bool editable, 2094 bool editable,
2091 const gfx::Rect& node_bounds_in_screen) { 2095 const gfx::Rect& node_bounds_in_screen) {
2092 #if defined(OS_WIN) 2096 #if defined(OS_WIN)
2093 if (!editable && virtual_keyboard_requested_) { 2097 if (!editable && virtual_keyboard_requested_) {
2094 virtual_keyboard_requested_ = false; 2098 virtual_keyboard_requested_ = false;
2095 2099
2096 RenderViewHost* rvh = RenderViewHost::From(host_); 2100 RenderViewHost* rvh = RenderViewHost::From(host_);
(...skipping 979 matching lines...) Expand 10 before | Expand all | Expand 10 after
3076 ->GetTextSelection(focused_view) 3080 ->GetTextSelection(focused_view)
3077 ->GetSelectedText(&selected_text)) { 3081 ->GetSelectedText(&selected_text)) {
3078 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard. 3082 // Set the CLIPBOARD_TYPE_SELECTION to the ui::Clipboard.
3079 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION); 3083 ui::ScopedClipboardWriter clipboard_writer(ui::CLIPBOARD_TYPE_SELECTION);
3080 clipboard_writer.WriteText(selected_text); 3084 clipboard_writer.WriteText(selected_text);
3081 } 3085 }
3082 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) 3086 #endif // defined(USE_X11) && !defined(OS_CHROMEOS)
3083 } 3087 }
3084 3088
3085 } // namespace content 3089 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698