aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2017-06-30 22:15:26 -0700
committerGitHub <noreply@github.com>2017-06-30 22:15:26 -0700
commitece35f9caa7c6882adf2927ca7d7ce2bc7d8cef8 (patch)
tree46e6f188b57b9776e90091113ca8c0faab69f1f1 /components
parent90cf19151a02f8ee72354e1d15640047478474cd (diff)
parent2aef2af9b839873a6961b3a3815776505f31cfe7 (diff)
downloadservo-ece35f9caa7c6882adf2927ca7d7ce2bc7d8cef8.tar.gz
servo-ece35f9caa7c6882adf2927ca7d7ce2bc7d8cef8.zip
Auto merge of #17581 - mbrubeck:incremental, r=pcwalton
Fix incremental layout bugs for absolute and cleared elements Fixes #17307. <del>There were two underlying bugs:</del> * <del>Nodes were not marked dirty when their style attribute changed.</del> * BaseFlow flags set during flow construction could get out of sync with the element's style if repair_style was called. --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #17307 - [x] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17581) <!-- Reviewable:end -->
Diffstat (limited to 'components')
-rw-r--r--components/layout/Cargo.toml2
-rw-r--r--components/layout/flow.rs23
-rw-r--r--components/style/servo/restyle_damage.rs2
3 files changed, 25 insertions, 2 deletions
diff --git a/components/layout/Cargo.toml b/components/layout/Cargo.toml
index 6b1ad9d2e6d..e3e2c76c2f4 100644
--- a/components/layout/Cargo.toml
+++ b/components/layout/Cargo.toml
@@ -12,7 +12,7 @@ path = "lib.rs"
[dependencies]
app_units = "0.5"
atomic_refcell = "0.1"
-bitflags = "0.7"
+bitflags = "0.8"
canvas_traits = {path = "../canvas_traits"}
euclid = "0.15"
fnv = "1.0"
diff --git a/components/layout/flow.rs b/components/layout/flow.rs
index f87fe4c9ef8..7d734bd1343 100644
--- a/components/layout/flow.rs
+++ b/components/layout/flow.rs
@@ -1115,6 +1115,28 @@ impl BaseFlow {
}
}
+ /// Update the 'flags' field when computed styles have changed.
+ ///
+ /// These flags are initially set during flow construction. They only need to be updated here
+ /// if they are based on properties that can change without triggering `RECONSTRUCT_FLOW`.
+ pub fn update_flags_if_needed(&mut self, style: &ServoComputedValues) {
+ // For absolutely-positioned flows, changes to top/bottom/left/right can cause these flags
+ // to get out of date:
+ if self.restyle_damage.contains(REFLOW_OUT_OF_FLOW) {
+ // Note: We don't need to check whether IS_ABSOLUTELY_POSITIONED has changed, because
+ // changes to the 'position' property trigger flow reconstruction.
+ if self.flags.contains(IS_ABSOLUTELY_POSITIONED) {
+ let logical_position = style.logical_position();
+ self.flags.set(INLINE_POSITION_IS_STATIC,
+ logical_position.inline_start == LengthOrPercentageOrAuto::Auto &&
+ logical_position.inline_end == LengthOrPercentageOrAuto::Auto);
+ self.flags.set(BLOCK_POSITION_IS_STATIC,
+ logical_position.block_start == LengthOrPercentageOrAuto::Auto &&
+ logical_position.block_end == LengthOrPercentageOrAuto::Auto);
+ }
+ }
+ }
+
/// Return a new BaseFlow like this one but with the given children list
pub fn clone_with_children(&self, children: FlowList) -> BaseFlow {
BaseFlow {
@@ -1361,6 +1383,7 @@ impl<'a> MutableFlowUtils for &'a mut Flow {
/// calling them individually, since there is no reason not to perform both operations.
fn repair_style_and_bubble_inline_sizes(self, style: &::StyleArc<ServoComputedValues>) {
self.repair_style(style);
+ mut_base(self).update_flags_if_needed(style);
self.bubble_inline_sizes();
}
diff --git a/components/style/servo/restyle_damage.rs b/components/style/servo/restyle_damage.rs
index b113300c5a2..0d3a4b00092 100644
--- a/components/style/servo/restyle_damage.rs
+++ b/components/style/servo/restyle_damage.rs
@@ -202,7 +202,7 @@ fn compute_damage(old: &ServoComputedValues, new: &ServoComputedValues) -> Servo
add_if_not_equal!(old, new, damage,
[REPAINT, REPOSITION, STORE_OVERFLOW, BUBBLE_ISIZES, REFLOW_OUT_OF_FLOW,
REFLOW, RECONSTRUCT_FLOW], [
- get_box.float, get_box.display, get_box.position, get_counters.content,
+ get_box.clear, get_box.float, get_box.display, get_box.position, get_counters.content,
get_counters.counter_reset, get_counters.counter_increment,
get_inheritedbox._servo_under_display_none,
get_list.quotes, get_list.list_style_type,