| 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 "views/controls/native/native_view_host.h" | 5 #include "views/controls/native/native_view_host.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "ui/gfx/canvas.h" | 8 #include "ui/gfx/canvas.h" |
| 9 #include "views/controls/native/native_view_host_views.h" | 9 #include "views/controls/native/native_view_host_views.h" |
| 10 #include "views/controls/native/native_view_host_wrapper.h" | 10 #include "views/controls/native/native_view_host_wrapper.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 OnPaintBackground(canvas); | 134 OnPaintBackground(canvas); |
| 135 | 135 |
| 136 // The area behind our window is black, so during a fast resize (where our | 136 // The area behind our window is black, so during a fast resize (where our |
| 137 // content doesn't draw over the full size of our native view, and the native | 137 // content doesn't draw over the full size of our native view, and the native |
| 138 // view background color doesn't show up), we need to cover that blackness | 138 // view background color doesn't show up), we need to cover that blackness |
| 139 // with something so that fast resizes don't result in black flash. | 139 // with something so that fast resizes don't result in black flash. |
| 140 // | 140 // |
| 141 // It would be nice if this used some approximation of the page's | 141 // It would be nice if this used some approximation of the page's |
| 142 // current background color. | 142 // current background color. |
| 143 if (native_wrapper_->HasInstalledClip()) | 143 if (native_wrapper_->HasInstalledClip()) |
| 144 canvas->FillRectInt(SK_ColorWHITE, 0, 0, width(), height()); | 144 canvas->FillRect(SK_ColorWHITE, GetLocalBounds()); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) { | 147 void NativeViewHost::VisibilityChanged(View* starting_from, bool is_visible) { |
| 148 Layout(); | 148 Layout(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 bool NativeViewHost::NeedsNotificationWhenVisibleBoundsChange() const { | 151 bool NativeViewHost::NeedsNotificationWhenVisibleBoundsChange() const { |
| 152 // The native widget is placed relative to the root. As such, we need to | 152 // The native widget is placed relative to the root. As such, we need to |
| 153 // know when the position of any ancestor changes, or our visibility relative | 153 // know when the position of any ancestor changes, or our visibility relative |
| 154 // to other views changed as it'll effect our position relative to the root. | 154 // to other views changed as it'll effect our position relative to the root. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // NativeViewHost, private: | 195 // NativeViewHost, private: |
| 196 | 196 |
| 197 void NativeViewHost::Detach(bool destroyed) { | 197 void NativeViewHost::Detach(bool destroyed) { |
| 198 DCHECK(native_view_ || views_view_); | 198 DCHECK(native_view_ || views_view_); |
| 199 native_wrapper_->NativeViewDetaching(destroyed); | 199 native_wrapper_->NativeViewDetaching(destroyed); |
| 200 native_view_ = NULL; | 200 native_view_ = NULL; |
| 201 views_view_ = NULL; | 201 views_view_ = NULL; |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace views | 204 } // namespace views |
| OLD | NEW |