aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout
diff options
context:
space:
mode:
Diffstat (limited to 'components/layout')
-rw-r--r--components/layout/Cargo.toml3
-rw-r--r--components/layout/construct.rs28
-rw-r--r--components/layout/display_list_builder.rs20
-rw-r--r--components/layout/incremental.rs4
-rw-r--r--components/layout/layout_thread.rs49
-rw-r--r--components/layout/lib.rs2
-rw-r--r--components/layout/query.rs30
-rw-r--r--components/layout/traversal.rs4
-rw-r--r--components/layout/webrender_helpers.rs26
-rw-r--r--components/layout/wrapper.rs20
10 files changed, 141 insertions, 45 deletions
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index 35ca6cd1173..dc1ac2f1bf4 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -72,7 +72,6 @@ libc = "0.2"
log = "0.3.5"
rustc-serialize = "0.3"
selectors = {version = "0.5.1", features = ["heap_size"]}
-serde = "0.7"
serde_json = "0.7"
serde_macros = "0.7"
smallvec = "0.1"
@@ -80,4 +79,4 @@ string_cache = {version = "0.2.12", features = ["heap_size"]}
time = "0.1"
unicode-bidi = "0.2"
unicode-script = { version = "0.1", features = ["harfbuzz"] }
-url = {version = "0.5.7", features = ["heap_size"]}
+url = {version = "1.0.0", features = ["heap_size"]}
diff --git a/components/layout/construct.rs b/components/layout/construct.rs
index ee961942300..cc34642466a 100644
--- a/components/layout/construct.rs
+++ b/components/layout/construct.rs
@@ -619,18 +619,20 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
// List of absolute descendants, in tree order.
let mut abs_descendants = AbsoluteDescendants::new();
- for kid in node.children() {
- if kid.get_pseudo_element_type() != PseudoElementType::Normal {
- self.process(&kid);
- }
+ if !node.is_replaced_content() {
+ for kid in node.children() {
+ if kid.get_pseudo_element_type() != PseudoElementType::Normal {
+ self.process(&kid);
+ }
- self.build_block_flow_using_construction_result_of_child(
- &mut flow,
- &mut consecutive_siblings,
- node,
- kid,
- &mut inline_fragment_accumulator,
- &mut abs_descendants);
+ self.build_block_flow_using_construction_result_of_child(
+ &mut flow,
+ &mut consecutive_siblings,
+ node,
+ kid,
+ &mut inline_fragment_accumulator,
+ &mut abs_descendants);
+ }
}
// Perform a final flush of any inline fragments that we were gathering up to handle {ib}
@@ -683,7 +685,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode>
HTMLElementTypeId::HTMLInputElement))) ||
node.type_id() == Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLTextAreaElement)));
- if node.get_pseudo_element_type().is_before_or_after() ||
+ if node.get_pseudo_element_type().is_replaced_content() ||
node_is_input_or_text_area {
// A TextArea's text contents are displayed through the input text
// box, so don't construct them.
@@ -1659,7 +1661,6 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
where ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode {
fn is_replaced_content(&self) -> bool {
match self.type_id() {
- None |
Some(NodeTypeId::CharacterData(_)) |
Some(NodeTypeId::DocumentType) |
Some(NodeTypeId::DocumentFragment) |
@@ -1673,6 +1674,7 @@ impl<ConcreteThreadSafeLayoutNode> NodeUtils for ConcreteThreadSafeLayoutNode
Some(NodeTypeId::Element(ElementTypeId::HTMLElement(
HTMLElementTypeId::HTMLObjectElement))) => self.has_object_data(),
Some(NodeTypeId::Element(_)) => false,
+ None => self.get_pseudo_element_type().is_replaced_content(),
}
}
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 3bc3d101f06..fb2847e9d77 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -1247,6 +1247,9 @@ impl FragmentDisplayListBuilding for Fragment {
let height = canvas_fragment_info.replaced_image_fragment_info
.computed_block_size.map_or(0, |h| h.to_px() as usize);
if width > 0 && height > 0 {
+ let computed_width = canvas_fragment_info.canvas_inline_size().to_px();
+ let computed_height = canvas_fragment_info.canvas_block_size().to_px();
+
let layer_id = self.layer_id();
let canvas_data = match canvas_fragment_info.ipc_renderer {
Some(ref ipc_renderer) => {
@@ -1257,7 +1260,10 @@ impl FragmentDisplayListBuilding for Fragment {
receiver.recv().unwrap()
},
None => CanvasData::Pixels(CanvasPixelData {
- image_data: IpcSharedMemory::from_byte(0xFFu8, width * height * 4),
+ image_data: IpcSharedMemory::from_byte(0xFFu8,
+ (computed_width *
+ computed_height * 4)
+ as usize),
image_key: None,
}),
};
@@ -1274,8 +1280,8 @@ impl FragmentDisplayListBuilding for Fragment {
base: base,
image_data: Some(Arc::new(canvas_data.image_data)),
webrender_image: WebRenderImageInfo {
- width: width as u32,
- height: height as u32,
+ width: computed_width as u32,
+ height: computed_height as u32,
format: PixelFormat::RGBA8,
key: canvas_data.image_key,
},
@@ -1319,8 +1325,9 @@ impl FragmentDisplayListBuilding for Fragment {
scroll_policy: ScrollPolicy,
mode: StackingContextCreationMode)
-> Box<StackingContext> {
+ let use_webrender = opts::get().use_webrender;
let border_box = match mode {
- StackingContextCreationMode::InnerScrollWrapper => {
+ StackingContextCreationMode::InnerScrollWrapper if !use_webrender => {
Rect::new(Point2D::zero(), base_flow.overflow.scroll.size)
}
_ => {
@@ -1333,9 +1340,12 @@ impl FragmentDisplayListBuilding for Fragment {
}
};
let overflow = match mode {
- StackingContextCreationMode::InnerScrollWrapper => {
+ StackingContextCreationMode::InnerScrollWrapper if !use_webrender => {
Rect::new(Point2D::zero(), base_flow.overflow.paint.size)
}
+ StackingContextCreationMode::InnerScrollWrapper if use_webrender => {
+ Rect::new(Point2D::zero(), base_flow.overflow.scroll.size)
+ }
StackingContextCreationMode::OuterScrollWrapper => {
Rect::new(Point2D::zero(), border_box.size)
}
diff --git a/components/layout/incremental.rs b/components/layout/incremental.rs
index affb4f42c70..fb73e8b6d87 100644
--- a/components/layout/incremental.rs
+++ b/components/layout/incremental.rs
@@ -218,7 +218,9 @@ pub fn compute_damage(old: Option<&Arc<ServoComputedValues>>, new: &ServoCompute
get_inheritedtable.border_collapse,
get_inheritedtable.border_spacing,
get_column.column_gap,
- get_position.flex_direction
+ get_position.flex_direction,
+ get_position.flex_basis,
+ get_position.order
]) || add_if_not_equal!(old, new, damage,
[ REPAINT, STORE_OVERFLOW, REFLOW_OUT_OF_FLOW ], [
get_position.top, get_position.left,
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs
index d226188f698..64779f8e031 100644
--- a/components/layout/layout_thread.rs
+++ b/components/layout/layout_thread.rs
@@ -37,7 +37,7 @@ use ipc_channel::router::ROUTER;
use layout_debug;
use layout_traits::LayoutThreadFactory;
use log;
-use msg::constellation_msg::{ConstellationChan, ConvertPipelineIdToWebRender, Failure, PipelineId};
+use msg::constellation_msg::{ConstellationChan, ConvertPipelineIdToWebRender, PanicMsg, PipelineId};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
use net_traits::image_cache_thread::{UsePlaceholder};
use parallel;
@@ -45,10 +45,11 @@ use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
use profile_traits::time::{self, TimerMetadata, profile};
use query::{LayoutRPCImpl, process_content_box_request, process_content_boxes_request};
-use query::{process_node_geometry_request, process_node_scroll_area_request, process_offset_parent_query};
-use query::{process_resolved_style_request, process_margin_style_query};
+use query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
+use query::{process_node_overflow_request, process_resolved_style_request, process_margin_style_query};
+use query::{process_offset_parent_query};
use script::dom::node::OpaqueStyleAndLayoutData;
-use script::layout_interface::{LayoutRPC, OffsetParentResponse, MarginStyleResponse};
+use script::layout_interface::{LayoutRPC, OffsetParentResponse, NodeOverflowResponse, MarginStyleResponse};
use script::layout_interface::{Msg, NewLayoutThreadInfo, Reflow, ReflowQueryType};
use script::layout_interface::{ScriptLayoutChan, ScriptReflow};
use script::reporter::CSSErrorReporter;
@@ -117,9 +118,14 @@ pub struct LayoutThreadData {
/// A queued response for the client {top, left, width, height} of a node in pixels.
pub client_rect_response: Rect<i32>,
+ pub layer_id_response: Option<LayerId>,
+
/// A queued response for the node at a given point
pub hit_test_response: (Option<DisplayItemMetadata>, bool),
+ /// A pair of overflow property in x and y
+ pub overflow_response: NodeOverflowResponse,
+
/// A queued response for the scroll {top, left, width, height} of a node in pixels.
pub scroll_area_response: Rect<i32>,
@@ -249,7 +255,7 @@ impl LayoutThreadFactory for LayoutThread {
chan: OpaqueScriptLayoutChannel,
pipeline_port: IpcReceiver<LayoutControlMsg>,
constellation_chan: ConstellationChan<ConstellationMsg>,
- failure_msg: Failure,
+ panic_chan: ConstellationChan<PanicMsg>,
script_chan: IpcSender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
image_cache_thread: ImageCacheThread,
@@ -259,8 +265,8 @@ impl LayoutThreadFactory for LayoutThread {
shutdown_chan: IpcSender<()>,
content_process_shutdown_chan: IpcSender<()>,
webrender_api_sender: Option<webrender_traits::RenderApiSender>) {
- let ConstellationChan(con_chan) = constellation_chan.clone();
- thread::spawn_named_with_send_on_failure(format!("LayoutThread {:?}", id),
+ let ConstellationChan(fail_chan) = panic_chan.clone();
+ thread::spawn_named_with_send_on_panic(format!("LayoutThread {:?}", id),
thread_state::LAYOUT,
move || {
{ // Ensures layout thread is destroyed before we send shutdown message
@@ -286,7 +292,7 @@ impl LayoutThreadFactory for LayoutThread {
}
let _ = shutdown_chan.send(());
let _ = content_process_shutdown_chan.send(());
- }, failure_msg, con_chan);
+ }, Some(id), fail_chan);
}
}
@@ -463,8 +469,10 @@ impl LayoutThread {
content_box_response: Rect::zero(),
content_boxes_response: Vec::new(),
client_rect_response: Rect::zero(),
+ layer_id_response: None,
hit_test_response: (None, false),
scroll_area_response: Rect::zero(),
+ overflow_response: NodeOverflowResponse(None),
resolved_style_response: None,
offset_parent_response: OffsetParentResponse::empty(),
margin_style_response: MarginStyleResponse::empty(),
@@ -732,7 +740,7 @@ impl LayoutThread {
info.layout_pair,
info.pipeline_port,
info.constellation_chan,
- info.failure,
+ info.panic_chan,
info.script_chan.clone(),
info.paint_chan.to::<LayoutToPaintMsg>(),
self.image_cache_thread.clone(),
@@ -949,8 +957,8 @@ impl LayoutThread {
let pipeline_id = self.id.to_webrender();
// TODO(gw) For now only create a root scrolling layer!
- let root_scroll_layer_id = webrender_traits::ScrollLayerId::new(pipeline_id, 0);
let mut frame_builder = WebRenderFrameBuilder::new(pipeline_id);
+ let root_scroll_layer_id = frame_builder.next_scroll_layer_id();
let sc_id = rw_data.display_list.as_ref().unwrap().convert_to_webrender(
&mut self.webrender_api.as_mut().unwrap(),
pipeline_id,
@@ -994,7 +1002,7 @@ impl LayoutThread {
let document = unsafe { ServoLayoutNode::new(&data.document) };
let document = document.as_document().unwrap();
- debug!("layout: received layout request for: {}", self.url.borrow().serialize());
+ debug!("layout: received layout request for: {}", *self.url.borrow());
let mut rw_data = possibly_locked_rw_data.lock();
@@ -1015,9 +1023,15 @@ impl LayoutThread {
ReflowQueryType::NodeGeometryQuery(_) => {
rw_data.client_rect_response = Rect::zero();
},
+ ReflowQueryType::NodeLayerIdQuery(_) => {
+ rw_data.layer_id_response = None;
+ },
ReflowQueryType::NodeScrollGeometryQuery(_) => {
rw_data.scroll_area_response = Rect::zero();
},
+ ReflowQueryType::NodeOverflowQuery(_) => {
+ rw_data.overflow_response = NodeOverflowResponse(None);
+ },
ReflowQueryType::ResolvedStyleQuery(_, _, _) => {
rw_data.resolved_style_response = None;
},
@@ -1034,8 +1048,7 @@ impl LayoutThread {
Some(x) => x,
};
- debug!("layout: received layout request for: {}",
- self.url.borrow().serialize());
+ debug!("layout: received layout request for: {}", *self.url.borrow());
if log_enabled!(log::LogLevel::Debug) {
node.dump();
}
@@ -1177,6 +1190,14 @@ impl LayoutThread {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.scroll_area_response = process_node_scroll_area_request(node, &mut root_flow);
},
+ ReflowQueryType::NodeOverflowQuery(node) => {
+ let node = unsafe { ServoLayoutNode::new(&node) };
+ rw_data.overflow_response = process_node_overflow_request(node);
+ },
+ ReflowQueryType::NodeLayerIdQuery(node) => {
+ let node = unsafe { ServoLayoutNode::new(&node) };
+ rw_data.layer_id_response = Some(process_node_layer_id_request(node));
+ },
ReflowQueryType::ResolvedStyleQuery(node, ref pseudo, ref property) => {
let node = unsafe { ServoLayoutNode::new(&node) };
rw_data.resolved_style_response =
@@ -1441,7 +1462,7 @@ impl LayoutThread {
/// Returns profiling information which is passed to the time profiler.
fn profiler_metadata(&self) -> Option<TimerMetadata> {
Some(TimerMetadata {
- url: self.url.borrow().serialize(),
+ url: self.url.borrow().to_string(),
iframe: if self.is_iframe {
TimerMetadataFrameType::IFrame
} else {
diff --git a/components/layout/lib.rs b/components/layout/lib.rs
index 4f1d9abdac1..f4978023d76 100644
--- a/components/layout/lib.rs
+++ b/components/layout/lib.rs
@@ -21,6 +21,7 @@
extern crate app_units;
extern crate azure;
+#[allow(unused_extern_crates)]
#[macro_use]
extern crate bitflags;
extern crate canvas_traits;
@@ -49,7 +50,6 @@ extern crate rustc_serialize;
extern crate script;
extern crate script_traits;
extern crate selectors;
-extern crate serde;
extern crate serde_json;
extern crate smallvec;
#[macro_use(atom, ns)] extern crate string_cache;
diff --git a/components/layout/query.rs b/components/layout/query.rs
index 1485e54f065..5b28acfa462 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -13,11 +13,12 @@ use flow;
use flow_ref::FlowRef;
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
use gfx::display_list::OpaqueNode;
+use gfx_traits::{LayerId};
use layout_thread::LayoutThreadData;
use msg::constellation_msg::ConstellationChan;
use opaque_node::OpaqueNodeMethods;
-use script::layout_interface::{ContentBoxResponse, ContentBoxesResponse, NodeGeometryResponse};
-use script::layout_interface::{HitTestResponse, LayoutRPC, OffsetParentResponse};
+use script::layout_interface::{ContentBoxResponse, NodeOverflowResponse, ContentBoxesResponse, NodeGeometryResponse};
+use script::layout_interface::{HitTestResponse, LayoutRPC, OffsetParentResponse, NodeLayerIdResponse};
use script::layout_interface::{ResolvedStyleResponse, ScriptLayoutChan, MarginStyleResponse};
use script_traits::LayoutMsg as ConstellationMsg;
use script_traits::UntrustedNodeAddress;
@@ -112,12 +113,23 @@ impl LayoutRPC for LayoutRPCImpl {
}
}
+ fn node_overflow(&self) -> NodeOverflowResponse {
+ NodeOverflowResponse(self.0.lock().unwrap().overflow_response.0)
+ }
+
fn node_scroll_area(&self) -> NodeGeometryResponse {
NodeGeometryResponse {
client_rect: self.0.lock().unwrap().scroll_area_response
}
}
+ fn node_layer_id(&self) -> NodeLayerIdResponse {
+ NodeLayerIdResponse {
+ layer_id: self.0.lock().unwrap().layer_id_response
+ .expect("layer_id is not correctly fetched, see PR #9968")
+ }
+ }
+
/// Retrieves the resolved value for a CSS style property.
fn resolved_style(&self) -> ResolvedStyleResponse {
let &LayoutRPCImpl(ref rw_data) = self;
@@ -425,6 +437,7 @@ impl FragmentBorderBoxIterator for UnioningFragmentScrollAreaIterator {
let bottom_padding = (border_box.size.height - bottom_border - top_border).to_px();
let top_padding = top_border.to_px();
let left_padding = left_border.to_px();
+
match self.level {
Some(start_level) if level <= start_level => { self.is_child = false; }
Some(_) => {
@@ -517,6 +530,11 @@ pub fn process_node_geometry_request<N: LayoutNode>(requested_node: N, layout_ro
iterator.client_rect
}
+pub fn process_node_layer_id_request<N: LayoutNode>(requested_node: N) -> LayerId {
+ let layout_node = requested_node.to_threadsafe();
+ layout_node.layer_id()
+}
+
pub fn process_node_scroll_area_request< N: LayoutNode>(requested_node: N, layout_root: &mut FlowRef)
-> Rect<i32> {
let mut iterator = UnioningFragmentScrollAreaIterator::new(requested_node.opaque());
@@ -691,6 +709,14 @@ pub fn process_offset_parent_query<N: LayoutNode>(requested_node: N, layout_root
}
}
+pub fn process_node_overflow_request<N: LayoutNode>(requested_node: N) -> NodeOverflowResponse {
+ let layout_node = requested_node.to_threadsafe();
+ let style = &*layout_node.style();
+ let style_box = style.get_box();
+
+ NodeOverflowResponse(Some((Point2D::new(style_box.overflow_x, style_box.overflow_y.0))))
+}
+
pub fn process_margin_style_query<N: LayoutNode>(requested_node: N)
-> MarginStyleResponse {
let layout_node = requested_node.to_threadsafe();
diff --git a/components/layout/traversal.rs b/components/layout/traversal.rs
index 00732f852ee..1fe5388549e 100644
--- a/components/layout/traversal.rs
+++ b/components/layout/traversal.rs
@@ -194,9 +194,9 @@ impl<'a> PostorderFlowTraversal for AssignBSizes<'a> {
#[inline]
fn should_process(&self, flow: &mut Flow) -> bool {
let base = flow::base(flow);
- base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW)
+ base.restyle_damage.intersects(REFLOW_OUT_OF_FLOW | REFLOW) &&
// The fragmentation countainer is responsible for calling Flow::fragment recursively
- && !base.flags.contains(CAN_BE_FRAGMENTED)
+ !base.flags.contains(CAN_BE_FRAGMENTED)
}
}
diff --git a/components/layout/webrender_helpers.rs b/components/layout/webrender_helpers.rs
index 1c7dc11785c..c3b28f8ecc1 100644
--- a/components/layout/webrender_helpers.rs
+++ b/components/layout/webrender_helpers.rs
@@ -268,11 +268,16 @@ impl WebRenderStackingContextConverter for StackingContext {
}
if child.context_type == StackingContextType::Real {
+ let scroll_layer_id_for_children = if self.scrolls_overflow_area {
+ scroll_layer_id
+ } else {
+ None
+ };
let stacking_context_id = child.convert_to_webrender(traversal,
api,
pipeline_id,
epoch,
- None,
+ scroll_layer_id_for_children,
scroll_policy,
frame_builder);
builder.push_stacking_context(stacking_context_id);
@@ -299,7 +304,7 @@ impl WebRenderStackingContextConverter for StackingContext {
api: &mut webrender_traits::RenderApi,
pipeline_id: webrender_traits::PipelineId,
epoch: webrender_traits::Epoch,
- scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
+ mut scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
mut scroll_policy: ScrollPolicy,
frame_builder: &mut WebRenderFrameBuilder)
-> webrender_traits::StackingContextId {
@@ -324,7 +329,13 @@ impl WebRenderStackingContextConverter for StackingContext {
self.blend_mode.to_blend_mode(),
self.filters.to_filter_ops(),
&mut frame_builder.auxiliary_lists_builder);
+
let mut builder = webrender_traits::DisplayListBuilder::new();
+
+ if self.scrolls_overflow_area {
+ scroll_layer_id = Some(frame_builder.next_scroll_layer_id());
+ }
+
self.convert_children_to_webrender(traversal,
api,
pipeline_id,
@@ -502,7 +513,8 @@ pub struct WebRenderFrameBuilder {
pub stacking_contexts: Vec<(StackingContextId, webrender_traits::StackingContext)>,
pub display_lists: Vec<(DisplayListId, webrender_traits::BuiltDisplayList)>,
pub auxiliary_lists_builder: AuxiliaryListsBuilder,
- pub root_pipeline_id: PipelineId
+ pub root_pipeline_id: PipelineId,
+ pub next_scroll_layer_id: usize,
}
impl WebRenderFrameBuilder {
@@ -512,6 +524,7 @@ impl WebRenderFrameBuilder {
display_lists: vec![],
auxiliary_lists_builder: AuxiliaryListsBuilder::new(),
root_pipeline_id: root_pipeline_id,
+ next_scroll_layer_id: 0,
}
}
@@ -538,5 +551,12 @@ impl WebRenderFrameBuilder {
self.display_lists.push((id, display_list));
id
}
+
+ pub fn next_scroll_layer_id(&mut self) -> webrender_traits::ScrollLayerId {
+ let scroll_layer_id = self.next_scroll_layer_id;
+ self.next_scroll_layer_id += 1;
+ webrender_traits::ScrollLayerId::new(self.root_pipeline_id, scroll_layer_id)
+ }
+
}
diff --git a/components/layout/wrapper.rs b/components/layout/wrapper.rs
index e76af843ea0..00c77631707 100644
--- a/components/layout/wrapper.rs
+++ b/components/layout/wrapper.rs
@@ -34,6 +34,7 @@ use core::nonzero::NonZero;
use data::{LayoutDataFlags, PrivateLayoutData};
use gfx::display_list::OpaqueNode;
use gfx::text::glyph::CharIndex;
+use gfx_traits::{LayerId, LayerType};
use incremental::RestyleDamage;
use msg::constellation_msg::PipelineId;
use opaque_node::OpaqueNodeMethods;
@@ -629,7 +630,7 @@ impl<T> PseudoElementType<T> {
}
}
- pub fn is_before_or_after(&self) -> bool {
+ pub fn is_replaced_content(&self) -> bool {
match *self {
PseudoElementType::Before(_) | PseudoElementType::After(_) => true,
_ => false,
@@ -851,6 +852,21 @@ pub trait ThreadSafeLayoutNode : Clone + Copy + Sized + PartialEq {
fn iframe_pipeline_id(&self) -> PipelineId;
fn get_colspan(&self) -> u32;
+
+ fn layer_id(&self) -> LayerId {
+ let layer_type = match self.get_pseudo_element_type() {
+ PseudoElementType::Normal => LayerType::FragmentBody,
+ PseudoElementType::Before(_) => LayerType::BeforePseudoContent,
+ PseudoElementType::After(_) => LayerType::AfterPseudoContent,
+ PseudoElementType::DetailsSummary(_) => LayerType::FragmentBody,
+ PseudoElementType::DetailsContent(_) => LayerType::FragmentBody,
+ };
+ LayerId::new_of_type(layer_type, self.opaque().id() as usize)
+ }
+
+ fn layer_id_for_overflow_scroll(&self) -> LayerId {
+ LayerId::new_of_type(LayerType::OverflowScroll, self.opaque().id() as usize)
+ }
}
// This trait is only public so that it can be implemented by the gecko wrapper.
@@ -1025,7 +1041,7 @@ impl<'ln> ThreadSafeLayoutNode for ServoThreadSafeLayoutNode<'ln> {
}
fn text_content(&self) -> TextContent {
- if self.pseudo.is_before_or_after() {
+ if self.pseudo.is_replaced_content() {
let data = &self.borrow_layout_data().unwrap().style_data;
let style = if self.pseudo.is_before() {