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

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

Issue 23731010: Move text_elider to gfx. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update3 Created 7 years, 3 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 | 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 25 matching lines...) Expand all
36 #include "content/common/view_messages.h" 36 #include "content/common/view_messages.h"
37 #include "content/common/webplugin_geometry.h" 37 #include "content/common/webplugin_geometry.h"
38 #include "content/public/browser/native_web_keyboard_event.h" 38 #include "content/public/browser/native_web_keyboard_event.h"
39 #include "content/public/common/content_switches.h" 39 #include "content/public/common/content_switches.h"
40 #include "skia/ext/platform_canvas.h" 40 #include "skia/ext/platform_canvas.h"
41 #include "third_party/WebKit/public/web/WebInputEvent.h" 41 #include "third_party/WebKit/public/web/WebInputEvent.h"
42 #include "third_party/WebKit/public/web/WebScreenInfo.h" 42 #include "third_party/WebKit/public/web/WebScreenInfo.h"
43 #include "third_party/WebKit/public/web/gtk/WebInputEventFactory.h" 43 #include "third_party/WebKit/public/web/gtk/WebInputEventFactory.h"
44 #include "ui/base/clipboard/scoped_clipboard_writer.h" 44 #include "ui/base/clipboard/scoped_clipboard_writer.h"
45 #include "ui/base/gtk/gtk_compat.h" 45 #include "ui/base/gtk/gtk_compat.h"
46 #include "ui/base/text/text_elider.h"
47 #include "ui/base/x/active_window_watcher_x.h" 46 #include "ui/base/x/active_window_watcher_x.h"
48 #include "ui/base/x/x11_util.h" 47 #include "ui/base/x/x11_util.h"
49 #include "ui/gfx/gtk_native_view_id_manager.h" 48 #include "ui/gfx/gtk_native_view_id_manager.h"
50 #include "ui/gfx/gtk_preserve_window.h" 49 #include "ui/gfx/gtk_preserve_window.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::WebInputEventFactory; 53 using WebKit::WebInputEventFactory;
54 using WebKit::WebMouseWheelEvent; 54 using WebKit::WebMouseWheelEvent;
55 using WebKit::WebScreenInfo; 55 using WebKit::WebScreenInfo;
56 56
57 namespace content { 57 namespace content {
58 namespace { 58 namespace {
59 59
60 // Paint rects on Linux are bounded by the maximum size of a shared memory 60 // Paint rects on Linux are bounded by the maximum size of a shared memory
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 931 }
932 932
933 void RenderWidgetHostViewGtk::SetTooltipText(const string16& tooltip_text) { 933 void RenderWidgetHostViewGtk::SetTooltipText(const string16& tooltip_text) {
934 // Maximum number of characters we allow in a tooltip. 934 // Maximum number of characters we allow in a tooltip.
935 const int kMaxTooltipLength = 8 << 10; 935 const int kMaxTooltipLength = 8 << 10;
936 // Clamp the tooltip length to kMaxTooltipLength so that we don't 936 // Clamp the tooltip length to kMaxTooltipLength so that we don't
937 // accidentally DOS the user with a mega tooltip (since GTK doesn't do 937 // accidentally DOS the user with a mega tooltip (since GTK doesn't do
938 // this itself). 938 // this itself).
939 // I filed https://bugzilla.gnome.org/show_bug.cgi?id=604641 upstream. 939 // I filed https://bugzilla.gnome.org/show_bug.cgi?id=604641 upstream.
940 const string16 clamped_tooltip = 940 const string16 clamped_tooltip =
941 ui::TruncateString(tooltip_text, kMaxTooltipLength); 941 gfx::TruncateString(tooltip_text, kMaxTooltipLength);
942 942
943 if (clamped_tooltip.empty()) { 943 if (clamped_tooltip.empty()) {
944 gtk_widget_set_has_tooltip(view_.get(), FALSE); 944 gtk_widget_set_has_tooltip(view_.get(), FALSE);
945 } else { 945 } else {
946 gtk_widget_set_tooltip_text(view_.get(), 946 gtk_widget_set_tooltip_text(view_.get(),
947 UTF16ToUTF8(clamped_tooltip).c_str()); 947 UTF16ToUTF8(clamped_tooltip).c_str());
948 } 948 }
949 } 949 }
950 950
951 void RenderWidgetHostViewGtk::SelectionChanged(const string16& text, 951 void RenderWidgetHostViewGtk::SelectionChanged(const string16& text,
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1577 gfx::PluginWindowHandle id) { 1577 gfx::PluginWindowHandle id) {
1578 plugin_container_manager_.CreatePluginContainer(id); 1578 plugin_container_manager_.CreatePluginContainer(id);
1579 } 1579 }
1580 1580
1581 void RenderWidgetHostViewGtk::OnDestroyPluginContainer( 1581 void RenderWidgetHostViewGtk::OnDestroyPluginContainer(
1582 gfx::PluginWindowHandle id) { 1582 gfx::PluginWindowHandle id) {
1583 plugin_container_manager_.DestroyPluginContainer(id); 1583 plugin_container_manager_.DestroyPluginContainer(id);
1584 } 1584 }
1585 1585
1586 } // namespace content 1586 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698