style: Fix outline-style: inherit behavior if you don't specify outline-width

The fix is calling set_outline_style so that we also reset the actual
outline width. Also clean-up surrounding code a little bit to be
marginally more efficient, and do the same change for border-*-style
(which was doing the right thing, but it's better to make sure both stay
in sync).

Differential Revision: https://phabricator.services.mozilla.com/D164554
This commit is contained in:
Emilio Cobos Álvarez 2022-12-13 12:29:37 +00:00 committed by Martin Robinson
parent db4dd48d31
commit cd50d30c31
2 changed files with 11 additions and 16 deletions

View file

@ -678,8 +678,7 @@ fn static_assert() {
}
pub fn copy_border_${side.ident}_style_from(&mut self, other: &Self) {
self.gecko.mBorderStyle[${side.index}] = other.gecko.mBorderStyle[${side.index}];
self.gecko.mComputedBorder.${side.ident} = self.gecko.mBorder.${side.ident};
self.set_border_${side.ident}_style(other.gecko.mBorderStyle[${side.index}]);
}
pub fn reset_border_${side.ident}_style(&mut self, other: &Self) {
@ -809,9 +808,7 @@ fn static_assert() {
}
pub fn copy_outline_style_from(&mut self, other: &Self) {
// FIXME(emilio): Why doesn't this need to reset mActualOutlineWidth?
// Looks fishy.
self.gecko.mOutlineStyle = other.gecko.mOutlineStyle;
self.set_outline_style(other.gecko.mOutlineStyle);
}
pub fn reset_outline_style(&mut self, other: &Self) {

View file

@ -435,19 +435,17 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
properties::adjust_border_width(self.style);
}
/// The initial value of outline-width may be changed at computed value time.
/// outline-style: none causes a computed outline-width of zero at computed
/// value time.
fn adjust_for_outline(&mut self) {
if self
.style
.get_outline()
.clone_outline_style()
.none_or_hidden() &&
self.style.get_outline().outline_has_nonzero_width()
{
self.style
.mutate_outline()
.set_outline_width(crate::Zero::zero());
let outline = self.style.get_outline();
if !outline.clone_outline_style().none_or_hidden() {
return;
}
if !outline.outline_has_nonzero_width() {
return;
}
self.style.mutate_outline().set_outline_width(crate::Zero::zero());
}
/// CSS overflow-x and overflow-y require some fixup as well in some cases.