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/renderer/render_widget.h" | 5 #include "content/renderer/render_widget.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 #endif | 71 #endif |
72 | 72 |
73 #if defined(OS_POSIX) | 73 #if defined(OS_POSIX) |
74 #include "ipc/ipc_channel_posix.h" | 74 #include "ipc/ipc_channel_posix.h" |
75 #include "third_party/skia/include/core/SkMallocPixelRef.h" | 75 #include "third_party/skia/include/core/SkMallocPixelRef.h" |
76 #include "third_party/skia/include/core/SkPixelRef.h" | 76 #include "third_party/skia/include/core/SkPixelRef.h" |
77 #endif // defined(OS_POSIX) | 77 #endif // defined(OS_POSIX) |
78 | 78 |
79 #include "third_party/WebKit/public/web/WebWidget.h" | 79 #include "third_party/WebKit/public/web/WebWidget.h" |
80 | 80 |
81 using WebKit::WebCompositionUnderline; | 81 using blink::WebCompositionUnderline; |
82 using WebKit::WebCursorInfo; | 82 using blink::WebCursorInfo; |
83 using WebKit::WebGestureEvent; | 83 using blink::WebGestureEvent; |
84 using WebKit::WebInputEvent; | 84 using blink::WebInputEvent; |
85 using WebKit::WebKeyboardEvent; | 85 using blink::WebKeyboardEvent; |
86 using WebKit::WebMouseEvent; | 86 using blink::WebMouseEvent; |
87 using WebKit::WebMouseWheelEvent; | 87 using blink::WebMouseWheelEvent; |
88 using WebKit::WebNavigationPolicy; | 88 using blink::WebNavigationPolicy; |
89 using WebKit::WebPagePopup; | 89 using blink::WebPagePopup; |
90 using WebKit::WebPopupMenu; | 90 using blink::WebPopupMenu; |
91 using WebKit::WebPopupMenuInfo; | 91 using blink::WebPopupMenuInfo; |
92 using WebKit::WebPopupType; | 92 using blink::WebPopupType; |
93 using WebKit::WebRange; | 93 using blink::WebRange; |
94 using WebKit::WebRect; | 94 using blink::WebRect; |
95 using WebKit::WebScreenInfo; | 95 using blink::WebScreenInfo; |
96 using WebKit::WebSize; | 96 using blink::WebSize; |
97 using WebKit::WebTextDirection; | 97 using blink::WebTextDirection; |
98 using WebKit::WebTouchEvent; | 98 using blink::WebTouchEvent; |
99 using WebKit::WebVector; | 99 using blink::WebVector; |
100 using WebKit::WebWidget; | 100 using blink::WebWidget; |
101 | 101 |
102 namespace { | 102 namespace { |
103 | 103 |
104 typedef std::map<std::string, ui::TextInputMode> TextInputModeMap; | 104 typedef std::map<std::string, ui::TextInputMode> TextInputModeMap; |
105 | 105 |
106 class TextInputModeMapSingleton { | 106 class TextInputModeMapSingleton { |
107 public: | 107 public: |
108 static TextInputModeMapSingleton* GetInstance() { | 108 static TextInputModeMapSingleton* GetInstance() { |
109 return Singleton<TextInputModeMapSingleton>::get(); | 109 return Singleton<TextInputModeMapSingleton>::get(); |
110 } | 110 } |
(...skipping 16 matching lines...) Expand all Loading... |
127 } | 127 } |
128 private: | 128 private: |
129 TextInputModeMap map; | 129 TextInputModeMap map; |
130 | 130 |
131 friend struct DefaultSingletonTraits<TextInputModeMapSingleton>; | 131 friend struct DefaultSingletonTraits<TextInputModeMapSingleton>; |
132 | 132 |
133 DISALLOW_COPY_AND_ASSIGN(TextInputModeMapSingleton); | 133 DISALLOW_COPY_AND_ASSIGN(TextInputModeMapSingleton); |
134 }; | 134 }; |
135 | 135 |
136 ui::TextInputMode ConvertInputMode( | 136 ui::TextInputMode ConvertInputMode( |
137 const WebKit::WebString& input_mode) { | 137 const blink::WebString& input_mode) { |
138 static TextInputModeMapSingleton* singleton = | 138 static TextInputModeMapSingleton* singleton = |
139 TextInputModeMapSingleton::GetInstance(); | 139 TextInputModeMapSingleton::GetInstance(); |
140 TextInputModeMap::iterator it = singleton->Map().find(input_mode.utf8()); | 140 TextInputModeMap::iterator it = singleton->Map().find(input_mode.utf8()); |
141 if (it == singleton->Map().end()) | 141 if (it == singleton->Map().end()) |
142 return ui::TEXT_INPUT_MODE_DEFAULT; | 142 return ui::TEXT_INPUT_MODE_DEFAULT; |
143 return it->second; | 143 return it->second; |
144 } | 144 } |
145 | 145 |
146 // TODO(brianderson): Replace the hard-coded threshold with a fraction of | 146 // TODO(brianderson): Replace the hard-coded threshold with a fraction of |
147 // the BeginMainFrame interval. | 147 // the BeginMainFrame interval. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 gfx::Rect widget_rect_; | 193 gfx::Rect widget_rect_; |
194 float device_scale_factor_; | 194 float device_scale_factor_; |
195 bool fit_to_view_; | 195 bool fit_to_view_; |
196 | 196 |
197 // The computed scaled used to fit widget into browser window. | 197 // The computed scaled used to fit widget into browser window. |
198 float scale_; | 198 float scale_; |
199 | 199 |
200 // Original values to restore back after emulation ends. | 200 // Original values to restore back after emulation ends. |
201 gfx::Size original_size_; | 201 gfx::Size original_size_; |
202 gfx::Size original_physical_backing_size_; | 202 gfx::Size original_physical_backing_size_; |
203 WebKit::WebScreenInfo original_screen_info_; | 203 blink::WebScreenInfo original_screen_info_; |
204 gfx::Rect original_view_screen_rect_; | 204 gfx::Rect original_view_screen_rect_; |
205 gfx::Rect original_window_screen_rect_; | 205 gfx::Rect original_window_screen_rect_; |
206 }; | 206 }; |
207 | 207 |
208 RenderWidget::ScreenMetricsEmulator::ScreenMetricsEmulator( | 208 RenderWidget::ScreenMetricsEmulator::ScreenMetricsEmulator( |
209 RenderWidget* widget, | 209 RenderWidget* widget, |
210 const gfx::Size& device_size, | 210 const gfx::Size& device_size, |
211 const gfx::Rect& widget_rect, | 211 const gfx::Rect& widget_rect, |
212 float device_scale_factor, | 212 float device_scale_factor, |
213 bool fit_to_view) | 213 bool fit_to_view) |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 // TODO(pfeldman): pass gutter_width along with the fit_to_view flag. | 323 // TODO(pfeldman): pass gutter_width along with the fit_to_view flag. |
324 int gutter_width = 10; | 324 int gutter_width = 10; |
325 params->x *= scale_; | 325 params->x *= scale_; |
326 params->x += gutter_width; | 326 params->x += gutter_width; |
327 params->y *= scale_; | 327 params->y *= scale_; |
328 params->y += gutter_width; | 328 params->y += gutter_width; |
329 } | 329 } |
330 | 330 |
331 // RenderWidget --------------------------------------------------------------- | 331 // RenderWidget --------------------------------------------------------------- |
332 | 332 |
333 RenderWidget::RenderWidget(WebKit::WebPopupType popup_type, | 333 RenderWidget::RenderWidget(blink::WebPopupType popup_type, |
334 const WebKit::WebScreenInfo& screen_info, | 334 const blink::WebScreenInfo& screen_info, |
335 bool swapped_out, | 335 bool swapped_out, |
336 bool hidden) | 336 bool hidden) |
337 : routing_id_(MSG_ROUTING_NONE), | 337 : routing_id_(MSG_ROUTING_NONE), |
338 surface_id_(0), | 338 surface_id_(0), |
339 webwidget_(NULL), | 339 webwidget_(NULL), |
340 opener_id_(MSG_ROUTING_NONE), | 340 opener_id_(MSG_ROUTING_NONE), |
341 init_complete_(false), | 341 init_complete_(false), |
342 current_paint_buf_(NULL), | 342 current_paint_buf_(NULL), |
343 overdraw_bottom_height_(0.f), | 343 overdraw_bottom_height_(0.f), |
344 next_paint_flags_(0), | 344 next_paint_flags_(0), |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 } | 404 } |
405 current_paint_buf_ = NULL; | 405 current_paint_buf_ = NULL; |
406 } | 406 } |
407 // If we are swapped out, we have released already. | 407 // If we are swapped out, we have released already. |
408 if (!is_swapped_out_ && RenderProcess::current()) | 408 if (!is_swapped_out_ && RenderProcess::current()) |
409 RenderProcess::current()->ReleaseProcess(); | 409 RenderProcess::current()->ReleaseProcess(); |
410 } | 410 } |
411 | 411 |
412 // static | 412 // static |
413 RenderWidget* RenderWidget::Create(int32 opener_id, | 413 RenderWidget* RenderWidget::Create(int32 opener_id, |
414 WebKit::WebPopupType popup_type, | 414 blink::WebPopupType popup_type, |
415 const WebKit::WebScreenInfo& screen_info) { | 415 const blink::WebScreenInfo& screen_info) { |
416 DCHECK(opener_id != MSG_ROUTING_NONE); | 416 DCHECK(opener_id != MSG_ROUTING_NONE); |
417 scoped_refptr<RenderWidget> widget( | 417 scoped_refptr<RenderWidget> widget( |
418 new RenderWidget(popup_type, screen_info, false, false)); | 418 new RenderWidget(popup_type, screen_info, false, false)); |
419 if (widget->Init(opener_id)) { // adds reference on success. | 419 if (widget->Init(opener_id)) { // adds reference on success. |
420 return widget.get(); | 420 return widget.get(); |
421 } | 421 } |
422 return NULL; | 422 return NULL; |
423 } | 423 } |
424 | 424 |
425 // static | 425 // static |
426 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { | 426 WebWidget* RenderWidget::CreateWebWidget(RenderWidget* render_widget) { |
427 switch (render_widget->popup_type_) { | 427 switch (render_widget->popup_type_) { |
428 case WebKit::WebPopupTypeNone: // Nothing to create. | 428 case blink::WebPopupTypeNone: // Nothing to create. |
429 break; | 429 break; |
430 case WebKit::WebPopupTypeSelect: | 430 case blink::WebPopupTypeSelect: |
431 case WebKit::WebPopupTypeSuggestion: | 431 case blink::WebPopupTypeSuggestion: |
432 return WebPopupMenu::create(render_widget); | 432 return WebPopupMenu::create(render_widget); |
433 case WebKit::WebPopupTypePage: | 433 case blink::WebPopupTypePage: |
434 return WebPagePopup::create(render_widget); | 434 return WebPagePopup::create(render_widget); |
435 case WebKit::WebPopupTypeHelperPlugin: | 435 case blink::WebPopupTypeHelperPlugin: |
436 return WebKit::WebHelperPlugin::create(render_widget); | 436 return blink::WebHelperPlugin::create(render_widget); |
437 default: | 437 default: |
438 NOTREACHED(); | 438 NOTREACHED(); |
439 } | 439 } |
440 return NULL; | 440 return NULL; |
441 } | 441 } |
442 | 442 |
443 bool RenderWidget::Init(int32 opener_id) { | 443 bool RenderWidget::Init(int32 opener_id) { |
444 return DoInit(opener_id, | 444 return DoInit(opener_id, |
445 RenderWidget::CreateWebWidget(this), | 445 RenderWidget::CreateWebWidget(this), |
446 new ViewHostMsg_CreateWidget(opener_id, popup_type_, | 446 new ViewHostMsg_CreateWidget(opener_id, popup_type_, |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 // Explicitly disable antialiasing for the compositor. As of the time of | 890 // Explicitly disable antialiasing for the compositor. As of the time of |
891 // this writing, the only platform that supported antialiasing for the | 891 // this writing, the only platform that supported antialiasing for the |
892 // compositor was Mac OS X, because the on-screen OpenGL context creation | 892 // compositor was Mac OS X, because the on-screen OpenGL context creation |
893 // code paths on Windows and Linux didn't yet have multisampling support. | 893 // code paths on Windows and Linux didn't yet have multisampling support. |
894 // Mac OS X essentially always behaves as though it's rendering offscreen. | 894 // Mac OS X essentially always behaves as though it's rendering offscreen. |
895 // Multisampling has a heavy cost especially on devices with relatively low | 895 // Multisampling has a heavy cost especially on devices with relatively low |
896 // fill rate like most notebooks, and the Mac implementation would need to | 896 // fill rate like most notebooks, and the Mac implementation would need to |
897 // be optimized to resolve directly into the IOSurface shared between the | 897 // be optimized to resolve directly into the IOSurface shared between the |
898 // GPU and browser processes. For these reasons and to avoid platform | 898 // GPU and browser processes. For these reasons and to avoid platform |
899 // disparities we explicitly disable antialiasing. | 899 // disparities we explicitly disable antialiasing. |
900 WebKit::WebGraphicsContext3D::Attributes attributes; | 900 blink::WebGraphicsContext3D::Attributes attributes; |
901 attributes.antialias = false; | 901 attributes.antialias = false; |
902 attributes.shareResources = true; | 902 attributes.shareResources = true; |
903 attributes.noAutomaticFlushes = true; | 903 attributes.noAutomaticFlushes = true; |
904 attributes.depth = false; | 904 attributes.depth = false; |
905 attributes.stencil = false; | 905 attributes.stencil = false; |
906 | 906 |
907 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 907 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
908 if (command_line.HasSwitch(cc::switches::kForceDirectLayerDrawing)) | 908 if (command_line.HasSwitch(cc::switches::kForceDirectLayerDrawing)) |
909 attributes.stencil = true; | 909 attributes.stencil = true; |
910 | 910 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1042 // generated it. | 1042 // generated it. |
1043 if (!animation_update_pending_ && !paint_aggregator_.HasPendingUpdate()) { | 1043 if (!animation_update_pending_ && !paint_aggregator_.HasPendingUpdate()) { |
1044 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); | 1044 TRACE_EVENT0("renderer", "EarlyOut_NoPendingUpdate"); |
1045 return; | 1045 return; |
1046 } | 1046 } |
1047 | 1047 |
1048 // Continue painting if necessary... | 1048 // Continue painting if necessary... |
1049 DoDeferredUpdateAndSendInputAck(); | 1049 DoDeferredUpdateAndSendInputAck(); |
1050 } | 1050 } |
1051 | 1051 |
1052 void RenderWidget::OnHandleInputEvent(const WebKit::WebInputEvent* input_event, | 1052 void RenderWidget::OnHandleInputEvent(const blink::WebInputEvent* input_event, |
1053 const ui::LatencyInfo& latency_info, | 1053 const ui::LatencyInfo& latency_info, |
1054 bool is_keyboard_shortcut) { | 1054 bool is_keyboard_shortcut) { |
1055 handling_input_event_ = true; | 1055 handling_input_event_ = true; |
1056 if (!input_event) { | 1056 if (!input_event) { |
1057 handling_input_event_ = false; | 1057 handling_input_event_ = false; |
1058 return; | 1058 return; |
1059 } | 1059 } |
1060 | 1060 |
1061 base::TimeTicks start_time; | 1061 base::TimeTicks start_time; |
1062 if (base::TimeTicks::IsHighResNowFastAndReliable()) | 1062 if (base::TimeTicks::IsHighResNowFastAndReliable()) |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1841 compositor_ = RenderWidgetCompositor::Create( | 1841 compositor_ = RenderWidgetCompositor::Create( |
1842 this, is_threaded_compositing_enabled_); | 1842 this, is_threaded_compositing_enabled_); |
1843 if (!compositor_) | 1843 if (!compositor_) |
1844 return; | 1844 return; |
1845 | 1845 |
1846 compositor_->setViewportSize(size_, physical_backing_size_); | 1846 compositor_->setViewportSize(size_, physical_backing_size_); |
1847 if (init_complete_) | 1847 if (init_complete_) |
1848 compositor_->setSurfaceReady(); | 1848 compositor_->setSurfaceReady(); |
1849 } | 1849 } |
1850 | 1850 |
1851 WebKit::WebLayerTreeView* RenderWidget::layerTreeView() { | 1851 blink::WebLayerTreeView* RenderWidget::layerTreeView() { |
1852 return compositor_.get(); | 1852 return compositor_.get(); |
1853 } | 1853 } |
1854 | 1854 |
1855 void RenderWidget::suppressCompositorScheduling(bool enable) { | 1855 void RenderWidget::suppressCompositorScheduling(bool enable) { |
1856 if (compositor_) | 1856 if (compositor_) |
1857 compositor_->SetSuppressScheduleComposite(enable); | 1857 compositor_->SetSuppressScheduleComposite(enable); |
1858 } | 1858 } |
1859 | 1859 |
1860 void RenderWidget::willBeginCompositorFrame() { | 1860 void RenderWidget::willBeginCompositorFrame() { |
1861 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); | 1861 TRACE_EVENT0("gpu", "RenderWidget::willBeginCompositorFrame"); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 } | 2008 } |
2009 } | 2009 } |
2010 | 2010 |
2011 WebRect RenderWidget::windowRect() { | 2011 WebRect RenderWidget::windowRect() { |
2012 if (pending_window_rect_count_) | 2012 if (pending_window_rect_count_) |
2013 return pending_window_rect_; | 2013 return pending_window_rect_; |
2014 | 2014 |
2015 return view_screen_rect_; | 2015 return view_screen_rect_; |
2016 } | 2016 } |
2017 | 2017 |
2018 void RenderWidget::setToolTipText(const WebKit::WebString& text, | 2018 void RenderWidget::setToolTipText(const blink::WebString& text, |
2019 WebTextDirection hint) { | 2019 WebTextDirection hint) { |
2020 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); | 2020 Send(new ViewHostMsg_SetTooltipText(routing_id_, text, hint)); |
2021 } | 2021 } |
2022 | 2022 |
2023 void RenderWidget::setWindowRect(const WebRect& rect) { | 2023 void RenderWidget::setWindowRect(const WebRect& rect) { |
2024 WebRect pos = rect; | 2024 WebRect pos = rect; |
2025 if (popup_origin_scale_for_emulation_) { | 2025 if (popup_origin_scale_for_emulation_) { |
2026 float scale = popup_origin_scale_for_emulation_; | 2026 float scale = popup_origin_scale_for_emulation_; |
2027 pos.x = popup_screen_origin_for_emulation_.x() + | 2027 pos.x = popup_screen_origin_for_emulation_.x() + |
2028 (pos.x - popup_view_origin_for_emulation_.x()) * scale; | 2028 (pos.x - popup_view_origin_for_emulation_.x()) * scale; |
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2426 if (!input_method_is_active_) | 2426 if (!input_method_is_active_) |
2427 return; | 2427 return; |
2428 #endif | 2428 #endif |
2429 | 2429 |
2430 ui::TextInputType new_type = GetTextInputType(); | 2430 ui::TextInputType new_type = GetTextInputType(); |
2431 if (IsDateTimeInput(new_type)) | 2431 if (IsDateTimeInput(new_type)) |
2432 return; // Not considered as a text input field in WebKit/Chromium. | 2432 return; // Not considered as a text input field in WebKit/Chromium. |
2433 | 2433 |
2434 bool new_can_compose_inline = CanComposeInline(); | 2434 bool new_can_compose_inline = CanComposeInline(); |
2435 | 2435 |
2436 WebKit::WebTextInputInfo new_info; | 2436 blink::WebTextInputInfo new_info; |
2437 if (webwidget_) | 2437 if (webwidget_) |
2438 new_info = webwidget_->textInputInfo(); | 2438 new_info = webwidget_->textInputInfo(); |
2439 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); | 2439 const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode); |
2440 | 2440 |
2441 if (text_input_type_ != new_type | 2441 if (text_input_type_ != new_type |
2442 || can_compose_inline_ != new_can_compose_inline | 2442 || can_compose_inline_ != new_can_compose_inline |
2443 || text_input_mode_ != new_mode) { | 2443 || text_input_mode_ != new_mode) { |
2444 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(), | 2444 Send(new ViewHostMsg_TextInputTypeChanged(routing_id(), |
2445 new_type, | 2445 new_type, |
2446 new_mode, | 2446 new_mode, |
2447 new_can_compose_inline)); | 2447 new_can_compose_inline)); |
2448 text_input_type_ = new_type; | 2448 text_input_type_ = new_type; |
2449 can_compose_inline_ = new_can_compose_inline; | 2449 can_compose_inline_ = new_can_compose_inline; |
2450 text_input_mode_ = new_mode; | 2450 text_input_mode_ = new_mode; |
2451 } | 2451 } |
2452 } | 2452 } |
2453 | 2453 |
2454 #if defined(OS_ANDROID) | 2454 #if defined(OS_ANDROID) |
2455 void RenderWidget::UpdateTextInputState(bool show_ime_if_needed, | 2455 void RenderWidget::UpdateTextInputState(bool show_ime_if_needed, |
2456 bool send_ime_ack) { | 2456 bool send_ime_ack) { |
2457 if (handling_ime_event_) | 2457 if (handling_ime_event_) |
2458 return; | 2458 return; |
2459 if (!show_ime_if_needed && !input_method_is_active_) | 2459 if (!show_ime_if_needed && !input_method_is_active_) |
2460 return; | 2460 return; |
2461 ui::TextInputType new_type = GetTextInputType(); | 2461 ui::TextInputType new_type = GetTextInputType(); |
2462 if (IsDateTimeInput(new_type)) | 2462 if (IsDateTimeInput(new_type)) |
2463 return; // Not considered as a text input field in WebKit/Chromium. | 2463 return; // Not considered as a text input field in WebKit/Chromium. |
2464 | 2464 |
2465 WebKit::WebTextInputInfo new_info; | 2465 blink::WebTextInputInfo new_info; |
2466 if (webwidget_) | 2466 if (webwidget_) |
2467 new_info = webwidget_->textInputInfo(); | 2467 new_info = webwidget_->textInputInfo(); |
2468 | 2468 |
2469 bool new_can_compose_inline = CanComposeInline(); | 2469 bool new_can_compose_inline = CanComposeInline(); |
2470 | 2470 |
2471 // Only sends text input params if they are changed or if the ime should be | 2471 // Only sends text input params if they are changed or if the ime should be |
2472 // shown. | 2472 // shown. |
2473 if (show_ime_if_needed || (text_input_type_ != new_type | 2473 if (show_ime_if_needed || (text_input_type_ != new_type |
2474 || text_input_info_ != new_info | 2474 || text_input_info_ != new_info |
2475 || can_compose_inline_ != new_can_compose_inline)) { | 2475 || can_compose_inline_ != new_can_compose_inline)) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2516 selection_focus_rect_ = params.focus_rect; | 2516 selection_focus_rect_ = params.focus_rect; |
2517 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); | 2517 webwidget_->selectionTextDirection(params.focus_dir, params.anchor_dir); |
2518 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); | 2518 params.is_anchor_first = webwidget_->isSelectionAnchorFirst(); |
2519 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); | 2519 Send(new ViewHostMsg_SelectionBoundsChanged(routing_id_, params)); |
2520 } | 2520 } |
2521 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 2521 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
2522 UpdateCompositionInfo(false); | 2522 UpdateCompositionInfo(false); |
2523 #endif | 2523 #endif |
2524 } | 2524 } |
2525 | 2525 |
2526 // Check WebKit::WebTextInputType and ui::TextInputType is kept in sync. | 2526 // Check blink::WebTextInputType and ui::TextInputType is kept in sync. |
2527 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNone) == \ | 2527 COMPILE_ASSERT(int(blink::WebTextInputTypeNone) == \ |
2528 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); | 2528 int(ui::TEXT_INPUT_TYPE_NONE), mismatching_enums); |
2529 COMPILE_ASSERT(int(WebKit::WebTextInputTypeText) == \ | 2529 COMPILE_ASSERT(int(blink::WebTextInputTypeText) == \ |
2530 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); | 2530 int(ui::TEXT_INPUT_TYPE_TEXT), mismatching_enums); |
2531 COMPILE_ASSERT(int(WebKit::WebTextInputTypePassword) == \ | 2531 COMPILE_ASSERT(int(blink::WebTextInputTypePassword) == \ |
2532 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); | 2532 int(ui::TEXT_INPUT_TYPE_PASSWORD), mismatching_enums); |
2533 COMPILE_ASSERT(int(WebKit::WebTextInputTypeSearch) == \ | 2533 COMPILE_ASSERT(int(blink::WebTextInputTypeSearch) == \ |
2534 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); | 2534 int(ui::TEXT_INPUT_TYPE_SEARCH), mismatching_enums); |
2535 COMPILE_ASSERT(int(WebKit::WebTextInputTypeEmail) == \ | 2535 COMPILE_ASSERT(int(blink::WebTextInputTypeEmail) == \ |
2536 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); | 2536 int(ui::TEXT_INPUT_TYPE_EMAIL), mismatching_enums); |
2537 COMPILE_ASSERT(int(WebKit::WebTextInputTypeNumber) == \ | 2537 COMPILE_ASSERT(int(blink::WebTextInputTypeNumber) == \ |
2538 int(ui::TEXT_INPUT_TYPE_NUMBER), mismatching_enums); | 2538 int(ui::TEXT_INPUT_TYPE_NUMBER), mismatching_enums); |
2539 COMPILE_ASSERT(int(WebKit::WebTextInputTypeTelephone) == \ | 2539 COMPILE_ASSERT(int(blink::WebTextInputTypeTelephone) == \ |
2540 int(ui::TEXT_INPUT_TYPE_TELEPHONE), mismatching_enums); | 2540 int(ui::TEXT_INPUT_TYPE_TELEPHONE), mismatching_enums); |
2541 COMPILE_ASSERT(int(WebKit::WebTextInputTypeURL) == \ | 2541 COMPILE_ASSERT(int(blink::WebTextInputTypeURL) == \ |
2542 int(ui::TEXT_INPUT_TYPE_URL), mismatching_enums); | 2542 int(ui::TEXT_INPUT_TYPE_URL), mismatching_enums); |
2543 COMPILE_ASSERT(int(WebKit::WebTextInputTypeDate) == \ | 2543 COMPILE_ASSERT(int(blink::WebTextInputTypeDate) == \ |
2544 int(ui::TEXT_INPUT_TYPE_DATE), mismatching_enum); | 2544 int(ui::TEXT_INPUT_TYPE_DATE), mismatching_enum); |
2545 COMPILE_ASSERT(int(WebKit::WebTextInputTypeDateTime) == \ | 2545 COMPILE_ASSERT(int(blink::WebTextInputTypeDateTime) == \ |
2546 int(ui::TEXT_INPUT_TYPE_DATE_TIME), mismatching_enum); | 2546 int(ui::TEXT_INPUT_TYPE_DATE_TIME), mismatching_enum); |
2547 COMPILE_ASSERT(int(WebKit::WebTextInputTypeDateTimeLocal) == \ | 2547 COMPILE_ASSERT(int(blink::WebTextInputTypeDateTimeLocal) == \ |
2548 int(ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL), mismatching_enum); | 2548 int(ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL), mismatching_enum); |
2549 COMPILE_ASSERT(int(WebKit::WebTextInputTypeMonth) == \ | 2549 COMPILE_ASSERT(int(blink::WebTextInputTypeMonth) == \ |
2550 int(ui::TEXT_INPUT_TYPE_MONTH), mismatching_enum); | 2550 int(ui::TEXT_INPUT_TYPE_MONTH), mismatching_enum); |
2551 COMPILE_ASSERT(int(WebKit::WebTextInputTypeTime) == \ | 2551 COMPILE_ASSERT(int(blink::WebTextInputTypeTime) == \ |
2552 int(ui::TEXT_INPUT_TYPE_TIME), mismatching_enum); | 2552 int(ui::TEXT_INPUT_TYPE_TIME), mismatching_enum); |
2553 COMPILE_ASSERT(int(WebKit::WebTextInputTypeWeek) == \ | 2553 COMPILE_ASSERT(int(blink::WebTextInputTypeWeek) == \ |
2554 int(ui::TEXT_INPUT_TYPE_WEEK), mismatching_enum); | 2554 int(ui::TEXT_INPUT_TYPE_WEEK), mismatching_enum); |
2555 COMPILE_ASSERT(int(WebKit::WebTextInputTypeTextArea) == \ | 2555 COMPILE_ASSERT(int(blink::WebTextInputTypeTextArea) == \ |
2556 int(ui::TEXT_INPUT_TYPE_TEXT_AREA), mismatching_enums); | 2556 int(ui::TEXT_INPUT_TYPE_TEXT_AREA), mismatching_enums); |
2557 COMPILE_ASSERT(int(WebKit::WebTextInputTypeContentEditable) == \ | 2557 COMPILE_ASSERT(int(blink::WebTextInputTypeContentEditable) == \ |
2558 int(ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE), mismatching_enums); | 2558 int(ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE), mismatching_enums); |
2559 COMPILE_ASSERT(int(WebKit::WebTextInputTypeDateTimeField) == \ | 2559 COMPILE_ASSERT(int(blink::WebTextInputTypeDateTimeField) == \ |
2560 int(ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD), mismatching_enums); | 2560 int(ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD), mismatching_enums); |
2561 | 2561 |
2562 ui::TextInputType RenderWidget::WebKitToUiTextInputType( | 2562 ui::TextInputType RenderWidget::WebKitToUiTextInputType( |
2563 WebKit::WebTextInputType type) { | 2563 blink::WebTextInputType type) { |
2564 // Check the type is in the range representable by ui::TextInputType. | 2564 // Check the type is in the range representable by ui::TextInputType. |
2565 DCHECK_LE(type, static_cast<int>(ui::TEXT_INPUT_TYPE_MAX)) << | 2565 DCHECK_LE(type, static_cast<int>(ui::TEXT_INPUT_TYPE_MAX)) << |
2566 "WebKit::WebTextInputType and ui::TextInputType not synchronized"; | 2566 "blink::WebTextInputType and ui::TextInputType not synchronized"; |
2567 return static_cast<ui::TextInputType>(type); | 2567 return static_cast<ui::TextInputType>(type); |
2568 } | 2568 } |
2569 | 2569 |
2570 ui::TextInputType RenderWidget::GetTextInputType() { | 2570 ui::TextInputType RenderWidget::GetTextInputType() { |
2571 if (webwidget_) | 2571 if (webwidget_) |
2572 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); | 2572 return WebKitToUiTextInputType(webwidget_->textInputInfo().type); |
2573 return ui::TEXT_INPUT_TYPE_NONE; | 2573 return ui::TEXT_INPUT_TYPE_NONE; |
2574 } | 2574 } |
2575 | 2575 |
2576 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 2576 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2691 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); | 2691 for (WebPluginGeometryVector::iterator i = plugin_window_moves_.begin(); |
2692 i != plugin_window_moves_.end(); ++i) { | 2692 i != plugin_window_moves_.end(); ++i) { |
2693 if (i->window == window) { | 2693 if (i->window == window) { |
2694 plugin_window_moves_.erase(i); | 2694 plugin_window_moves_.erase(i); |
2695 break; | 2695 break; |
2696 } | 2696 } |
2697 } | 2697 } |
2698 } | 2698 } |
2699 | 2699 |
2700 void RenderWidget::GetRenderingStats( | 2700 void RenderWidget::GetRenderingStats( |
2701 WebKit::WebRenderingStatsImpl& stats) const { | 2701 blink::WebRenderingStatsImpl& stats) const { |
2702 if (compositor_) | 2702 if (compositor_) |
2703 compositor_->GetRenderingStats(&stats.rendering_stats); | 2703 compositor_->GetRenderingStats(&stats.rendering_stats); |
2704 | 2704 |
2705 stats.rendering_stats.Add( | 2705 stats.rendering_stats.Add( |
2706 legacy_software_mode_stats_->GetRenderingStats()); | 2706 legacy_software_mode_stats_->GetRenderingStats()); |
2707 } | 2707 } |
2708 | 2708 |
2709 bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const { | 2709 bool RenderWidget::GetGpuRenderingStats(GpuRenderingStats* stats) const { |
2710 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); | 2710 GpuChannelHost* gpu_channel = RenderThreadImpl::current()->GetGpuChannel(); |
2711 if (!gpu_channel) | 2711 if (!gpu_channel) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 ViewHostMsg_BeginPinch_Params params; | 2756 ViewHostMsg_BeginPinch_Params params; |
2757 params.zoom_in = zoom_in; | 2757 params.zoom_in = zoom_in; |
2758 params.pixels_to_move = pixels_to_move; | 2758 params.pixels_to_move = pixels_to_move; |
2759 params.anchor_x = anchor_x; | 2759 params.anchor_x = anchor_x; |
2760 params.anchor_y = anchor_y; | 2760 params.anchor_y = anchor_y; |
2761 | 2761 |
2762 Send(new ViewHostMsg_BeginPinch(routing_id_, params)); | 2762 Send(new ViewHostMsg_BeginPinch(routing_id_, params)); |
2763 pending_synthetic_gesture_ = callback; | 2763 pending_synthetic_gesture_ = callback; |
2764 } | 2764 } |
2765 | 2765 |
2766 bool RenderWidget::WillHandleMouseEvent(const WebKit::WebMouseEvent& event) { | 2766 bool RenderWidget::WillHandleMouseEvent(const blink::WebMouseEvent& event) { |
2767 return false; | 2767 return false; |
2768 } | 2768 } |
2769 | 2769 |
2770 bool RenderWidget::WillHandleKeyEvent(const WebKit::WebKeyboardEvent& event) { | 2770 bool RenderWidget::WillHandleKeyEvent(const blink::WebKeyboardEvent& event) { |
2771 return false; | 2771 return false; |
2772 } | 2772 } |
2773 | 2773 |
2774 bool RenderWidget::WillHandleGestureEvent( | 2774 bool RenderWidget::WillHandleGestureEvent( |
2775 const WebKit::WebGestureEvent& event) { | 2775 const blink::WebGestureEvent& event) { |
2776 return false; | 2776 return false; |
2777 } | 2777 } |
2778 | 2778 |
2779 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { | 2779 void RenderWidget::hasTouchEventHandlers(bool has_handlers) { |
2780 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); | 2780 Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers)); |
2781 } | 2781 } |
2782 | 2782 |
2783 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { | 2783 bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const { |
2784 return true; | 2784 return true; |
2785 } | 2785 } |
2786 | 2786 |
2787 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> | 2787 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> |
2788 RenderWidget::CreateGraphicsContext3D( | 2788 RenderWidget::CreateGraphicsContext3D( |
2789 const WebKit::WebGraphicsContext3D::Attributes& attributes) { | 2789 const blink::WebGraphicsContext3D::Attributes& attributes) { |
2790 if (!webwidget_) | 2790 if (!webwidget_) |
2791 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2791 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
2792 if (CommandLine::ForCurrentProcess()->HasSwitch( | 2792 if (CommandLine::ForCurrentProcess()->HasSwitch( |
2793 switches::kDisableGpuCompositing)) | 2793 switches::kDisableGpuCompositing)) |
2794 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2794 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
2795 if (!RenderThreadImpl::current()) | 2795 if (!RenderThreadImpl::current()) |
2796 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); | 2796 return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>(); |
2797 scoped_refptr<GpuChannelHost> gpu_channel_host( | 2797 scoped_refptr<GpuChannelHost> gpu_channel_host( |
2798 RenderThreadImpl::current()->EstablishGpuChannelSync( | 2798 RenderThreadImpl::current()->EstablishGpuChannelSync( |
2799 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); | 2799 CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE)
); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2835 GetURLForGraphicsContext3D(), | 2835 GetURLForGraphicsContext3D(), |
2836 gpu_channel_host.get(), | 2836 gpu_channel_host.get(), |
2837 swap_client, | 2837 swap_client, |
2838 attributes, | 2838 attributes, |
2839 false /* bind generates resources */, | 2839 false /* bind generates resources */, |
2840 limits)); | 2840 limits)); |
2841 return context.Pass(); | 2841 return context.Pass(); |
2842 } | 2842 } |
2843 | 2843 |
2844 } // namespace content | 2844 } // namespace content |
OLD | NEW |