Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData

This commit is contained in:
Anthony Ramine 2020-04-06 14:42:05 +02:00
parent 88d79fe46d
commit 030a1cf8fb
12 changed files with 129 additions and 162 deletions

View file

@ -97,7 +97,7 @@ use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
use script_layout_interface::message::PendingRestyle;
use script_layout_interface::rpc::LayoutRPC;
use script_layout_interface::OpaqueStyleAndLayoutData;
use script_layout_interface::StyleAndOpaqueLayoutData;
use script_traits::serializable::BlobImpl;
use script_traits::transferable::MessagePortImpl;
use script_traits::{DocumentActivity, DrawAPaintImageResult};
@ -508,7 +508,7 @@ unsafe_no_jsmanaged_fields!(StatusCode);
unsafe_no_jsmanaged_fields!(SystemTime);
unsafe_no_jsmanaged_fields!(Instant);
unsafe_no_jsmanaged_fields!(RelativePos);
unsafe_no_jsmanaged_fields!(OpaqueStyleAndLayoutData);
unsafe_no_jsmanaged_fields!(StyleAndOpaqueLayoutData);
unsafe_no_jsmanaged_fields!(PathBuf);
unsafe_no_jsmanaged_fields!(DrawAPaintImageResult);
unsafe_no_jsmanaged_fields!(DocumentId);

View file

@ -76,7 +76,7 @@ use msg::constellation_msg::{BrowsingContextId, PipelineId};
use net_traits::image::base::{Image, ImageMetadata};
use ref_slice::ref_slice;
use script_layout_interface::{HTMLCanvasData, HTMLMediaData, LayoutElementType, LayoutNodeType};
use script_layout_interface::{OpaqueStyleAndLayoutData, SVGSVGData, TrustedNodeAddress};
use script_layout_interface::{SVGSVGData, StyleAndOpaqueLayoutData, TrustedNodeAddress};
use script_traits::DocumentActivity;
use script_traits::UntrustedNodeAddress;
use selectors::matching::{matches_selector_list, MatchingContext, MatchingMode};
@ -152,8 +152,8 @@ pub struct Node {
///
/// Must be sent back to the layout thread to be destroyed when this
/// node is finalized.
#[ignore_malloc_size_of = "shrug"]
style_and_layout_data: UnsafeCell<Option<OpaqueStyleAndLayoutData>>,
#[ignore_malloc_size_of = "Unsafe cell"]
style_and_layout_data: UnsafeCell<Option<Box<StyleAndOpaqueLayoutData>>>,
}
bitflags! {
@ -1282,9 +1282,9 @@ pub trait LayoutNodeHelpers<'dom> {
fn children_count(self) -> u32;
fn get_opaque_style_and_layout_data(self) -> Option<&'dom OpaqueStyleAndLayoutData>;
unsafe fn init_opaque_style_and_layout_data(self, data: OpaqueStyleAndLayoutData);
unsafe fn take_opaque_style_and_layout_data(self) -> OpaqueStyleAndLayoutData;
fn get_style_and_opaque_layout_data(self) -> Option<&'dom StyleAndOpaqueLayoutData>;
unsafe fn init_style_and_opaque_layout_data(self, data: Box<StyleAndOpaqueLayoutData>);
unsafe fn take_style_and_opaque_layout_data(self) -> Box<StyleAndOpaqueLayoutData>;
fn text_content(self) -> Cow<'dom, str>;
fn selection(self) -> Option<Range<usize>>;
@ -1410,13 +1410,13 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
#[inline]
#[allow(unsafe_code)]
fn get_opaque_style_and_layout_data(self) -> Option<&'dom OpaqueStyleAndLayoutData> {
unsafe { (*self.unsafe_get().style_and_layout_data.get()).as_ref() }
fn get_style_and_opaque_layout_data(self) -> Option<&'dom StyleAndOpaqueLayoutData> {
unsafe { (*self.unsafe_get().style_and_layout_data.get()).as_deref() }
}
#[inline]
#[allow(unsafe_code)]
unsafe fn init_opaque_style_and_layout_data(self, val: OpaqueStyleAndLayoutData) {
unsafe fn init_style_and_opaque_layout_data(self, val: Box<StyleAndOpaqueLayoutData>) {
let data = &mut *self.unsafe_get().style_and_layout_data.get();
debug_assert!(data.is_none());
*data = Some(val);
@ -1424,7 +1424,7 @@ impl<'dom> LayoutNodeHelpers<'dom> for LayoutDom<'dom, Node> {
#[inline]
#[allow(unsafe_code)]
unsafe fn take_opaque_style_and_layout_data(self) -> OpaqueStyleAndLayoutData {
unsafe fn take_style_and_opaque_layout_data(self) -> Box<StyleAndOpaqueLayoutData> {
(*self.unsafe_get().style_and_layout_data.get())
.take()
.unwrap()