mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
Introduce PartialStyleAndLayoutData.
This commit is contained in:
parent
6aaf3e6a01
commit
bea96f60e3
3 changed files with 14 additions and 5 deletions
|
@ -49,13 +49,14 @@ use query::{process_node_overflow_request, process_resolved_style_request, proce
|
|||
use script::layout_interface::{LayoutRPC, OffsetParentResponse, NodeOverflowResponse, MarginStyleResponse};
|
||||
use script::layout_interface::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType, ScriptReflow};
|
||||
use script::reporter::CSSErrorReporter;
|
||||
use script_layout_interface::OpaqueStyleAndLayoutData;
|
||||
use script_layout_interface::restyle_damage::{REPAINT, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW, REFLOW};
|
||||
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
|
||||
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
|
||||
use script_traits::{StackingContextScrollState, UntrustedNodeAddress};
|
||||
use sequential;
|
||||
use serde_json;
|
||||
use std::borrow::ToOwned;
|
||||
use std::cell::RefCell;
|
||||
use std::collections::HashMap;
|
||||
use std::hash::BuildHasherDefault;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
@ -1480,7 +1481,7 @@ impl LayoutThread {
|
|||
/// Handles a message to destroy layout data. Layout data must be destroyed on *this* thread
|
||||
/// because the struct type is transmuted to a different type on the script side.
|
||||
unsafe fn handle_reap_style_and_layout_data(&self, data: OpaqueStyleAndLayoutData) {
|
||||
let ptr: *mut () = *data.ptr;
|
||||
let ptr: *mut RefCell<PartialStyleAndLayoutData> = *data.ptr;
|
||||
let non_opaque: NonOpaqueStyleAndLayoutData = ptr as *mut _;
|
||||
let _ = Box::from_raw(non_opaque);
|
||||
}
|
||||
|
|
|
@ -44,8 +44,8 @@ use script::layout_interface::{HTMLCanvasData, HTMLElementTypeId, LayoutCharacte
|
|||
use script::layout_interface::{LayoutDocumentHelpers, LayoutElementHelpers, LayoutJS};
|
||||
use script::layout_interface::{LayoutNodeHelpers, Node, NodeTypeId};
|
||||
use script::layout_interface::{RawLayoutElementHelpers, Text, TrustedNodeAddress};
|
||||
use script_layout_interface::OpaqueStyleAndLayoutData;
|
||||
use script_layout_interface::restyle_damage::RestyleDamage;
|
||||
use script_layout_interface::{OpaqueStyleAndLayoutData, PartialStyleAndLayoutData};
|
||||
use selectors::matching::{DeclarationBlock, ElementFlags};
|
||||
use selectors::parser::{AttrSelector, NamespaceConstraint};
|
||||
use smallvec::VecLike;
|
||||
|
@ -127,7 +127,7 @@ impl<'ln> ServoLayoutNode<'ln> {
|
|||
let ptr: NonOpaqueStyleAndLayoutData =
|
||||
Box::into_raw(box RefCell::new(PrivateLayoutData::new()));
|
||||
let opaque = OpaqueStyleAndLayoutData {
|
||||
ptr: unsafe { NonZero::new(ptr as *mut ()) }
|
||||
ptr: unsafe { NonZero::new(ptr as *mut RefCell<PartialStyleAndLayoutData>) }
|
||||
};
|
||||
unsafe {
|
||||
self.node.init_style_and_layout_data(opaque);
|
||||
|
|
|
@ -24,12 +24,20 @@ extern crate style;
|
|||
pub mod restyle_damage;
|
||||
|
||||
use core::nonzero::NonZero;
|
||||
use restyle_damage::RestyleDamage;
|
||||
use std::cell::RefCell;
|
||||
use style::servo::PrivateStyleData;
|
||||
|
||||
pub struct PartialStyleAndLayoutData {
|
||||
pub style_data: PrivateStyleData,
|
||||
pub restyle_damage: RestyleDamage,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, HeapSizeOf)]
|
||||
pub struct OpaqueStyleAndLayoutData {
|
||||
#[ignore_heap_size_of = "TODO(#6910) Box value that should be counted but \
|
||||
the type lives in layout"]
|
||||
pub ptr: NonZero<*mut ()>
|
||||
pub ptr: NonZero<*mut RefCell<PartialStyleAndLayoutData>>
|
||||
}
|
||||
|
||||
#[allow(unsafe_code)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue