mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +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.
|
||||
"nsPIDOMWindow", // <- Takes the vtable from a template parameter, and we can't
|
||||
// generate it conditionally.
|
||||
"RawGeckoPresContext", // Just passing it through.
|
||||
"JS::Rooted",
|
||||
"mozilla::Maybe",
|
||||
"gfxSize", // <- union { struct { T width; T height; }; T components[2] };
|
||||
|
@ -467,6 +468,7 @@ mod bindings {
|
|||
"RawGeckoDocument",
|
||||
"RawGeckoElement",
|
||||
"RawGeckoNode",
|
||||
"RawGeckoPresContext",
|
||||
"ThreadSafeURIHolder",
|
||||
"ThreadSafePrincipalHolder",
|
||||
"ConsumeStyleBehavior",
|
||||
|
@ -560,6 +562,7 @@ mod bindings {
|
|||
"RawGeckoElement",
|
||||
"RawGeckoDocument",
|
||||
"RawServoDeclarationBlockStrong",
|
||||
"RawGeckoPresContext",
|
||||
];
|
||||
let servo_borrow_types = [
|
||||
"nsCSSValue",
|
||||
|
|
|
@ -8,6 +8,7 @@ use animation::Animation;
|
|||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use dom::OpaqueNode;
|
||||
use euclid::size::TypedSize2D;
|
||||
use gecko_bindings::bindings::RawGeckoPresContextBorrowed;
|
||||
use gecko_bindings::bindings::RawServoStyleSet;
|
||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use media_queries::{Device, MediaType};
|
||||
|
@ -73,7 +74,8 @@ lazy_static! {
|
|||
|
||||
impl 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.
|
||||
let window_size: TypedSize2D<f32, ViewportPx> = TypedSize2D::new(800.0, 600.0);
|
||||
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::RawGeckoElement;
|
||||
use gecko_bindings::structs::RawGeckoNode;
|
||||
use gecko_bindings::structs::RawGeckoPresContext;
|
||||
use gecko_bindings::structs::ThreadSafeURIHolder;
|
||||
use gecko_bindings::structs::ThreadSafePrincipalHolder;
|
||||
use gecko_bindings::structs::ConsumeStyleBehavior;
|
||||
|
@ -206,6 +207,8 @@ pub type RawGeckoDocumentBorrowed<'a> = &'a RawGeckoDocument;
|
|||
pub type RawGeckoDocumentBorrowedOrNull<'a> = Option<&'a RawGeckoDocument>;
|
||||
pub type RawServoDeclarationBlockStrongBorrowed<'a> = &'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 nsCSSValueBorrowedOrNull<'a> = Option<&'a nsCSSValue>;
|
||||
pub type nsCSSValueBorrowedMut<'a> = &'a mut nsCSSValue;
|
||||
|
@ -1028,7 +1031,8 @@ extern "C" {
|
|||
-> ServoCssRulesStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_Init() -> RawServoStyleSetOwned;
|
||||
pub fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextBorrowed)
|
||||
-> RawServoStyleSetOwned;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_AppendStyleSheet(set: RawServoStyleSetBorrowed,
|
||||
|
|
|
@ -11613,12 +11613,14 @@ pub mod root {
|
|||
pub type RawGeckoNode = root::nsINode;
|
||||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||
pub type RawGeckoDocument = root::nsIDocument;
|
||||
pub type RawGeckoPresContext = [u64; 156usize];
|
||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
||||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoPresContextBorrowed = *const [u64; 156usize];
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
pub enum nsCSSTokenSerializationType {
|
||||
|
|
|
@ -11540,12 +11540,14 @@ pub mod root {
|
|||
pub type RawGeckoNode = root::nsINode;
|
||||
pub type RawGeckoElement = root::mozilla::dom::Element;
|
||||
pub type RawGeckoDocument = root::nsIDocument;
|
||||
pub type RawGeckoPresContext = [u64; 152usize];
|
||||
pub type RawGeckoNodeBorrowed = *const root::RawGeckoNode;
|
||||
pub type RawGeckoNodeBorrowedOrNull = *const root::RawGeckoNode;
|
||||
pub type RawGeckoElementBorrowed = *const root::RawGeckoElement;
|
||||
pub type RawGeckoElementBorrowedOrNull = *const root::RawGeckoElement;
|
||||
pub type RawGeckoDocumentBorrowed = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoDocumentBorrowedOrNull = *const root::RawGeckoDocument;
|
||||
pub type RawGeckoPresContextBorrowed = *const [u64; 152usize];
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
|
||||
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::{nsACString, nsAString};
|
||||
use style::gecko_bindings::bindings::RawGeckoElementBorrowed;
|
||||
use style::gecko_bindings::bindings::RawGeckoPresContextBorrowed;
|
||||
use style::gecko_bindings::bindings::RawServoImportRuleBorrowed;
|
||||
use style::gecko_bindings::bindings::ServoComputedValuesBorrowedOrNull;
|
||||
use style::gecko_bindings::bindings::nsTArrayBorrowed_uintptr_t;
|
||||
|
@ -601,8 +602,9 @@ pub extern "C" fn Servo_ComputedValues_Release(ptr: ServoComputedValuesBorrowed)
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn Servo_StyleSet_Init() -> RawServoStyleSetOwned {
|
||||
let data = Box::new(PerDocumentStyleData::new());
|
||||
pub extern "C" fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextBorrowed)
|
||||
-> RawServoStyleSetOwned {
|
||||
let data = Box::new(PerDocumentStyleData::new(pres_context));
|
||||
data.into_ffi()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue