Index: content/browser/renderer_host/render_widget_host_view_android.cc |
diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc |
index 644343df3754e8b8d962c298eb860135033e7536..c028afe84a67f3281cb05309e1948c0611784f43 100644 |
--- a/content/browser/renderer_host/render_widget_host_view_android.cc |
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc |
@@ -635,9 +635,7 @@ void RenderWidgetHostViewAndroid::SelectionChanged(const base::string16& text, |
void RenderWidgetHostViewAndroid::SelectionBoundsChanged( |
const ViewHostMsg_SelectionBounds_Params& params) { |
- if (content_view_core_) { |
- content_view_core_->OnSelectionBoundsChanged(params); |
- } |
+ NOTREACHED() << "Selection bounds should be routed through the compositor."; |
} |
void RenderWidgetHostViewAndroid::ScrollOffsetChanged() { |
@@ -894,6 +892,10 @@ void RenderWidgetHostViewAndroid::InternalSwapCompositorFrame( |
SwapDelegatedFrame(output_surface_id, frame->delegated_frame_data.Pass()); |
frame_evictor_->SwappedFrame(!host_->is_hidden()); |
+ |
+ // As the selection bound updates may trigger view invalidation, always call |
+ // it after any potential compositor scheduling. |
+ UpdateSelectionBounds(frame->metadata); |
} |
void RenderWidgetHostViewAndroid::OnSwapCompositorFrame( |
@@ -929,6 +931,7 @@ void RenderWidgetHostViewAndroid::SynchronousFrameMetadata( |
// compositor flow. |
OnFrameMetadataUpdated(frame_metadata); |
ComputeContentsSize(frame_metadata); |
+ UpdateSelectionBounds(frame_metadata); |
// DevTools ScreenCast support for Android WebView. |
if (DevToolsAgentHost::HasFor(RenderViewHost::From(GetRenderWidgetHost()))) { |
@@ -1000,6 +1003,7 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( |
frame_metadata.location_bar_offset, |
frame_metadata.location_bar_content_translation, |
frame_metadata.overdraw_bottom_height); |
+ |
aelias_OOO_until_Jul13
2014/06/12 06:22:42
nit: unnecessary newline
jdduke (slow)
2014/06/12 18:32:44
Done.
|
#if defined(VIDEO_HOLE) |
if (host_ && host_->IsRenderView()) { |
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>( |
@@ -1009,6 +1013,35 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated( |
#endif // defined(VIDEO_HOLE) |
} |
+void RenderWidgetHostViewAndroid::UpdateSelectionBounds( |
+ const cc::CompositorFrameMetadata& frame_metadata) { |
+ if (!content_view_core_) |
+ return; |
+ |
+ const cc::SelectionBound& anchor = frame_metadata.selection_anchor; |
+ const cc::SelectionBound& focus = frame_metadata.selection_focus; |
+ |
+ if (cached_selection_anchor_ == anchor && cached_selection_focus_ == focus) |
+ return; |
+ |
+ TRACE_EVENT0("input", "RenderWidgetHostViewAndroid::UpdateSelectionBounds"); |
+ |
+ cached_selection_anchor_ = anchor; |
+ cached_selection_focus_ = focus; |
+ |
+ content_view_core_->OnSelectionBoundsChanged( |
+ anchor.viewport_rect.bottom_left(), |
+ focus.viewport_rect.bottom_left(), |
+ anchor.type == cc::SELECTION_BOUND_RIGHT |
+ ? blink::WebTextDirectionRightToLeft |
+ : blink::WebTextDirectionDefault, |
+ focus.type == cc::SELECTION_BOUND_LEFT |
+ ? blink::WebTextDirectionRightToLeft |
+ : blink::WebTextDirectionDefault, |
+ anchor.visible, |
+ focus.visible); |
+} |
+ |
void RenderWidgetHostViewAndroid::AcceleratedSurfaceInitialized(int host_id, |
int route_id) { |
accelerated_surface_route_id_ = route_id; |