aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/message.rs
diff options
context:
space:
mode:
authormoe <35686186+csmoe@users.noreply.github.com>2018-03-16 14:06:27 +0800
committercsmoe <35686186+csmoe@users.noreply.github.com>2018-03-17 00:39:11 +0800
commitdf6b64181b276482c4082b2064d3b9c4ed86b970 (patch)
tree1f8b7897ce664d120bd3dddd524e155c88e4abe6 /components/script_layout_interface/message.rs
parentb93f153ed59fb993af306bd8c540887196021f87 (diff)
downloadservo-df6b64181b276482c4082b2064d3b9c4ed86b970.tar.gz
servo-df6b64181b276482c4082b2064d3b9c4ed86b970.zip
extract querymsg from ReflowGoal
Diffstat (limited to 'components/script_layout_interface/message.rs')
-rw-r--r--components/script_layout_interface/message.rs59
1 files changed, 38 insertions, 21 deletions
diff --git a/components/script_layout_interface/message.rs b/components/script_layout_interface/message.rs
index ef408600270..ac52d9373ce 100644
--- a/components/script_layout_interface/message.rs
+++ b/components/script_layout_interface/message.rs
@@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-use {OpaqueStyleAndLayoutData, TrustedNodeAddress, PendingImage};
+use {OpaqueStyleAndLayoutData, PendingImage, TrustedNodeAddress};
use app_units::Au;
use euclid::{Point2D, Rect};
use gfx_traits::Epoch;
@@ -106,11 +106,8 @@ pub enum NodesFromPointQueryType {
Topmost,
}
-/// Any query to perform with this reflow.
#[derive(Debug, PartialEq)]
-pub enum ReflowGoal {
- Full,
- TickAnimations,
+pub enum QueryMsg {
ContentBoxQuery(TrustedNodeAddress),
ContentBoxesQuery(TrustedNodeAddress),
NodeScrollIdQuery(TrustedNodeAddress),
@@ -124,19 +121,33 @@ pub enum ReflowGoal {
ElementInnerTextQuery(TrustedNodeAddress),
}
+/// Any query to perform with this reflow.
+#[derive(Debug, PartialEq)]
+pub enum ReflowGoal {
+ Full,
+ TickAnimations,
+ LayoutQuery(QueryMsg, u64),
+}
+
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::NodesFromPointQuery(..) | ReflowGoal::TextIndexQuery(..) |
- ReflowGoal::TickAnimations | ReflowGoal::ElementInnerTextQuery(_) |
- ReflowGoal::Full => true,
- ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) |
- ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) |
- ReflowGoal::NodeScrollIdQuery(_) |
- ReflowGoal::ResolvedStyleQuery(..) | ReflowGoal::OffsetParentQuery(_) |
- ReflowGoal::StyleQuery(_) => false,
+ ReflowGoal::Full | ReflowGoal::TickAnimations => true,
+ ReflowGoal::LayoutQuery(ref querymsg, _) => match querymsg {
+ &QueryMsg::NodesFromPointQuery(..) |
+ &QueryMsg::TextIndexQuery(..) |
+ &QueryMsg::ElementInnerTextQuery(_) => true,
+ &QueryMsg::ContentBoxQuery(_) |
+ &QueryMsg::ContentBoxesQuery(_) |
+ &QueryMsg::NodeGeometryQuery(_) |
+ &QueryMsg::NodeScrollGeometryQuery(_) |
+ &QueryMsg::NodeScrollIdQuery(_) |
+ &QueryMsg::ResolvedStyleQuery(..) |
+ &QueryMsg::OffsetParentQuery(_) |
+ &QueryMsg::StyleQuery(_) => false,
+ },
}
}
@@ -144,14 +155,20 @@ impl ReflowGoal {
/// false if a layout_thread display list is sufficient.
pub fn needs_display(&self) -> bool {
match *self {
- ReflowGoal::StyleQuery(_) | ReflowGoal::TextIndexQuery(..) |
- ReflowGoal::ContentBoxQuery(_) | ReflowGoal::ContentBoxesQuery(_) |
- ReflowGoal::NodeGeometryQuery(_) | ReflowGoal::NodeScrollGeometryQuery(_) |
- ReflowGoal::NodeScrollIdQuery(_) | ReflowGoal::ResolvedStyleQuery(..) |
- ReflowGoal::OffsetParentQuery(_) => false,
- ReflowGoal::NodesFromPointQuery(..) | ReflowGoal::Full |
- ReflowGoal::ElementInnerTextQuery(_) |
- ReflowGoal::TickAnimations => true,
+ ReflowGoal::Full | ReflowGoal::TickAnimations => true,
+ ReflowGoal::LayoutQuery(ref querymsg, _) => match querymsg {
+ &QueryMsg::NodesFromPointQuery(..) |
+ &QueryMsg::TextIndexQuery(..) |
+ &QueryMsg::ElementInnerTextQuery(_) => true,
+ &QueryMsg::ContentBoxQuery(_) |
+ &QueryMsg::ContentBoxesQuery(_) |
+ &QueryMsg::NodeGeometryQuery(_) |
+ &QueryMsg::NodeScrollGeometryQuery(_) |
+ &QueryMsg::NodeScrollIdQuery(_) |
+ &QueryMsg::ResolvedStyleQuery(..) |
+ &QueryMsg::OffsetParentQuery(_) |
+ &QueryMsg::StyleQuery(_) => false,
+ },
}
}
}