Skip to content

Commit

Permalink
Parse style sheets with a real base URL in geckolib.
Browse files Browse the repository at this point in the history
  • Loading branch information
heycam committed Aug 2, 2016
1 parent 2eeb945 commit f2a547c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions ports/geckolib/gecko_bindings/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ extern "C" {
pub fn Gecko_ReleaseCalcArbitraryThread(aPtr: *mut Calc);
pub fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8, length: u32,
parsing_mode: SheetParsingMode,
base_bytes: *const u8,
base_length: u32,
base: *mut ThreadSafeURIHolder,
referrer: *mut ThreadSafeURIHolder,
principal:
Expand Down
6 changes: 4 additions & 2 deletions ports/geckolib/glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ pub extern "C" fn Servo_DropNodeData(data: *mut ServoNodeData) -> () {
pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
length: u32,
mode: SheetParsingMode,
base_bytes: *const u8,
base_length: u32,
base: *mut ThreadSafeURIHolder,
referrer: *mut ThreadSafeURIHolder,
principal: *mut ThreadSafePrincipalHolder)
Expand All @@ -165,8 +167,8 @@ pub extern "C" fn Servo_StylesheetFromUTF8Bytes(bytes: *const u8,
SheetParsingMode::eAgentSheetFeatures => Origin::UserAgent,
};

// FIXME(heycam): Pass in the real base URL.
let url = Url::parse("about:none").unwrap();
let base_str = unsafe { from_utf8_unchecked(slice::from_raw_parts(base_bytes, base_length as usize)) };
let url = Url::parse(base_str).unwrap();
let extra_data = ParserContextExtraData {
base: Some(GeckoArcURI::new(base)),
referrer: Some(GeckoArcURI::new(referrer)),
Expand Down

0 comments on commit f2a547c

Please sign in to comment.