mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
style: Merge the two scrollbar color properties into scrollbar-color.
Differential Revision: https://phabricator.services.mozilla.com/D6115
This commit is contained in:
parent
5c66290142
commit
0bcffa7094
5 changed files with 94 additions and 16 deletions
|
@ -5304,7 +5304,7 @@ clip-path
|
|||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="InheritedUI"
|
||||
skip_longhands="cursor">
|
||||
skip_longhands="cursor scrollbar-color">
|
||||
pub fn set_cursor(&mut self, v: longhands::cursor::computed_value::T) {
|
||||
use style_traits::cursor::CursorKind;
|
||||
|
||||
|
@ -5450,6 +5450,48 @@ clip-path
|
|||
|
||||
longhands::cursor::computed_value::T { images, keyword }
|
||||
}
|
||||
|
||||
pub fn set_scrollbar_color(&mut self, v: longhands::scrollbar_color::computed_value::T) {
|
||||
use gecko_bindings::structs::StyleComplexColor;
|
||||
use values::generics::ui::ScrollbarColor;
|
||||
match v {
|
||||
ScrollbarColor::Auto => {
|
||||
self.gecko.mScrollbarFaceColor = StyleComplexColor::auto();
|
||||
self.gecko.mScrollbarTrackColor = StyleComplexColor::auto();
|
||||
}
|
||||
ScrollbarColor::Colors { thumb, track } => {
|
||||
self.gecko.mScrollbarFaceColor = thumb.into();
|
||||
self.gecko.mScrollbarTrackColor = track.into();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn copy_scrollbar_color_from(&mut self, other: &Self) {
|
||||
self.gecko.mScrollbarFaceColor = other.gecko.mScrollbarFaceColor;
|
||||
self.gecko.mScrollbarTrackColor = other.gecko.mScrollbarTrackColor;
|
||||
}
|
||||
|
||||
pub fn reset_scrollbar_color(&mut self, other: &Self) {
|
||||
self.copy_scrollbar_color_from(other);
|
||||
}
|
||||
|
||||
pub fn clone_scrollbar_color(&self) -> longhands::scrollbar_color::computed_value::T {
|
||||
use gecko_bindings::structs::StyleComplexColor_Tag as Tag;
|
||||
use values::generics::ui::ScrollbarColor;
|
||||
debug_assert!(
|
||||
(self.gecko.mScrollbarFaceColor.mTag == Tag::eAuto) ==
|
||||
(self.gecko.mScrollbarTrackColor.mTag == Tag::eAuto),
|
||||
"Whether the two colors are `auto` should match",
|
||||
);
|
||||
if self.gecko.mScrollbarFaceColor.mTag == Tag::eAuto {
|
||||
ScrollbarColor::Auto
|
||||
} else {
|
||||
ScrollbarColor::Colors {
|
||||
thumb: self.gecko.mScrollbarFaceColor.into(),
|
||||
track: self.gecko.mScrollbarTrackColor.into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
</%self:impl_trait>
|
||||
|
||||
<%self:impl_trait style_struct_name="Column"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue