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

Unified Diff: content/renderer/render_view_impl.cc

Issue 300323005: Route selection bounds updates through the compositor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Defer selection updates until after compositor scheduling Created 6 years, 6 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/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 9544dad2c9917564839e0132361c33248c429ba1..e2f7302b98650f132bc567a798e48242fc7fc25c 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -431,6 +431,14 @@ static bool ShouldUseCompositedScrollingForFrames(
return DeviceScaleEnsuresTextQuality(device_scale_factor);
}
+static bool ShouldUseCompositedSelectionUpdates() {
+#if defined(OS_ANDROID)
+ return true;
+#else
+ return false;
+#endif
+}
+
static bool ShouldUseUniversalAcceleratedCompositingForOverflowScroll() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -755,6 +763,8 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
ShouldUseCompositedScrollingForFrames(device_scale_factor_));
webview()->settings()->setUseExpandedHeuristicsForGpuRasterization(
ShouldUseExpandedHeuristicsForGpuRasterization());
+ webview()->settings()->setCompositedSelectionUpdatesEnabled(
+ ShouldUseCompositedSelectionUpdates());
ApplyWebPreferences(webkit_preferences_, webview());
@@ -989,6 +999,9 @@ void RenderViewImpl::PepperFocusChanged(PepperPluginInstanceImpl* instance,
else if (focused_pepper_plugin_ == instance)
focused_pepper_plugin_ = NULL;
+ if (compositor_)
+ compositor_->SetIgnoreSelectionUpdates(focused_pepper_plugin_ != NULL);
+
UpdateTextInputType();
UpdateSelectionBounds();
}
@@ -3487,7 +3500,7 @@ ui::TextInputType RenderViewImpl::GetTextInputType() {
return RenderWidget::GetTextInputType();
}
-void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
+bool RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
#if defined(ENABLE_PLUGINS)
if (focused_pepper_plugin_) {
// TODO(kinaba) http://crbug.com/101101
@@ -3497,10 +3510,18 @@ void RenderViewImpl::GetSelectionBounds(gfx::Rect* start, gfx::Rect* end) {
gfx::Rect caret = focused_pepper_plugin_->GetCaretBounds();
*start = caret;
*end = caret;
- return;
+ return true;
}
#endif
- RenderWidget::GetSelectionBounds(start, end);
+
+ // With composited selection updates, the selection bounds will be reported
+ // directly by the compositor, in which case explicit IPC selection
+ // notifications should be suppressed.
+ if (compositor_ && webview() &&
+ webview()->settings()->compositedSelectionUpdatesEnabled())
+ return false;
+
+ return RenderWidget::GetSelectionBounds(start, end);
}
#if defined(OS_MACOSX) || defined(USE_AURA)

Powered by Google App Engine
This is Rietveld 408576698