Chromium Code Reviews| 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 gfx::SizeF RenderWidgetHostViewAura::GetVisibleViewportSize() const { | |
| 879 gfx::Rect window_bounds = window_->GetBoundsInScreen(); | |
| 880 aura::Window* root_window = window_->GetRootWindow(); | |
| 881 if (root_window) { | |
| 882 gfx::Rect root_window_bounds = root_window->GetBoundsInScreen(); | |
| 883 gfx::Rect available_bounds = gfx::Rect( | |
| 884 root_window_bounds.x() + root_window_insets_.left(), | |
| 885 root_window_bounds.y() + root_window_insets_.top(), | |
| 886 root_window_bounds.width() - root_window_insets_.left() - | |
| 887 root_window_insets_.right(), | |
|
sky
2014/04/24 15:55:09
The insets should be relative to window_, not the
kevers
2014/04/24 18:38:33
Done. Added TODOs to keyboard controller to addre
| |
| 888 root_window_bounds.height() - root_window_insets_.top() - | |
| 889 root_window_insets_.bottom()); | |
| 890 gfx::Rect intersect = gfx::IntersectRects(window_bounds, available_bounds); | |
| 891 int overlap = intersect.height(); | |
| 892 if (overlap > 0 && overlap < window_bounds.height()) | |
| 893 return gfx::SizeF(intersect.width(), intersect.height()); | |
| 894 } | |
| 895 return gfx::SizeF(GetViewBounds().width(), GetViewBounds().height()); | |
| 896 } | |
| 897 | |
| 898 void RenderWidgetHostViewAura::SetInsets(const gfx::Insets& insets) { | |
| 899 if (insets != root_window_insets_) { | |
| 900 root_window_insets_ = insets; | |
| 901 host_->WasResized(); | |
| 902 } | |
| 903 } | |
| 904 | |
| 878 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { | 905 void RenderWidgetHostViewAura::UpdateCursor(const WebCursor& cursor) { |
| 879 current_cursor_ = cursor; | 906 current_cursor_ = cursor; |
| 880 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> | 907 const gfx::Display display = gfx::Screen::GetScreenFor(window_)-> |
| 881 GetDisplayNearestWindow(window_); | 908 GetDisplayNearestWindow(window_); |
| 882 current_cursor_.SetDisplayInfo(display); | 909 current_cursor_.SetDisplayInfo(display); |
| 883 UpdateCursorIfOverSelf(); | 910 UpdateCursorIfOverSelf(); |
| 884 } | 911 } |
| 885 | 912 |
| 886 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { | 913 void RenderWidgetHostViewAura::SetIsLoading(bool is_loading) { |
| 887 is_loading_ = is_loading; | 914 is_loading_ = is_loading; |
| (...skipping 2282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3170 RenderWidgetHost* widget) { | 3197 RenderWidgetHost* widget) { |
| 3171 return new RenderWidgetHostViewAura(widget); | 3198 return new RenderWidgetHostViewAura(widget); |
| 3172 } | 3199 } |
| 3173 | 3200 |
| 3174 // static | 3201 // static |
| 3175 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { | 3202 void RenderWidgetHostViewPort::GetDefaultScreenInfo(WebScreenInfo* results) { |
| 3176 GetScreenInfoForWindow(results, NULL); | 3203 GetScreenInfoForWindow(results, NULL); |
| 3177 } | 3204 } |
| 3178 | 3205 |
| 3179 } // namespace content | 3206 } // namespace content |
| OLD | NEW |