| 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_aura.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_aura.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) | 922 #endif // defined(USE_X11) && !defined(OS_CHROMEOS) |
| 923 } | 923 } |
| 924 | 924 |
| 925 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { | 925 gfx::Size RenderWidgetHostViewAura::GetRequestedRendererSize() const { |
| 926 return delegated_frame_host_->GetRequestedRendererSize(); | 926 return delegated_frame_host_->GetRequestedRendererSize(); |
| 927 } | 927 } |
| 928 | 928 |
| 929 void RenderWidgetHostViewAura::SelectionBoundsChanged( | 929 void RenderWidgetHostViewAura::SelectionBoundsChanged( |
| 930 const ViewHostMsg_SelectionBounds_Params& params) { | 930 const ViewHostMsg_SelectionBounds_Params& params) { |
| 931 ui::SelectionBound anchor_bound, focus_bound; | 931 ui::SelectionBound anchor_bound, focus_bound; |
| 932 anchor_bound.edge_top = params.anchor_rect.origin(); | 932 anchor_bound.SetEdge(params.anchor_rect.origin(), |
| 933 anchor_bound.edge_bottom = params.anchor_rect.bottom_left(); | 933 params.anchor_rect.bottom_left()); |
| 934 focus_bound.edge_top = params.focus_rect.origin(); | 934 focus_bound.SetEdge(params.focus_rect.origin(), |
| 935 focus_bound.edge_bottom = params.focus_rect.bottom_left(); | 935 params.focus_rect.bottom_left()); |
| 936 | 936 |
| 937 if (params.anchor_rect == params.focus_rect) { | 937 if (params.anchor_rect == params.focus_rect) { |
| 938 anchor_bound.type = focus_bound.type = ui::SelectionBound::CENTER; | 938 anchor_bound.set_type(ui::SelectionBound::CENTER); |
| 939 focus_bound.set_type(ui::SelectionBound::CENTER); |
| 939 } else { | 940 } else { |
| 940 // Whether text is LTR at the anchor handle. | 941 // Whether text is LTR at the anchor handle. |
| 941 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight; | 942 bool anchor_LTR = params.anchor_dir == blink::WebTextDirectionLeftToRight; |
| 942 // Whether text is LTR at the focus handle. | 943 // Whether text is LTR at the focus handle. |
| 943 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight; | 944 bool focus_LTR = params.focus_dir == blink::WebTextDirectionLeftToRight; |
| 944 | 945 |
| 945 if ((params.is_anchor_first && anchor_LTR) || | 946 if ((params.is_anchor_first && anchor_LTR) || |
| 946 (!params.is_anchor_first && !anchor_LTR)) { | 947 (!params.is_anchor_first && !anchor_LTR)) { |
| 947 anchor_bound.type = ui::SelectionBound::LEFT; | 948 anchor_bound.set_type(ui::SelectionBound::LEFT); |
| 948 } else { | 949 } else { |
| 949 anchor_bound.type = ui::SelectionBound::RIGHT; | 950 anchor_bound.set_type(ui::SelectionBound::RIGHT); |
| 950 } | 951 } |
| 951 if ((params.is_anchor_first && focus_LTR) || | 952 if ((params.is_anchor_first && focus_LTR) || |
| 952 (!params.is_anchor_first && !focus_LTR)) { | 953 (!params.is_anchor_first && !focus_LTR)) { |
| 953 focus_bound.type = ui::SelectionBound::RIGHT; | 954 focus_bound.set_type(ui::SelectionBound::RIGHT); |
| 954 } else { | 955 } else { |
| 955 focus_bound.type = ui::SelectionBound::LEFT; | 956 focus_bound.set_type(ui::SelectionBound::LEFT); |
| 956 } | 957 } |
| 957 } | 958 } |
| 958 | 959 |
| 959 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_) | 960 if (anchor_bound == selection_anchor_ && focus_bound == selection_focus_) |
| 960 return; | 961 return; |
| 961 | 962 |
| 962 selection_anchor_ = anchor_bound; | 963 selection_anchor_ = anchor_bound; |
| 963 selection_focus_ = focus_bound; | 964 selection_focus_ = focus_bound; |
| 964 if (GetInputMethod()) | 965 if (GetInputMethod()) |
| 965 GetInputMethod()->OnCaretBoundsChanged(this); | 966 GetInputMethod()->OnCaretBoundsChanged(this); |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2573 | 2574 |
| 2574 //////////////////////////////////////////////////////////////////////////////// | 2575 //////////////////////////////////////////////////////////////////////////////// |
| 2575 // RenderWidgetHostViewBase, public: | 2576 // RenderWidgetHostViewBase, public: |
| 2576 | 2577 |
| 2577 // static | 2578 // static |
| 2578 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { | 2579 void RenderWidgetHostViewBase::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 2579 GetScreenInfoForWindow(results, NULL); | 2580 GetScreenInfoForWindow(results, NULL); |
| 2580 } | 2581 } |
| 2581 | 2582 |
| 2582 } // namespace content | 2583 } // namespace content |
| OLD | NEW |