Index: content/renderer/gpu/render_widget_compositor.cc |
diff --git a/content/renderer/gpu/render_widget_compositor.cc b/content/renderer/gpu/render_widget_compositor.cc |
index 33612b0acb372936fd2e6a378a4caad2d6cae38b..67e26fabc582b3c865e616da7e79e72df1eff765 100644 |
--- a/content/renderer/gpu/render_widget_compositor.cc |
+++ b/content/renderer/gpu/render_widget_compositor.cc |
@@ -19,6 +19,7 @@ |
#include "cc/base/switches.h" |
#include "cc/debug/layer_tree_debug_state.h" |
#include "cc/debug/micro_benchmark.h" |
+#include "cc/input/layer_selection_bound.h" |
#include "cc/layers/layer.h" |
#include "cc/output/copy_output_request.h" |
#include "cc/output/copy_output_result.h" |
@@ -33,6 +34,7 @@ |
#include "content/renderer/render_thread_impl.h" |
#include "gpu/command_buffer/client/gles2_interface.h" |
#include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallback.h" |
+#include "third_party/WebKit/public/platform/WebSelectionBound.h" |
#include "third_party/WebKit/public/platform/WebSize.h" |
#include "third_party/WebKit/public/web/WebWidget.h" |
#include "ui/gfx/frame_time.h" |
@@ -48,6 +50,7 @@ class Layer; |
} |
using blink::WebFloatPoint; |
+using blink::WebSelectionBound; |
using blink::WebSize; |
using blink::WebRect; |
@@ -73,6 +76,27 @@ bool GetSwitchValueAsInt( |
} |
} |
+cc::LayerSelectionBound ConvertWebSelectionBound( |
+ const WebSelectionBound& bound) { |
+ DCHECK(bound.layerId); |
+ |
+ cc::LayerSelectionBound result; |
+ switch (bound.type) { |
+ case blink::WebSelectionBound::Caret: |
+ result.type = cc::SELECTION_BOUND_CENTER; |
+ break; |
+ case blink::WebSelectionBound::SelectionLeft: |
+ result.type = cc::SELECTION_BOUND_LEFT; |
+ break; |
+ case blink::WebSelectionBound::SelectionRight: |
+ result.type = cc::SELECTION_BOUND_RIGHT; |
+ break; |
+ } |
+ result.layer_id = bound.layerId; |
+ result.layer_rect = gfx::Rect(bound.edgeRectInLayer); |
+ return result; |
+} |
+ |
} // namespace |
// static |
@@ -567,6 +591,18 @@ void RenderWidgetCompositor::clearViewportLayers() { |
scoped_refptr<cc::Layer>()); |
} |
+void RenderWidgetCompositor::registerSelection( |
+ const blink::WebSelectionBound& anchor, |
+ const blink::WebSelectionBound& focus) { |
+ layer_tree_host_->RegisterSelection(ConvertWebSelectionBound(anchor), |
+ ConvertWebSelectionBound(focus)); |
+} |
+ |
+void RenderWidgetCompositor::clearSelection() { |
+ cc::LayerSelectionBound empty_selection; |
+ layer_tree_host_->RegisterSelection(empty_selection, empty_selection); |
+} |
+ |
void CompositeAndReadbackAsyncCallback( |
blink::WebCompositeAndReadbackAsyncCallback* callback, |
scoped_ptr<cc::CopyOutputResult> result) { |