mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Remove concept of Layers from Servo
Layers were a feature of the legacy drawing path. If we re-add them at some point, it probably makes more sense to make them a product of display list inspection. This change also remove a bunch of dead painting code.
This commit is contained in:
parent
e667e62f0c
commit
ccb7ab926a
21 changed files with 57 additions and 745 deletions
|
@ -12,7 +12,7 @@ use euclid::point::TypedPoint2D;
|
|||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::TypedSize2D;
|
||||
use gfx_traits::{DevicePixel, LayerPixel, StackingContextId};
|
||||
use gfx_traits::{Epoch, FrameTreeId, FragmentType, LayerId};
|
||||
use gfx_traits::{Epoch, FrameTreeId, FragmentType};
|
||||
use gleam::gl;
|
||||
use gleam::gl::types::{GLint, GLsizei};
|
||||
use image::{DynamicImage, ImageFormat, RgbImage};
|
||||
|
@ -503,9 +503,9 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
self.title_for_main_frame();
|
||||
}
|
||||
|
||||
(Msg::ScrollFragmentPoint(pipeline_id, layer_id, point, _),
|
||||
(Msg::ScrollFragmentPoint(pipeline_id, point, _),
|
||||
ShutdownState::NotShuttingDown) => {
|
||||
self.scroll_fragment_to_point(pipeline_id, layer_id, point);
|
||||
self.scroll_fragment_to_point(pipeline_id, point);
|
||||
}
|
||||
|
||||
(Msg::MoveTo(point),
|
||||
|
@ -770,7 +770,6 @@ impl<Window: WindowMethods> IOCompositor<Window> {
|
|||
|
||||
fn scroll_fragment_to_point(&mut self,
|
||||
_pipeline_id: PipelineId,
|
||||
_layer_id: LayerId,
|
||||
_point: Point2D<f32>) {
|
||||
println!("TODO: Support scroll_fragment_to_point again");
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ use SendableFrameTree;
|
|||
use compositor::CompositingReason;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::size::Size2D;
|
||||
use gfx_traits::LayerId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState, PipelineId};
|
||||
use profile_traits::mem;
|
||||
|
@ -72,7 +71,7 @@ pub enum Msg {
|
|||
ShutdownComplete,
|
||||
|
||||
/// Scroll a page in a window
|
||||
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
|
||||
ScrollFragmentPoint(PipelineId, Point2D<f32>, bool),
|
||||
/// Alerts the compositor that the current page has changed its title.
|
||||
ChangePageTitle(PipelineId, Option<String>),
|
||||
/// Alerts the compositor that the current page has changed its URL.
|
||||
|
|
|
@ -1,57 +0,0 @@
|
|||
Scrolling
|
||||
=========
|
||||
|
||||
Scrolling is implemented by the compositor. Compositor layers that opt in to
|
||||
scroll events via the `wants_scroll_events` flag can scroll their contents.
|
||||
These will be referred "scrolling roots." Scrolling roots serve as a viewport
|
||||
into their content, which is stored in descendant layers. In order for
|
||||
scrolling roots to be able to scroll their content, they need to be smaller
|
||||
than that content. If the content was smaller than the scrolling root, it would
|
||||
not be able to move around inside the scrolling root. Imagine a browser window
|
||||
that is larger than the content that it contains. The size of each layer is
|
||||
defined by the window size (the root layer) or the block size for iframes and
|
||||
elements with `overflow:scroll`.
|
||||
|
||||
Since the compositor allows layers to exist independently of their parents,
|
||||
child layers can overflow or fail to intersect their parents completely. To
|
||||
prevent this, scrolling roots use the `masks_to_bounds` flag, which is a signal
|
||||
to the compositor that it should not paint the parts of descendant layers that
|
||||
lie outside the boundaries of the scrolling root.
|
||||
|
||||
Below is an ASCII art diagram showing a scrolling root with three content
|
||||
layers (a, b, and c), scrolled down a few ticks. `masks_to_bounds` has not been
|
||||
applied in the diagram.
|
||||
|
||||
<pre>
|
||||
+-----------------------+
|
||||
| |
|
||||
=========================
|
||||
| | scrolling
|
||||
| <-------------+root
|
||||
| |
|
||||
| +-------+ |
|
||||
=========================
|
||||
| | b | |
|
||||
++-------+ +--^----+ |
|
||||
|| | | |
|
||||
|| | | | content
|
||||
|| c <---------+---------+layers
|
||||
|+-------+ / |
|
||||
| a < |
|
||||
| |
|
||||
+-----------------------+
|
||||
</pre>
|
||||
|
||||
Everything above and below the set of `====` bars would be hidden by
|
||||
`masks_to_bounds`, so the composited scene will just be the viewport defined by
|
||||
the scrolling root with the content layers a and b visible.
|
||||
|
||||
<pre>
|
||||
=========================
|
||||
| |
|
||||
| |
|
||||
| |
|
||||
| +-------+ |
|
||||
=========================
|
||||
</pre>
|
||||
|
|
@ -933,11 +933,10 @@ impl<Message, LTF, STF> Constellation<Message, LTF, STF>
|
|||
self.handle_alert(pipeline_id, message, sender);
|
||||
}
|
||||
|
||||
FromScriptMsg::ScrollFragmentPoint(pipeline_id, layer_id, point, smooth) => {
|
||||
FromScriptMsg::ScrollFragmentPoint(pipeline_id, point, smooth) => {
|
||||
self.compositor_proxy.send(ToCompositorMsg::ScrollFragmentPoint(pipeline_id,
|
||||
layer_id,
|
||||
point,
|
||||
smooth));
|
||||
point,
|
||||
smooth));
|
||||
}
|
||||
|
||||
FromScriptMsg::GetClientWindow(send) => {
|
||||
|
|
|
@ -15,19 +15,16 @@
|
|||
//! low-level drawing primitives.
|
||||
|
||||
use app_units::Au;
|
||||
use azure::azure::AzFloat;
|
||||
use azure::azure_hl::Color;
|
||||
use euclid::{Matrix4D, Point2D, Rect, Size2D};
|
||||
use euclid::approxeq::ApproxEq;
|
||||
use euclid::num::{One, Zero};
|
||||
use euclid::rect::TypedRect;
|
||||
use euclid::side_offsets::SideOffsets2D;
|
||||
use gfx_traits::{LayerId, ScrollPolicy, StackingContextId};
|
||||
use gfx_traits::{ScrollPolicy, StackingContextId};
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use ipc_channel::ipc::IpcSharedMemory;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image::base::{Image, PixelFormat};
|
||||
use paint_context::PaintContext;
|
||||
use range::Range;
|
||||
use std::cmp::{self, Ordering};
|
||||
use std::collections::HashMap;
|
||||
|
@ -38,7 +35,7 @@ use style::computed_values::{border_style, filter, image_rendering, mix_blend_mo
|
|||
use style_traits::cursor::Cursor;
|
||||
use text::TextRun;
|
||||
use text::glyph::ByteIndex;
|
||||
use util::geometry::{self, ScreenPx, max_rect};
|
||||
use util::geometry::{self, max_rect};
|
||||
use webrender_traits::{self, WebGLContextId};
|
||||
|
||||
pub use style::dom::OpaqueNode;
|
||||
|
@ -51,44 +48,6 @@ pub use azure::azure_hl::GradientStop;
|
|||
/// items that involve a blur. This ensures that the display item boundaries include all the ink.
|
||||
pub static BLUR_INFLATION_FACTOR: i32 = 3;
|
||||
|
||||
/// LayerInfo is used to store PaintLayer metadata during DisplayList construction.
|
||||
/// It is also used for tracking LayerIds when creating layers to preserve ordering when
|
||||
/// layered DisplayItems should render underneath unlayered DisplayItems.
|
||||
#[derive(Clone, Copy, HeapSizeOf, Deserialize, Serialize, Debug)]
|
||||
pub struct LayerInfo {
|
||||
/// The base LayerId of this layer.
|
||||
pub layer_id: LayerId,
|
||||
|
||||
/// The scroll policy of this layer.
|
||||
pub scroll_policy: ScrollPolicy,
|
||||
|
||||
/// The subpage that this layer represents, if there is one.
|
||||
pub subpage_pipeline_id: Option<PipelineId>,
|
||||
|
||||
/// The id for the next layer in the sequence. This is used for synthesizing
|
||||
/// layers for content that needs to be displayed on top of this layer.
|
||||
pub next_layer_id: LayerId,
|
||||
|
||||
/// The color of the background in this layer. Used for unpainted content.
|
||||
pub background_color: Color,
|
||||
}
|
||||
|
||||
impl LayerInfo {
|
||||
pub fn new(id: LayerId,
|
||||
scroll_policy: ScrollPolicy,
|
||||
subpage_pipeline_id: Option<PipelineId>,
|
||||
background_color: Color)
|
||||
-> LayerInfo {
|
||||
LayerInfo {
|
||||
layer_id: id,
|
||||
scroll_policy: scroll_policy,
|
||||
subpage_pipeline_id: subpage_pipeline_id,
|
||||
next_layer_id: id.companion_layer_id(),
|
||||
background_color: background_color,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(HeapSizeOf, Deserialize, Serialize)]
|
||||
pub struct DisplayList {
|
||||
pub list: Vec<DisplayItem>,
|
||||
|
@ -185,156 +144,6 @@ impl DisplayList {
|
|||
}
|
||||
}
|
||||
|
||||
/// Draws the DisplayList in order.
|
||||
pub fn draw_into_context<'a>(&self,
|
||||
paint_context: &mut PaintContext,
|
||||
transform: &Matrix4D<f32>,
|
||||
stacking_context_id: StackingContextId,
|
||||
start: usize,
|
||||
end: usize) {
|
||||
let mut traversal = DisplayListTraversal::new_partial(self,
|
||||
stacking_context_id,
|
||||
start,
|
||||
end);
|
||||
self.draw_with_state(&mut traversal,
|
||||
paint_context,
|
||||
transform,
|
||||
&Point2D::zero(),
|
||||
None);
|
||||
}
|
||||
|
||||
/// Draws a single DisplayItem into the given PaintContext.
|
||||
pub fn draw_item_at_index_into_context(&self,
|
||||
paint_context: &mut PaintContext,
|
||||
transform: &Matrix4D<f32>,
|
||||
index: usize) {
|
||||
let old_transform = paint_context.draw_target.get_transform();
|
||||
paint_context.draw_target.set_transform(&transform.to_2d());
|
||||
|
||||
let item = &self.list[index];
|
||||
item.draw_into_context(paint_context);
|
||||
|
||||
paint_context.draw_target.set_transform(&old_transform);
|
||||
}
|
||||
|
||||
fn draw_with_state<'a>(&'a self,
|
||||
traversal: &mut DisplayListTraversal,
|
||||
paint_context: &mut PaintContext,
|
||||
transform: &Matrix4D<f32>,
|
||||
subpixel_offset: &Point2D<Au>,
|
||||
tile_rect: Option<Rect<Au>>) {
|
||||
while let Some(item) = traversal.next() {
|
||||
match item {
|
||||
&DisplayItem::PushStackingContext(ref stacking_context_item) => {
|
||||
let context = &stacking_context_item.stacking_context;
|
||||
if context.intersects_rect_in_parent_context(tile_rect) {
|
||||
self.draw_stacking_context(traversal,
|
||||
context,
|
||||
paint_context,
|
||||
transform,
|
||||
subpixel_offset);
|
||||
} else {
|
||||
traversal.skip_to_end_of_stacking_context(context.id);
|
||||
}
|
||||
}
|
||||
&DisplayItem::PopStackingContext(_) => return,
|
||||
_ => {
|
||||
if item.intersects_rect_in_parent_context(tile_rect) {
|
||||
item.draw_into_context(paint_context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_stacking_context(&self,
|
||||
traversal: &mut DisplayListTraversal,
|
||||
stacking_context: &StackingContext,
|
||||
paint_context: &mut PaintContext,
|
||||
transform: &Matrix4D<f32>,
|
||||
subpixel_offset: &Point2D<Au>) {
|
||||
debug_assert!(stacking_context.context_type == StackingContextType::Real);
|
||||
|
||||
let draw_target = paint_context.get_or_create_temporary_draw_target(
|
||||
&stacking_context.filters,
|
||||
stacking_context.blend_mode);
|
||||
|
||||
let old_transform = paint_context.draw_target.get_transform();
|
||||
let pixels_per_px = paint_context.screen_pixels_per_px();
|
||||
let (transform, subpixel_offset) = match stacking_context.layer_info {
|
||||
// If this stacking context starts a layer, the offset and
|
||||
// transformation are handled by layer position within the
|
||||
// compositor.
|
||||
Some(..) => (*transform, *subpixel_offset),
|
||||
None => {
|
||||
let origin = stacking_context.bounds.origin + *subpixel_offset;
|
||||
let pixel_snapped_origin =
|
||||
Point2D::new(origin.x.to_nearest_pixel(pixels_per_px.get()),
|
||||
origin.y.to_nearest_pixel(pixels_per_px.get()));
|
||||
|
||||
let transform = transform
|
||||
.pre_translated(pixel_snapped_origin.x as AzFloat,
|
||||
pixel_snapped_origin.y as AzFloat,
|
||||
0.0)
|
||||
.pre_mul(&stacking_context.transform);
|
||||
|
||||
if transform.is_identity_or_simple_translation() {
|
||||
let pixel_snapped_origin = Point2D::new(Au::from_f32_px(pixel_snapped_origin.x),
|
||||
Au::from_f32_px(pixel_snapped_origin.y));
|
||||
(transform, origin - pixel_snapped_origin)
|
||||
} else {
|
||||
// In the case of a more complicated transformation, don't attempt to
|
||||
// preserve subpixel offsets. This causes problems with reference tests
|
||||
// that do scaling and rotation and it's unclear if we even want to be doing
|
||||
// this.
|
||||
(transform, Point2D::zero())
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let transformed_transform =
|
||||
match transformed_tile_rect(paint_context.screen_rect, &transform) {
|
||||
Some(transformed) => transformed,
|
||||
None => {
|
||||
// https://drafts.csswg.org/css-transforms/#transform-function-lists
|
||||
// If a transform function causes the current transformation matrix (CTM)
|
||||
// of an object to be non-invertible, the object and its content do not
|
||||
// get displayed.
|
||||
return;
|
||||
},
|
||||
};
|
||||
|
||||
{
|
||||
let mut paint_subcontext = PaintContext {
|
||||
draw_target: draw_target.clone(),
|
||||
font_context: &mut *paint_context.font_context,
|
||||
page_rect: paint_context.page_rect,
|
||||
screen_rect: paint_context.screen_rect,
|
||||
clip_rect: Some(stacking_context.overflow),
|
||||
transient_clip: None,
|
||||
layer_kind: paint_context.layer_kind,
|
||||
subpixel_offset: subpixel_offset,
|
||||
};
|
||||
|
||||
// Set up our clip rect and transform.
|
||||
paint_subcontext.draw_target.set_transform(&transform.to_2d());
|
||||
paint_subcontext.push_clip_if_applicable();
|
||||
|
||||
self.draw_with_state(traversal,
|
||||
&mut paint_subcontext,
|
||||
&transform,
|
||||
&subpixel_offset,
|
||||
Some(transformed_transform));
|
||||
|
||||
paint_subcontext.remove_transient_clip_if_applicable();
|
||||
paint_subcontext.pop_clip_if_applicable();
|
||||
}
|
||||
|
||||
draw_target.set_transform(&old_transform);
|
||||
paint_context.draw_temporary_draw_target_if_necessary(
|
||||
&draw_target, &stacking_context.filters, stacking_context.blend_mode);
|
||||
}
|
||||
|
||||
// Return all nodes containing the point of interest, bottommost first, and
|
||||
// respecting the `pointer-events` CSS property.
|
||||
pub fn hit_test(&self,
|
||||
|
@ -385,12 +194,10 @@ impl DisplayList {
|
|||
client_point: &Point2D<Au>,
|
||||
scroll_offsets: &ScrollOffsetMap,
|
||||
result: &mut Vec<DisplayItemMetadata>) {
|
||||
let is_fixed = stacking_context.layer_info.map_or(false,
|
||||
|info| info.scroll_policy == ScrollPolicy::FixedPosition);
|
||||
|
||||
// Convert the parent translated point into stacking context local transform space if the
|
||||
// stacking context isn't fixed. If it's fixed, we need to use the client point anyway.
|
||||
debug_assert!(stacking_context.context_type == StackingContextType::Real);
|
||||
let is_fixed = stacking_context.scroll_policy == ScrollPolicy::FixedPosition;
|
||||
let mut translated_point = if is_fixed {
|
||||
*client_point
|
||||
} else {
|
||||
|
@ -521,23 +328,6 @@ impl<'a> Iterator for DisplayListTraversal<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
fn transformed_tile_rect(tile_rect: TypedRect<usize, ScreenPx>,
|
||||
transform: &Matrix4D<f32>)
|
||||
-> Option<Rect<Au>> {
|
||||
// Invert the current transform, then use this to back transform
|
||||
// the tile rect (placed at the origin) into the space of this
|
||||
// stacking context.
|
||||
let inverse_transform = match transform.inverse() {
|
||||
Some(inverse) => inverse,
|
||||
None => return None,
|
||||
};
|
||||
let inverse_transform_2d = inverse_transform.to_2d();
|
||||
let tile_size = Size2D::new(tile_rect.to_f32().size.width, tile_rect.to_f32().size.height);
|
||||
let tile_rect = Rect::new(Point2D::zero(), tile_size).to_untyped();
|
||||
Some(geometry::f32_rect_to_au_rect(inverse_transform_2d.transform_rect(&tile_rect)))
|
||||
}
|
||||
|
||||
|
||||
/// Display list sections that make up a stacking context. Each section here refers
|
||||
/// to the steps in CSS 2.1 Appendix E.
|
||||
///
|
||||
|
@ -589,8 +379,8 @@ pub struct StackingContext {
|
|||
/// Whether this stacking context creates a new 3d rendering context.
|
||||
pub establishes_3d_context: bool,
|
||||
|
||||
/// The layer info for this stacking context, if there is any.
|
||||
pub layer_info: Option<LayerInfo>,
|
||||
/// The scroll policy of this layer.
|
||||
pub scroll_policy: ScrollPolicy,
|
||||
|
||||
/// Children of this StackingContext.
|
||||
pub children: Vec<StackingContext>,
|
||||
|
@ -612,7 +402,7 @@ impl StackingContext {
|
|||
transform: Matrix4D<f32>,
|
||||
perspective: Matrix4D<f32>,
|
||||
establishes_3d_context: bool,
|
||||
layer_info: Option<LayerInfo>,
|
||||
scroll_policy: ScrollPolicy,
|
||||
scroll_id: Option<StackingContextId>)
|
||||
-> StackingContext {
|
||||
StackingContext {
|
||||
|
@ -626,7 +416,7 @@ impl StackingContext {
|
|||
transform: transform,
|
||||
perspective: perspective,
|
||||
establishes_3d_context: establishes_3d_context,
|
||||
layer_info: layer_info,
|
||||
scroll_policy: scroll_policy,
|
||||
children: Vec::new(),
|
||||
overflow_scroll_id: scroll_id,
|
||||
}
|
||||
|
@ -682,21 +472,6 @@ impl StackingContext {
|
|||
}
|
||||
print_tree.end_level();
|
||||
}
|
||||
|
||||
fn intersects_rect_in_parent_context(&self, rect: Option<Rect<Au>>) -> bool {
|
||||
// We only do intersection checks for real stacking contexts, since
|
||||
// pseudo stacking contexts might not have proper position information.
|
||||
if self.context_type != StackingContextType::Real {
|
||||
return true;
|
||||
}
|
||||
|
||||
let rect = match rect {
|
||||
Some(ref rect) => rect,
|
||||
None => return true,
|
||||
};
|
||||
|
||||
self.overflow_rect_in_parent_space().intersects(rect)
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for StackingContext {
|
||||
|
@ -729,9 +504,7 @@ impl PartialEq for StackingContext {
|
|||
|
||||
impl fmt::Debug for StackingContext {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
let type_string = if self.layer_info.is_some() {
|
||||
"Layered StackingContext"
|
||||
} else if self.context_type == StackingContextType::Real {
|
||||
let type_string = if self.context_type == StackingContextType::Real {
|
||||
"StackingContext"
|
||||
} else {
|
||||
"Pseudo-StackingContext"
|
||||
|
@ -1280,92 +1053,6 @@ pub enum BoxShadowClipMode {
|
|||
}
|
||||
|
||||
impl DisplayItem {
|
||||
/// Paints this display item into the given painting context.
|
||||
fn draw_into_context(&self, paint_context: &mut PaintContext) {
|
||||
let this_clip = &self.base().clip;
|
||||
match paint_context.transient_clip {
|
||||
Some(ref transient_clip) if transient_clip == this_clip => {}
|
||||
Some(_) | None => paint_context.push_transient_clip((*this_clip).clone()),
|
||||
}
|
||||
|
||||
match *self {
|
||||
DisplayItem::SolidColor(ref solid_color) => {
|
||||
if !solid_color.color.a.approx_eq(&0.0) {
|
||||
paint_context.draw_solid_color(&solid_color.base.bounds, solid_color.color)
|
||||
}
|
||||
}
|
||||
|
||||
DisplayItem::Text(ref text) => {
|
||||
debug!("Drawing text at {:?}.", text.base.bounds);
|
||||
paint_context.draw_text(&**text);
|
||||
}
|
||||
|
||||
DisplayItem::Image(ref image_item) => {
|
||||
debug!("Drawing image at {:?}.", image_item.base.bounds);
|
||||
paint_context.draw_image(
|
||||
&image_item.base.bounds,
|
||||
&image_item.stretch_size,
|
||||
&image_item.tile_spacing,
|
||||
&image_item.webrender_image,
|
||||
&image_item.image_data
|
||||
.as_ref()
|
||||
.expect("Non-WR painting needs image data!")[..],
|
||||
image_item.image_rendering.clone());
|
||||
}
|
||||
|
||||
DisplayItem::WebGL(_) => {
|
||||
panic!("Shouldn't be here, WebGL display items are created just with webrender");
|
||||
}
|
||||
|
||||
DisplayItem::Border(ref border) => {
|
||||
paint_context.draw_border(&border.base.bounds,
|
||||
&border.border_widths,
|
||||
&border.radius,
|
||||
&border.color,
|
||||
&border.style)
|
||||
}
|
||||
|
||||
DisplayItem::Gradient(ref gradient) => {
|
||||
paint_context.draw_linear_gradient(&gradient.base.bounds,
|
||||
&gradient.start_point,
|
||||
&gradient.end_point,
|
||||
&gradient.stops);
|
||||
}
|
||||
|
||||
DisplayItem::Line(ref line) => {
|
||||
paint_context.draw_line(&line.base.bounds, line.color, line.style)
|
||||
}
|
||||
|
||||
DisplayItem::BoxShadow(ref box_shadow) => {
|
||||
paint_context.draw_box_shadow(&box_shadow.box_bounds,
|
||||
&box_shadow.offset,
|
||||
box_shadow.color,
|
||||
box_shadow.blur_radius,
|
||||
box_shadow.spread_radius,
|
||||
box_shadow.clip_mode);
|
||||
}
|
||||
|
||||
DisplayItem::Iframe(..) => {}
|
||||
|
||||
DisplayItem::PushStackingContext(..) => {}
|
||||
|
||||
DisplayItem::PopStackingContext(..) => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn intersects_rect_in_parent_context(&self, rect: Option<Rect<Au>>) -> bool {
|
||||
let rect = match rect {
|
||||
Some(ref rect) => rect,
|
||||
None => return true,
|
||||
};
|
||||
|
||||
if !rect.intersects(&self.bounds()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.base().clip.might_intersect_rect(&rect)
|
||||
}
|
||||
|
||||
pub fn base(&self) -> &BaseDisplayItem {
|
||||
match *self {
|
||||
DisplayItem::SolidColor(ref solid_color) => &solid_color.base,
|
||||
|
|
|
@ -23,7 +23,6 @@ pub mod color;
|
|||
pub mod print_tree;
|
||||
|
||||
use range::RangeIndex;
|
||||
use std::fmt::{self, Debug, Formatter};
|
||||
use std::sync::atomic::{ATOMIC_USIZE_INIT, AtomicUsize, Ordering};
|
||||
|
||||
/// The next ID that will be used for a special stacking context.
|
||||
|
@ -80,56 +79,6 @@ pub enum ScrollPolicy {
|
|||
FixedPosition,
|
||||
}
|
||||
|
||||
#[derive(Clone, PartialEq, Eq, Copy, Hash, Deserialize, Serialize, HeapSizeOf)]
|
||||
pub struct LayerId(
|
||||
/// The type of the layer. This serves to differentiate layers that share fragments.
|
||||
LayerType,
|
||||
/// The identifier for this layer's fragment, derived from the fragment memory address.
|
||||
usize,
|
||||
/// An index for identifying companion layers, synthesized to ensure that
|
||||
/// content on top of this layer's fragment has the proper rendering order.
|
||||
usize
|
||||
);
|
||||
|
||||
impl Debug for LayerId {
|
||||
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
|
||||
let LayerId(layer_type, id, companion) = *self;
|
||||
let type_string = match layer_type {
|
||||
LayerType::FragmentBody => "-FragmentBody",
|
||||
LayerType::OverflowScroll => "-OverflowScroll",
|
||||
LayerType::BeforePseudoContent => "-BeforePseudoContent",
|
||||
LayerType::AfterPseudoContent => "-AfterPseudoContent",
|
||||
};
|
||||
|
||||
write!(f, "{}{}-{}", id, type_string, companion)
|
||||
}
|
||||
}
|
||||
|
||||
impl LayerId {
|
||||
/// FIXME(#2011, pcwalton): This is unfortunate. Maybe remove this in the future.
|
||||
pub fn null() -> LayerId {
|
||||
LayerId(LayerType::FragmentBody, 0, 0)
|
||||
}
|
||||
|
||||
pub fn new_of_type(layer_type: LayerType, fragment_id: usize) -> LayerId {
|
||||
LayerId(layer_type, fragment_id, 0)
|
||||
}
|
||||
|
||||
pub fn companion_layer_id(&self) -> LayerId {
|
||||
let LayerId(layer_type, id, companion) = *self;
|
||||
LayerId(layer_type, id, companion + 1)
|
||||
}
|
||||
|
||||
pub fn original(&self) -> LayerId {
|
||||
let LayerId(layer_type, id, _) = *self;
|
||||
LayerId(layer_type, id, 0)
|
||||
}
|
||||
|
||||
pub fn kind(&self) -> LayerType {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
/// A newtype struct for denoting the age of messages; prevents race conditions.
|
||||
#[derive(PartialEq, Eq, Debug, Copy, Clone, PartialOrd, Ord, Deserialize, Serialize)]
|
||||
pub struct Epoch(pub u32);
|
||||
|
|
|
@ -36,15 +36,14 @@ use floats::{ClearType, FloatKind, Floats, PlacementInfo};
|
|||
use flow::{self, BaseFlow, EarlyAbsolutePositionInfo, Flow, FlowClass, ForceNonfloatedFlag};
|
||||
use flow::{BLOCK_POSITION_IS_STATIC, CLEARS_LEFT, CLEARS_RIGHT};
|
||||
use flow::{CONTAINS_TEXT_OR_REPLACED_FRAGMENTS, INLINE_POSITION_IS_STATIC};
|
||||
use flow::{FragmentationContext, NEEDS_LAYER, PreorderFlowTraversal};
|
||||
use flow::{FragmentationContext, PreorderFlowTraversal};
|
||||
use flow::{ImmutableFlowUtils, LateAbsolutePositionInfo, MutableFlowUtils, OpaqueFlow};
|
||||
use flow::IS_ABSOLUTELY_POSITIONED;
|
||||
use flow_list::FlowList;
|
||||
use flow_ref::FlowRef;
|
||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, HAS_LAYER, Overflow};
|
||||
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
|
||||
use fragment::SpecificFragmentInfo;
|
||||
use gfx::display_list::{ClippingRegion, StackingContext};
|
||||
use gfx_traits::LayerId;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use layout_debug;
|
||||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo, MaybeAuto};
|
||||
|
@ -57,12 +56,12 @@ use std::cmp::{max, min};
|
|||
use std::fmt;
|
||||
use std::sync::Arc;
|
||||
use style::computed_values::{border_collapse, box_sizing, display, float, overflow_x, overflow_y};
|
||||
use style::computed_values::{position, text_align, transform_style};
|
||||
use style::computed_values::{position, text_align};
|
||||
use style::context::{SharedStyleContext, StyleContext};
|
||||
use style::logical_geometry::{LogicalPoint, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ServoComputedValues;
|
||||
use style::values::computed::{LengthOrNone, LengthOrPercentageOrNone};
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::{LengthOrPercentageOrNone, LengthOrPercentage};
|
||||
use style::values::computed::LengthOrPercentageOrAuto;
|
||||
use util::clamp;
|
||||
|
||||
/// Information specific to floated blocks.
|
||||
|
@ -793,8 +792,6 @@ impl BlockFlow {
|
|||
let mut break_at = None;
|
||||
let content_box = self.fragment.content_box();
|
||||
if self.base.restyle_damage.contains(REFLOW) {
|
||||
self.determine_if_layer_needed();
|
||||
|
||||
// Our current border-box position.
|
||||
let mut cur_b = Au(0);
|
||||
|
||||
|
@ -1679,34 +1676,6 @@ impl BlockFlow {
|
|||
self.base.flags = flags
|
||||
}
|
||||
|
||||
fn determine_if_layer_needed(&mut self) {
|
||||
// Fixed position layers get layers.
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) && self.is_fixed() {
|
||||
self.base.flags.insert(NEEDS_LAYER);
|
||||
return
|
||||
}
|
||||
|
||||
// This flow needs a layer if it has a 3d transform, or provides perspective
|
||||
// to child layers. See http://dev.w3.org/csswg/css-transforms/#3d-rendering-contexts.
|
||||
let has_3d_transform = self.fragment.style().transform_requires_layer();
|
||||
let has_perspective = self.fragment.style().get_effects().perspective !=
|
||||
LengthOrNone::None;
|
||||
|
||||
if has_3d_transform || has_perspective {
|
||||
self.base.flags.insert(NEEDS_LAYER);
|
||||
return
|
||||
}
|
||||
|
||||
match (self.fragment.style().get_box().overflow_x,
|
||||
self.fragment.style().get_box().overflow_y.0) {
|
||||
(overflow_x::T::auto, _) | (overflow_x::T::scroll, _) |
|
||||
(_, overflow_x::T::auto) | (_, overflow_x::T::scroll) => {
|
||||
self.base.flags.insert(NEEDS_LAYER);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn block_stacking_context_type(&self) -> BlockStackingContextType {
|
||||
if self.fragment.establishes_stacking_context() {
|
||||
return BlockStackingContextType::StackingContext
|
||||
|
@ -1956,10 +1925,6 @@ impl Flow for BlockFlow {
|
|||
}
|
||||
|
||||
fn compute_absolute_position(&mut self, _layout_context: &SharedLayoutContext) {
|
||||
if self.base.flags.contains(NEEDS_LAYER) {
|
||||
self.fragment.flags.insert(HAS_LAYER)
|
||||
}
|
||||
|
||||
// FIXME (mbrubeck): Get the real container size, taking the container writing mode into
|
||||
// account. Must handle vertical writing modes.
|
||||
let container_size = Size2D::new(self.base.block_container_inline_size, Au(0));
|
||||
|
@ -1968,8 +1933,6 @@ impl Flow for BlockFlow {
|
|||
self.base.clip = ClippingRegion::max();
|
||||
}
|
||||
|
||||
let transform_style = self.fragment.style().get_used_transform_style();
|
||||
|
||||
if self.base.flags.contains(IS_ABSOLUTELY_POSITIONED) {
|
||||
// `overflow: auto` and `overflow: scroll` force creation of layers, since we can only
|
||||
// scroll layers.
|
||||
|
@ -2103,16 +2066,6 @@ impl Flow for BlockFlow {
|
|||
|
||||
// Process children.
|
||||
for kid in self.base.child_iter_mut() {
|
||||
// If this layer preserves the 3d context of children,
|
||||
// then children will need a render layer.
|
||||
// TODO(gw): This isn't always correct. In some cases
|
||||
// this may create extra layers than needed. I think
|
||||
// there are also some edge cases where children don't
|
||||
// get a layer when they should.
|
||||
if transform_style == transform_style::T::preserve_3d {
|
||||
flow::mut_base(kid).flags.insert(NEEDS_LAYER);
|
||||
}
|
||||
|
||||
if flow::base(kid).flags.contains(INLINE_POSITION_IS_STATIC) ||
|
||||
flow::base(kid).flags.contains(BLOCK_POSITION_IS_STATIC) {
|
||||
let kid_base = flow::mut_base(kid);
|
||||
|
@ -2177,14 +2130,6 @@ impl Flow for BlockFlow {
|
|||
(self.fragment.border_box - self.fragment.style().logical_border_width()).size
|
||||
}
|
||||
|
||||
fn layer_id(&self) -> LayerId {
|
||||
self.fragment.layer_id()
|
||||
}
|
||||
|
||||
fn layer_id_for_overflow_scroll(&self) -> LayerId {
|
||||
self.fragment.layer_id_for_overflow_scroll()
|
||||
}
|
||||
|
||||
fn is_absolute_containing_block(&self) -> bool {
|
||||
self.contains_positioned_fragments()
|
||||
}
|
||||
|
|
|
@ -7,13 +7,10 @@
|
|||
// for thread_local
|
||||
#![allow(unsafe_code)]
|
||||
|
||||
use app_units::Au;
|
||||
use euclid::Rect;
|
||||
use fnv::FnvHasher;
|
||||
use gfx::display_list::WebRenderImageInfo;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx::font_context::FontContext;
|
||||
use gfx_traits::LayerId;
|
||||
use heapsize::HeapSizeOf;
|
||||
use ipc_channel::ipc;
|
||||
use net_traits::image::base::Image;
|
||||
|
@ -87,9 +84,6 @@ pub struct SharedLayoutContext {
|
|||
/// Interface to the font cache thread.
|
||||
pub font_cache_thread: Mutex<FontCacheThread>,
|
||||
|
||||
/// The visible rects for each layer, as reported to us by the compositor.
|
||||
pub visible_rects: Arc<HashMap<LayerId, Rect<Au>, BuildHasherDefault<FnvHasher>>>,
|
||||
|
||||
/// A cache of WebRender image info.
|
||||
pub webrender_image_cache: Arc<RwLock<HashMap<(Url, UsePlaceholder),
|
||||
WebRenderImageInfo,
|
||||
|
|
|
@ -19,13 +19,13 @@ use euclid::{Matrix4D, Point2D, Radians, Rect, SideOffsets2D, Size2D};
|
|||
use flex::FlexFlow;
|
||||
use flow::{BaseFlow, Flow, IS_ABSOLUTELY_POSITIONED};
|
||||
use flow_ref;
|
||||
use fragment::{CoordinateSystem, Fragment, HAS_LAYER, ImageFragmentInfo, ScannedTextFragmentInfo};
|
||||
use fragment::{CoordinateSystem, Fragment, ImageFragmentInfo, ScannedTextFragmentInfo};
|
||||
use fragment::SpecificFragmentInfo;
|
||||
use gfx::display_list::{BLUR_INFLATION_FACTOR, BaseDisplayItem, BorderDisplayItem};
|
||||
use gfx::display_list::{BorderRadii, BoxShadowClipMode, BoxShadowDisplayItem, ClippingRegion};
|
||||
use gfx::display_list::{DisplayItem, DisplayItemMetadata, DisplayListSection, GradientDisplayItem};
|
||||
use gfx::display_list::{GradientStop, IframeDisplayItem, ImageDisplayItem, WebGLDisplayItem};
|
||||
use gfx::display_list::{LayerInfo, LineDisplayItem, OpaqueNode};
|
||||
use gfx::display_list::{LineDisplayItem, OpaqueNode};
|
||||
use gfx::display_list::{SolidColorDisplayItem, StackingContext, StackingContextType};
|
||||
use gfx::display_list::{TextDisplayItem, TextOrientation, WebRenderImageInfo};
|
||||
use gfx_traits::{ScrollPolicy, StackingContextId, color};
|
||||
|
@ -1410,12 +1410,6 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
filters.push(Filter::Opacity(effects.opacity))
|
||||
}
|
||||
|
||||
let layer_info = if self.flags.contains(HAS_LAYER) {
|
||||
Some(LayerInfo::new(self.layer_id(), scroll_policy, None, color::transparent()))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
let transform_style = self.style().get_used_transform_style();
|
||||
let establishes_3d_context = scrolls_overflow_area ||
|
||||
transform_style == transform_style::T::flat;
|
||||
|
@ -1436,7 +1430,7 @@ impl FragmentDisplayListBuilding for Fragment {
|
|||
transform,
|
||||
perspective,
|
||||
establishes_3d_context,
|
||||
layer_info,
|
||||
scroll_policy,
|
||||
scroll_id)
|
||||
}
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ use flow_list::{FlowList, MutFlowListIterator};
|
|||
use flow_ref::{self, FlowRef, WeakFlowRef};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, Overflow, SpecificFragmentInfo};
|
||||
use gfx::display_list::{ClippingRegion, StackingContext};
|
||||
use gfx_traits::{LayerId, LayerType, StackingContextId};
|
||||
use gfx_traits::StackingContextId;
|
||||
use gfx_traits::print_tree::PrintTree;
|
||||
use inline::InlineFlow;
|
||||
use model::{CollapsibleMargins, IntrinsicISizes, MarginCollapseInfo};
|
||||
|
@ -399,16 +399,6 @@ pub trait Flow: fmt::Debug + Sync + Send + 'static {
|
|||
/// implications because this can be called on parents concurrently from descendants!
|
||||
fn generated_containing_block_size(&self, _: OpaqueFlow) -> LogicalSize<Au>;
|
||||
|
||||
/// Returns a layer ID for the given fragment.
|
||||
fn layer_id(&self) -> LayerId {
|
||||
LayerId::new_of_type(LayerType::FragmentBody, base(self).flow_id())
|
||||
}
|
||||
|
||||
/// Returns a layer ID for the given fragment.
|
||||
fn layer_id_for_overflow_scroll(&self) -> LayerId {
|
||||
LayerId::new_of_type(LayerType::OverflowScroll, base(self).flow_id())
|
||||
}
|
||||
|
||||
/// Attempts to perform incremental fixup of this flow by replacing its fragment's style with
|
||||
/// the new style. This can only succeed if the flow has exactly one fragment.
|
||||
fn repair_style(&mut self, new_style: &Arc<ServoComputedValues>);
|
||||
|
@ -634,10 +624,6 @@ bitflags! {
|
|||
#[doc = "Flags used in flows."]
|
||||
pub flags FlowFlags: u32 {
|
||||
// text align flags
|
||||
#[doc = "Whether this flow must have its own layer. Even if this flag is not set, it might"]
|
||||
#[doc = "get its own layer if it's deemed to be likely to overlap flows with their own"]
|
||||
#[doc = "layer."]
|
||||
const NEEDS_LAYER = 0b0000_0000_0000_0000_0010_0000,
|
||||
#[doc = "Whether this flow is absolutely positioned. This is checked all over layout, so a"]
|
||||
#[doc = "virtual call is too expensive."]
|
||||
const IS_ABSOLUTELY_POSITIONED = 0b0000_0000_0000_0000_0100_0000,
|
||||
|
|
|
@ -17,7 +17,7 @@ use gfx;
|
|||
use gfx::display_list::{BLUR_INFLATION_FACTOR, OpaqueNode};
|
||||
use gfx::text::glyph::ByteIndex;
|
||||
use gfx::text::text_run::{TextRun, TextRunSlice};
|
||||
use gfx_traits::{FragmentType, LayerId, LayerType, StackingContextId};
|
||||
use gfx_traits::{FragmentType, StackingContextId};
|
||||
use inline::{FIRST_FRAGMENT_OF_ELEMENT, InlineFragmentContext, InlineFragmentNodeInfo};
|
||||
use inline::{InlineMetrics, LAST_FRAGMENT_OF_ELEMENT, LineMetrics};
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
|
@ -48,7 +48,7 @@ use style::dom::TRestyleDamage;
|
|||
use style::logical_geometry::{LogicalMargin, LogicalRect, LogicalSize, WritingMode};
|
||||
use style::properties::ServoComputedValues;
|
||||
use style::str::char_is_whitespace;
|
||||
use style::values::computed::{LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::{LengthOrNone, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use style::values::computed::LengthOrPercentageOrNone;
|
||||
use text;
|
||||
use text::TextRunScanner;
|
||||
|
@ -122,9 +122,6 @@ pub struct Fragment {
|
|||
/// The pseudo-element that this fragment represents.
|
||||
pub pseudo: PseudoElementType<()>,
|
||||
|
||||
/// Various flags for this fragment.
|
||||
pub flags: FragmentFlags,
|
||||
|
||||
/// A debug ID that is consistent for the life of this fragment (via transform etc).
|
||||
/// This ID should not be considered stable across multiple layouts or fragment
|
||||
/// manipulations.
|
||||
|
@ -919,7 +916,6 @@ impl Fragment {
|
|||
specific: specific,
|
||||
inline_context: None,
|
||||
pseudo: node.get_pseudo_element_type().strip(),
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: DebugId::new(),
|
||||
stacking_context_id: StackingContextId::new(0),
|
||||
}
|
||||
|
@ -948,7 +944,6 @@ impl Fragment {
|
|||
specific: specific,
|
||||
inline_context: None,
|
||||
pseudo: pseudo,
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: DebugId::new(),
|
||||
stacking_context_id: StackingContextId::new(0),
|
||||
}
|
||||
|
@ -976,7 +971,6 @@ impl Fragment {
|
|||
specific: info,
|
||||
inline_context: self.inline_context.clone(),
|
||||
pseudo: self.pseudo.clone(),
|
||||
flags: FragmentFlags::empty(),
|
||||
debug_id: self.debug_id.clone(),
|
||||
stacking_context_id: StackingContextId::new(0),
|
||||
}
|
||||
|
@ -2535,9 +2529,6 @@ impl Fragment {
|
|||
_ => {}
|
||||
}
|
||||
|
||||
if self.flags.contains(HAS_LAYER) {
|
||||
return true
|
||||
}
|
||||
if self.style().get_effects().opacity != 1.0 {
|
||||
return true
|
||||
}
|
||||
|
@ -2550,6 +2541,18 @@ impl Fragment {
|
|||
if self.style().get_effects().transform.0.is_some() {
|
||||
return true
|
||||
}
|
||||
|
||||
// TODO(mrobinson): Determine if this is necessary, since blocks with
|
||||
// transformations already create stacking contexts.
|
||||
if self.style().get_effects().perspective != LengthOrNone::None {
|
||||
return true
|
||||
}
|
||||
|
||||
// Fixed position blocks always create stacking contexts.
|
||||
if self.style.get_box().position == position::T::fixed {
|
||||
return true
|
||||
}
|
||||
|
||||
match self.style().get_used_transform_style() {
|
||||
transform_style::T::flat | transform_style::T::preserve_3d => {
|
||||
return true
|
||||
|
@ -2874,21 +2877,6 @@ impl Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn layer_id(&self) -> LayerId {
|
||||
let layer_type = match self.pseudo {
|
||||
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.node.id() as usize)
|
||||
}
|
||||
|
||||
pub fn layer_id_for_overflow_scroll(&self) -> LayerId {
|
||||
LayerId::new_of_type(LayerType::OverflowScroll, self.node.id() as usize)
|
||||
}
|
||||
|
||||
/// Returns true if any of the inline styles associated with this fragment have
|
||||
/// `vertical-align` set to `top` or `bottom`.
|
||||
pub fn is_vertically_aligned_to_top_or_bottom(&self) -> bool {
|
||||
|
@ -3094,13 +3082,6 @@ impl Overflow {
|
|||
}
|
||||
}
|
||||
|
||||
bitflags! {
|
||||
pub flags FragmentFlags: u8 {
|
||||
/// Whether this fragment has a layer.
|
||||
const HAS_LAYER = 0x01,
|
||||
}
|
||||
}
|
||||
|
||||
/// Specified distances from the margin edge of a block to its content in the inline direction.
|
||||
/// These are returned by `guess_inline_content_edge_offsets()` and are used in the float placement
|
||||
/// speculation logic.
|
||||
|
|
|
@ -12,14 +12,13 @@ use euclid::size::Size2D;
|
|||
use flow::{self, Flow};
|
||||
use fragment::{Fragment, FragmentBorderBoxIterator, SpecificFragmentInfo};
|
||||
use gfx::display_list::{DisplayItemMetadata, DisplayList, OpaqueNode, ScrollOffsetMap};
|
||||
use gfx_traits::LayerId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use opaque_node::OpaqueNodeMethods;
|
||||
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse};
|
||||
use script_layout_interface::rpc::{HitTestResponse, LayoutRPC};
|
||||
use script_layout_interface::rpc::{MarginStyleResponse, NodeGeometryResponse};
|
||||
use script_layout_interface::rpc::{NodeLayerIdResponse, NodeOverflowResponse};
|
||||
use script_layout_interface::rpc::{OffsetParentResponse, ResolvedStyleResponse};
|
||||
use script_layout_interface::rpc::{NodeOverflowResponse, OffsetParentResponse};
|
||||
use script_layout_interface::rpc::ResolvedStyleResponse;
|
||||
use script_layout_interface::wrapper_traits::{LayoutNode, ThreadSafeLayoutNode};
|
||||
use script_traits::LayoutMsg as ConstellationMsg;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
|
@ -61,8 +60,6 @@ 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),
|
||||
|
||||
|
@ -180,13 +177,6 @@ impl LayoutRPC for LayoutRPCImpl {
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
@ -587,11 +577,6 @@ 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 Flow)
|
||||
-> Rect<i32> {
|
||||
let mut iterator = UnioningFragmentScrollAreaIterator::new(requested_node.opaque());
|
||||
|
|
|
@ -26,7 +26,6 @@ trait WebRenderStackingContextConverter {
|
|||
pipeline_id: webrender_traits::PipelineId,
|
||||
epoch: webrender_traits::Epoch,
|
||||
scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
|
||||
scroll_policy: ScrollPolicy,
|
||||
frame_builder: &mut WebRenderFrameBuilder)
|
||||
-> webrender_traits::StackingContextId;
|
||||
|
||||
|
@ -36,7 +35,6 @@ trait WebRenderStackingContextConverter {
|
|||
pipeline_id: webrender_traits::PipelineId,
|
||||
epoch: webrender_traits::Epoch,
|
||||
scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
|
||||
scroll_policy: ScrollPolicy,
|
||||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder,
|
||||
force_positioned_stacking_level: bool);
|
||||
|
@ -256,7 +254,6 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
pipeline_id: webrender_traits::PipelineId,
|
||||
epoch: webrender_traits::Epoch,
|
||||
scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
|
||||
scroll_policy: ScrollPolicy,
|
||||
builder: &mut webrender_traits::DisplayListBuilder,
|
||||
frame_builder: &mut WebRenderFrameBuilder,
|
||||
_force_positioned_stacking_level: bool) {
|
||||
|
@ -278,7 +275,6 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
pipeline_id,
|
||||
epoch,
|
||||
scroll_layer_id_for_children,
|
||||
scroll_policy,
|
||||
frame_builder);
|
||||
builder.push_stacking_context(stacking_context_id);
|
||||
|
||||
|
@ -295,14 +291,9 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
pipeline_id: webrender_traits::PipelineId,
|
||||
epoch: webrender_traits::Epoch,
|
||||
scroll_layer_id: Option<webrender_traits::ScrollLayerId>,
|
||||
mut scroll_policy: ScrollPolicy,
|
||||
frame_builder: &mut WebRenderFrameBuilder)
|
||||
-> webrender_traits::StackingContextId {
|
||||
if let Some(ref layer_info) = self.layer_info {
|
||||
scroll_policy = layer_info.scroll_policy
|
||||
}
|
||||
|
||||
let webrender_scroll_policy = match scroll_policy {
|
||||
let webrender_scroll_policy = match self.scroll_policy {
|
||||
ScrollPolicy::Scrollable => webrender_traits::ScrollPolicy::Scrollable,
|
||||
ScrollPolicy::FixedPosition => webrender_traits::ScrollPolicy::Fixed,
|
||||
};
|
||||
|
@ -353,7 +344,6 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
pipeline_id,
|
||||
epoch,
|
||||
None,
|
||||
scroll_policy,
|
||||
&mut inner_builder,
|
||||
frame_builder,
|
||||
false);
|
||||
|
@ -367,7 +357,6 @@ impl WebRenderStackingContextConverter for StackingContext {
|
|||
pipeline_id,
|
||||
epoch,
|
||||
scroll_layer_id,
|
||||
scroll_policy,
|
||||
&mut builder,
|
||||
frame_builder,
|
||||
false);
|
||||
|
@ -397,7 +386,6 @@ impl WebRenderDisplayListConverter for DisplayList {
|
|||
pipeline_id,
|
||||
epoch,
|
||||
scroll_layer_id,
|
||||
ScrollPolicy::Scrollable,
|
||||
frame_builder)
|
||||
}
|
||||
_ => unreachable!("DisplayList did not start with StackingContext."),
|
||||
|
|
|
@ -51,12 +51,12 @@ use euclid::rect::Rect;
|
|||
use euclid::scale_factor::ScaleFactor;
|
||||
use euclid::size::Size2D;
|
||||
use fnv::FnvHasher;
|
||||
use gfx::display_list::{ClippingRegion, DisplayList, LayerInfo, OpaqueNode};
|
||||
use gfx::display_list::{ClippingRegion, DisplayList, OpaqueNode};
|
||||
use gfx::display_list::{StackingContext, StackingContextType, WebRenderImageInfo};
|
||||
use gfx::font;
|
||||
use gfx::font_cache_thread::FontCacheThread;
|
||||
use gfx::font_context;
|
||||
use gfx_traits::{Epoch, FragmentType, LayerId, ScrollPolicy, StackingContextId, color};
|
||||
use gfx_traits::{Epoch, FragmentType, ScrollPolicy, StackingContextId, color};
|
||||
use heapsize::HeapSizeOf;
|
||||
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
|
||||
use ipc_channel::router::ROUTER;
|
||||
|
@ -71,7 +71,7 @@ use layout::layout_debug;
|
|||
use layout::parallel;
|
||||
use layout::query::{LayoutRPCImpl, LayoutThreadData, process_content_box_request, process_content_boxes_request};
|
||||
use layout::query::{process_margin_style_query, process_node_overflow_request, process_resolved_style_request};
|
||||
use layout::query::{process_node_geometry_request, process_node_layer_id_request, process_node_scroll_area_request};
|
||||
use layout::query::{process_node_geometry_request, process_node_scroll_area_request};
|
||||
use layout::query::process_offset_parent_query;
|
||||
use layout::sequential;
|
||||
use layout::traversal::{ComputeAbsolutePositions, RecalcStyleAndConstructFlows};
|
||||
|
@ -124,9 +124,6 @@ use util::prefs::PREFS;
|
|||
use util::resource_files::read_resource_file;
|
||||
use util::thread;
|
||||
|
||||
/// The number of screens we have to traverse before we decide to generate new display lists.
|
||||
const DISPLAY_PORT_THRESHOLD_SIZE_FACTOR: i32 = 4;
|
||||
|
||||
/// Information needed by the layout thread.
|
||||
pub struct LayoutThread {
|
||||
/// The ID of the pipeline that we belong to.
|
||||
|
@ -197,10 +194,6 @@ pub struct LayoutThread {
|
|||
/// The root of the flow tree.
|
||||
root_flow: Option<FlowRef>,
|
||||
|
||||
/// The position and size of the visible rect for each layer. We do not build display lists
|
||||
/// for any areas more than `DISPLAY_PORT_SIZE_FACTOR` screens away from this area.
|
||||
visible_rects: Arc<HashMap<LayerId, Rect<Au>, BuildHasherDefault<FnvHasher>>>,
|
||||
|
||||
/// The list of currently-running animations.
|
||||
running_animations: Arc<RwLock<HashMap<OpaqueNode, Vec<Animation>>>>,
|
||||
|
||||
|
@ -446,7 +439,6 @@ impl LayoutThread {
|
|||
new_animations_receiver: new_animations_receiver,
|
||||
outstanding_web_fonts: outstanding_web_fonts_counter,
|
||||
root_flow: None,
|
||||
visible_rects: Arc::new(HashMap::with_hasher(Default::default())),
|
||||
running_animations: Arc::new(RwLock::new(HashMap::new())),
|
||||
expired_animations: Arc::new(RwLock::new(HashMap::new())),
|
||||
epoch: Epoch(0),
|
||||
|
@ -460,7 +452,6 @@ 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),
|
||||
|
@ -523,7 +514,6 @@ impl LayoutThread {
|
|||
image_cache_thread: self.image_cache_thread.clone(),
|
||||
image_cache_sender: Mutex::new(self.image_cache_sender.clone()),
|
||||
font_cache_thread: Mutex::new(self.font_cache_thread.clone()),
|
||||
visible_rects: self.visible_rects.clone(),
|
||||
webrender_image_cache: self.webrender_image_cache.clone(),
|
||||
}
|
||||
}
|
||||
|
@ -561,10 +551,6 @@ impl LayoutThread {
|
|||
};
|
||||
|
||||
match request {
|
||||
Request::FromPipeline(LayoutControlMsg::SetVisibleRects(new_visible_rects)) => {
|
||||
self.handle_request_helper(Msg::SetVisibleRects(new_visible_rects),
|
||||
possibly_locked_rw_data)
|
||||
},
|
||||
Request::FromPipeline(LayoutControlMsg::SetStackingContextScrollStates(
|
||||
new_scroll_states)) => {
|
||||
self.handle_request_helper(Msg::SetStackingContextScrollStates(new_scroll_states),
|
||||
|
@ -654,9 +640,6 @@ impl LayoutThread {
|
|||
Msg::ReflowWithNewlyLoadedWebFont => {
|
||||
self.reflow_with_newly_loaded_web_font(possibly_locked_rw_data)
|
||||
}
|
||||
Msg::SetVisibleRects(new_visible_rects) => {
|
||||
self.set_visible_rects(new_visible_rects, possibly_locked_rw_data);
|
||||
}
|
||||
Msg::SetStackingContextScrollStates(new_scroll_states) => {
|
||||
self.set_stacking_context_scroll_states(new_scroll_states,
|
||||
possibly_locked_rw_data);
|
||||
|
@ -935,7 +918,7 @@ impl LayoutThread {
|
|||
Matrix4D::identity(),
|
||||
Matrix4D::identity(),
|
||||
true,
|
||||
None,
|
||||
ScrollPolicy::Scrollable,
|
||||
None);
|
||||
|
||||
let display_list_entries =
|
||||
|
@ -945,7 +928,6 @@ impl LayoutThread {
|
|||
|
||||
debug!("Done building display list.");
|
||||
|
||||
let root_background_color = get_root_flow_background_color(layout_root);
|
||||
let root_size = {
|
||||
let root_flow = flow::base(layout_root);
|
||||
if rw_data.stylist.viewport_constraints().is_some() {
|
||||
|
@ -958,11 +940,6 @@ impl LayoutThread {
|
|||
let origin = Rect::new(Point2D::new(Au(0), Au(0)), root_size);
|
||||
root_stacking_context.bounds = origin;
|
||||
root_stacking_context.overflow = origin;
|
||||
root_stacking_context.layer_info =
|
||||
Some(LayerInfo::new(layout_root.layer_id(),
|
||||
ScrollPolicy::Scrollable,
|
||||
None,
|
||||
root_background_color));
|
||||
|
||||
rw_data.display_list =
|
||||
Some(Arc::new(DisplayList::new(root_stacking_context,
|
||||
|
@ -1066,9 +1043,6 @@ 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();
|
||||
},
|
||||
|
@ -1279,10 +1253,6 @@ impl LayoutThread {
|
|||
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) };
|
||||
let layout_context = LayoutContext::new(&shared_layout_context);
|
||||
|
@ -1305,66 +1275,6 @@ impl LayoutThread {
|
|||
}
|
||||
}
|
||||
|
||||
fn set_visible_rects<'a, 'b>(&mut self,
|
||||
new_visible_rects: Vec<(LayerId, Rect<Au>)>,
|
||||
possibly_locked_rw_data: &mut RwData<'a, 'b>)
|
||||
-> bool {
|
||||
let mut rw_data = possibly_locked_rw_data.lock();
|
||||
|
||||
// First, determine if we need to regenerate the display lists. This will happen if the
|
||||
// layers have moved more than `DISPLAY_PORT_THRESHOLD_SIZE_FACTOR` away from their last
|
||||
// positions.
|
||||
let mut must_regenerate_display_lists = false;
|
||||
let mut old_visible_rects = HashMap::with_hasher(Default::default());
|
||||
let inflation_amount =
|
||||
Size2D::new(self.viewport_size.width * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR,
|
||||
self.viewport_size.height * DISPLAY_PORT_THRESHOLD_SIZE_FACTOR);
|
||||
for &(ref layer_id, ref new_visible_rect) in &new_visible_rects {
|
||||
match self.visible_rects.get(layer_id) {
|
||||
None => {
|
||||
old_visible_rects.insert(*layer_id, *new_visible_rect);
|
||||
}
|
||||
Some(old_visible_rect) => {
|
||||
old_visible_rects.insert(*layer_id, *old_visible_rect);
|
||||
|
||||
if !old_visible_rect.inflate(inflation_amount.width, inflation_amount.height)
|
||||
.intersects(new_visible_rect) {
|
||||
must_regenerate_display_lists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !must_regenerate_display_lists {
|
||||
// Update `visible_rects` in case there are new layers that were discovered.
|
||||
self.visible_rects = Arc::new(old_visible_rects);
|
||||
return true
|
||||
}
|
||||
|
||||
debug!("regenerating display lists!");
|
||||
for &(ref layer_id, ref new_visible_rect) in &new_visible_rects {
|
||||
old_visible_rects.insert(*layer_id, *new_visible_rect);
|
||||
}
|
||||
self.visible_rects = Arc::new(old_visible_rects);
|
||||
|
||||
// Regenerate the display lists.
|
||||
let reflow_info = Reflow {
|
||||
goal: ReflowGoal::ForDisplay,
|
||||
page_clip_rect: max_rect(),
|
||||
};
|
||||
|
||||
let mut layout_context = self.build_shared_layout_context(&*rw_data,
|
||||
false,
|
||||
reflow_info.goal);
|
||||
|
||||
self.perform_post_main_layout_passes(&reflow_info,
|
||||
None,
|
||||
None,
|
||||
&mut *rw_data,
|
||||
&mut layout_context);
|
||||
true
|
||||
}
|
||||
|
||||
fn set_stacking_context_scroll_states<'a, 'b>(
|
||||
&mut self,
|
||||
new_scroll_states: Vec<StackingContextScrollState>,
|
||||
|
@ -1670,9 +1580,9 @@ fn reflow_query_type_needs_display_list(query_type: &ReflowQueryType) -> bool {
|
|||
ReflowQueryType::HitTestQuery(..) => true,
|
||||
ReflowQueryType::ContentBoxQuery(_) | ReflowQueryType::ContentBoxesQuery(_) |
|
||||
ReflowQueryType::NodeGeometryQuery(_) | ReflowQueryType::NodeScrollGeometryQuery(_) |
|
||||
ReflowQueryType::NodeOverflowQuery(_) | ReflowQueryType::NodeLayerIdQuery(_) |
|
||||
ReflowQueryType::ResolvedStyleQuery(..) | ReflowQueryType::OffsetParentQuery(_) |
|
||||
ReflowQueryType::MarginStyleQuery(_) | ReflowQueryType::NoQuery => false,
|
||||
ReflowQueryType::NodeOverflowQuery(_) | ReflowQueryType::ResolvedStyleQuery(..) |
|
||||
ReflowQueryType::OffsetParentQuery(_) | ReflowQueryType::MarginStyleQuery(_) |
|
||||
ReflowQueryType::NoQuery => false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ use dom::screen::Screen;
|
|||
use dom::storage::Storage;
|
||||
use euclid::{Point2D, Rect, Size2D};
|
||||
use fetch;
|
||||
use gfx_traits::LayerId;
|
||||
use ipc_channel::ipc::{self, IpcSender};
|
||||
use js::jsapi::{HandleObject, HandleValue, JSAutoCompartment, JSContext};
|
||||
use js::jsapi::{JS_GC, JS_GetRuntime, SetWindowProxy};
|
||||
|
@ -935,11 +934,11 @@ impl Window {
|
|||
//let document = self.Document();
|
||||
// Step 12
|
||||
self.perform_a_scroll(x.to_f32().unwrap_or(0.0f32), y.to_f32().unwrap_or(0.0f32),
|
||||
LayerId::null(), behavior, None);
|
||||
behavior, None);
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/cssom-view/#perform-a-scroll
|
||||
pub fn perform_a_scroll(&self, x: f32, y: f32, layer_id: LayerId,
|
||||
pub fn perform_a_scroll(&self, x: f32, y: f32,
|
||||
behavior: ScrollBehavior, element: Option<&Element>) {
|
||||
//TODO Step 1
|
||||
let point = Point2D::new(x, y);
|
||||
|
@ -959,7 +958,7 @@ impl Window {
|
|||
|
||||
let global_scope = self.upcast::<GlobalScope>();
|
||||
let message = ConstellationMsg::ScrollFragmentPoint(
|
||||
global_scope.pipeline_id(), layer_id, point, smooth);
|
||||
global_scope.pipeline_id(), point, smooth);
|
||||
global_scope.constellation_chan().send(message).unwrap();
|
||||
}
|
||||
|
||||
|
@ -1239,19 +1238,11 @@ impl Window {
|
|||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom-view/#dom-element-scroll
|
||||
pub fn scroll_node(&self, node: TrustedNodeAddress,
|
||||
pub fn scroll_node(&self, _node: TrustedNodeAddress,
|
||||
x_: f64, y_: f64, behavior: ScrollBehavior) {
|
||||
if !self.reflow(ReflowGoal::ForScriptQuery,
|
||||
ReflowQueryType::NodeLayerIdQuery(node),
|
||||
ReflowReason::Query) {
|
||||
return;
|
||||
}
|
||||
|
||||
let layer_id = self.layout_rpc.node_layer_id().layer_id;
|
||||
|
||||
// Step 12
|
||||
self.perform_a_scroll(x_.to_f32().unwrap_or(0.0f32), y_.to_f32().unwrap_or(0.0f32),
|
||||
layer_id, behavior, None);
|
||||
behavior, None);
|
||||
}
|
||||
|
||||
pub fn resolved_style_query(&self,
|
||||
|
@ -1609,7 +1600,6 @@ fn debug_reflow_events(id: PipelineId, goal: &ReflowGoal, query_type: &ReflowQue
|
|||
ReflowQueryType::ContentBoxesQuery(_n) => "\tContentBoxesQuery",
|
||||
ReflowQueryType::HitTestQuery(..) => "\tHitTestQuery",
|
||||
ReflowQueryType::NodeGeometryQuery(_n) => "\tNodeGeometryQuery",
|
||||
ReflowQueryType::NodeLayerIdQuery(_n) => "\tNodeLayerIdQuery",
|
||||
ReflowQueryType::NodeOverflowQuery(_n) => "\tNodeOverFlowQuery",
|
||||
ReflowQueryType::NodeScrollGeometryQuery(_n) => "\tNodeScrollGeometryQuery",
|
||||
ReflowQueryType::ResolvedStyleQuery(_, _, _) => "\tResolvedStyleQuery",
|
||||
|
|
|
@ -57,7 +57,6 @@ use dom::window::{ReflowReason, Window};
|
|||
use dom::worker::TrustedWorkerAddress;
|
||||
use euclid::Rect;
|
||||
use euclid::point::Point2D;
|
||||
use gfx_traits::LayerId;
|
||||
use hyper::header::{ContentType, Headers, HttpDate, LastModified};
|
||||
use hyper::header::ReferrerPolicy as ReferrerPolicyHeader;
|
||||
use hyper::method::Method;
|
||||
|
@ -1880,10 +1879,7 @@ impl ScriptThread {
|
|||
let point = Point2D::new(rect.origin.x.to_nearest_px() as f32,
|
||||
rect.origin.y.to_nearest_px() as f32);
|
||||
|
||||
let message = ConstellationMsg::ScrollFragmentPoint(pipeline_id,
|
||||
LayerId::null(),
|
||||
point,
|
||||
false);
|
||||
let message = ConstellationMsg::ScrollFragmentPoint(pipeline_id, point, false);
|
||||
self.constellation_chan.send(message).unwrap();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use {OpaqueStyleAndLayoutData, TrustedNodeAddress};
|
|||
use app_units::Au;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use gfx_traits::{Epoch, LayerId};
|
||||
use gfx_traits::Epoch;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use net_traits::image_cache_thread::ImageCacheThread;
|
||||
|
@ -48,10 +48,6 @@ pub enum Msg {
|
|||
/// Requests that the layout thread reflow with a newly-loaded Web font.
|
||||
ReflowWithNewlyLoadedWebFont,
|
||||
|
||||
/// Updates the layout visible rects, affecting the area that display lists will be constructed
|
||||
/// for.
|
||||
SetVisibleRects(Vec<(LayerId, Rect<Au>)>),
|
||||
|
||||
/// Destroys layout data associated with a DOM node.
|
||||
///
|
||||
/// TODO(pcwalton): Maybe think about batching to avoid message traffic.
|
||||
|
@ -99,7 +95,6 @@ pub enum ReflowQueryType {
|
|||
NodeOverflowQuery(TrustedNodeAddress),
|
||||
HitTestQuery(Point2D<f32>, Point2D<f32>, bool),
|
||||
NodeGeometryQuery(TrustedNodeAddress),
|
||||
NodeLayerIdQuery(TrustedNodeAddress),
|
||||
NodeScrollGeometryQuery(TrustedNodeAddress),
|
||||
ResolvedStyleQuery(TrustedNodeAddress, Option<PseudoElement>, Atom),
|
||||
OffsetParentQuery(TrustedNodeAddress),
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
use app_units::Au;
|
||||
use euclid::point::Point2D;
|
||||
use euclid::rect::Rect;
|
||||
use gfx_traits::LayerId;
|
||||
use script_traits::UntrustedNodeAddress;
|
||||
use style::properties::longhands::{margin_top, margin_right, margin_bottom, margin_left, overflow_x};
|
||||
|
||||
|
@ -28,8 +27,6 @@ pub trait LayoutRPC {
|
|||
fn node_overflow(&self) -> NodeOverflowResponse;
|
||||
/// Requests the scroll geometry of this node. Used by APIs such as `scrollTop`.
|
||||
fn node_scroll_area(&self) -> NodeGeometryResponse;
|
||||
/// Requests the layer id of this node. Used by APIs such as `scrollTop`
|
||||
fn node_layer_id(&self) -> NodeLayerIdResponse;
|
||||
/// Requests the node containing the point of interest
|
||||
fn hit_test(&self) -> HitTestResponse;
|
||||
/// Query layout for the resolved value of a given CSS property
|
||||
|
@ -51,10 +48,6 @@ pub struct NodeGeometryResponse {
|
|||
|
||||
pub struct NodeOverflowResponse(pub Option<Point2D<overflow_x::computed_value::T>>);
|
||||
|
||||
pub struct NodeLayerIdResponse {
|
||||
pub layer_id: LayerId,
|
||||
}
|
||||
|
||||
pub struct HitTestResponse {
|
||||
pub node_address: Option<UntrustedNodeAddress>,
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ use HTMLCanvasData;
|
|||
use LayoutNodeType;
|
||||
use OpaqueStyleAndLayoutData;
|
||||
use SVGSVGData;
|
||||
use gfx_traits::{ByteIndex, LayerId, LayerType};
|
||||
use gfx_traits::ByteIndex;
|
||||
use msg::constellation_msg::PipelineId;
|
||||
use range::Range;
|
||||
use restyle_damage::RestyleDamage;
|
||||
|
@ -371,21 +371,6 @@ pub trait ThreadSafeLayoutNode: Clone + Copy + NodeInfo + PartialEq + Sized {
|
|||
|
||||
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)
|
||||
}
|
||||
|
||||
fn get_style_data(&self) -> Option<&AtomicRefCell<PersistentStyleData>>;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
#![deny(missing_docs)]
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
extern crate app_units;
|
||||
extern crate canvas_traits;
|
||||
extern crate cookie as cookie_rs;
|
||||
extern crate devtools_traits;
|
||||
|
@ -36,7 +35,6 @@ extern crate url;
|
|||
mod script_msg;
|
||||
pub mod webdriver_msg;
|
||||
|
||||
use app_units::Au;
|
||||
use devtools_traits::{DevtoolScriptControlMsg, ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use euclid::Size2D;
|
||||
use euclid::length::Length;
|
||||
|
@ -46,7 +44,6 @@ use euclid::scale_factor::ScaleFactor;
|
|||
use euclid::size::TypedSize2D;
|
||||
use gfx_traits::DevicePixel;
|
||||
use gfx_traits::Epoch;
|
||||
use gfx_traits::LayerId;
|
||||
use gfx_traits::StackingContextId;
|
||||
use heapsize::HeapSizeOf;
|
||||
use ipc_channel::ipc::{IpcReceiver, IpcSender};
|
||||
|
@ -115,8 +112,6 @@ pub enum LayoutControlMsg {
|
|||
GetCurrentEpoch(IpcSender<Epoch>),
|
||||
/// Asks layout to run another step in its animation.
|
||||
TickAnimations,
|
||||
/// Informs layout as to which regions of the page are visible.
|
||||
SetVisibleRects(Vec<(LayerId, Rect<Au>)>),
|
||||
/// Tells layout about the new scrolling offsets of each scrollable stacking context.
|
||||
SetStackingContextScrollStates(Vec<StackingContextScrollState>),
|
||||
/// Requests the current load state of Web fonts. `true` is returned if fonts are still loading
|
||||
|
|
|
@ -13,7 +13,6 @@ use canvas_traits::CanvasMsg;
|
|||
use devtools_traits::{ScriptToDevtoolsControlMsg, WorkerId};
|
||||
use euclid::point::Point2D;
|
||||
use euclid::size::Size2D;
|
||||
use gfx_traits::LayerId;
|
||||
use ipc_channel::ipc::IpcSender;
|
||||
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
|
||||
use msg::constellation_msg::{PipelineId, TraversalDirection};
|
||||
|
@ -114,7 +113,7 @@ pub enum ScriptMsg {
|
|||
/// Check if an alert dialog box should be presented
|
||||
Alert(PipelineId, String, IpcSender<bool>),
|
||||
/// Scroll a page in a window
|
||||
ScrollFragmentPoint(PipelineId, LayerId, Point2D<f32>, bool),
|
||||
ScrollFragmentPoint(PipelineId, Point2D<f32>, bool),
|
||||
/// Set title of current page
|
||||
/// https://html.spec.whatwg.org/multipage/#document.title
|
||||
SetTitle(PipelineId, Option<String>),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue