mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Bug 1298588 part 2, servo piece. Pass through an nsPresContext to the PerDocumentStyleData constructor. r=bholley
This commit is contained in:
parent
384e905be2
commit
8908743719
6 changed files with 19 additions and 4 deletions
|
@ -392,6 +392,7 @@ mod bindings {
|
||||||
// for clang.
|
// for clang.
|
||||||
"nsPIDOMWindow", // <- Takes the vtable from a template parameter, and we can't
|
"nsPIDOMWindow", // <- Takes the vtable from a template parameter, and we can't
|
||||||
// generate it conditionally.
|
// generate it conditionally.
|
||||||
|
"RawGeckoPresContext", // Just passing it through.
|
||||||
"JS::Rooted",
|
"JS::Rooted",
|
||||||
"mozilla::Maybe",
|
"mozilla::Maybe",
|
||||||
"gfxSize", // <- union { struct { T width; T height; }; T components[2] };
|
"gfxSize", // <- union { struct { T width; T height; }; T components[2] };
|
||||||
|
@ -467,6 +468,7 @@ mod bindings {
|
||||||
"RawGeckoDocument",
|
"RawGeckoDocument",
|
||||||
"RawGeckoElement",
|
"RawGeckoElement",
|
||||||
"RawGeckoNode",
|
"RawGeckoNode",
|
||||||
|
"RawGeckoPresContext",
|
||||||
"ThreadSafeURIHolder",
|
"ThreadSafeURIHolder",
|
||||||
"ThreadSafePrincipalHolder",
|
"ThreadSafePrincipalHolder",
|
||||||
"ConsumeStyleBehavior",
|
"ConsumeStyleBehavior",
|
||||||
|
@ -560,6 +562,7 @@ mod bindings {
|
||||||
"RawGeckoElement",
|
"RawGeckoElement",
|
||||||
"RawGeckoDocument",
|
"RawGeckoDocument",
|
||||||
"RawServoDeclarationBlockStrong",
|
"RawServoDeclarationBlockStrong",
|
||||||
|
"RawGeckoPresContext",
|
||||||
];
|
];
|
||||||
let servo_borrow_types = [
|
let servo_borrow_types = [
|
||||||
"nsCSSValue",
|
"nsCSSValue",
|
||||||
|
|
|
@ -8,6 +8,7 @@ use animation::Animation;
|
||||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||||
use dom::OpaqueNode;
|
use dom::OpaqueNode;
|
||||||
use euclid::size::TypedSize2D;
|
use euclid::size::TypedSize2D;
|
||||||
|
use gecko_bindings::bindings::RawGeckoPresContextBorrowed;
|
||||||
use gecko_bindings::bindings::RawServoStyleSet;
|
use gecko_bindings::bindings::RawServoStyleSet;
|
||||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||||
use media_queries::{Device, MediaType};
|
use media_queries::{Device, MediaType};
|
||||||
|
@ -73,7 +74,8 @@ lazy_static! {
|
||||||
|
|
||||||
impl PerDocumentStyleData {
|
impl PerDocumentStyleData {
|
||||||
/// Create a dummy `PerDocumentStyleData`.
|
/// Create a dummy `PerDocumentStyleData`.
|
||||||
pub fn new() -> Self {
|
#[allow(unused_variables)] // temporary until we make use of the ctor arg.
|
||||||
|
pub fn new(pres_context: RawGeckoPresContextBorrowed) -> Self {
|
||||||
// FIXME(bholley): Real window size.
|
// FIXME(bholley): Real window size.
|
||||||
let window_size: TypedSize2D<f32, ViewportPx> = TypedSize2D::new(800.0, 600.0);
|
let window_size: TypedSize2D<f32, ViewportPx> = TypedSize2D::new(800.0, 600.0);
|
||||||
let device = Device::new(MediaType::Screen, window_size);
|
let device = Device::new(MediaType::Screen, window_size);
|
||||||
|
|
|
@ -6,6 +6,7 @@ type nsAString_internal = nsAString;
|
||||||
use gecko_bindings::structs::RawGeckoDocument;
|
use gecko_bindings::structs::RawGeckoDocument;
|
||||||
use gecko_bindings::structs::RawGeckoElement;
|
use gecko_bindings::structs::RawGeckoElement;
|
||||||
use gecko_bindings::structs::RawGeckoNode;
|
use gecko_bindings::structs::RawGeckoNode;
|
||||||
|
use gecko_bindings::structs::RawGeckoPresContext;
|
||||||
use gecko_bindings::structs::ThreadSafeURIHolder;
|
use gecko_bindings::structs::ThreadSafeURIHolder;
|
||||||
use gecko_bindings::structs::ThreadSafePrincipalHolder;
|
use gecko_bindings::structs::ThreadSafePrincipalHolder;
|
||||||
use gecko_bindings::structs::ConsumeStyleBehavior;
|
use gecko_bindings::structs::ConsumeStyleBehavior;
|
||||||
|
@ -206,6 +207,8 @@ pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
|
||||||
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
|
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
|
||||||
pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlockStrong;
|
pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'a RawServoDeclarationBlockStrong;
|
||||||
pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>;
|
pub type RawServoDeclarationBlockStrongBorrowedOrNull<'a> = Option<&'a RawServoDeclarationBlockStrong>;
|
||||||
|
pub type RawGeckoPresContextBorrowed<'a> = &'a RawGeckoPresContext;
|
||||||
|
pub type RawGeckoPresContextBorrowedOrNull<'a> = Option<&'a RawGeckoPresContext>;
|
||||||
pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue;
|
pub type nsCSSValueBorrowed<'a> = &'a nsCSSValue;
|
||||||
pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;
|
pub type nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;
|
||||||
pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;
|
pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;
|
||||||
|
@ -1028,7 +1031,8 @@ extern "C" {
|
||||||
-> ServoCssRulesStrong;
|
-> ServoCssRulesStrong;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_StyleSet_Init() -> RawServoStyleSetOwned;
|
pub fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextBorrowed)
|
||||||
|
-> RawServoStyleSetOwned;
|
||||||
}
|
}
|
||||||
extern "C" {
|
extern "C" {
|
||||||
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
|
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
|
||||||
|
|
|
@ -11613,12 +11613,14 @@ pub mod root {
|
||||||
pub type RawGeckoNode = root::nsINode;
|
pub type RawGeckoNode = root::nsINode;
|
||||||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||||
pub type RawGeckoDocument = root::nsIDocument;
|
pub type RawGeckoDocument = root::nsIDocument;
|
||||||
|
pub type RawGeckoPresContext = [u64; 156usize];
|
||||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||||
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
||||||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||||
|
pub type RawGeckoPresContextBorrowed = *const [u64; 156usize];
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum nsCSSTokenSerializationType {
|
pub enum nsCSSTokenSerializationType {
|
||||||
|
|
|
@ -11540,12 +11540,14 @@ pub mod root {
|
||||||
pub type RawGeckoNode = root::nsINode;
|
pub type RawGeckoNode = root::nsINode;
|
||||||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||||
pub type RawGeckoDocument = root::nsIDocument;
|
pub type RawGeckoDocument = root::nsIDocument;
|
||||||
|
pub type RawGeckoPresContext = [u64; 152usize];
|
||||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||||
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
||||||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||||
|
pub type RawGeckoPresContextBorrowed = *const [u64; 152usize];
|
||||||
#[repr(u32)]
|
#[repr(u32)]
|
||||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||||
pub enum nsCSSTokenSerializationType {
|
pub enum nsCSSTokenSerializationType {
|
||||||
|
|
|
@ -36,6 +36,7 @@ use style::gecko_bindings::bindings::{RawServoStyleSheetStrong, ServoComputedVal
|
||||||
use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong};
|
use style::gecko_bindings::bindings::{ServoCssRulesBorrowed, ServoCssRulesStrong};
|
||||||
use style::gecko_bindings::bindings::{nsACString, nsAString};
|
use style::gecko_bindings::bindings::{nsACString, nsAString};
|
||||||
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
|
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
|
||||||
|
use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
|
||||||
use style::gecko_bindings::bindings::RawServoImportRuleBorrowed;
|
use style::gecko_bindings::bindings::RawServoImportRuleBorrowed;
|
||||||
use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
|
use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
|
||||||
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
|
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
|
||||||
|
@ -601,8 +602,9 @@ pub extern "C" fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
pub extern "C" fn Servo_StyleSet_Init() -> RawServoStyleSetOwned {
|
pub extern "C" fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextBorrowed)
|
||||||
let data = Box::new(PerDocumentStyleData::new());
|
-> RawServoStyleSetOwned {
|
||||||
|
let data = Box::new(PerDocumentStyleData::new(pres_context));
|
||||||
data.into_ffi()
|
data.into_ffi()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue