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

Unified Diff: content/browser/renderer_host/render_widget_host_impl.cc

Issue 300323005: Route selection bounds updates through the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 7 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: content/browser/renderer_host/render_widget_host_impl.cc
diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc
index 5afb35d3ee61214ba6724785ebde7a2d0158b34e..c6b6dd3953073d0dd84e7228d8050de539770ad3 100644
--- a/content/browser/renderer_host/render_widget_host_impl.cc
+++ b/content/browser/renderer_host/render_widget_host_impl.cc
@@ -118,6 +118,27 @@ int GetInputRouterViewFlagsFromCompositorFrameMetadata(
return view_flags;
}
+// TODO(jdduke): Remove when all platforms use CompositorFrameMetadata directly
+// and ViewHostMsg_SelectionBounds_Params is no long necessary.
+bool GetSelectionBounds(const cc::CompositorFrameMetadata& metadata,
+ ViewHostMsg_SelectionBounds_Params* bounds) {
+ if (metadata.start_selection_handle.type == cc::SelectionHandle::IGNORED)
+ return false;
+ ViewHostMsg_SelectionBounds_Params params;
+ bounds->anchor_rect = metadata.start_selection_handle.bounds;
+ bounds->focus_rect = metadata.end_selection_handle.bounds;
+ if (metadata.start_selection_handle.type == cc::SelectionHandle::CENTER)
+ bounds->focus_rect = bounds->anchor_rect;
+ // TODO(jdduke): Determine from data.
+ bounds->anchor_dir = blink::WebTextDirectionDefault;
+ bounds->focus_dir = blink::WebTextDirectionDefault;
+ bounds->is_anchor_first =
+ metadata.start_selection_handle.type == cc::SelectionHandle::LEFT;
+ bounds->is_anchor_visible = metadata.start_selection_handle.visible;
+ bounds->is_focus_visible = metadata.end_selection_handle.visible;
+ return true;
+}
+
// Implements the RenderWidgetHostIterator interface. It keeps a list of
// RenderWidgetHosts, and makes sure it returns a live RenderWidgetHost at each
// iteration (or NULL if there isn't any left).
@@ -1483,6 +1504,10 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame(
GetInputRouterViewFlagsFromCompositorFrameMetadata(frame->metadata));
if (view_) {
+ ViewHostMsg_SelectionBounds_Params bounds;
+ if (GetSelectionBounds(frame->metadata, &bounds))
+ OnSelectionBoundsChanged(bounds);
+
view_->OnSwapCompositorFrame(output_surface_id, frame.Pass());
view_->DidReceiveRendererFrame();
} else {

Powered by Google App Engine
This is Rietveld 408576698