mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
stylo: Make URLs work in inline style
MozReview-Commit-ID: 6Tc0kBw4V8c
This commit is contained in:
parent
06f99c13f2
commit
4deae33ab1
3 changed files with 13 additions and 10 deletions
|
@ -296,13 +296,10 @@ impl<'le> fmt::Debug for GeckoElement<'le> {
|
||||||
|
|
||||||
impl<'le> GeckoElement<'le> {
|
impl<'le> GeckoElement<'le> {
|
||||||
/// Parse the style attribute of an element.
|
/// Parse the style attribute of an element.
|
||||||
pub fn parse_style_attribute(value: &str) -> PropertyDeclarationBlock {
|
pub fn parse_style_attribute(value: &str,
|
||||||
// FIXME(bholley): Real base URL and error reporter.
|
base_url: &ServoUrl,
|
||||||
let base_url = &*DUMMY_BASE_URL;
|
extra_data: ParserContextExtraData) -> PropertyDeclarationBlock {
|
||||||
// FIXME(heycam): Needs real ParserContextExtraData so that URLs parse
|
parse_style_attribute(value, base_url, Box::new(StdoutErrorReporter), extra_data)
|
||||||
// properly.
|
|
||||||
let extra_data = ParserContextExtraData::default();
|
|
||||||
parse_style_attribute(value, &base_url, Box::new(StdoutErrorReporter), extra_data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn flags(&self) -> u32 {
|
fn flags(&self) -> u32 {
|
||||||
|
|
|
@ -1415,7 +1415,9 @@ extern "C" {
|
||||||
-> bool;
|
-> bool;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal)
|
pub fn Servo_ParseStyleAttribute(data: *const nsACString_internal,
|
||||||
|
base: *const nsACString_internal,
|
||||||
|
extraData: *const GeckoParserExtraData)
|
||||||
-> RawServoDeclarationBlockStrong;
|
-> RawServoDeclarationBlockStrong;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
|
@ -718,9 +718,13 @@ pub extern "C" fn Servo_ParseProperty(property: *const nsACString, value: *const
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_ParseStyleAttribute(data: *const nsACString) -> RawServoDeclarationBlockStrong {
|
pub extern "C" fn Servo_ParseStyleAttribute(data: *const nsACString,
|
||||||
|
base: *const nsACString,
|
||||||
|
raw_extra_data: *const structs::GeckoParserExtraData)
|
||||||
|
-> RawServoDeclarationBlockStrong {
|
||||||
let value = unsafe { data.as_ref().unwrap().as_str_unchecked() };
|
let value = unsafe { data.as_ref().unwrap().as_str_unchecked() };
|
||||||
Arc::new(RwLock::new(GeckoElement::parse_style_attribute(value))).into_strong()
|
make_context!((base, raw_extra_data) => (base_url, extra_data));
|
||||||
|
Arc::new(RwLock::new(GeckoElement::parse_style_attribute(value, &base_url, extra_data))).into_strong()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue