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

Side by Side Diff: content/browser/frame_host/render_widget_host_view_guest.cc

Issue 1203223002: [Experimental, WIP] Demo version of extracting WebView selection data from CompositorFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind_helpers.h" 5 #include "base/bind_helpers.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/output/viewport_selection_bound.h"
9 #include "cc/surfaces/surface.h" 10 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_factory.h" 11 #include "cc/surfaces/surface_factory.h"
11 #include "cc/surfaces/surface_manager.h" 12 #include "cc/surfaces/surface_manager.h"
12 #include "cc/surfaces/surface_sequence.h" 13 #include "cc/surfaces/surface_sequence.h"
13 #include "content/browser/browser_plugin/browser_plugin_guest.h" 14 #include "content/browser/browser_plugin/browser_plugin_guest.h"
14 #include "content/browser/compositor/surface_utils.h" 15 #include "content/browser/compositor/surface_utils.h"
15 #include "content/browser/frame_host/render_widget_host_view_guest.h" 16 #include "content/browser/frame_host/render_widget_host_view_guest.h"
16 #include "content/browser/renderer_host/render_view_host_impl.h" 17 #include "content/browser/renderer_host/render_view_host_impl.h"
17 #include "content/common/browser_plugin/browser_plugin_messages.h" 18 #include "content/common/browser_plugin/browser_plugin_messages.h"
18 #include "content/common/frame_messages.h" 19 #include "content/common/frame_messages.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // When not using surfaces, the frame just gets proxied to 215 // When not using surfaces, the frame just gets proxied to
215 // the embedder's renderer to be composited. 216 // the embedder's renderer to be composited.
216 if (!frame->delegated_frame_data || !use_surfaces_) { 217 if (!frame->delegated_frame_data || !use_surfaces_) {
217 guest_->SwapCompositorFrame(output_surface_id, 218 guest_->SwapCompositorFrame(output_surface_id,
218 host_->GetProcess()->GetID(), 219 host_->GetProcess()->GetID(),
219 host_->GetRoutingID(), 220 host_->GetRoutingID(),
220 frame.Pass()); 221 frame.Pass());
221 return; 222 return;
222 } 223 }
223 224
225 DCHECK(platform_view_);
226 // Only forward our selection information if (1) we have focus, and (2) our
227 // focused node isn't a plugin (which might be a nested browser plugin, in
228 // which case its RenderWidgetHoseViewGuest will forward the selection
229 // information).
230 if (guest_->focused() && !platform_view_->focused_node_is_plugin()) {
231 cc::ViewportSelectionBound start = frame->metadata.selection.start;
232 gfx::PointF edge_top = guest_->GetScreenCoordinates(start.edge_top);
233 gfx::PointF edge_bottom = guest_->GetScreenCoordinates(start.edge_bottom);
234 fprintf(stderr, "wjm: RWHVG::OnSwapCompositorFrame(%p) Screen "
235 "edge_top=(%6.1f,%6.1f) edge_bottom=(%6.1f,%6.1f)\n",
236 this, edge_top.x(), edge_top.y(), edge_bottom.x(), edge_bottom.y());
237 fprintf(stderr, "wjm: RWHVG::OnSwapCompositorFrame(%p) Window "
238 "edge_top=(%6.1f,%6.1f) edge_bottom=(%6.1f,%6.1f)\n",
239 this, start.edge_top.x(), start.edge_top.y(),
240 start.edge_bottom.x(), start.edge_bottom.y());
241 }
242
224 cc::RenderPass* root_pass = 243 cc::RenderPass* root_pass =
225 frame->delegated_frame_data->render_pass_list.back(); 244 frame->delegated_frame_data->render_pass_list.back();
226 245
227 gfx::Size frame_size = root_pass->output_rect.size(); 246 gfx::Size frame_size = root_pass->output_rect.size();
228 float scale_factor = frame->metadata.device_scale_factor; 247 float scale_factor = frame->metadata.device_scale_factor;
229 248
230 guest_->UpdateGuestSizeIfNecessary(frame_size, scale_factor); 249 guest_->UpdateGuestSizeIfNecessary(frame_size, scale_factor);
231 250
232 // Check whether we need to recreate the cc::Surface, which means the child 251 // Check whether we need to recreate the cc::Surface, which means the child
233 // frame renderer has changed its output surface, or size, or scale factor. 252 // frame renderer has changed its output surface, or size, or scale factor.
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 } 677 }
659 678
660 if (blink::WebInputEvent::isGestureEventType(event->type)) { 679 if (blink::WebInputEvent::isGestureEventType(event->type)) {
661 host_->ForwardGestureEvent( 680 host_->ForwardGestureEvent(
662 *static_cast<const blink::WebGestureEvent*>(event)); 681 *static_cast<const blink::WebGestureEvent*>(event));
663 return; 682 return;
664 } 683 }
665 } 684 }
666 685
667 } // namespace content 686 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_plugin/browser_plugin_guest.cc ('k') | content/browser/renderer_host/render_view_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698