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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_gtk.cc

Issue 10735010: 3D Compositing in <browser>, first draft. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/renderer_host/render_widget_host_view_gtk.h" 5 #include "content/browser/renderer_host/render_widget_host_view_gtk.h"
6 6
7 // If this gets included after the gtk headers, then a bunch of compiler 7 // If this gets included after the gtk headers, then a bunch of compiler
8 // errors happen because of a "#define Status int" in Xlib.h, which interacts 8 // errors happen because of a "#define Status int" in Xlib.h, which interacts
9 // badly with net::URLRequestStatus::Status. 9 // badly with net::URLRequestStatus::Status.
10 #include "content/common/view_messages.h" 10 #include "content/common/view_messages.h"
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 RenderWidgetHostImpl::From( 560 RenderWidgetHostImpl::From(
561 host_view->GetRenderWidgetHost())->ForwardWheelEvent(web_event); 561 host_view->GetRenderWidgetHost())->ForwardWheelEvent(web_event);
562 return FALSE; 562 return FALSE;
563 } 563 }
564 564
565 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget); 565 DISALLOW_IMPLICIT_CONSTRUCTORS(RenderWidgetHostViewGtkWidget);
566 }; 566 };
567 567
568 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk( 568 RenderWidgetHostViewGtk::RenderWidgetHostViewGtk(
569 content::RenderWidgetHost* widget_host) 569 content::RenderWidgetHost* widget_host)
570 : host_(RenderWidgetHostImpl::From(widget_host)), 570 : RenderWidgetHostViewBase(scoped_ptr<CompositingDelegate> (new CompositingD elegateGtk(this)).Pass()),
571 host_(RenderWidgetHostImpl::From(widget_host)),
571 about_to_validate_and_paint_(false), 572 about_to_validate_and_paint_(false),
572 is_hidden_(false), 573 is_hidden_(false),
573 is_loading_(false), 574 is_loading_(false),
574 parent_(NULL), 575 parent_(NULL),
575 is_popup_first_mouse_release_(true), 576 is_popup_first_mouse_release_(true),
576 was_imcontext_focused_before_grab_(false), 577 was_imcontext_focused_before_grab_(false),
577 do_x_grab_(false), 578 do_x_grab_(false),
578 is_fullscreen_(false), 579 is_fullscreen_(false),
579 made_active_(false), 580 made_active_(false),
580 destroy_handler_id_(0), 581 destroy_handler_id_(0),
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1019 1020
1020 void RenderWidgetHostViewGtk::CopyFromCompositingSurface( 1021 void RenderWidgetHostViewGtk::CopyFromCompositingSurface(
1021 const gfx::Size& size, 1022 const gfx::Size& size,
1022 skia::PlatformCanvas* output, 1023 skia::PlatformCanvas* output,
1023 base::Callback<void(bool)> callback) { 1024 base::Callback<void(bool)> callback) {
1024 // TODO(mazda): Implement this. 1025 // TODO(mazda): Implement this.
1025 NOTIMPLEMENTED(); 1026 NOTIMPLEMENTED();
1026 callback.Run(false); 1027 callback.Run(false);
1027 } 1028 }
1028 1029
1029 void RenderWidgetHostViewGtk::AcceleratedSurfaceBuffersSwapped( 1030 void RenderWidgetHostViewGtk::CompositingDelegateGtk::AcceleratedSurfaceBuffersS wapped(
1030 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, 1031 const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params,
1031 int gpu_host_id) { 1032 int gpu_host_id) {
1032 RenderWidgetHostImpl::AcknowledgeBufferPresent( 1033 RenderWidgetHostImpl::AcknowledgeBufferPresent(
1033 params.route_id, gpu_host_id, 0); 1034 params.route_id, gpu_host_id, 0);
1034 } 1035 }
1035 1036
1036 void RenderWidgetHostViewGtk::AcceleratedSurfacePostSubBuffer( 1037 void RenderWidgetHostViewGtk::CompositingDelegateGtk::AcceleratedSurfacePostSubB uffer(
1037 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params, 1038 const GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params& params,
1038 int gpu_host_id) { 1039 int gpu_host_id) {
1039 RenderWidgetHostImpl::AcknowledgeBufferPresent( 1040 RenderWidgetHostImpl::AcknowledgeBufferPresent(
1040 params.route_id, gpu_host_id, 0); 1041 params.route_id, gpu_host_id, 0);
1041 } 1042 }
1042 1043
1043 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() { 1044 void RenderWidgetHostViewGtk::AcceleratedSurfaceSuspend() {
1044 } 1045 }
1045 1046
1046 bool RenderWidgetHostViewGtk::HasAcceleratedSurface( 1047 bool RenderWidgetHostViewGtk::HasAcceleratedSurface(
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 GdkRectangle frame_extents; 1242 GdkRectangle frame_extents;
1242 GdkWindow* gdk_window = gtk_widget_get_window(toplevel); 1243 GdkWindow* gdk_window = gtk_widget_get_window(toplevel);
1243 if (!gdk_window) 1244 if (!gdk_window)
1244 return gfx::Rect(); 1245 return gfx::Rect();
1245 1246
1246 gdk_window_get_frame_extents(gdk_window, &frame_extents); 1247 gdk_window_get_frame_extents(gdk_window, &frame_extents);
1247 return gfx::Rect(frame_extents.x, frame_extents.y, 1248 return gfx::Rect(frame_extents.x, frame_extents.y,
1248 frame_extents.width, frame_extents.height); 1249 frame_extents.width, frame_extents.height);
1249 } 1250 }
1250 1251
1251 gfx::GLSurfaceHandle RenderWidgetHostViewGtk::GetCompositingSurface() {
1252 if (compositing_surface_ == gfx::kNullPluginWindow) {
1253 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
1254 gfx::NativeViewId view_id = GetNativeViewId();
1255
1256 if (!manager->GetPermanentXIDForId(&compositing_surface_, view_id)) {
1257 DLOG(ERROR) << "Can't find XID for view id " << view_id;
1258 }
1259 }
1260 return gfx::GLSurfaceHandle(compositing_surface_, true);
1261 }
1262
1263 bool RenderWidgetHostViewGtk::LockMouse() { 1252 bool RenderWidgetHostViewGtk::LockMouse() {
1264 if (mouse_locked_) 1253 if (mouse_locked_)
1265 return true; 1254 return true;
1266 1255
1267 mouse_locked_ = true; 1256 mouse_locked_ = true;
1268 1257
1269 // Release any current grab. 1258 // Release any current grab.
1270 GtkWidget* current_grab_window = gtk_grab_get_current(); 1259 GtkWidget* current_grab_window = gtk_grab_get_current();
1271 if (current_grab_window) { 1260 if (current_grab_window) {
1272 gtk_grab_remove(current_grab_window); 1261 gtk_grab_remove(current_grab_window);
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 parent, 1498 parent,
1510 static_cast<content::AccessibilityNodeData::State>(0), 1499 static_cast<content::AccessibilityNodeData::State>(0),
1511 this)); 1500 this));
1512 } 1501 }
1513 BrowserAccessibilityGtk* root = 1502 BrowserAccessibilityGtk* root =
1514 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); 1503 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk();
1515 1504
1516 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); 1505 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER);
1517 return root->GetAtkObject(); 1506 return root->GetAtkObject();
1518 } 1507 }
1508
1509 ////////////////////////////////////////////////////////////////////////////////
1510 // CompositingDelegateGtk
1511
1512 gfx::GLSurfaceHandle
1513 RenderWidgetHostViewGtk::CompositingDelegateGtk::GetCompositingSurface() {
1514 if (view_->compositing_surface_ == gfx::kNullPluginWindow) {
1515 GtkNativeViewManager* manager = GtkNativeViewManager::GetInstance();
1516 gfx::NativeViewId view_id = view_->GetNativeViewId();
1517
1518 if (!manager->GetPermanentXIDForId(&view_->compositing_surface_, view_id)) {
1519 DLOG(ERROR) << "Can't find XID for view id " << view_id;
1520 }
1521 }
1522 return gfx::GLSurfaceHandle(view_->compositing_surface_, true);
1523 }
1524
1525 bool
1526 RenderWidgetHostViewGtk::CompositingDelegateGtk::ResizeNeedsNewSurface() {
1527 return true;
1528 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698