Bug 1304792: stylo: Implement @import. r=heycam

MozReview-Commit-ID: Hw1V66JxIBD
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
This commit is contained in:
Emilio Cobos Álvarez 2016-12-17 10:58:56 +01:00
parent b49eb6f566
commit a5f5e48c68
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
7 changed files with 177 additions and 16 deletions

View file

@ -143,6 +143,8 @@ unsafe impl Send for nsStyleXUL {}
unsafe impl Sync for nsStyleXUL {}
use gecko_bindings::structs::nscoord;
use gecko_bindings::structs::nsresult;
use gecko_bindings::structs::Loader;
use gecko_bindings::structs::ServoStyleSheet;
pub type nsTArrayBorrowed_uintptr_t<'a> = &'a mut ::gecko_bindings::structs::nsTArray<usize>;
pub type ServoComputedValuesStrong = ::gecko_bindings::sugar::ownership::Strong<ServoComputedValues>;
pub type ServoComputedValuesBorrowed<'a> = &'a ServoComputedValues;
@ -169,6 +171,11 @@ pub type RawServoStyleRuleBorrowed<'a> = &'a RawServoStyleRule;
pub type RawServoStyleRuleBorrowedOrNull<'a> = Option<&'a RawServoStyleRule>;
enum RawServoStyleRuleVoid { }
pub struct RawServoStyleRule(RawServoStyleRuleVoid);
pub type RawServoImportRuleStrong = ::gecko_bindings::sugar::ownership::Strong<RawServoImportRule>;
pub type RawServoImportRuleBorrowed<'a> = &'a RawServoImportRule;
pub type RawServoImportRuleBorrowedOrNull<'a> = Option<&'a RawServoImportRule>;
enum RawServoImportRuleVoid { }
pub struct RawServoImportRule(RawServoImportRuleVoid);
pub type RawServoStyleSetOwned = ::gecko_bindings::sugar::ownership::Owned<RawServoStyleSet>;
pub type RawServoStyleSetOwnedOrNull = ::gecko_bindings::sugar::ownership::OwnedOrNull<RawServoStyleSet>;
pub type RawServoStyleSetBorrowed<'a> = &'a RawServoStyleSet;
@ -236,6 +243,12 @@ extern "C" {
extern "C" {
pub fn Servo_StyleRule_Release(ptr: RawServoStyleRuleBorrowed);
}
extern "C" {
pub fn Servo_ImportRule_AddRef(ptr: RawServoImportRuleBorrowed);
}
extern "C" {
pub fn Servo_ImportRule_Release(ptr: RawServoImportRuleBorrowed);
}
extern "C" {
pub fn Servo_StyleSet_Drop(ptr: RawServoStyleSetOwned);
}
@ -314,6 +327,13 @@ extern "C" {
pub fn Gecko_GetDocumentElement(document: RawGeckoDocumentBorrowed)
-> RawGeckoElementBorrowedOrNull;
}
extern "C" {
pub fn Gecko_LoadStyleSheet(loader: *mut Loader,
parent: *mut ServoStyleSheet,
import_rule: RawServoImportRuleStrong,
url_bytes: *const u8, url_length: u32,
media_bytes: *const u8, media_length: u32);
}
extern "C" {
pub fn Gecko_MaybeCreateStyleChildrenIterator(node: RawGeckoNodeBorrowed)
-> StyleChildrenIteratorOwnedOrNull;
@ -970,7 +990,10 @@ extern "C" {
-> RawServoStyleSheetStrong;
}
extern "C" {
pub fn Servo_StyleSheet_FromUTF8Bytes(data: *const nsACString_internal,
pub fn Servo_StyleSheet_FromUTF8Bytes(loader: *mut Loader,
gecko_stylesheet:
*mut ServoStyleSheet,
data: *const nsACString_internal,
parsing_mode: SheetParsingMode,
base_url:
*const nsACString_internal,
@ -980,6 +1003,22 @@ extern "C" {
*mut ThreadSafePrincipalHolder)
-> RawServoStyleSheetStrong;
}
extern "C" {
pub fn Servo_ImportRule_GetSheet(import_rule: RawServoImportRuleBorrowed)
-> RawServoStyleSheetStrong;
}
extern "C" {
pub fn Servo_StyleSheet_ClearAndUpdate(stylesheet:
RawServoStyleSheetBorrowed,
loader: *mut Loader,
gecko_stylesheet:
*mut ServoStyleSheet,
data: *const nsACString_internal,
base: *mut ThreadSafeURIHolder,
referrer: *mut ThreadSafeURIHolder,
principal:
*mut ThreadSafePrincipalHolder);
}
extern "C" {
pub fn Servo_StyleSheet_HasRules(sheet: RawServoStyleSheetBorrowed)
-> bool;

View file

@ -1005,6 +1005,7 @@ pub mod root {
pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215;
pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint =
16777216;
@ -2362,6 +2363,14 @@ pub mod root {
assert_eq!(::std::mem::size_of::<StyleSheet>() , 88usize);
assert_eq!(::std::mem::align_of::<StyleSheet>() , 8usize);
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ServoStyleSheet {
pub _address: u8,
}
impl Clone for ServoStyleSheet {
fn clone(&self) -> Self { *self }
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Side {
@ -2593,7 +2602,7 @@ pub mod root {
* The FramePropertyTable is optimized for storing 0 or 1 properties on
* a given frame. Storing very large numbers of properties on a single
* frame will not be efficient.
*
*
* Property values are passed as void* but do not actually have to be
* valid pointers. You can use NS_INT32_TO_PTR/NS_PTR_TO_INT32 to
* store int32_t values. Null/zero values can be stored and retrieved.

View file

@ -1005,6 +1005,7 @@ pub mod root {
pub const NS_STYLE_DISPLAY_MODE_BROWSER: ::std::os::raw::c_uint = 0;
pub const NS_STYLE_DISPLAY_MODE_MINIMAL_UI: ::std::os::raw::c_uint = 1;
pub const NS_STYLE_DISPLAY_MODE_STANDALONE: ::std::os::raw::c_uint = 2;
pub const NS_STYLE_DISPLAY_MODE_FULLSCREEN: ::std::os::raw::c_uint = 3;
pub const NS_STYLE_INHERIT_MASK: ::std::os::raw::c_uint = 16777215;
pub const NS_STYLE_HAS_TEXT_DECORATION_LINES: ::std::os::raw::c_uint =
16777216;
@ -2345,6 +2346,14 @@ pub mod root {
assert_eq!(::std::mem::size_of::<StyleSheet>() , 80usize);
assert_eq!(::std::mem::align_of::<StyleSheet>() , 8usize);
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct ServoStyleSheet {
pub _address: u8,
}
impl Clone for ServoStyleSheet {
fn clone(&self) -> Self { *self }
}
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
pub enum Side {
@ -2576,7 +2585,7 @@ pub mod root {
* The FramePropertyTable is optimized for storing 0 or 1 properties on
* a given frame. Storing very large numbers of properties on a single
* frame will not be efficient.
*
*
* Property values are passed as void* but do not actually have to be
* valid pointers. You can use NS_INT32_TO_PTR/NS_PTR_TO_INT32 to
* store int32_t values. Null/zero values can be stored and retrieved.