diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-09-03 08:12:22 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-03 08:12:22 -0400 |
commit | d8446f85a95723dec3a18b05bdd30514a57bddab (patch) | |
tree | 3e92a0a5fed4315519a34e8cef33c54840ada0d4 /components/script/dom/htmlimageelement.rs | |
parent | eb6aec37e9bde5aba2a3dc6b6ce5374579219f31 (diff) | |
parent | 1254cbf313243e8879a464538a5c78383ba3bc8b (diff) | |
download | servo-d8446f85a95723dec3a18b05bdd30514a57bddab.tar.gz servo-d8446f85a95723dec3a18b05bdd30514a57bddab.zip |
Auto merge of #21588 - emilio:gecko-sync, r=emilio
style: Sync changes from mozilla-central.
See each individual commit for details.
https://bugzilla.mozilla.org/show_bug.cgi?id=1488172
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/21588)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 19 |
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) } |