mirror of
https://github.com/servo/servo.git
synced 2025-10-01 17:19:16 +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
|
@ -24,6 +24,7 @@ use style::context::{ReflowGoal};
|
|||
use style::dom::{TDocument, TElement, TNode};
|
||||
use style::error_reporting::StdoutErrorReporter;
|
||||
use style::parallel;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::properties::ComputedValues;
|
||||
use style::selector_impl::{SelectorImplExt, PseudoElementCascadeType};
|
||||
use style::stylesheets::Origin;
|
||||
|
@ -132,7 +133,9 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
|
|||
|
||||
// FIXME(heycam): Pass in the real base URL.
|
||||
let url = Url::parse("about:none").unwrap();
|
||||
let sheet = Arc::new(Stylesheet::from_str(input, url, origin, Box::new(StdoutErrorReporter)));
|
||||
let extra_data = ParserContextExtraData { };
|
||||
let sheet = Arc::new(Stylesheet::from_str(input, url, origin, Box::new(StdoutErrorReporter),
|
||||
extra_data));
|
||||
unsafe {
|
||||
transmute(sheet)
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ use style::dom::{TDocument, TElement, TNode, TRestyleDamage, UnsafeNode};
|
|||
use style::element_state::ElementState;
|
||||
#[allow(unused_imports)] // Used in commented-out code.
|
||||
use style::error_reporting::StdoutErrorReporter;
|
||||
use style::parser::ParserContextExtraData;
|
||||
use style::properties::{PropertyDeclaration, PropertyDeclarationBlock};
|
||||
#[allow(unused_imports)] // Used in commented-out code.
|
||||
use style::properties::{parse_style_attribute};
|
||||
|
@ -330,7 +331,11 @@ impl<'le> TElement for GeckoElement<'le> {
|
|||
let attr = self.get_attr(&ns!(), &atom!("style"));
|
||||
// FIXME(bholley): Real base URL and error reporter.
|
||||
let base_url = Url::parse("http://www.example.org").unwrap();
|
||||
attr.map(|v| parse_style_attribute(&v, &base_url, Box::new(StdoutErrorReporter)))
|
||||
// FIXME(heycam): Needs real ParserContextExtraData so that URLs parse
|
||||
// properly.
|
||||
let extra_data = ParserContextExtraData::default();
|
||||
attr.map(|v| parse_style_attribute(&v, &base_url, Box::new(StdoutErrorReporter),
|
||||
extra_data))
|
||||
*/
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue