OLD | NEW |
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 840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
851 const std::vector<gfx::Rect>& copy_rects) { | 851 const std::vector<gfx::Rect>& copy_rects) { |
852 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::DidUpdateBackingStore"); | 852 TRACE_EVENT0("ui::gtk", "RenderWidgetHostViewGtk::DidUpdateBackingStore"); |
853 | 853 |
854 if (is_hidden_) | 854 if (is_hidden_) |
855 return; | 855 return; |
856 | 856 |
857 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that | 857 // TODO(darin): Implement the equivalent of Win32's ScrollWindowEX. Can that |
858 // be done using XCopyArea? Perhaps similar to | 858 // be done using XCopyArea? Perhaps similar to |
859 // BackingStore::ScrollBackingStore? | 859 // BackingStore::ScrollBackingStore? |
860 if (about_to_validate_and_paint_) | 860 if (about_to_validate_and_paint_) |
861 invalid_rect_ = invalid_rect_.Union(scroll_rect); | 861 invalid_rect_.Union(scroll_rect); |
862 else | 862 else |
863 Paint(scroll_rect); | 863 Paint(scroll_rect); |
864 | 864 |
865 for (size_t i = 0; i < copy_rects.size(); ++i) { | 865 for (size_t i = 0; i < copy_rects.size(); ++i) { |
866 // Avoid double painting. NOTE: This is only relevant given the call to | 866 // Avoid double painting. NOTE: This is only relevant given the call to |
867 // Paint(scroll_rect) above. | 867 // Paint(scroll_rect) above. |
868 gfx::Rect rect = copy_rects[i].Subtract(scroll_rect); | 868 gfx::Rect rect = copy_rects[i]; |
| 869 rect.Subtract(scroll_rect); |
869 if (rect.IsEmpty()) | 870 if (rect.IsEmpty()) |
870 continue; | 871 continue; |
871 | 872 |
872 if (about_to_validate_and_paint_) | 873 if (about_to_validate_and_paint_) |
873 invalid_rect_ = invalid_rect_.Union(rect); | 874 invalid_rect_.Union(rect); |
874 else | 875 else |
875 Paint(rect); | 876 Paint(rect); |
876 } | 877 } |
877 } | 878 } |
878 | 879 |
879 void RenderWidgetHostViewGtk::RenderViewGone(base::TerminationStatus status, | 880 void RenderWidgetHostViewGtk::RenderViewGone(base::TerminationStatus status, |
880 int error_code) { | 881 int error_code) { |
881 Destroy(); | 882 Destroy(); |
882 plugin_container_manager_.set_host_widget(NULL); | 883 plugin_container_manager_.set_host_widget(NULL); |
883 } | 884 } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); | 962 GtkClipboard* x_clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY); |
962 gtk_clipboard_set_text( | 963 gtk_clipboard_set_text( |
963 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); | 964 x_clipboard, utf8_selection.c_str(), utf8_selection.length()); |
964 } | 965 } |
965 | 966 |
966 void RenderWidgetHostViewGtk::SelectionBoundsChanged( | 967 void RenderWidgetHostViewGtk::SelectionBoundsChanged( |
967 const gfx::Rect& start_rect, | 968 const gfx::Rect& start_rect, |
968 WebKit::WebTextDirection start_direction, | 969 WebKit::WebTextDirection start_direction, |
969 const gfx::Rect& end_rect, | 970 const gfx::Rect& end_rect, |
970 WebKit::WebTextDirection end_direction) { | 971 WebKit::WebTextDirection end_direction) { |
971 im_context_->UpdateCaretBounds(start_rect.Union(end_rect)); | 972 gfx::Rect combined_rect = start_rect; |
| 973 combined_rect.Union(end_rect); |
| 974 im_context_->UpdateCaretBounds(combined_rect); |
972 } | 975 } |
973 | 976 |
974 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { | 977 GdkEventButton* RenderWidgetHostViewGtk::GetLastMouseDown() { |
975 return last_mouse_down_; | 978 return last_mouse_down_; |
976 } | 979 } |
977 | 980 |
978 gfx::NativeView RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { | 981 gfx::NativeView RenderWidgetHostViewGtk::BuildInputMethodsGtkMenu() { |
979 return im_context_->BuildInputMethodsGtkMenu(); | 982 return im_context_->BuildInputMethodsGtkMenu(); |
980 } | 983 } |
981 | 984 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 | 1171 |
1169 // If the size of our canvas is (0,0), then we don't want to block here. We | 1172 // If the size of our canvas is (0,0), then we don't want to block here. We |
1170 // are doing one of our first paints and probably have animations going on. | 1173 // are doing one of our first paints and probably have animations going on. |
1171 bool force_create = !host_->empty(); | 1174 bool force_create = !host_->empty(); |
1172 BackingStoreGtk* backing_store = static_cast<BackingStoreGtk*>( | 1175 BackingStoreGtk* backing_store = static_cast<BackingStoreGtk*>( |
1173 host_->GetBackingStore(force_create)); | 1176 host_->GetBackingStore(force_create)); |
1174 // Calling GetBackingStore maybe have changed |invalid_rect_|... | 1177 // Calling GetBackingStore maybe have changed |invalid_rect_|... |
1175 about_to_validate_and_paint_ = false; | 1178 about_to_validate_and_paint_ = false; |
1176 | 1179 |
1177 gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight); | 1180 gfx::Rect paint_rect = gfx::Rect(0, 0, kMaxWindowWidth, kMaxWindowHeight); |
1178 paint_rect = paint_rect.Intersect(invalid_rect_); | 1181 paint_rect.Intersect(invalid_rect_); |
1179 | 1182 |
1180 if (backing_store) { | 1183 if (backing_store) { |
1181 // Only render the widget if it is attached to a window; there's a short | 1184 // Only render the widget if it is attached to a window; there's a short |
1182 // period where this object isn't attached to a window but hasn't been | 1185 // period where this object isn't attached to a window but hasn't been |
1183 // Destroy()ed yet and it receives paint messages... | 1186 // Destroy()ed yet and it receives paint messages... |
1184 if (window) { | 1187 if (window) { |
1185 backing_store->XShowRect(gfx::Point(0, 0), | 1188 backing_store->XShowRect(gfx::Point(0, 0), |
1186 paint_rect, ui::GetX11WindowFromGtkWidget(view_.get())); | 1189 paint_rect, ui::GetX11WindowFromGtkWidget(view_.get())); |
1187 } | 1190 } |
1188 if (!whiteout_start_time_.is_null()) { | 1191 if (!whiteout_start_time_.is_null()) { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1547 this)); | 1550 this)); |
1548 } | 1551 } |
1549 BrowserAccessibilityGtk* root = | 1552 BrowserAccessibilityGtk* root = |
1550 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); | 1553 browser_accessibility_manager_->GetRoot()->ToBrowserAccessibilityGtk(); |
1551 | 1554 |
1552 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); | 1555 atk_object_set_role(root->GetAtkObject(), ATK_ROLE_HTML_CONTAINER); |
1553 return root->GetAtkObject(); | 1556 return root->GetAtkObject(); |
1554 } | 1557 } |
1555 | 1558 |
1556 } // namespace content | 1559 } // namespace content |
OLD | NEW |