Commit f956cc7d authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Add fix to properly change slider color when toggling mute

Also added new content layer type for sliders to bring slider colors in
line with ux specs.

Bug: 960118
Change-Id: I5be99cb731ba77c3d32550a34d55bb5c4e8a5e5a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2024327
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#736655}
parent 2001a829
...@@ -250,9 +250,14 @@ SkColor AshColorProvider::GetContentLayerColorImpl( ...@@ -250,9 +250,14 @@ SkColor AshColorProvider::GetContentLayerColorImpl(
dark_color = gfx::kGoogleRed300; dark_color = gfx::kGoogleRed300;
break; break;
case ContentLayerType::kProminentIconButton: case ContentLayerType::kProminentIconButton:
case ContentLayerType::kSliderThumbEnabled:
light_color = gfx::kGoogleBlue600; light_color = gfx::kGoogleBlue600;
dark_color = gfx::kGoogleBlue300; dark_color = gfx::kGoogleBlue300;
break; break;
case ContentLayerType::kSliderThumbDisabled:
light_color = gfx::kGoogleGrey600;
dark_color = gfx::kGoogleGrey600;
break;
case ContentLayerType::kIconSystemMenu: case ContentLayerType::kIconSystemMenu:
light_color = gfx::kGoogleGrey700; light_color = gfx::kGoogleGrey700;
dark_color = gfx::kGoogleGrey200; dark_color = gfx::kGoogleGrey200;
......
...@@ -93,6 +93,10 @@ class ASH_EXPORT AshColorProvider { ...@@ -93,6 +93,10 @@ class ASH_EXPORT AshColorProvider {
// FeaturePodIconButton // FeaturePodIconButton
kIconSystemMenu, kIconSystemMenu,
kIconSystemMenuToggled, kIconSystemMenuToggled,
// Color for sliders (volume, brightness etc.)
kSliderThumbEnabled,
kSliderThumbDisabled,
}; };
// Attributes of ripple, includes the base color, opacity of inkdrop and // Attributes of ripple, includes the base color, opacity of inkdrop and
......
...@@ -42,15 +42,15 @@ SystemSlider::SystemSlider(views::SliderListener* listener) ...@@ -42,15 +42,15 @@ SystemSlider::SystemSlider(views::SliderListener* listener)
: views::Slider(listener) {} : views::Slider(listener) {}
SkColor SystemSlider::GetThumbColor() const { SkColor SystemSlider::GetThumbColor() const {
return AshColorProvider::Get()->GetControlsLayerColor( using Type = AshColorProvider::ContentLayerType;
AshColorProvider::ControlsLayerType::kActiveControlBackground, return AshColorProvider::Get()->GetContentLayerColor(
(style() == RenderingStyle::kMinimalStyle) ? Type::kSliderThumbDisabled
: Type::kSliderThumbEnabled,
AshColorProvider::AshColorMode::kDark); AshColorProvider::AshColorMode::kDark);
} }
SkColor SystemSlider::GetTroughColor() const { SkColor SystemSlider::GetTroughColor() const {
return AshColorProvider::Get()->GetControlsLayerColor( return AshColorProvider::Get()->GetDisabledColor(GetThumbColor());
AshColorProvider::ControlsLayerType::kInactiveControlBackground,
AshColorProvider::AshColorMode::kDark);
} }
ReadOnlySlider::ReadOnlySlider() : SystemSlider(nullptr) {} ReadOnlySlider::ReadOnlySlider() : SystemSlider(nullptr) {}
......
...@@ -83,6 +83,11 @@ void Slider::SetEnableAccessibilityEvents(bool enabled) { ...@@ -83,6 +83,11 @@ void Slider::SetEnableAccessibilityEvents(bool enabled) {
OnPropertyChanged(&accessibility_events_enabled_, kPropertyEffectsNone); OnPropertyChanged(&accessibility_events_enabled_, kPropertyEffectsNone);
} }
void Slider::SetRenderingStyle(RenderingStyle style) {
style_ = style;
SchedulePaint();
}
float Slider::GetAnimatingValue() const{ float Slider::GetAnimatingValue() const{
return move_animation_ && move_animation_->is_animating() return move_animation_ && move_animation_->is_animating()
? move_animation_->CurrentValueBetween(initial_animating_value_, ? move_animation_->CurrentValueBetween(initial_animating_value_,
......
...@@ -59,7 +59,12 @@ class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate { ...@@ -59,7 +59,12 @@ class VIEWS_EXPORT Slider : public View, public gfx::AnimationDelegate {
kDefaultStyle, kDefaultStyle,
kMinimalStyle, kMinimalStyle,
}; };
void SetRenderingStyle(RenderingStyle style) { style_ = style; }
// Set rendering style and schedule paint since the colors for the slider
// may change.
void SetRenderingStyle(RenderingStyle style);
RenderingStyle style() const { return style_; }
protected: protected:
// Returns the current position of the thumb on the slider. // Returns the current position of the thumb on the slider.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment