aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlimageelement.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <emilio@crisal.io>2018-09-03 13:07:04 +0200
committerEmilio Cobos Álvarez <emilio@crisal.io>2018-09-03 13:09:10 +0200
commit5d8545d2b4a0dca7f18e1be9023ab0d36d47a33c (patch)
treea54504c97c741455ed46629ce2d602c114d142a7 /components/script/dom/htmlimageelement.rs
parent6d43bf78bc5e2a0c41206dfaa93be6d6c4af527f (diff)
downloadservo-5d8545d2b4a0dca7f18e1be9023ab0d36d47a33c.tar.gz
servo-5d8545d2b4a0dca7f18e1be9023ab0d36d47a33c.zip
Fix other parts of the Servo build.
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r--components/script/dom/htmlimageelement.rs19
1 files changed, 14 insertions, 5 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 62523e61f4e..3aaa7c579cb 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -538,12 +538,17 @@ impl HTMLImageElement {
/// https://html.spec.whatwg.org/multipage/#matches-the-environment
fn matches_environment(&self, media_query: String) -> bool {
let document = document_from_node(self);
- let device = document.device();
- if !device.is_some() {
- return false;
- }
+ let device = match document.device() {
+ Some(device) => device,
+ None => return false,
+ };
let quirks_mode = document.quirks_mode();
let document_url = &document.url();
+ // FIXME(emilio): This should do the same that we do for other media
+ // lists regarding the rule type and such, though it doesn't really
+ // matter right now...
+ //
+ // Also, ParsingMode::all() is wrong, and should be DEFAULT.
let context = ParserContext::new(
Origin::Author,
document_url,
@@ -551,11 +556,12 @@ impl HTMLImageElement {
ParsingMode::all(),
quirks_mode,
None,
+ None,
);
let mut parserInput = ParserInput::new(&media_query);
let mut parser = Parser::new(&mut parserInput);
let media_list = MediaList::parse(&context, &mut parser);
- media_list.evaluate(&device.unwrap(), quirks_mode)
+ media_list.evaluate(&device, quirks_mode)
}
/// <https://html.spec.whatwg.org/multipage/#normalise-the-source-densities>
@@ -1039,9 +1045,12 @@ pub fn parse_a_sizes_attribute(value: DOMString) -> SourceSizeList {
Origin::Author,
&url,
Some(CssRuleType::Style),
+ // FIXME(emilio): why ::empty() instead of ::DEFAULT? Also, what do
+ // browsers do regarding quirks-mode in a media list?
ParsingMode::empty(),
QuirksMode::NoQuirks,
None,
+ None,
);
SourceSizeList::parse(&context, &mut parser)
}