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

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: Proper visibility 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..65525a92eafb0a2b4d7df2925e9dea4b959a51e6 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() {

Powered by Google App Engine
This is Rietveld 408576698