Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: components/exo/shell_surface.cc

Issue 2870613002: Use defualt shadow elevation. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/exo/shell_surface.h" 5 #include "components/exo/shell_surface.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/frame/custom_frame_view_ash.h" 9 #include "ash/frame/custom_frame_view_ash.h"
10 #include "ash/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 1575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 ((widget_->IsFullscreen() || widget_->IsMaximized()) || 1586 ((widget_->IsFullscreen() || widget_->IsMaximized()) ||
1587 underlay_capture_events) && 1587 underlay_capture_events) &&
1588 ash::wm::GetWindowState(window)->allow_set_bounds_direct() && 1588 ash::wm::GetWindowState(window)->allow_set_bounds_direct() &&
1589 window->layer()->GetTargetTransform().IsIdentity(); 1589 window->layer()->GetTargetTransform().IsIdentity();
1590 1590
1591 if (!shadow_enabled_ && !black_background_enabled) { 1591 if (!shadow_enabled_ && !black_background_enabled) {
1592 wm::SetShadowElevation(window, wm::ShadowElevation::NONE); 1592 wm::SetShadowElevation(window, wm::ShadowElevation::NONE);
1593 if (shadow_underlay_) 1593 if (shadow_underlay_)
1594 shadow_underlay_->Hide(); 1594 shadow_underlay_->Hide();
1595 } else { 1595 } else {
1596 wm::SetShadowElevation(window, wm::ShadowElevation::MEDIUM); 1596 wm::SetShadowElevation(window, wm::ShadowElevation::DEFAULT);
1597 gfx::Rect shadow_content_bounds = 1597 gfx::Rect shadow_content_bounds =
1598 gfx::ScaleToEnclosedRect(shadow_content_bounds_, 1.f / scale_); 1598 gfx::ScaleToEnclosedRect(shadow_content_bounds_, 1.f / scale_);
1599 1599
1600 // Convert from screen to display coordinates. 1600 // Convert from screen to display coordinates.
1601 if (!shadow_content_bounds.IsEmpty()) { 1601 if (!shadow_content_bounds.IsEmpty()) {
1602 gfx::Point origin = shadow_content_bounds.origin() - origin_offset_; 1602 gfx::Point origin = shadow_content_bounds.origin() - origin_offset_;
1603 wm::ConvertPointFromScreen(window->parent(), &origin); 1603 wm::ConvertPointFromScreen(window->parent(), &origin);
1604 shadow_content_bounds.set_origin(origin); 1604 shadow_content_bounds.set_origin(origin);
1605 } 1605 }
1606 1606
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 window->StackChildAbove(shadow_overlay(), shadow_underlay()); 1720 window->StackChildAbove(shadow_overlay(), shadow_underlay());
1721 } 1721 }
1722 shadow_overlay_->Show(); 1722 shadow_overlay_->Show();
1723 } 1723 }
1724 shadow_overlay_->SetBounds(shadow_bounds); 1724 shadow_overlay_->SetBounds(shadow_bounds);
1725 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size())); 1725 shadow->SetContentBounds(gfx::Rect(shadow_bounds.size()));
1726 // Surfaces that can't be activated are usually menus and tooltips. Use a 1726 // Surfaces that can't be activated are usually menus and tooltips. Use a
1727 // small style shadow for them. 1727 // small style shadow for them.
1728 if (!activatable_) 1728 if (!activatable_)
1729 shadow->SetElevation(wm::ShadowElevation::SMALL); 1729 shadow->SetElevation(wm::ShadowElevation::SMALL);
1730 // We don't have rounded corners unless frame is enabled.
1731 if (!frame_enabled_)
1732 shadow->SetRoundedCornerRadius(0);
oshima 2017/05/08 11:22:02 This is causing b/37254594
1733 } 1730 }
1734 } 1731 }
1735 1732
1736 gfx::Point ShellSurface::GetMouseLocation() const { 1733 gfx::Point ShellSurface::GetMouseLocation() const {
1737 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow(); 1734 aura::Window* const root_window = widget_->GetNativeWindow()->GetRootWindow();
1738 gfx::Point location = 1735 gfx::Point location =
1739 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); 1736 root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot();
1740 aura::Window::ConvertPointToTarget( 1737 aura::Window::ConvertPointToTarget(
1741 root_window, widget_->GetNativeWindow()->parent(), &location); 1738 root_window, widget_->GetNativeWindow()->parent(), &location);
1742 return location; 1739 return location;
1743 } 1740 }
1744 1741
1745 } // namespace exo 1742 } // namespace exo
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698