diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 03:24:06 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-26 03:24:06 +0000 |
commit | 38b444fe15e6d255db0a7a7a40928e71de3b0ba1 (patch) | |
tree | 87f666d95fac1ef6e489e78c57fad1554d39f7a9 /ui | |
parent | 3240e0812ab1a3a7a97f570871c33fd54168fc1b (diff) | |
download | chromium_src-38b444fe15e6d255db0a7a7a40928e71de3b0ba1.zip chromium_src-38b444fe15e6d255db0a7a7a40928e71de3b0ba1.tar.gz chromium_src-38b444fe15e6d255db0a7a7a40928e71de3b0ba1.tar.bz2 |
aura: No shadow for transparent window.
- Add a transparent flag to Window;
- Use the transparent in Window::Init to call Layer::SetFillsBoundsOpaquely;
- Update ShadowController to use SHADOW_TYPE_NONE for transparent window;
Side change:
- Make tooltip widget non-transparent as it needs the default shadow;
BUG=110916
TEST=Verify fix for issue 110916 and drop-n-drop works as before.
Review URL: http://codereview.chromium.org/9169050
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@119184 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/window.cc | 8 | ||||
-rw-r--r-- | ui/aura/window.h | 6 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 2 |
3 files changed, 15 insertions, 1 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 5502f5d..a47d897 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -41,6 +41,7 @@ Window::Window(WindowDelegate* delegate) parent_(NULL), transient_parent_(NULL), id_(-1), + transparent_(false), user_data_(NULL), stops_event_propagation_(false), ignore_events_(false) { @@ -100,6 +101,7 @@ void Window::Init(ui::Layer::LayerType layer_type) { layer_->SetVisible(false); layer_->set_delegate(this); UpdateLayerName(name_); + layer_->SetFillsBoundsOpaquely(!transparent_); RootWindow::GetInstance()->WindowInitialized(this); } @@ -117,6 +119,12 @@ void Window::SetName(const std::string& name) { UpdateLayerName(name_); } +void Window::SetTransparent(bool transparent) { + // Cannot change transparent flag after the window is initialized. + DCHECK(!layer()); + transparent_ = transparent; +} + ui::Layer* Window::AcquireLayer() { return layer_.release(); } diff --git a/ui/aura/window.h b/ui/aura/window.h index 9fc775e..9d3a2fd 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -70,6 +70,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate { const string16 title() const { return title_; } void set_title(const string16& title) { title_ = title; } + bool transparent() const { return transparent_; } + void SetTransparent(bool transparent); + ui::Layer* layer() { return layer_.get(); } const ui::Layer* layer() const { return layer_.get(); } @@ -341,6 +344,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate { string16 title_; + // Whether layer is initialized as non-opaque. + bool transparent_; + scoped_ptr<EventFilter> event_filter_; scoped_ptr<LayoutManager> layout_manager_; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 71d25cb..5842627 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -166,13 +166,13 @@ void NativeWidgetAura::InitNativeWidget(const Widget::InitParams& params) { window_->SetType(GetAuraWindowTypeForWidgetType(window_type)); // TODO(jamescook): Should this use params.show_state instead? window_->SetIntProperty(aura::client::kShowStateKey, ui::SHOW_STATE_NORMAL); + window_->SetTransparent(params.transparent); window_->Init(params.create_texture_for_layer ? ui::Layer::LAYER_HAS_TEXTURE : ui::Layer::LAYER_HAS_NO_TEXTURE); if (window_type == Widget::InitParams::TYPE_CONTROL) window_->Show(); - window_->layer()->SetFillsBoundsOpaquely(!params.transparent); delegate_->OnNativeWidgetCreated(); window_->SetBounds(params.bounds); if (window_type == Widget::InitParams::TYPE_CONTROL) { |