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) |