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 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
868 else | 868 else |
869 return bounds; | 869 return bounds; |
870 } | 870 } |
871 | 871 |
872 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { | 872 void RenderWidgetHostViewAura::SetBackground(const SkBitmap& background) { |
873 RenderWidgetHostViewBase::SetBackground(background); | 873 RenderWidgetHostViewBase::SetBackground(background); |
874 host_->SetBackground(background); | 874 host_->SetBackground(background); |
875 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); | 875 window_->layer()->SetFillsBoundsOpaquely(background.isOpaque()); |
876 } | 876 } |
877 | 877 |
878 int RenderWidgetHostViewAura::GetVisibleViewportHeight() const { | |
879 gfx::Rect window_bounds = window_->GetBoundsInScreen(); | |
880 gfx::Rect intersect = gfx::IntersectRects(window_bounds, | |
881 virtual_keyboard_bounds_); | |
882 int overlap = intersect.height(); | |
883 if (overlap > 0 && overlap < window_bounds.height()) | |
884 return window_bounds.height() - overlap; | |
885 return GetViewBounds().height(); | |
886 } | |
887 | |
888 void RenderWidgetHostViewAura::SetKeyboardBounds(const gfx::Rect& bounds) { | |
sky
2014/04/23 20:47:08
Is there a reason you can't set an insets? I'm thi
kevers
2014/04/23 20:57:49
The reason for explicitly using screen coordinates
sky
2014/04/23 21:15:31
Isn't that an implementation detail? Can't the key
kevers
2014/04/24 02:02:13
Done.
| |
889 if (bounds != virtual_keyboard_bounds_) { | |
890 virtual_keyboard_bounds_ = bounds; | |
891 host_->WasResized(); | |
892 } | |
893 } | |
894 | |
878 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 895 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
879 current_cursor_ = cursor; | 896 current_cursor_ = cursor; |
880 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 897 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
881 GetDisplayNearestWindow(window_); | 898 GetDisplayNearestWindow(window_); |
882 current_cursor_.SetDisplayInfo(display); | 899 current_cursor_.SetDisplayInfo(display); |
883 UpdateCursorIfOverSelf(); | 900 UpdateCursorIfOverSelf(); |
884 } | 901 } |
885 | 902 |
886 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 903 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
887 is_loading_ = is_loading; | 904 is_loading_ = is_loading; |
(...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3170 RenderWidgetHost* widget) { | 3187 RenderWidgetHost* widget) { |
3171 return new RenderWidgetHostViewAura(widget); | 3188 return new RenderWidgetHostViewAura(widget); |
3172 } | 3189 } |
3173 | 3190 |
3174 // static | 3191 // static |
3175 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3192 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
3176 GetScreenInfoForWindow(results, NULL); | 3193 GetScreenInfoForWindow(results, NULL); |
3177 } | 3194 } |
3178 | 3195 |
3179 } // namespace content | 3196 } // namespace content |
OLD | NEW |