aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/message.rs
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2017-09-30 14:57:59 +0200
committerMartin Robinson <mrobinson@igalia.com>2017-09-30 16:06:48 +0200
commit0380431157be6ef3fbacb1c118a7a1cf8b156d7c (patch)
tree0b0fa2d323c03e93def6fe63694b6983029c68ef /components/script_layout_interface/message.rs
parent75a4dcf293a6de9bc7ae180f25ea010dd3a667bc (diff)
downloadservo-0380431157be6ef3fbacb1c118a7a1cf8b156d7c.tar.gz
servo-0380431157be6ef3fbacb1c118a7a1cf8b156d7c.zip
Combine ReflowGoal and ReflowQueryType
This simplifies the logic in the layout_thread and makes it clearer which types of reflows generate display lists and cause display updates.
Diffstat (limited to 'components/script_layout_interface/message.rs')
-rw-r--r--components/script_layout_interface/message.rs43
1 files changed, 36 insertions, 7 deletions
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index 91963bce226..2df0b7de1fb 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -20,7 +20,7 @@ use servo_atoms::Atom;
use servo_url::ServoUrl;
use std::sync::Arc;
use std::sync::mpsc::{Receiver, Sender};
-use style::context::{QuirksMode, ReflowGoal};
+use style::context::QuirksMode;
use style::properties::PropertyId;
use style::selector_parser::PseudoElement;
use style::stylesheets::Stylesheet;
@@ -103,8 +103,9 @@ pub enum Msg {
/// Any query to perform with this reflow.
#[derive(Debug, PartialEq)]
-pub enum ReflowQueryType {
- NoQuery,
+pub enum ReflowGoal {
+ Full,
+ TickAnimations,
ContentBoxQuery(TrustedNodeAddress),
ContentBoxesQuery(TrustedNodeAddress),
NodeOverflowQuery(TrustedNodeAddress),
@@ -119,10 +120,38 @@ pub enum ReflowQueryType {
NodesFromPoint(Point2D<f32>),
}
+impl ReflowGoal {
+ /// Returns true if the given ReflowQuery needs a full, up-to-date display list to
+ /// be present or false if it only needs stacking-relative positions.
+ pub fn needs_display_list(&self) -> bool {
+ match *self {
+ ReflowGoal::NodesFromPoint(..) | ReflowGoal::HitTestQuery(..) |
+ ReflowGoal::TextIndexQuery(..) | ReflowGoal::Full => true,
+ ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) |
+ ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) |
+ ReflowGoal::NodeOverflowQuery(_) | ReflowGoal::NodeScrollRootIdQuery(_) |
+ ReflowGoal::ResolvedStyleQuery(..) | ReflowGoal::OffsetParentQuery(_) |
+ ReflowGoal::MarginStyleQuery(_) | ReflowGoal::TickAnimations => false,
+ }
+ }
+
+ /// Returns true if the given ReflowQuery needs its display list send to WebRender or
+ /// false if a layout_thread display list is sufficient.
+ pub fn needs_display(&self) -> bool {
+ match *self {
+ ReflowGoal::MarginStyleQuery(_) | ReflowGoal::TextIndexQuery(..) |
+ ReflowGoal::HitTestQuery(..) | ReflowGoal::ContentBoxQuery(_) |
+ ReflowGoal::ContentBoxesQuery(_) | ReflowGoal::NodeGeometryQuery(_) |
+ ReflowGoal::NodeScrollGeometryQuery(_) | ReflowGoal::NodeOverflowQuery(_) |
+ ReflowGoal::NodeScrollRootIdQuery(_) | ReflowGoal::ResolvedStyleQuery(..) |
+ ReflowGoal::OffsetParentQuery(_) | ReflowGoal::NodesFromPoint(..) => false,
+ ReflowGoal::Full | ReflowGoal::TickAnimations => true,
+ }
+ }
+}
+
/// Information needed for a reflow.
pub struct Reflow {
- /// The goal of reflow: either to render to the screen or to flush layout info for script.
- pub goal: ReflowGoal,
/// A clipping rectangle for the page, an enlarged rectangle containing the viewport.
pub page_clip_rect: Rect<Au>,
}
@@ -148,8 +177,8 @@ pub struct ScriptReflow {
pub window_size: WindowSizeData,
/// The channel that we send a notification to.
pub script_join_chan: Sender<ReflowComplete>,
- /// The type of query if any to perform during this reflow.
- pub query_type: ReflowQueryType,
+ /// The goal of this reflow.
+ pub reflow_goal: ReflowGoal,
/// The number of objects in the dom #10110
pub dom_count: u32,
}