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

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: 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/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index 7257b007bca385082e9e507b6c4678334854ab50..3ec8ee7bdd505ef8adf0bc61b68f1136984694f9 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -431,6 +431,18 @@ static bool ShouldUseCompositedScrollingForFrames(
return DeviceScaleEnsuresTextQuality(device_scale_factor);
}
+static bool ShouldUseCompositedSelectionUpdates() {
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
+ if (command_line.HasSwitch(switches::kDisableCompositedSelectionUpdates))
+ return false;
+
+ if (command_line.HasSwitch(switches::kEnableCompositedSelectionUpdates))
+ return true;
+
+ return false;
+}
+
static bool ShouldUseUniversalAcceleratedCompositingForOverflowScroll() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
@@ -751,6 +763,8 @@ void RenderViewImpl::Initialize(RenderViewImplParams* params) {
ShouldUseAcceleratedFixedRootBackground(device_scale_factor_));
webview()->settings()->setCompositedScrollingForFramesEnabled(
ShouldUseCompositedScrollingForFrames(device_scale_factor_));
+ webview()->settings()->setCompositedSelectionUpdatesEnabled(
+ ShouldUseCompositedSelectionUpdates());
ApplyWebPreferences(webkit_preferences_, webview());
@@ -986,6 +1000,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();
}
@@ -3494,7 +3511,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
@@ -3504,10 +3521,15 @@ 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);
+
+ 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