mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add an extra data field to ParserContext.
This will be used for passing Gecko-specific information through the CSS parser in stylo.
This commit is contained in:
parent
a636b7127e
commit
bb85f5faf0
10 changed files with 91 additions and 27 deletions
|
@ -15,6 +15,7 @@ use std::ascii::AsciiExt;
|
|||
use std::borrow::ToOwned;
|
||||
use std::cell::Ref;
|
||||
use string_cache::Atom;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::properties::{PropertyDeclaration, Shorthand};
|
||||
use style::properties::{is_supported_property, parse_one_declaration};
|
||||
use style::selector_impl::PseudoElement;
|
||||
|
@ -239,7 +240,9 @@ impl CSSStyleDeclarationMethods for CSSStyleDeclaration {
|
|||
|
||||
// Step 6
|
||||
let window = window_from_node(&*self.owner);
|
||||
let declarations = parse_one_declaration(&property, &value, &window.get_url(), window.css_error_reporter());
|
||||
let declarations =
|
||||
parse_one_declaration(&property, &value, &window.get_url(), window.css_error_reporter(),
|
||||
ParserContextExtraData::default());
|
||||
|
||||
// Step 7
|
||||
let declarations = if let Ok(declarations) = declarations {
|
||||
|
|
|
@ -85,6 +85,7 @@ use std::sync::Arc;
|
|||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use string_cache::{Atom, BorrowedAtom, BorrowedNamespace, Namespace, QualName};
|
||||
use style::element_state::*;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::properties::DeclaredValue;
|
||||
use style::properties::longhands::{self, background_image, border_spacing, font_family, overflow_x, font_size};
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock, parse_style_attribute};
|
||||
|
@ -1977,7 +1978,8 @@ impl VirtualMethods for Element {
|
|||
*self.style_attribute.borrow_mut() =
|
||||
mutation.new_value(attr).map(|value| {
|
||||
let win = window_from_node(self);
|
||||
parse_style_attribute(&value, &doc.base_url(), win.css_error_reporter())
|
||||
parse_style_attribute(&value, &doc.base_url(), win.css_error_reporter(),
|
||||
ParserContextExtraData::default())
|
||||
});
|
||||
if node.is_in_doc() {
|
||||
node.dirty(NodeDamage::NodeStyleDamaged);
|
||||
|
|
|
@ -37,6 +37,7 @@ use std::mem;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use string_cache::Atom;
|
||||
use style::media_queries::{MediaQueryList, parse_media_query_list};
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::servo::Stylesheet;
|
||||
use style::stylesheets::Origin;
|
||||
use url::Url;
|
||||
|
@ -306,7 +307,8 @@ impl AsyncResponseListener for StylesheetContext {
|
|||
|
||||
let mut sheet = Stylesheet::from_bytes(&data, final_url, protocol_encoding_label,
|
||||
Some(environment_encoding), Origin::Author,
|
||||
win.css_error_reporter());
|
||||
win.css_error_reporter(),
|
||||
ParserContextExtraData::default());
|
||||
let media = self.media.take().unwrap();
|
||||
sheet.set_media(Some(media));
|
||||
let sheet = Arc::new(sheet);
|
||||
|
|
|
@ -17,6 +17,7 @@ use layout_interface::{LayoutChan, Msg};
|
|||
use std::sync::Arc;
|
||||
use string_cache::Atom;
|
||||
use style::media_queries::parse_media_query_list;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::servo::Stylesheet;
|
||||
use style::stylesheets::Origin;
|
||||
use util::str::DOMString;
|
||||
|
@ -60,7 +61,8 @@ impl HTMLStyleElement {
|
|||
};
|
||||
|
||||
let data = node.GetTextContent().expect("Element.textContent must be a string");
|
||||
let mut sheet = Stylesheet::from_str(&data, url, Origin::Author, win.css_error_reporter());
|
||||
let mut sheet = Stylesheet::from_str(&data, url, Origin::Author, win.css_error_reporter(),
|
||||
ParserContextExtraData::default());
|
||||
let mut css_parser = CssParser::new(&mq_str);
|
||||
let media = parse_media_query_list(&mut css_parser);
|
||||
sheet.set_media(Some(media));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue