Skip to content
Browse files

Stylo: Pass an explicit parent SheetLoadData for child stylesheet loads.

MozReview-Commit-ID: 7XNu42NtITm
  • Loading branch information
bholley committed Feb 28, 2018
1 parent 2d4caaf commit 0236a6ce998cfbf587211530816850dea593bbab
Showing with 15 additions and 6 deletions.
  1. +3 −0 components/style/gecko/generated/
  2. +7 −3 ports/geckolib/
  3. +5 −3 ports/geckolib/
@@ -235,6 +235,7 @@ use gecko_bindings::structs::nscoord;
use gecko_bindings::structs::nsresult;
use gecko_bindings::structs::Loader;
use gecko_bindings::structs::LoaderReusableStyleSheets;
use gecko_bindings::structs::SheetLoadData;
use gecko_bindings::structs::ServoStyleSheet;
use gecko_bindings::structs::ServoComputedData;
use gecko_bindings::structs::ServoStyleContext;
@@ -664,6 +665,7 @@ extern "C" {
pub fn Gecko_LoadStyleSheet(
loader: *mut Loader,
parent: *mut ServoStyleSheet,
parent_load_data: *mut SheetLoadData,
reusable_sheets: *mut LoaderReusableStyleSheets,
base_url_data: *mut RawGeckoURLExtraData,
url_bytes: *const u8,
@@ -2093,6 +2095,7 @@ extern "C" {
pub fn Servo_StyleSheet_FromUTF8Bytes(
loader: *mut Loader,
gecko_stylesheet: *mut ServoStyleSheet,
load_data: *mut SheetLoadData,
data: *const u8,
data_len: usize,
parsing_mode: SheetParsingMode,
@@ -90,7 +90,7 @@ use style::gecko_bindings::structs;
use style::gecko_bindings::structs::{CallerType, CSSPseudoElementType, CompositeOperation};
use style::gecko_bindings::structs::{Loader, LoaderReusableStyleSheets};
use style::gecko_bindings::structs::{RawServoStyleRule, ServoStyleContextStrong, RustString};
use style::gecko_bindings::structs::{ServoStyleSheet, SheetParsingMode, nsAtom, nsCSSPropertyID};
use style::gecko_bindings::structs::{ServoStyleSheet, SheetLoadData, SheetParsingMode, nsAtom, nsCSSPropertyID};
use style::gecko_bindings::structs::{nsCSSFontDesc, nsCSSFontFaceRule, nsCSSCounterStyleRule};
use style::gecko_bindings::structs::{nsRestyleHint, nsChangeHint, PropertyValuePair};
use style::gecko_bindings::structs::AtomArray;
@@ -1067,10 +1067,14 @@ pub extern "C" fn Servo_StyleSheet_Empty(mode: SheetParsingMode) -> RawServoStyl

/// Note: The load_data corresponds to this sheet, and is passed as the parent
/// load data for child sheet loads. It may be null for certain cases where we
/// know we won't have child loads.
pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
loader: *mut Loader,
stylesheet: *mut ServoStyleSheet,
load_data: *mut SheetLoadData,
data: *const u8,
data_len: usize,
mode: SheetParsingMode,
@@ -1094,7 +1098,7 @@ pub extern "C" fn Servo_StyleSheet_FromUTF8Bytes(
let loader = if loader.is_null() {
} else {
Some(StylesheetLoader::new(loader, stylesheet, reusable_sheets))
Some(StylesheetLoader::new(loader, stylesheet, load_data, reusable_sheets))

// FIXME(emilio): loader.as_ref() doesn't typecheck for some reason?
@@ -1538,7 +1542,7 @@ pub extern "C" fn Servo_CssRules_InsertRule(
let loader = if loader.is_null() {
} else {
Some(StylesheetLoader::new(loader, gecko_stylesheet, ptr::null_mut()))
Some(StylesheetLoader::new(loader, gecko_stylesheet, ptr::null_mut(), ptr::null_mut()))
let loader = loader.as_ref().map(|loader| loader as &StyleStylesheetLoader);
let rule = unsafe { rule.as_ref().unwrap().as_str_unchecked() };
@@ -6,7 +6,7 @@ use cssparser::SourceLocation;
use servo_arc::Arc;
use style::gecko::data::GeckoStyleSheet;
use style::gecko_bindings::bindings::Gecko_LoadStyleSheet;
use style::gecko_bindings::structs::{Loader, ServoStyleSheet, LoaderReusableStyleSheets};
use style::gecko_bindings::structs::{Loader, ServoStyleSheet, SheetLoadData, LoaderReusableStyleSheets};
use style::gecko_bindings::sugar::ownership::FFIArcHelpers;
use style::media_queries::MediaList;
use style::parser::ParserContext;
@@ -15,13 +15,14 @@ use style::stylesheets::{ImportRule, StylesheetLoader as StyleStylesheetLoader};
use style::stylesheets::import_rule::ImportSheet;
use style::values::specified::url::SpecifiedUrl;

pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet, *mut LoaderReusableStyleSheets);
pub struct StylesheetLoader(*mut Loader, *mut ServoStyleSheet, *mut SheetLoadData, *mut LoaderReusableStyleSheets);

impl StylesheetLoader {
pub fn new(loader: *mut Loader,
parent: *mut ServoStyleSheet,
parent_load_data: *mut SheetLoadData,
reusable_sheets: *mut LoaderReusableStyleSheets) -> Self {
StylesheetLoader(loader, parent, reusable_sheets)
StylesheetLoader(loader, parent, parent_load_data, reusable_sheets)

@@ -45,6 +46,7 @@ impl StyleStylesheetLoader for StylesheetLoader {
spec_len as u32,

0 comments on commit 0236a6c

Please sign in to comment.
You can’t perform that action at this time.