Fix Servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-10-19 01:01:06 +02:00
parent b66e828842
commit 856886c40d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 30 additions and 20 deletions

View file

@ -553,12 +553,12 @@ pub fn convert_linear_gradient(
let angle = match direction { let angle = match direction {
LineDirection::Angle(angle) => angle.radians(), LineDirection::Angle(angle) => angle.radians(),
LineDirection::Horizontal(x) => match x { LineDirection::Horizontal(x) => match x {
X::Left => Angle::Deg(270.).radians(), X::Left => Angle::from_degrees(270.).radians(),
X::Right => Angle::Deg(90.).radians(), X::Right => Angle::from_degrees(90.).radians(),
}, },
LineDirection::Vertical(y) => match y { LineDirection::Vertical(y) => match y {
Y::Top => Angle::Deg(0.).radians(), Y::Top => Angle::from_degrees(0.).radians(),
Y::Bottom => Angle::Deg(180.).radians(), Y::Bottom => Angle::from_degrees(180.).radians(),
}, },
LineDirection::Corner(horizontal, vertical) => { LineDirection::Corner(horizontal, vertical) => {
// This the angle for one of the diagonals of the box. Our angle // This the angle for one of the diagonals of the box. Our angle

View file

@ -53,21 +53,21 @@ impl CSS {
pub fn Supports_(win: &Window, condition: DOMString) -> bool { pub fn Supports_(win: &Window, condition: DOMString) -> bool {
let mut input = ParserInput::new(&condition); let mut input = ParserInput::new(&condition);
let mut input = Parser::new(&mut input); let mut input = Parser::new(&mut input);
let cond = parse_condition_or_declaration(&mut input); let cond = match parse_condition_or_declaration(&mut input) {
if let Ok(cond) = cond { Ok(c) => c,
let url = win.Document().url(); Err(..) => return false,
let context = ParserContext::new_for_cssom( };
&url,
Some(CssRuleType::Style), let url = win.Document().url();
ParsingMode::DEFAULT, let context = ParserContext::new_for_cssom(
QuirksMode::NoQuirks, &url,
None, Some(CssRuleType::Style),
None, ParsingMode::DEFAULT,
); QuirksMode::NoQuirks,
cond.eval(&context) None,
} else { None,
false );
} cond.eval(&context, &Default::default())
} }
/// <https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet> /// <https://drafts.css-houdini.org/css-paint-api-1/#paint-worklet>

View file

@ -81,7 +81,17 @@ impl CSSSupportsRule {
None, None,
None, None,
); );
let enabled = cond.eval(&context); let enabled = {
let namespaces =
self
.cssconditionrule
.parent_stylesheet()
.style_stylesheet()
.contents
.namespaces
.read();
cond.eval(&context, &namespaces)
};
let mut guard = self.cssconditionrule.shared_lock().write(); let mut guard = self.cssconditionrule.shared_lock().write();
let rule = self.supportsrule.write_with(&mut guard); let rule = self.supportsrule.write_with(&mut guard);
rule.condition = cond; rule.condition = cond;