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

Unified Diff: content/browser/renderer_host/render_widget_host_view_android.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_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 dac39c7205f3b9e43634c0cb47eb5f2841c704fc..91e6a49befebd92de7fd6909e0746b5443fef141 100644
--- a/content/browser/renderer_host/render_widget_host_view_android.cc
+++ b/content/browser/renderer_host/render_widget_host_view_android.cc
@@ -189,6 +189,8 @@ RenderWidgetHostViewAndroid::RenderWidgetHostViewAndroid(
gesture_provider_(CreateGestureProviderConfig(), this),
flush_input_requested_(false),
accelerated_surface_route_id_(0),
+ cached_selection_anchor_visible_(false),
+ cached_selection_focus_visible_(false),
using_synchronous_compositor_(SynchronousCompositorImpl::FromID(
widget_host->GetProcess()->GetID(),
widget_host->GetRoutingID()) != NULL),
@@ -635,9 +637,29 @@ void RenderWidgetHostViewAndroid::SelectionChanged(const base::string16& text,
void RenderWidgetHostViewAndroid::SelectionBoundsChanged(
const ViewHostMsg_SelectionBounds_Params& params) {
- if (content_view_core_) {
- content_view_core_->OnSelectionBoundsChanged(params);
- }
+ if (!content_view_core_)
+ return;
+
+ const gfx::PointF anchor = params.anchor_rect.bottom_left();
+ const gfx::PointF focus = params.focus_rect.bottom_left();
+
+ if (cached_selection_anchor_ == anchor && cached_selection_focus_ == focus &&
+ cached_selection_anchor_visible_ == params.is_anchor_visible &&
+ cached_selection_focus_visible_ == params.is_focus_visible)
+ return;
+
+ cached_selection_anchor_ = anchor;
+ cached_selection_focus_ = focus;
+ cached_selection_anchor_visible_ = params.is_anchor_visible;
+ cached_selection_focus_visible_ = params.is_focus_visible;
+
+ content_view_core_->OnSelectionBoundsChanged(anchor,
+ focus,
+ params.anchor_dir,
+ params.focus_dir,
+ params.is_anchor_first,
+ params.is_anchor_visible,
+ params.is_focus_visible);
}
void RenderWidgetHostViewAndroid::ScrollOffsetChanged() {
@@ -985,6 +1007,7 @@ void RenderWidgetHostViewAndroid::OnFrameMetadataUpdated(
frame_metadata.location_bar_offset,
frame_metadata.location_bar_content_translation,
frame_metadata.overdraw_bottom_height);
+
#if defined(VIDEO_HOLE)
if (host_ && host_->IsRenderView()) {
RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(

Powered by Google App Engine
This is Rietveld 408576698