Removes ash::features::ShouldUseShaderRoundedCorner() feature
This has been enabled on all devices for a while, now we can say
it's always true. Removing the flag and the legacy code now
makes sense.
Bug: 979365
Test: compilation succeeds / trybot
Change-Id: Icf8bbf06fbd385ad9ff50380d242e0b4b43960e2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1680986
Commit-Queue: Jun Mukai <mukai@chromium.org>
Reviewed-by: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Malay Keshav <malaykeshav@chromium.org>
Cr-Commit-Position: refs/heads/master@{#673408}
diff --git a/ash/app_list/views/app_list_view.cc b/ash/app_list/views/app_list_view.cc
index ba0f680..9eed216c 100644
--- a/ash/app_list/views/app_list_view.cc
+++ b/ash/app_list/views/app_list_view.cc
@@ -21,7 +21,6 @@
#include "ash/public/cpp/app_list/app_list_config.h"
#include "ash/public/cpp/app_list/app_list_features.h"
#include "ash/public/cpp/app_list/app_list_types.h"
-#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/wallpaper_types.h"
#include "base/macros.h"
@@ -385,9 +384,6 @@
~AppListBackgroundShieldView() override = default;
void UpdateBackground(bool use_blur) {
- DCHECK(!(use_blur && background_mask_))
- << "Avoid requesting blur when it already exists.";
-
DestroyLayer();
SetPaintToLayer(use_blur ? ui::LAYER_SOLID_COLOR : ui::LAYER_TEXTURED);
layer()->SetFillsBoundsOpaquely(false);
@@ -395,20 +391,9 @@
layer()->SetColor(color_);
layer()->SetBackgroundBlur(AppListConfig::instance().blur_radius());
layer()->SetBackdropFilterQuality(kAppListBlurQuality);
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- layer()->SetRoundedCornerRadius(
- {kAppListBackgroundRadius, kAppListBackgroundRadius, 0, 0});
- } else {
- if (!background_mask_) {
- background_mask_ = views::Painter::CreatePaintedLayer(
- views::Painter::CreateSolidRoundRectPainter(
- SK_ColorBLACK, kAppListBackgroundRadius));
- background_mask_->layer()->SetFillsBoundsOpaquely(false);
- }
- layer()->SetMaskLayer(background_mask_->layer());
- }
+ layer()->SetRoundedCornerRadius(
+ {kAppListBackgroundRadius, kAppListBackgroundRadius, 0, 0});
} else {
- background_mask_.reset();
layer()->SetBackgroundBlur(0);
}
}
@@ -432,13 +417,6 @@
gfx::Rect new_bounds = bounds;
new_bounds.Inset(0, 0, 0, -kAppListBackgroundRadius * 2);
SetBoundsRect(new_bounds);
-
- // Update the |background_mask_| with the same shape and size if their size
- // doesn't match.
- if (background_mask_ &&
- layer()->size() != background_mask_->layer()->size()) {
- background_mask_->layer()->SetBounds(new_bounds);
- }
}
// Overridden from views::View:
@@ -456,9 +434,6 @@
}
private:
- // Prevents background blur from showing around the rounded corners when blur
- // is enabled.
- std::unique_ptr<ui::LayerOwner> background_mask_;
SkColor color_;
DISALLOW_COPY_AND_ASSIGN(AppListBackgroundShieldView);
diff --git a/ash/display/window_tree_host_manager.cc b/ash/display/window_tree_host_manager.cc
index 5bd6545..b31e690 100644
--- a/ash/display/window_tree_host_manager.cc
+++ b/ash/display/window_tree_host_manager.cc
@@ -64,6 +64,9 @@
// This is initialized in the constructor, and then in CreatePrimaryHost().
int64_t primary_display_id = -1;
+// The default memory limit: 512mb.
+const char kUICompositorDefaultMemoryLimitMB[] = "512";
+
display::DisplayManager* GetDisplayManager() {
return Shell::Get()->display_manager();
}
@@ -92,33 +95,6 @@
return ash_host->AsWindowTreeHost()->window();
}
-const char* GetUICompositorMemoryLimitMB() {
- bool uses_shader_rounded_corner = features::ShouldUseShaderRoundedCorner();
- // TODO(oshima): Cleanup once new rounded corners is launched.
- // Uses 512mb which is default.
- if (uses_shader_rounded_corner)
- return "512";
-
- display::DisplayManager* display_manager =
- ash::Shell::Get()->display_manager();
- int width;
- if (display::Display::HasInternalDisplay()) {
- // If the device has an internal display, use it even if
- // it's disabled (can happen when booted in docked mode.
- const display::ManagedDisplayInfo& display_info =
- display_manager->GetDisplayInfo(display::Display::InternalDisplayId());
- width = display_info.size_in_pixel().width();
- } else {
- // Otherwise just use the primary.
- width = display::Screen::GetScreen()
- ->GetPrimaryDisplay()
- .GetSizeInPixel()
- .width();
- }
-
- return width >= 3000 ? "1024" : "512";
-}
-
} // namespace
// A utility class to store/restore focused/active window
@@ -262,7 +238,7 @@
switches::kUiCompositorMemoryLimitWhenVisibleMB)) {
command_line->AppendSwitchASCII(
switches::kUiCompositorMemoryLimitWhenVisibleMB,
- GetUICompositorMemoryLimitMB());
+ kUICompositorDefaultMemoryLimitMB);
}
const display::Display& primary_candidate =
diff --git a/ash/public/cpp/ash_features.cc b/ash/public/cpp/ash_features.cc
index 5e2f0e3..93c6115 100644
--- a/ash/public/cpp/ash_features.cc
+++ b/ash/public/cpp/ash_features.cc
@@ -78,9 +78,6 @@
const base::Feature kSupervisedUserDeprecationNotice{
"SupervisedUserDeprecationNotice", base::FEATURE_ENABLED_BY_DEFAULT};
-const base::Feature kUseShaderRoundedCorner{"UseShaderRoundedCorner",
- base::FEATURE_ENABLED_BY_DEFAULT};
-
const base::Feature kSystemTrayFeaturePodsPagination{
"SystemTrayFeaturePodsPagination", base::FEATURE_DISABLED_BY_DEFAULT};
@@ -144,10 +141,6 @@
return base::FeatureList::IsEnabled(kSupervisedUserDeprecationNotice);
}
-bool ShouldUseShaderRoundedCorner() {
- return base::FeatureList::IsEnabled(kUseShaderRoundedCorner);
-}
-
bool IsSystemTrayFeaturePodsPaginationEnabled() {
return base::FeatureList::IsEnabled(kSystemTrayFeaturePodsPagination);
}
diff --git a/ash/public/cpp/ash_features.h b/ash/public/cpp/ash_features.h
index 9bf3fc16..69eca1f3 100644
--- a/ash/public/cpp/ash_features.h
+++ b/ash/public/cpp/ash_features.h
@@ -95,10 +95,6 @@
// Enables the Supervised User Deprecation notices.
ASH_PUBLIC_EXPORT extern const base::Feature kSupervisedUserDeprecationNotice;
-// Uses fragment shader for all the rounded corners instead of mask layer. This
-// improves memory performance by avoiding render surfaces where ever possible.
-ASH_PUBLIC_EXPORT extern const base::Feature kUseShaderRoundedCorner;
-
// Enables pagination for feature pod buttons in the system tray
ASH_PUBLIC_EXPORT extern const base::Feature kSystemTrayFeaturePodsPagination;
@@ -134,8 +130,6 @@
ASH_PUBLIC_EXPORT bool IsSupervisedUserDeprecationNoticeEnabled();
-ASH_PUBLIC_EXPORT bool ShouldUseShaderRoundedCorner();
-
ASH_PUBLIC_EXPORT bool IsSystemTrayFeaturePodsPaginationEnabled();
ASH_PUBLIC_EXPORT bool IsSwapSideVolumeButtonsForOrientationEnabled();
diff --git a/ash/public/cpp/rounded_corner_decorator.cc b/ash/public/cpp/rounded_corner_decorator.cc
index 52445f09..7924830a 100644
--- a/ash/public/cpp/rounded_corner_decorator.cc
+++ b/ash/public/cpp/rounded_corner_decorator.cc
@@ -20,12 +20,8 @@
: layer_window_(layer_window), layer_(layer), radius_(radius) {
layer_window_->AddObserver(this);
layer_->AddObserver(this);
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- layer_->SetRoundedCornerRadius({radius_, radius_, radius_, radius_});
- layer_->SetIsFastRoundedCorner(true);
- } else {
- Update(layer_->size());
- }
+ layer_->SetRoundedCornerRadius({radius_, radius_, radius_, radius_});
+ layer_->SetIsFastRoundedCorner(true);
// Update the shadow if necessary.
ui::Shadow* shadow = wm::ShadowController::GetShadowForWindow(shadow_window);
@@ -41,65 +37,18 @@
return !!layer_;
}
-void RoundedCornerDecorator::OnPaintLayer(const ui::PaintContext& context) {
- cc::PaintFlags flags;
- flags.setAlpha(255);
- flags.setAntiAlias(true);
- flags.setStyle(cc::PaintFlags::kFill_Style);
-
- SkScalar radii[8] = {radius_, radius_, // top-left
- radius_, radius_, // top-right
- radius_, radius_, // bottom-right
- radius_, radius_}; // bottom-left
- SkPath path;
- const gfx::Size size = mask_layer_->size();
- path.addRoundRect(gfx::RectToSkRect(gfx::Rect(size)), radii);
-
- ui::PaintRecorder recorder(context, size);
- recorder.canvas()->DrawPath(path, flags);
-}
-
void RoundedCornerDecorator::LayerDestroyed(ui::Layer* layer) {
Shutdown();
}
-void RoundedCornerDecorator::OnWindowBoundsChanged(
- aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- ui::PropertyChangeReason reason) {
- Update(new_bounds.size());
-}
-
void RoundedCornerDecorator::OnWindowDestroying(aura::Window* window) {
Shutdown();
}
-void RoundedCornerDecorator::Update(const gfx::Size& size) {
- if (ash::features::ShouldUseShaderRoundedCorner())
- return;
-
- DCHECK(layer_window_);
- DCHECK(layer_);
- if (!mask_layer_) {
- mask_layer_ = std::make_unique<ui::Layer>(ui::LAYER_TEXTURED);
- mask_layer_->set_delegate(this);
- mask_layer_->SetFillsBoundsOpaquely(false);
- layer_->SetMaskLayer(mask_layer_.get());
- }
- mask_layer_->SetBounds(gfx::Rect(size));
-}
-
void RoundedCornerDecorator::Shutdown() {
if (!IsValid())
return;
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- layer_->SetRoundedCornerRadius({0, 0, 0, 0});
- } else {
- if (layer_->layer_mask_layer() == mask_layer_.get())
- layer_->SetMaskLayer(nullptr);
- mask_layer_.reset();
- }
+ layer_->SetRoundedCornerRadius({0, 0, 0, 0});
layer_->RemoveObserver(this);
layer_window_->RemoveObserver(this);
diff --git a/ash/public/cpp/rounded_corner_decorator.h b/ash/public/cpp/rounded_corner_decorator.h
index 00b72d1..01a48cc 100644
--- a/ash/public/cpp/rounded_corner_decorator.h
+++ b/ash/public/cpp/rounded_corner_decorator.h
@@ -10,7 +10,6 @@
#include "ash/public/cpp/ash_public_export.h"
#include "ui/aura/window_observer.h"
#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_delegate.h"
#include "ui/compositor/layer_observer.h"
#include "ui/gfx/geometry/size.h"
@@ -20,8 +19,7 @@
// Applies rounded corners to the given layer, and modifies the shadow of
// the given window to be rounded.
-class ASH_PUBLIC_EXPORT RoundedCornerDecorator : public ui::LayerDelegate,
- public ui::LayerObserver,
+class ASH_PUBLIC_EXPORT RoundedCornerDecorator : public ui::LayerObserver,
public aura::WindowObserver {
public:
RoundedCornerDecorator(aura::Window* shadow_window,
@@ -34,28 +32,17 @@
// layer.
bool IsValid();
- // ui::LayerDelegate:
- void OnPaintLayer(const ui::PaintContext& context) override;
- void OnDeviceScaleFactorChanged(float old_device_scale_factor,
- float new_device_scale_factor) override {}
-
// ui::LayerObserver:
void LayerDestroyed(ui::Layer* layer) override;
// aura::WindowObserver:
- void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- ui::PropertyChangeReason reason) override;
void OnWindowDestroying(aura::Window* window) override;
private:
- void Update(const gfx::Size& size);
void Shutdown();
aura::Window* layer_window_;
ui::Layer* layer_;
- std::unique_ptr<ui::Layer> mask_layer_;
int radius_;
DISALLOW_COPY_AND_ASSIGN(RoundedCornerDecorator);
diff --git a/ash/public/cpp/rounded_corner_decorator_unittest.cc b/ash/public/cpp/rounded_corner_decorator_unittest.cc
index c6a27730..2d75f6a 100644
--- a/ash/public/cpp/rounded_corner_decorator_unittest.cc
+++ b/ash/public/cpp/rounded_corner_decorator_unittest.cc
@@ -13,33 +13,10 @@
namespace ash {
-class RoundedCornerDecoratorTest : public aura::test::AuraTestBase,
- public testing::WithParamInterface<bool> {
- public:
- RoundedCornerDecoratorTest() = default;
- ~RoundedCornerDecoratorTest() override = default;
-
- void SetUp() override {
- aura::test::AuraTestBase::SetUp();
- if (UseShaderForRoundedCorner()) {
- scoped_feature_list_.InitAndEnableFeature(
- ash::features::kUseShaderRoundedCorner);
- } else {
- scoped_feature_list_.InitAndDisableFeature(
- ash::features::kUseShaderRoundedCorner);
- }
- }
-
- bool UseShaderForRoundedCorner() const { return GetParam(); }
-
- private:
- base::test::ScopedFeatureList scoped_feature_list_;
-
- DISALLOW_COPY_AND_ASSIGN(RoundedCornerDecoratorTest);
-};
+using RoundedCornerDecoratorTest = aura::test::AuraTestBase;
// Test that the decorator doesn't try to apply itself to destroyed layers.
-TEST_P(RoundedCornerDecoratorTest, RoundedCornerMaskProperlyInvalidatesItself) {
+TEST_F(RoundedCornerDecoratorTest, RoundedCornerMaskProperlyInvalidatesItself) {
constexpr int kCornerRadius = 4;
constexpr gfx::RoundedCornersF kRadii(kCornerRadius);
std::unique_ptr<aura::Window> window(aura::test::CreateTestWindowWithBounds(
@@ -49,12 +26,8 @@
// Confirm a mask layer exists and the decorator is valid.
EXPECT_TRUE(window->layer());
- if (UseShaderForRoundedCorner()) {
- ASSERT_FALSE(window->layer()->layer_mask_layer());
- EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
- } else {
- EXPECT_TRUE(window->layer()->layer_mask_layer());
- }
+ ASSERT_FALSE(window->layer()->layer_mask_layer());
+ EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
EXPECT_TRUE(decorator->IsValid());
// Destroy window.
@@ -65,7 +38,7 @@
}
// Test that mask layer changes bounds with the window it is applied to.
-TEST_P(RoundedCornerDecoratorTest,
+TEST_F(RoundedCornerDecoratorTest,
RoundedCornerMaskChangesBoundsOnWindowBoundsChange) {
constexpr int kCornerRadius = 4;
constexpr gfx::RoundedCornersF kRadii(kCornerRadius);
@@ -74,15 +47,8 @@
auto decorator = std::make_unique<ash::RoundedCornerDecorator>(
window.get(), window.get(), window->layer(), kCornerRadius);
- if (UseShaderForRoundedCorner()) {
- ASSERT_FALSE(window->layer()->layer_mask_layer());
- EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
- } else {
- // Make sure the mask layer has the correct bounds and exists.
- ASSERT_TRUE(window->layer()->layer_mask_layer());
- EXPECT_EQ(gfx::Rect(0, 0, 100, 100),
- window->layer()->layer_mask_layer()->bounds());
- }
+ ASSERT_FALSE(window->layer()->layer_mask_layer());
+ EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
// Change the bounds of the window. Set zero duration animations to apply
// changes immediately.
@@ -91,18 +57,8 @@
// Make sure the mask layer's bounds are also changed.
EXPECT_EQ(gfx::Rect(0, 0, 150, 150).ToString(), window->bounds().ToString());
- if (UseShaderForRoundedCorner()) {
- ASSERT_FALSE(window->layer()->layer_mask_layer());
- EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
- } else {
- EXPECT_EQ(window->layer()->layer_mask_layer()->bounds().ToString(),
- window->bounds().ToString());
- }
+ ASSERT_FALSE(window->layer()->layer_mask_layer());
+ EXPECT_EQ(window->layer()->rounded_corner_radii(), kRadii);
}
-INSTANTIATE_TEST_SUITE_P(
- /* prefix intentionally left blank due to only one parameterization */,
- RoundedCornerDecoratorTest,
- testing::Bool());
-
} // namespace ash
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc
index 094cf0dd..67d61d1 100644
--- a/ash/shelf/shelf_view.cc
+++ b/ash/shelf/shelf_view.cc
@@ -14,7 +14,6 @@
#include "ash/keyboard/ui/keyboard_controller.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/public/cpp/ash_constants.h"
-#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shelf_model.h"
#include "ash/public/cpp/shelf_types.h"
#include "ash/public/cpp/window_properties.h"
@@ -2299,17 +2298,9 @@
void ShelfView::SetDragImageBlur(const gfx::Size& size, int blur_radius) {
drag_image_->SetPaintToLayer();
drag_image_->layer()->SetFillsBoundsOpaquely(false);
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- const uint32_t radius = std::round(size.width() / 2.f);
- drag_image_->layer()->SetRoundedCornerRadius(
- {radius, radius, radius, radius});
- } else {
- drag_image_mask_ = views::Painter::CreatePaintedLayer(
- views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK,
- size.width() / 2.0f));
- drag_image_mask_->layer()->SetBounds(gfx::Rect(size));
- drag_image_->layer()->SetMaskLayer(drag_image_mask_->layer());
- }
+ const uint32_t radius = std::round(size.width() / 2.f);
+ drag_image_->layer()->SetRoundedCornerRadius(
+ {radius, radius, radius, radius});
drag_image_->layer()->SetBackgroundBlur(blur_radius);
}
diff --git a/ash/shelf/shelf_view.h b/ash/shelf/shelf_view.h
index fe0ea61b..8881424 100644
--- a/ash/shelf/shelf_view.h
+++ b/ash/shelf/shelf_view.h
@@ -633,9 +633,6 @@
// the item can be dragged outside the app grid.
std::unique_ptr<ash::DragImageView> drag_image_;
- // The owner of a mask layer used to clip the background blur.
- std::unique_ptr<ui::LayerOwner> drag_image_mask_;
-
// The cursor offset to the middle of the dragged item.
gfx::Vector2d drag_image_offset_;
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc
index 56332e1..16f90b8 100644
--- a/ash/shelf/shelf_widget.cc
+++ b/ash/shelf/shelf_widget.cc
@@ -34,7 +34,6 @@
#include "base/command_line.h"
#include "chromeos/constants/chromeos_switches.h"
#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_owner.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/skbitmap_operations.h"
#include "ui/views/accessible_pane_view.h"
@@ -121,9 +120,6 @@
// ShelfBackgroundAnimator.
ui::Layer opaque_background_;
- // A mask to show rounded corners when appropriate.
- std::unique_ptr<ui::LayerOwner> mask_ = nullptr;
-
// When true, the default focus of the shelf is the last focusable child.
bool default_last_focusable_child_ = false;
@@ -233,46 +229,25 @@
// To achieve this, we extend the layer in the same direction where the shelf
// is aligned (downwards for a bottom shelf, etc.).
const int radius = kShelfRoundedCornerRadius;
- // With shader rounded corners, we can easily round only 2 corners out of
- // 4 which means we don't need as much extra shelf height.
- const int safety_margin = ash::features::ShouldUseShaderRoundedCorner()
- ? kShelfMaxOvershootHeight
- : 3 * radius;
+ // We can easily round only 2 corners out of 4 which means we don't need as
+ // much extra shelf height.
+ const int safety_margin = kShelfMaxOvershootHeight;
opaque_background_bounds.Inset(
-shelf->SelectValueForShelfAlignment(0, safety_margin, 0), 0,
-shelf->SelectValueForShelfAlignment(0, 0, safety_margin),
-shelf->SelectValueForShelfAlignment(safety_margin, 0, 0));
// Show rounded corners except in maximized (which includes split view) mode.
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- if (background_type == SHELF_BACKGROUND_MAXIMIZED) {
- opaque_background_.SetRoundedCornerRadius({0, 0, 0, 0});
- } else {
- opaque_background_.SetRoundedCornerRadius({
- shelf->SelectValueForShelfAlignment(radius, 0, radius),
- shelf->SelectValueForShelfAlignment(radius, radius, 0),
- shelf->SelectValueForShelfAlignment(0, radius, 0),
- shelf->SelectValueForShelfAlignment(0, 0, radius),
- });
- opaque_background_.AddCacheRenderSurfaceRequest();
- }
+ if (background_type == SHELF_BACKGROUND_MAXIMIZED) {
+ opaque_background_.SetRoundedCornerRadius({0, 0, 0, 0});
} else {
- if (background_type == SHELF_BACKGROUND_MAXIMIZED) {
- if (mask_)
- opaque_background_.RemoveCacheRenderSurfaceRequest();
- mask_ = nullptr;
- opaque_background_.SetMaskLayer(nullptr);
- } else {
- if (!mask_) {
- mask_ = views::Painter::CreatePaintedLayer(
- views::Painter::CreateSolidRoundRectPainter(SK_ColorBLACK, radius));
- mask_->layer()->SetFillsBoundsOpaquely(false);
- opaque_background_.SetMaskLayer(mask_->layer());
- opaque_background_.AddCacheRenderSurfaceRequest();
- }
- if (mask_->layer()->bounds() != opaque_background_bounds)
- mask_->layer()->SetBounds(opaque_background_bounds);
- }
+ opaque_background_.SetRoundedCornerRadius({
+ shelf->SelectValueForShelfAlignment(radius, 0, radius),
+ shelf->SelectValueForShelfAlignment(radius, radius, 0),
+ shelf->SelectValueForShelfAlignment(0, radius, 0),
+ shelf->SelectValueForShelfAlignment(0, 0, radius),
+ });
+ opaque_background_.AddCacheRenderSurfaceRequest();
}
opaque_background_.SetBounds(opaque_background_bounds);
UpdateBackgroundBlur();
diff --git a/ash/system/message_center/arc/arc_notification_content_view.cc b/ash/system/message_center/arc/arc_notification_content_view.cc
index 98c0538..a9db22d 100644
--- a/ash/system/message_center/arc/arc_notification_content_view.cc
+++ b/ash/system/message_center/arc/arc_notification_content_view.cc
@@ -499,21 +499,9 @@
surface_copy_->root()->SetBounds(size);
layer()->Add(surface_copy_->root());
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- surface_copy_->root()->SetRoundedCornerRadius(
- {top_radius_, top_radius_, bottom_radius_, bottom_radius_});
- surface_copy_->root()->SetIsFastRoundedCorner(true);
- } else {
- if (!surface_copy_mask_) {
- surface_copy_mask_ = views::Painter::CreatePaintedLayer(
- std::make_unique<message_center::NotificationBackgroundPainter>(
- top_radius_, bottom_radius_));
- surface_copy_mask_->layer()->SetBounds(size);
- surface_copy_mask_->layer()->SetFillsBoundsOpaquely(false);
- }
- DCHECK(!surface_copy_mask_->layer()->parent());
- surface_copy_->root()->SetMaskLayer(surface_copy_mask_->layer());
- }
+ surface_copy_->root()->SetRoundedCornerRadius(
+ {top_radius_, top_radius_, bottom_radius_, bottom_radius_});
+ surface_copy_->root()->SetIsFastRoundedCorner(true);
// Changes the opacity instead of setting the visibility, to keep
// |EventFowarder| working.
diff --git a/ash/system/message_center/arc/arc_notification_content_view.h b/ash/system/message_center/arc/arc_notification_content_view.h
index d835b3e..caaa5712f 100644
--- a/ash/system/message_center/arc/arc_notification_content_view.h
+++ b/ash/system/message_center/arc/arc_notification_content_view.h
@@ -199,7 +199,6 @@
base::Optional<gfx::Insets> mask_insets_;
std::unique_ptr<ui::LayerTreeOwner> surface_copy_;
- std::unique_ptr<ui::LayerOwner> surface_copy_mask_;
DISALLOW_COPY_AND_ASSIGN(ArcNotificationContentView);
};
diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc
index 415edc8..99d6a49 100644
--- a/ash/system/tray/tray_bubble_view.cc
+++ b/ash/system/tray/tray_bubble_view.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <numeric>
-#include "ash/public/cpp/ash_features.h"
#include "base/macros.h"
#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColor.h"
@@ -17,7 +16,6 @@
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
-#include "ui/compositor/layer_owner.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/color_palette.h"
@@ -233,12 +231,6 @@
set_margins(gfx::Insets());
SetPaintToLayer();
- if (!ash::features::ShouldUseShaderRoundedCorner()) {
- bubble_content_mask_ = views::Painter::CreatePaintedLayer(
- views::Painter::CreateSolidRoundRectPainter(
- SK_ColorBLACK, bubble_border_->corner_radius()));
- }
-
auto layout = std::make_unique<BottomAlignedBoxLayout>(this);
layout->SetDefaultFlex(1);
layout_ = SetLayoutManager(std::move(layout));
@@ -266,14 +258,9 @@
}
void TrayBubbleView::InitializeAndShowBubble() {
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- int radius = bubble_border_->corner_radius();
- layer()->parent()->SetRoundedCornerRadius({radius, radius, radius, radius});
- layer()->parent()->SetIsFastRoundedCorner(true);
- } else {
- CHECK(bubble_content_mask_);
- layer()->parent()->SetMaskLayer(bubble_content_mask_->layer());
- }
+ int radius = bubble_border_->corner_radius();
+ layer()->parent()->SetRoundedCornerRadius({radius, radius, radius, radius});
+ layer()->parent()->SetIsFastRoundedCorner(true);
GetWidget()->Show();
UpdateBubble();
@@ -358,12 +345,6 @@
return ax::mojom::Role::kDialog;
}
-void TrayBubbleView::SizeToContents() {
- BubbleDialogDelegateView::SizeToContents();
- if (bubble_content_mask_)
- bubble_content_mask_->layer()->SetBounds(layer()->parent()->bounds());
-}
-
void TrayBubbleView::OnBeforeBubbleWidgetInit(Widget::InitParams* params,
Widget* bubble_widget) const {
if (bubble_border_->shadow() == BubbleBorder::NO_ASSETS) {
diff --git a/ash/system/tray/tray_bubble_view.h b/ash/system/tray/tray_bubble_view.h
index fb55167..eb84375 100644
--- a/ash/system/tray/tray_bubble_view.h
+++ b/ash/system/tray/tray_bubble_view.h
@@ -19,10 +19,6 @@
#include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/mouse_watcher.h"
-namespace ui {
-class LayerOwner;
-}
-
namespace views {
class BoxLayout;
class View;
@@ -180,7 +176,6 @@
// Overridden from views::BubbleDialogDelegateView.
int GetDialogButtons() const override;
ax::mojom::Role GetAccessibleWindowRole() override;
- void SizeToContents() override;
// Overridden from views::View.
void ChildPreferredSizeChanged(View* child) override;
@@ -222,7 +217,6 @@
// the latter ensures we don't leak it before passing off ownership.
views::BubbleBorder* bubble_border_;
std::unique_ptr<views::BubbleBorder> owned_bubble_border_;
- std::unique_ptr<ui::LayerOwner> bubble_content_mask_;
bool is_gesture_dragging_;
// True once the mouse cursor was actively moved by the user over the bubble.
diff --git a/ash/system/unified/unified_system_tray_bubble.cc b/ash/system/unified/unified_system_tray_bubble.cc
index 0109f5f..5f7c808b 100644
--- a/ash/system/unified/unified_system_tray_bubble.cc
+++ b/ash/system/unified/unified_system_tray_bubble.cc
@@ -5,7 +5,6 @@
#include "ash/system/unified/unified_system_tray_bubble.h"
#include "ash/public/cpp/app_list/app_list_features.h"
-#include "ash/public/cpp/ash_features.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/system/status_area_widget.h"
@@ -322,18 +321,12 @@
bubble_widget_->client_view()->layer()->SetBackgroundBlur(0);
- if (features::ShouldUseShaderRoundedCorner()) {
- blur_layer_ = std::make_unique<ui::LayerOwner>(
- std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR));
- blur_layer_->layer()->SetColor(SK_ColorTRANSPARENT);
- blur_layer_->layer()->SetRoundedCornerRadius(
- {kUnifiedTrayCornerRadius, kUnifiedTrayCornerRadius,
- kUnifiedTrayCornerRadius, kUnifiedTrayCornerRadius});
- } else {
- blur_layer_ = views::Painter::CreatePaintedLayer(
- views::Painter::CreateSolidRoundRectPainter(SK_ColorTRANSPARENT, 0));
- }
-
+ blur_layer_ = std::make_unique<ui::LayerOwner>(
+ std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR));
+ blur_layer_->layer()->SetColor(SK_ColorTRANSPARENT);
+ blur_layer_->layer()->SetRoundedCornerRadius(
+ {kUnifiedTrayCornerRadius, kUnifiedTrayCornerRadius,
+ kUnifiedTrayCornerRadius, kUnifiedTrayCornerRadius});
blur_layer_->layer()->SetFillsBoundsOpaquely(false);
bubble_widget_->GetLayer()->Add(blur_layer_->layer());
diff --git a/ash/wm/overview/caption_container_view.cc b/ash/wm/overview/caption_container_view.cc
index e62d391..27931db7 100644
--- a/ash/wm/overview/caption_container_view.cc
+++ b/ash/wm/overview/caption_container_view.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "ash/public/cpp/ash_features.h"
#include "ash/wm/overview/rounded_rect_view.h"
#include "ash/wm/window_preview_view.h"
#include "ui/aura/client/aura_constants.h"
@@ -234,7 +233,7 @@
void CaptionContainerView::UpdatePreviewRoundedCorners(bool show,
float rounding) {
- if (!preview_view_ || !ash::features::ShouldUseShaderRoundedCorner())
+ if (!preview_view_)
return;
const float scale = preview_view_->layer()->transform().Scale2d().x();
diff --git a/ash/wm/overview/drop_target_view.cc b/ash/wm/overview/drop_target_view.cc
index 52f9d8b..27a2eb61 100644
--- a/ash/wm/overview/drop_target_view.cc
+++ b/ash/wm/overview/drop_target_view.cc
@@ -6,7 +6,6 @@
#include <algorithm>
-#include "ash/public/cpp/ash_features.h"
#include "ash/resources/vector_icons/vector_icons.h"
#include "ash/wm/overview/overview_constants.h"
#include "ui/gfx/paint_vector_icon.h"
@@ -53,11 +52,9 @@
background_view_->SetPaintToLayer(ui::LAYER_SOLID_COLOR);
background_view_->layer()->SetColor(kDropTargetBackgroundColor);
background_view_->layer()->SetOpacity(kDropTargetBackgroundOpacity);
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- constexpr gfx::RoundedCornersF kRadii(kOverviewWindowRoundingDp);
- background_view_->layer()->SetRoundedCornerRadius(kRadii);
- background_view_->layer()->SetIsFastRoundedCorner(true);
- }
+ constexpr gfx::RoundedCornersF kRadii(kOverviewWindowRoundingDp);
+ background_view_->layer()->SetRoundedCornerRadius(kRadii);
+ background_view_->layer()->SetIsFastRoundedCorner(true);
AddChildView(background_view_);
if (has_plus_icon) {
diff --git a/ash/wm/overview/overview_controller.cc b/ash/wm/overview/overview_controller.cc
index 2a8e560..2d7d1c1 100644
--- a/ash/wm/overview/overview_controller.cc
+++ b/ash/wm/overview/overview_controller.cc
@@ -440,10 +440,11 @@
observers_.RemoveObserver(observer);
}
-void OverviewController::DelayedUpdateMaskAndShadow() {
+void OverviewController::DelayedUpdateRoundedCornersAndShadow() {
base::ThreadTaskRunnerHandle::Get()->PostTask(
- FROM_HERE, base::BindOnce(&OverviewController::UpdateMaskAndShadow,
- weak_ptr_factory_.GetWeakPtr()));
+ FROM_HERE,
+ base::BindOnce(&OverviewController::UpdateRoundedCornersAndShadow,
+ weak_ptr_factory_.GetWeakPtr()));
}
void OverviewController::AddExitAnimationObserver(
@@ -605,7 +606,7 @@
overview_session_->set_is_shutting_down(true);
// Do not show mask and show during overview shutdown.
- overview_session_->UpdateMaskAndShadow();
+ overview_session_->UpdateRoundedCornersAndShadow();
for (auto& observer : observers_)
observer.OnOverviewModeEnding(overview_session_.get());
@@ -725,9 +726,9 @@
occlusion_tracker_pauser_.reset();
}
-void OverviewController::UpdateMaskAndShadow() {
+void OverviewController::UpdateRoundedCornersAndShadow() {
if (overview_session_)
- overview_session_->UpdateMaskAndShadow();
+ overview_session_->UpdateRoundedCornersAndShadow();
}
} // namespace ash
diff --git a/ash/wm/overview/overview_controller.h b/ash/wm/overview/overview_controller.h
index 7199441b..f6e6d18c 100644
--- a/ash/wm/overview/overview_controller.h
+++ b/ash/wm/overview/overview_controller.h
@@ -69,8 +69,8 @@
void AddObserver(OverviewObserver* observer);
void RemoveObserver(OverviewObserver* observer);
- // Post a task to update the shadow and mask of overview windows.
- void DelayedUpdateMaskAndShadow();
+ // Post a task to update the shadow and rounded corners of overview windows.
+ void DelayedUpdateRoundedCornersAndShadow();
// OverviewDelegate:
void AddExitAnimationObserver(
@@ -133,7 +133,7 @@
void OnEndingAnimationComplete(bool canceled);
void ResetPauser();
- void UpdateMaskAndShadow();
+ void UpdateRoundedCornersAndShadow();
// Collection of DelayedAnimationObserver objects that own widgets that may be
// still animating after overview mode ends. If shell needs to shut down while
diff --git a/ash/wm/overview/overview_grid.cc b/ash/wm/overview/overview_grid.cc
index 1cc2575..e22a871 100644
--- a/ash/wm/overview/overview_grid.cc
+++ b/ash/wm/overview/overview_grid.cc
@@ -950,7 +950,7 @@
void OverviewGrid::OnScreenCopiedBeforeRotation() {
for (auto& window : window_list()) {
window->set_disable_mask(true);
- window->UpdateMaskAndShadow();
+ window->UpdateRoundedCornersAndShadow();
window->StopWidgetAnimation();
}
}
@@ -960,7 +960,7 @@
bool canceled) {
for (auto& window : window_list())
window->set_disable_mask(false);
- Shell::Get()->overview_controller()->DelayedUpdateMaskAndShadow();
+ Shell::Get()->overview_controller()->DelayedUpdateRoundedCornersAndShadow();
}
void OverviewGrid::OnStartingAnimationComplete(bool canceled) {
diff --git a/ash/wm/overview/overview_item.cc b/ash/wm/overview/overview_item.cc
index fb9e043a..97f5dd0 100644
--- a/ash/wm/overview/overview_item.cc
+++ b/ash/wm/overview/overview_item.cc
@@ -8,7 +8,6 @@
#include <utility>
#include <vector>
-#include "ash/public/cpp/ash_features.h"
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/resources/vector_icons/vector_icons.h"
@@ -141,43 +140,6 @@
} // namespace
-// The class to cache render surface to the specified window's layer.
-class OverviewItem::WindowSurfaceCacheObserver : public aura::WindowObserver {
- public:
- explicit WindowSurfaceCacheObserver(aura::Window* window) {
- StartObserving(window);
- }
-
- ~WindowSurfaceCacheObserver() override { StopObserving(); }
-
- void StartObserving(aura::Window* window) {
- // If we're already observing a window, stop observing it first.
- StopObserving();
-
- window_ = window;
- window_->AddObserver(this);
- window_->layer()->AddCacheRenderSurfaceRequest();
- }
-
- // aura::WindowObserver:
- void OnWindowDestroying(aura::Window* window) override {
- DCHECK_EQ(window_, window);
- StopObserving();
- }
-
- private:
- void StopObserving() {
- if (window_) {
- window_->layer()->RemoveCacheRenderSurfaceRequest();
- window_->RemoveObserver(this);
- window_ = nullptr;
- }
- }
-
- aura::Window* window_ = nullptr;
- DISALLOW_COPY_AND_ASSIGN(WindowSurfaceCacheObserver);
-};
-
// The close button for the overview item. It has a custom ink drop.
class OverviewItem::OverviewCloseButton : public views::ImageButton {
public:
@@ -318,7 +280,7 @@
FadeInWidgetAndMaybeSlideOnEnter(item_widget_.get(),
OVERVIEW_ANIMATION_ENTER_FROM_HOME_LAUNCHER,
/*slide=*/true, /*observe=*/true);
- UpdateMaskAndShadow();
+ UpdateRoundedCornersAndShadow();
}
std::unique_ptr<ui::ScopedLayerAnimationSettings>
@@ -443,7 +405,7 @@
// transform and |item_widget_|'s new bounds so set it after SetItemBounds
// and UpdateHeaderLayout. Do not apply the shadow for drop target.
if (new_animation_type == OVERVIEW_ANIMATION_NONE)
- UpdateMaskAndShadow();
+ UpdateRoundedCornersAndShadow();
if (cannot_snap_widget_) {
inset_bounds.Inset(
@@ -529,11 +491,6 @@
caption_container_view_->SetShowPreview(minimized);
if (!minimized)
EnsureVisible();
-
- if (window_surface_cache_observers_) {
- window_surface_cache_observers_->StartObserving(
- transform_window_.GetOverviewWindow());
- }
}
void OverviewItem::UpdateCannotSnapWarningVisibility() {
@@ -583,32 +540,22 @@
is_being_dragged_ = (item == this);
// Disable mask and shadow for the dragged overview item during dragging.
if (is_being_dragged_)
- UpdateMaskAndShadow();
+ UpdateRoundedCornersAndShadow();
caption_container_view_->SetHeaderVisibility(
is_being_dragged_
? CaptionContainerView::HeaderVisibility::kInvisible
: CaptionContainerView::HeaderVisibility::kCloseButtonInvisibleOnly);
-
- if (!features::ShouldUseShaderRoundedCorner()) {
- // Start caching render surface during overview window dragging.
- window_surface_cache_observers_ =
- std::make_unique<WindowSurfaceCacheObserver>(
- transform_window_.GetOverviewWindow());
- }
}
void OverviewItem::OnSelectorItemDragEnded(bool snap) {
- // Stop caching render surface after overview window dragging.
- window_surface_cache_observers_.reset();
-
if (is_being_dragged_) {
is_being_dragged_ = false;
// Do nothing further with the dragged overview item if it is being snapped.
if (snap)
return;
// Re-show mask and shadow for the dragged overview item after drag ends.
- UpdateMaskAndShadow();
+ UpdateRoundedCornersAndShadow();
}
// Update the header.
@@ -754,7 +701,7 @@
shadow_->SetContentBounds(bounds_in_item);
}
-void OverviewItem::UpdateMaskAndShadow() {
+void OverviewItem::UpdateRoundedCornersAndShadow() {
// Do not show mask and shadow if:
// 1) overview is shutting down or
// 2) this overview item is in an overview grid that contains more than 10
@@ -769,8 +716,6 @@
OverviewController* overview_controller = Shell::Get()->overview_controller();
if (disable_mask_ || !overview_controller ||
!overview_controller->InOverviewSession() ||
- (!features::ShouldUseShaderRoundedCorner() &&
- overview_grid_->window_list().size() > 10) ||
overview_controller->IsInStartAnimation() || is_being_dragged_ ||
overview_grid_->IsDropTargetWindow(GetWindow()) ||
transform_window_.GetOverviewWindow()
diff --git a/ash/wm/overview/overview_item.h b/ash/wm/overview/overview_item.h
index 0546b446..6d0e88f 100644
--- a/ash/wm/overview/overview_item.h
+++ b/ash/wm/overview/overview_item.h
@@ -173,8 +173,8 @@
// the shadow is hidden.
void SetShadowBounds(base::Optional<gfx::Rect> bounds_in_screen);
- // Updates the mask and shadow on this overview window item.
- void UpdateMaskAndShadow();
+ // Updates the rounded corners and shadow on this overview window item.
+ void UpdateRoundedCornersAndShadow();
// Called when the starting animation is completed, or called immediately
// if there was no starting animation.
@@ -261,7 +261,6 @@
friend class OverviewSessionRoundedCornerTest;
friend class OverviewSessionTest;
class OverviewCloseButton;
- class WindowSurfaceCacheObserver;
FRIEND_TEST_ALL_PREFIXES(SplitViewOverviewSessionTest,
OverviewUnsnappableIndicatorVisibility);
@@ -365,9 +364,6 @@
// rounded edges mask applied on entering overview window.
std::unique_ptr<ui::Shadow> shadow_;
- // The observer to observe the window that has cached its render surface.
- std::unique_ptr<WindowSurfaceCacheObserver> window_surface_cache_observers_;
-
DISALLOW_COPY_AND_ASSIGN(OverviewItem);
};
diff --git a/ash/wm/overview/overview_session.cc b/ash/wm/overview/overview_session.cc
index d089b1af..9f23cbb 100644
--- a/ash/wm/overview/overview_session.cc
+++ b/ash/wm/overview/overview_session.cc
@@ -650,10 +650,10 @@
return grid->UpdateYPositionAndOpacity(new_y, opacity, callback);
}
-void OverviewSession::UpdateMaskAndShadow() {
+void OverviewSession::UpdateRoundedCornersAndShadow() {
for (auto& grid : grid_list_)
for (auto& window : grid->window_list())
- window->UpdateMaskAndShadow();
+ window->UpdateRoundedCornersAndShadow();
}
void OverviewSession::OnStartingAnimationComplete(bool canceled) {
@@ -663,7 +663,7 @@
if (!canceled) {
if (overview_focus_widget_)
overview_focus_widget_->Show();
- Shell::Get()->overview_controller()->DelayedUpdateMaskAndShadow();
+ Shell::Get()->overview_controller()->DelayedUpdateRoundedCornersAndShadow();
}
}
diff --git a/ash/wm/overview/overview_session.h b/ash/wm/overview/overview_session.h
index 3daafc5..575a830a 100644
--- a/ash/wm/overview/overview_session.h
+++ b/ash/wm/overview/overview_session.h
@@ -208,7 +208,7 @@
UpdateAnimationSettingsCallback callback);
// Updates all the overview items' mask and shadow.
- void UpdateMaskAndShadow();
+ void UpdateRoundedCornersAndShadow();
// Called when the overview mode starting animation completes.
void OnStartingAnimationComplete(bool canceled);
diff --git a/ash/wm/overview/overview_session_unittest.cc b/ash/wm/overview/overview_session_unittest.cc
index 2c3731f..d7f8054 100644
--- a/ash/wm/overview/overview_session_unittest.cc
+++ b/ash/wm/overview/overview_session_unittest.cc
@@ -345,10 +345,6 @@
return item->transform_window_;
}
- bool HasMaskForItem(OverviewItem* item) const {
- return !!item->transform_window_.mask_;
- }
-
void CheckOverviewEnterExitHistogram(const char* trace,
std::vector<int>&& enter_counts,
std::vector<int>&& exit_counts) {
@@ -2665,29 +2661,12 @@
ToggleOverview();
}
-class OverviewSessionRoundedCornerTest
- : public OverviewSessionTest,
- public testing::WithParamInterface<bool> {
+class OverviewSessionRoundedCornerTest : public OverviewSessionTest {
public:
OverviewSessionRoundedCornerTest() = default;
~OverviewSessionRoundedCornerTest() override = default;
- void SetUp() override {
- OverviewSessionTest::SetUp();
- if (UseShaderForRoundedCorner()) {
- scoped_feature_list_.InitAndEnableFeature(
- ash::features::kUseShaderRoundedCorner);
- } else {
- scoped_feature_list_.InitAndDisableFeature(
- ash::features::kUseShaderRoundedCorner);
- }
- }
-
- bool UseShaderForRoundedCorner() const { return GetParam(); }
-
bool HasRoundedCorner(OverviewItem* item) {
- if (!UseShaderForRoundedCorner())
- return HasMaskForItem(item) || item->transform_window_.IsMinimized();
const ui::Layer* layer = item->transform_window_.IsMinimized()
? GetPreviewView(item)->layer()
: transform_window(item).window()->layer();
@@ -2695,8 +2674,6 @@
}
private:
- base::test::ScopedFeatureList scoped_feature_list_;
-
DISALLOW_COPY_AND_ASSIGN(OverviewSessionRoundedCornerTest);
};
@@ -2765,7 +2742,7 @@
// Test that the mask that is applied to add rounded corners in overview mode
// is removed during drags.
-TEST_P(OverviewSessionRoundedCornerTest, RoundedEdgeMaskVisibilityDragging) {
+TEST_F(OverviewSessionRoundedCornerTest, RoundedEdgeMaskVisibilityDragging) {
std::unique_ptr<aura::Window> window1(CreateTestWindow());
std::unique_ptr<aura::Window> window2(CreateTestWindow());
@@ -2811,35 +2788,6 @@
EXPECT_TRUE(HasRoundedCorner(item2));
}
-TEST_P(OverviewSessionRoundedCornerTest, NoRoundedEdgeMaskFor11Windows) {
- // This is only for old rounded corner implementation.
- if (features::ShouldUseShaderRoundedCorner())
- return;
-
- std::vector<std::unique_ptr<aura::Window>> windows;
- for (int i = 0; i < 11; i++)
- windows.push_back(CreateTestWindow());
- EnterTabletMode();
- ToggleOverview();
- base::RunLoop().RunUntilIdle();
- for (auto& window : windows) {
- OverviewItem* item = GetWindowItemForWindow(0, window.get());
- EXPECT_FALSE(HasRoundedCorner(item));
- }
- // Remove 1 window and windows will have rounded corners.
- windows.pop_back();
- ASSERT_EQ(10u, windows.size());
- for (auto& window : windows) {
- OverviewItem* item = GetWindowItemForWindow(0, window.get());
- EXPECT_TRUE(HasRoundedCorner(item));
- }
-}
-
-INSTANTIATE_TEST_SUITE_P(
- /* prefix intentionally left blank due to only one parameterization */,
- OverviewSessionRoundedCornerTest,
- testing::Bool());
-
// Tests that the shadows in overview mode are placed correctly.
TEST_F(OverviewSessionTest, ShadowBounds) {
// Helper function to check if the bounds of a shadow owned by |shadow_parent|
diff --git a/ash/wm/overview/rounded_label_widget.cc b/ash/wm/overview/rounded_label_widget.cc
index 8a10601..8b98c68 100644
--- a/ash/wm/overview/rounded_label_widget.cc
+++ b/ash/wm/overview/rounded_label_widget.cc
@@ -6,7 +6,6 @@
#include <memory>
-#include "ash/public/cpp/ash_features.h"
#include "ash/wm/overview/scoped_overview_animation_settings.h"
#include "ui/aura/window.h"
#include "ui/base/l10n/l10n_util.h"
@@ -38,11 +37,9 @@
layer()->SetColor(background_color);
layer()->SetFillsBoundsOpaquely(false);
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- const gfx::RoundedCornersF radii(rounding_dp);
- layer()->SetRoundedCornerRadius(radii);
- layer()->SetIsFastRoundedCorner(true);
- }
+ const gfx::RoundedCornersF radii(rounding_dp);
+ layer()->SetRoundedCornerRadius(radii);
+ layer()->SetIsFastRoundedCorner(true);
label_ = new views::Label(l10n_util::GetStringUTF16(message_id),
views::style::CONTEXT_LABEL);
diff --git a/ash/wm/overview/scoped_overview_transform_window.cc b/ash/wm/overview/scoped_overview_transform_window.cc
index 05fd689d..31965c33 100644
--- a/ash/wm/overview/scoped_overview_transform_window.cc
+++ b/ash/wm/overview/scoped_overview_transform_window.cc
@@ -97,78 +97,6 @@
DISALLOW_COPY_AND_ASSIGN(LayerCachingAndFilteringObserver);
};
-// WindowMask is applied to overview windows to give them rounded edges while
-// they are in overview mode.
-class ScopedOverviewTransformWindow::WindowMask : public ui::LayerDelegate,
- public aura::WindowObserver {
- public:
- explicit WindowMask(aura::Window* window)
- : layer_(ui::LAYER_TEXTURED), window_(window) {
- window_->AddObserver(this);
- layer_.set_delegate(this);
- layer_.SetFillsBoundsOpaquely(false);
- }
-
- ~WindowMask() override {
- if (window_)
- window_->RemoveObserver(this);
- layer_.set_delegate(nullptr);
- }
-
- void set_top_inset(int top_inset) { top_inset_ = top_inset; }
- ui::Layer* layer() { return &layer_; }
-
- private:
- // ui::LayerDelegate:
- void OnPaintLayer(const ui::PaintContext& context) override {
- cc::PaintFlags flags;
- flags.setAlpha(255);
- flags.setAntiAlias(true);
- flags.setStyle(cc::PaintFlags::kFill_Style);
-
- // The amount of round applied on the mask gets scaled as |window_| gets
- // transformed, so reverse the transform so the final scaled round matches
- // |kOverviewWindowRoundingDp|.
- const gfx::Vector2dF scale = window_->transform().Scale2d();
- const SkScalar r_x =
- SkIntToScalar(std::round(kOverviewWindowRoundingDp / scale.x()));
- const SkScalar r_y =
- SkIntToScalar(std::round(kOverviewWindowRoundingDp / scale.y()));
-
- SkPath path;
- SkScalar radii[8] = {r_x, r_y, r_x, r_y, r_x, r_y, r_x, r_y};
- gfx::Rect bounds(layer()->size());
- bounds.Inset(0, top_inset_, 0, 0);
- path.addRoundRect(gfx::RectToSkRect(bounds), radii);
-
- ui::PaintRecorder recorder(context, layer()->size());
- recorder.canvas()->DrawPath(path, flags);
- }
-
- void OnDeviceScaleFactorChanged(float old_device_scale_factor,
- float new_device_scale_factor) override {}
-
- // aura::WindowObserver:
- void OnWindowBoundsChanged(aura::Window* window,
- const gfx::Rect& old_bounds,
- const gfx::Rect& new_bounds,
- ui::PropertyChangeReason reason) override {
- layer_.SetBounds(new_bounds);
- }
-
- void OnWindowDestroying(aura::Window* window) override {
- window_->RemoveObserver(this);
- window_ = nullptr;
- }
-
- ui::Layer layer_;
- int top_inset_ = 0;
- // Pointer to the window of which this is a mask to.
- aura::Window* window_;
-
- DISALLOW_COPY_AND_ASSIGN(WindowMask);
-};
-
ScopedOverviewTransformWindow::ScopedOverviewTransformWindow(
OverviewItem* overview_item,
aura::Window* window)
@@ -459,31 +387,17 @@
// Add the mask which gives the overview item rounded corners, and add the
// shadow around the window.
ui::Layer* layer = window_->layer();
- if (ash::features::ShouldUseShaderRoundedCorner()) {
- const float scale = layer->transform().Scale2d().x();
- const gfx::RoundedCornersF radii(show ? kOverviewWindowRoundingDp / scale
- : 0.0f);
- layer->SetRoundedCornerRadius(radii);
- layer->SetIsFastRoundedCorner(true);
- int top_inset = GetTopInset();
- if (top_inset > 0) {
- gfx::Rect clip_rect(window_->bounds().size());
- clip_rect.Inset(0, top_inset, 0, 0);
- layer->SetClipRect(clip_rect);
- }
- return;
+ const float scale = layer->transform().Scale2d().x();
+ const gfx::RoundedCornersF radii(show ? kOverviewWindowRoundingDp / scale
+ : 0.0f);
+ layer->SetRoundedCornerRadius(radii);
+ layer->SetIsFastRoundedCorner(true);
+ int top_inset = GetTopInset();
+ if (top_inset > 0) {
+ gfx::Rect clip_rect(window_->bounds().size());
+ clip_rect.Inset(0, top_inset, 0, 0);
+ layer->SetClipRect(clip_rect);
}
-
- if (!base::FeatureList::IsEnabled(features::kEnableOverviewRoundedCorners) ||
- !show) {
- mask_.reset();
- return;
- }
-
- mask_ = std::make_unique<WindowMask>(window_);
- mask_->layer()->SetBounds(layer->bounds());
- mask_->set_top_inset(GetTopInset());
- layer->SetMaskLayer(mask_->layer());
}
void ScopedOverviewTransformWindow::CancelAnimationsListener() {
@@ -494,11 +408,11 @@
ui::LayerAnimationSequence* sequence) {
// Remove the mask before animating because masks affect animation
// performance. The mask will be added back once the animation is completed.
- overview_item_->UpdateMaskAndShadow();
+ overview_item_->UpdateRoundedCornersAndShadow();
}
void ScopedOverviewTransformWindow::OnImplicitAnimationsCompleted() {
- overview_item_->UpdateMaskAndShadow();
+ overview_item_->UpdateRoundedCornersAndShadow();
overview_item_->OnDragAnimationCompleted();
}
@@ -526,12 +440,6 @@
targeting_policy_map_.erase(it);
}
-gfx::Rect ScopedOverviewTransformWindow::GetMaskBoundsForTesting() const {
- if (!mask_)
- return gfx::Rect();
- return mask_->layer()->bounds();
-}
-
void ScopedOverviewTransformWindow::CloseWidget() {
aura::Window* parent_window = ::wm::GetTransientRoot(window_);
if (parent_window)
diff --git a/ash/wm/overview/scoped_overview_transform_window.h b/ash/wm/overview/scoped_overview_transform_window.h
index 0d72d61..fa9068e 100644
--- a/ash/wm/overview/scoped_overview_transform_window.h
+++ b/ash/wm/overview/scoped_overview_transform_window.h
@@ -171,12 +171,9 @@
return overview_bounds_;
}
- gfx::Rect GetMaskBoundsForTesting() const;
-
private:
friend class OverviewSessionTest;
class LayerCachingAndFilteringObserver;
- class WindowMask;
FRIEND_TEST_ALL_PREFIXES(ScopedOverviewTransformWindowWithMaskTest,
WindowBoundsChangeTest);
@@ -214,10 +211,6 @@
std::vector<std::unique_ptr<LayerCachingAndFilteringObserver>>
cached_and_filtered_layer_observers_;
- // A mask to be applied on |window_|. This will give |window_| rounded edges
- // while in overview.
- std::unique_ptr<WindowMask> mask_;
-
// For the duration of this object |window_| and its transient childrens'
// event targeting policy will be sent to NONE. Store the originals so we can
// change it back when destroying |this|.
diff --git a/ash/wm/overview/scoped_overview_transform_window_unittest.cc b/ash/wm/overview/scoped_overview_transform_window_unittest.cc
index b4e25bb..f87c8c7 100644
--- a/ash/wm/overview/scoped_overview_transform_window_unittest.cc
+++ b/ash/wm/overview/scoped_overview_transform_window_unittest.cc
@@ -337,40 +337,4 @@
EXPECT_EQ(etp::kTargetAndDescendants, transient2->event_targeting_policy());
}
-class ScopedOverviewTransformWindowWithMaskTest
- : public ScopedOverviewTransformWindowTest {
- public:
- ScopedOverviewTransformWindowWithMaskTest() = default;
- ~ScopedOverviewTransformWindowWithMaskTest() override = default;
-
- void SetUp() override {
- ScopedOverviewTransformWindowTest::SetUp();
- scoped_feature_list_.InitAndDisableFeature(
- ash::features::kUseShaderRoundedCorner);
- }
-
- private:
- base::test::ScopedFeatureList scoped_feature_list_;
-
- DISALLOW_COPY_AND_ASSIGN(ScopedOverviewTransformWindowWithMaskTest);
-};
-
-// Verify that if the window's bounds are changed while it's in overview mode,
-// the rounded edge mask's bounds are also changed accordingly.
-TEST_F(ScopedOverviewTransformWindowWithMaskTest, WindowBoundsChangeTest) {
- UpdateDisplay("400x400");
- const gfx::Rect bounds(10, 10, 200, 200);
- std::unique_ptr<aura::Window> window = CreateTestWindow(bounds);
- ScopedOverviewTransformWindow scoped_window(nullptr, window.get());
- scoped_window.UpdateMask(true);
-
- EXPECT_TRUE(scoped_window.mask_);
- EXPECT_EQ(window->bounds(), scoped_window.GetMaskBoundsForTesting());
- EXPECT_EQ(bounds, scoped_window.GetMaskBoundsForTesting());
-
- wm::GetWindowState(window.get())->Maximize();
- EXPECT_EQ(window->bounds(), scoped_window.GetMaskBoundsForTesting());
- EXPECT_NE(bounds, scoped_window.GetMaskBoundsForTesting());
-}
-
} // namespace ash