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

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

Issue 63253002: Rename WebKit namespace to blink (part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 | Annotate | Revision Log
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 #include <cairo/cairo.h> 7 #include <cairo/cairo.h>
8 #include <gdk/gdk.h> 8 #include <gdk/gdk.h>
9 #include <gdk/gdkkeysyms.h> 9 #include <gdk/gdkkeysyms.h>
10 #include <gdk/gdkx.h> 10 #include <gdk/gdkx.h>
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #include "third_party/WebKit/public/web/WebScreenInfo.h" 43 #include "third_party/WebKit/public/web/WebScreenInfo.h"
44 #include "ui/base/clipboard/scoped_clipboard_writer.h" 44 #include "ui/base/clipboard/scoped_clipboard_writer.h"
45 #include "ui/base/x/active_window_watcher_x.h" 45 #include "ui/base/x/active_window_watcher_x.h"
46 #include "ui/base/x/x11_util.h" 46 #include "ui/base/x/x11_util.h"
47 #include "ui/gfx/gtk_compat.h" 47 #include "ui/gfx/gtk_compat.h"
48 #include "ui/gfx/gtk_native_view_id_manager.h" 48 #include "ui/gfx/gtk_native_view_id_manager.h"
49 #include "ui/gfx/gtk_preserve_window.h" 49 #include "ui/gfx/gtk_preserve_window.h"
50 #include "ui/gfx/text_elider.h" 50 #include "ui/gfx/text_elider.h"
51 #include "webkit/common/cursors/webcursor_gtk_data.h" 51 #include "webkit/common/cursors/webcursor_gtk_data.h"
52 52
53 using WebKit::WebMouseWheelEvent; 53 using blink::WebMouseWheelEvent;
54 using WebKit::WebScreenInfo; 54 using blink::WebScreenInfo;
55 55
56 namespace content { 56 namespace content {
57 namespace { 57 namespace {
58 58
59 // Paint rects on Linux are bounded by the maximum size of a shared memory 59 // Paint rects on Linux are bounded by the maximum size of a shared memory
60 // region. By default that's 32MB, but many distros increase it significantly 60 // region. By default that's 32MB, but many distros increase it significantly
61 // (i.e. to 256MB). 61 // (i.e. to 256MB).
62 // 62 //
63 // We fetch the maximum value from /proc/sys/kernel/shmmax at runtime and, if 63 // We fetch the maximum value from /proc/sys/kernel/shmmax at runtime and, if
64 // we exceed that, then we limit the height of the paint rect in the renderer. 64 // we exceed that, then we limit the height of the paint rect in the renderer.
(...skipping 22 matching lines...) Expand all
87 GdkPixmap* mask = gdk_bitmap_create_from_data( 87 GdkPixmap* mask = gdk_bitmap_create_from_data(
88 NULL, reinterpret_cast<const gchar*>(moz_spinning_mask_bits), 32, 32); 88 NULL, reinterpret_cast<const gchar*>(moz_spinning_mask_bits), 32, 32);
89 moz_spinning_cursor = 89 moz_spinning_cursor =
90 gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2); 90 gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 2, 2);
91 g_object_unref(source); 91 g_object_unref(source);
92 g_object_unref(mask); 92 g_object_unref(mask);
93 } 93 }
94 return moz_spinning_cursor; 94 return moz_spinning_cursor;
95 } 95 }
96 96
97 bool MovedToPoint(const WebKit::WebMouseEvent& mouse_event, 97 bool MovedToPoint(const blink::WebMouseEvent& mouse_event,
98 const gfx::Point& center) { 98 const gfx::Point& center) {
99 return mouse_event.globalX == center.x() && 99 return mouse_event.globalX == center.x() &&
100 mouse_event.globalY == center.y(); 100 mouse_event.globalY == center.y();
101 } 101 }
102 102
103 } // namespace 103 } // namespace
104 104
105 // This class is a simple convenience wrapper for Gtk functions. It has only 105 // This class is a simple convenience wrapper for Gtk functions. It has only
106 // static methods. 106 // static methods.
107 class RenderWidgetHostViewGtkWidget { 107 class RenderWidgetHostViewGtkWidget {
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (event_widget != widget) { 378 if (event_widget != widget) {
379 int x = 0; 379 int x = 0;
380 int y = 0; 380 int y = 0;
381 gtk_widget_get_pointer(widget, &x, &y); 381 gtk_widget_get_pointer(widget, &x, &y);
382 event->x = x; 382 event->x = x;
383 event->y = y; 383 event->y = y;
384 } 384 }
385 385
386 host_view->ModifyEventForEdgeDragging(widget, event); 386 host_view->ModifyEventForEdgeDragging(widget, event);
387 387
388 WebKit::WebMouseEvent mouse_event = WebMouseEventBuilder::Build(event); 388 blink::WebMouseEvent mouse_event = WebMouseEventBuilder::Build(event);
389 389
390 if (host_view->mouse_locked_) { 390 if (host_view->mouse_locked_) {
391 gfx::Point center = host_view->GetWidgetCenter(); 391 gfx::Point center = host_view->GetWidgetCenter();
392 392
393 bool moved_to_center = MovedToPoint(mouse_event, center); 393 bool moved_to_center = MovedToPoint(mouse_event, center);
394 if (moved_to_center) 394 if (moved_to_center)
395 host_view->mouse_has_been_warped_to_new_center_ = true; 395 host_view->mouse_has_been_warped_to_new_center_ = true;
396 396
397 host_view->ModifyEventMovementAndCoords(&mouse_event); 397 host_view->ModifyEventMovementAndCoords(&mouse_event);
398 398
(...skipping 29 matching lines...) Expand all
428 GDK_BUTTON3_MASK | 428 GDK_BUTTON3_MASK |
429 GDK_BUTTON4_MASK | 429 GDK_BUTTON4_MASK |
430 GDK_BUTTON5_MASK; 430 GDK_BUTTON5_MASK;
431 431
432 // Only forward crossing events if the mouse button is not down. 432 // Only forward crossing events if the mouse button is not down.
433 // (When the mouse button is down, the proper events are already being 433 // (When the mouse button is down, the proper events are already being
434 // sent by ButtonPressReleaseEvent and MouseMoveEvent, above, and if we 434 // sent by ButtonPressReleaseEvent and MouseMoveEvent, above, and if we
435 // additionally send this crossing event with the state indicating the 435 // additionally send this crossing event with the state indicating the
436 // button is down, it causes problems with drag and drop in WebKit.) 436 // button is down, it causes problems with drag and drop in WebKit.)
437 if (!(event->state & any_button_mask)) { 437 if (!(event->state & any_button_mask)) {
438 WebKit::WebMouseEvent mouse_event = WebMouseEventBuilder::Build(event); 438 blink::WebMouseEvent mouse_event = WebMouseEventBuilder::Build(event);
439 host_view->ModifyEventMovementAndCoords(&mouse_event); 439 host_view->ModifyEventMovementAndCoords(&mouse_event);
440 // When crossing out and back into a render view the movement values 440 // When crossing out and back into a render view the movement values
441 // must represent the instantaneous movement of the mouse, not the jump 441 // must represent the instantaneous movement of the mouse, not the jump
442 // from the exit to re-entry point. 442 // from the exit to re-entry point.
443 mouse_event.movementX = 0; 443 mouse_event.movementX = 0;
444 mouse_event.movementY = 0; 444 mouse_event.movementY = 0;
445 RenderWidgetHostImpl::From( 445 RenderWidgetHostImpl::From(
446 host_view->GetRenderWidgetHost())->ForwardMouseEvent(mouse_event); 446 host_view->GetRenderWidgetHost())->ForwardMouseEvent(mouse_event);
447 } 447 }
448 448
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 gfx::NativeView RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { 986 gfx::NativeView RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() {
987 return im_context_->BuildInputMethodsGtkMenu(); 987 return im_context_->BuildInputMethodsGtkMenu();
988 } 988 }
989 989
990 void RenderWidgetHostViewGtk::OnDestroy(GtkWidget* widget) { 990 void RenderWidgetHostViewGtk::OnDestroy(GtkWidget* widget) {
991 DCHECK(is_fullscreen_); 991 DCHECK(is_fullscreen_);
992 host_->Shutdown(); 992 host_->Shutdown();
993 } 993 }
994 994
995 bool RenderWidgetHostViewGtk::NeedsInputGrab() { 995 bool RenderWidgetHostViewGtk::NeedsInputGrab() {
996 return popup_type_ == WebKit::WebPopupTypeSelect; 996 return popup_type_ == blink::WebPopupTypeSelect;
997 } 997 }
998 998
999 bool RenderWidgetHostViewGtk::IsPopup() const { 999 bool RenderWidgetHostViewGtk::IsPopup() const {
1000 return popup_type_ != WebKit::WebPopupTypeNone; 1000 return popup_type_ != blink::WebPopupTypeNone;
1001 } 1001 }
1002 1002
1003 void RenderWidgetHostViewGtk::DoSharedInit() { 1003 void RenderWidgetHostViewGtk::DoSharedInit() {
1004 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this)); 1004 view_.Own(RenderWidgetHostViewGtkWidget::CreateNewWidget(this));
1005 im_context_.reset(new GtkIMContextWrapper(this)); 1005 im_context_.reset(new GtkIMContextWrapper(this));
1006 plugin_container_manager_.set_host_widget(view_.get()); 1006 plugin_container_manager_.set_host_widget(view_.get());
1007 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get())); 1007 key_bindings_handler_.reset(new GtkKeyBindingsHandler(view_.get()));
1008 } 1008 }
1009 1009
1010 void RenderWidgetHostViewGtk::DoPopupOrFullscreenInit(GtkWindow* window, 1010 void RenderWidgetHostViewGtk::DoPopupOrFullscreenInit(GtkWindow* window,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 gdk_window_get_origin(window, &window_x, &window_y); 1443 gdk_window_get_origin(window, &window_x, &window_y);
1444 gint window_w = gdk_window_get_width(window); 1444 gint window_w = gdk_window_get_width(window);
1445 gint window_h = gdk_window_get_height(window); 1445 gint window_h = gdk_window_get_height(window);
1446 widget_center_.SetPoint(window_x + window_w / 2, 1446 widget_center_.SetPoint(window_x + window_w / 2,
1447 window_y + window_h / 2); 1447 window_y + window_h / 2);
1448 widget_center_valid_ = true; 1448 widget_center_valid_ = true;
1449 return widget_center_; 1449 return widget_center_;
1450 } 1450 }
1451 1451
1452 void RenderWidgetHostViewGtk::ModifyEventMovementAndCoords( 1452 void RenderWidgetHostViewGtk::ModifyEventMovementAndCoords(
1453 WebKit::WebMouseEvent* event) { 1453 blink::WebMouseEvent* event) {
1454 // Movement is computed by taking the difference of the new cursor position 1454 // Movement is computed by taking the difference of the new cursor position
1455 // and the previous. Under mouse lock the cursor will be warped back to the 1455 // and the previous. Under mouse lock the cursor will be warped back to the
1456 // center so that we are not limited by clipping boundaries. 1456 // center so that we are not limited by clipping boundaries.
1457 // We do not measure movement as the delta from cursor to center because 1457 // We do not measure movement as the delta from cursor to center because
1458 // we may receive more mouse movement events before our warp has taken 1458 // we may receive more mouse movement events before our warp has taken
1459 // effect. 1459 // effect.
1460 event->movementX = event->globalX - global_mouse_position_.x(); 1460 event->movementX = event->globalX - global_mouse_position_.x();
1461 event->movementY = event->globalY - global_mouse_position_.y(); 1461 event->movementY = event->globalY - global_mouse_position_.y();
1462 1462
1463 // While the cursor is being warped back to the unlocked position, suppress 1463 // While the cursor is being warped back to the unlocked position, suppress
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 gfx::PluginWindowHandle id) { 1587 gfx::PluginWindowHandle id) {
1588 plugin_container_manager_.CreatePluginContainer(id); 1588 plugin_container_manager_.CreatePluginContainer(id);
1589 } 1589 }
1590 1590
1591 void RenderWidgetHostViewGtk::OnDestroyPluginContainer( 1591 void RenderWidgetHostViewGtk::OnDestroyPluginContainer(
1592 gfx::PluginWindowHandle id) { 1592 gfx::PluginWindowHandle id) {
1593 plugin_container_manager_.DestroyPluginContainer(id); 1593 plugin_container_manager_.DestroyPluginContainer(id);
1594 } 1594 }
1595 1595
1596 } // namespace content 1596 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698