mirror of
https://github.com/servo/servo.git
synced 2025-07-29 18:20:24 +01:00
Revert changes to load media styles as UA styles
Revert changes to set chrome url of user agent widget styles
This commit is contained in:
parent
82339a9295
commit
142d42a833
2 changed files with 3 additions and 29 deletions
|
@ -24,7 +24,6 @@ use dom_struct::dom_struct;
|
||||||
use html5ever::{LocalName, Prefix};
|
use html5ever::{LocalName, Prefix};
|
||||||
use net_traits::ReferrerPolicy;
|
use net_traits::ReferrerPolicy;
|
||||||
use servo_arc::Arc;
|
use servo_arc::Arc;
|
||||||
use servo_url::ServoUrl;
|
|
||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
use style::media_queries::MediaList;
|
use style::media_queries::MediaList;
|
||||||
use style::parser::ParserContext as CssParserContext;
|
use style::parser::ParserContext as CssParserContext;
|
||||||
|
@ -112,26 +111,10 @@ impl HTMLStyleElement {
|
||||||
let mq =
|
let mq =
|
||||||
Arc::new(shared_lock.wrap(MediaList::parse(&context, &mut CssParser::new(&mut input))));
|
Arc::new(shared_lock.wrap(MediaList::parse(&context, &mut CssParser::new(&mut input))));
|
||||||
let loader = StylesheetLoader::for_element(self.upcast());
|
let loader = StylesheetLoader::for_element(self.upcast());
|
||||||
let (url, origin) = if let Some(shadow_root) = self
|
|
||||||
.upcast::<Node>()
|
|
||||||
.containing_shadow_root() {
|
|
||||||
if shadow_root.is_user_agent_widget() {
|
|
||||||
(
|
|
||||||
ServoUrl::parse(&format!("chrome://{:?}", window.get_url().to_string()))
|
|
||||||
.unwrap(),
|
|
||||||
Origin::UserAgent,
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
(window.get_url(), Origin::Author)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
(window.get_url(), Origin::Author)
|
|
||||||
};
|
|
||||||
|
|
||||||
let sheet = Stylesheet::from_str(
|
let sheet = Stylesheet::from_str(
|
||||||
&data,
|
&data,
|
||||||
url,
|
window.get_url(),
|
||||||
origin,
|
Origin::Author,
|
||||||
mq,
|
mq,
|
||||||
shared_lock,
|
shared_lock,
|
||||||
Some(&loader),
|
Some(&loader),
|
||||||
|
|
|
@ -141,16 +141,7 @@ impl FetchResponseListener for StylesheetContext {
|
||||||
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
|
// TODO: Get the actual value. http://dev.w3.org/csswg/css-syntax/#environment-encoding
|
||||||
let environment_encoding = UTF_8;
|
let environment_encoding = UTF_8;
|
||||||
let protocol_encoding_label = metadata.charset.as_ref().map(|s| &**s);
|
let protocol_encoding_label = metadata.charset.as_ref().map(|s| &**s);
|
||||||
let final_url = if let Some(ref shadow_root) = self.shadow_root {
|
let final_url = metadata.final_url;
|
||||||
if shadow_root.root().is_user_agent_widget() {
|
|
||||||
ServoUrl::parse(&format!("chrome://{:?}", metadata.final_url.to_string()))
|
|
||||||
.unwrap()
|
|
||||||
} else {
|
|
||||||
metadata.final_url
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
metadata.final_url
|
|
||||||
};
|
|
||||||
|
|
||||||
let win = window_from_node(&*elem);
|
let win = window_from_node(&*elem);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue