OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/renderer_host/render_widget_host_view_views.h" | 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 wmwe.button = WebKit::WebMouseEvent::ButtonNone; | 677 wmwe.button = WebKit::WebMouseEvent::ButtonNone; |
678 | 678 |
679 // TODO(sadrul): How do we determine if it's a horizontal scroll? | 679 // TODO(sadrul): How do we determine if it's a horizontal scroll? |
680 wmwe.deltaY = event.offset(); | 680 wmwe.deltaY = event.offset(); |
681 wmwe.wheelTicksY = wmwe.deltaY > 0 ? 1 : -1; | 681 wmwe.wheelTicksY = wmwe.deltaY > 0 ? 1 : -1; |
682 | 682 |
683 host_->ForwardWheelEvent(wmwe); | 683 host_->ForwardWheelEvent(wmwe); |
684 return true; | 684 return true; |
685 } | 685 } |
686 | 686 |
687 ui::TextInputClient* RenderWidgetHostViewViews::GetTextInputClient() { | 687 views::TextInputClient* RenderWidgetHostViewViews::GetTextInputClient() { |
688 return this; | 688 return this; |
689 } | 689 } |
690 | 690 |
691 bool RenderWidgetHostViewViews::GetTooltipText(const gfx::Point& p, | 691 bool RenderWidgetHostViewViews::GetTooltipText(const gfx::Point& p, |
692 string16* tooltip) const { | 692 string16* tooltip) const { |
693 if (tooltip_text_.length() == 0) | 693 if (tooltip_text_.length() == 0) |
694 return false; | 694 return false; |
695 *tooltip = tooltip_text_; | 695 *tooltip = tooltip_text_; |
696 return true; | 696 return true; |
697 } | 697 } |
698 | 698 |
699 // ui::TextInputClient implementation ----------------------------------------- | 699 // TextInputClient implementation --------------------------------------------- |
700 void RenderWidgetHostViewViews::SetCompositionText( | 700 void RenderWidgetHostViewViews::SetCompositionText( |
701 const ui::CompositionText& composition) { | 701 const ui::CompositionText& composition) { |
702 if (!host_) | 702 if (!host_) |
703 return; | 703 return; |
704 | 704 |
705 // ui::CompositionUnderline should be identical to | 705 // ui::CompositionUnderline should be identical to |
706 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. | 706 // WebKit::WebCompositionUnderline, so that we can do reinterpret_cast safely. |
707 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == | 707 COMPILE_ASSERT(sizeof(ui::CompositionUnderline) == |
708 sizeof(WebKit::WebCompositionUnderline), | 708 sizeof(WebKit::WebCompositionUnderline), |
709 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); | 709 ui_CompositionUnderline__WebKit_WebCompositionUnderline_diff); |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 if (!host_) | 830 if (!host_) |
831 return false; | 831 return false; |
832 host_->UpdateTextDirection( | 832 host_->UpdateTextDirection( |
833 direction == base::i18n::RIGHT_TO_LEFT ? | 833 direction == base::i18n::RIGHT_TO_LEFT ? |
834 WebKit::WebTextDirectionRightToLeft : | 834 WebKit::WebTextDirectionRightToLeft : |
835 WebKit::WebTextDirectionLeftToRight); | 835 WebKit::WebTextDirectionLeftToRight); |
836 host_->NotifyTextDirection(); | 836 host_->NotifyTextDirection(); |
837 return true; | 837 return true; |
838 } | 838 } |
839 | 839 |
| 840 views::View* RenderWidgetHostViewViews::GetOwnerViewOfTextInputClient() { |
| 841 return this; |
| 842 } |
| 843 |
840 void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) { | 844 void RenderWidgetHostViewViews::OnPaint(gfx::Canvas* canvas) { |
841 if (is_hidden_ || !host_) | 845 if (is_hidden_ || !host_) |
842 return; | 846 return; |
843 | 847 |
844 DCHECK(!host_->is_accelerated_compositing_active() || | 848 DCHECK(!host_->is_accelerated_compositing_active() || |
845 get_use_acceleration_when_possible()); | 849 get_use_acceleration_when_possible()); |
846 | 850 |
847 // If we aren't using the views compositor, then | 851 // If we aren't using the views compositor, then |
848 // paint a "hole" in the canvas so that the render of the web page is on | 852 // paint a "hole" in the canvas so that the render of the web page is on |
849 // top of whatever else has already been painted in the views hierarchy. | 853 // top of whatever else has already been painted in the views hierarchy. |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 for (std::vector< base::Callback<void(void)> >::const_iterator | 1170 for (std::vector< base::Callback<void(void)> >::const_iterator |
1167 it = on_compositing_ended_callbacks_.begin(); | 1171 it = on_compositing_ended_callbacks_.begin(); |
1168 it != on_compositing_ended_callbacks_.end(); ++it) { | 1172 it != on_compositing_ended_callbacks_.end(); ++it) { |
1169 it->Run(); | 1173 it->Run(); |
1170 } | 1174 } |
1171 on_compositing_ended_callbacks_.clear(); | 1175 on_compositing_ended_callbacks_.clear(); |
1172 compositor->RemoveObserver(this); | 1176 compositor->RemoveObserver(this); |
1173 } | 1177 } |
1174 | 1178 |
1175 #endif | 1179 #endif |
OLD | NEW |