diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | components/layout/Cargo.toml | 2 | ||||
-rw-r--r-- | components/layout/flow.rs | 23 | ||||
-rw-r--r-- | components/style/servo/restyle_damage.rs | 2 | ||||
-rw-r--r-- | tests/wpt/metadata-css/css21_dev/html4/dynamic-top-change-001.htm.ini | 3 | ||||
-rw-r--r-- | tests/wpt/mozilla/meta/MANIFEST.json | 25 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/css/incremental_position.html | 27 | ||||
-rw-r--r-- | tests/wpt/mozilla/tests/css/incremental_position_ref.html | 19 |
8 files changed, 97 insertions, 6 deletions
diff --git a/Cargo.lock b/Cargo.lock index 3769cb8c9b6..93ce649c032 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1415,7 +1415,7 @@ version = "0.0.1" dependencies = [ "app_units 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "bitflags 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)", "canvas_traits 0.0.1", "euclid 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", 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, diff --git a/tests/wpt/metadata-css/css21_dev/html4/dynamic-top-change-001.htm.ini b/tests/wpt/metadata-css/css21_dev/html4/dynamic-top-change-001.htm.ini deleted file mode 100644 index 286c394e934..00000000000 --- a/tests/wpt/metadata-css/css21_dev/html4/dynamic-top-change-001.htm.ini +++ /dev/null @@ -1,3 +0,0 @@ -[dynamic-top-change-001.htm] - type: reftest - expected: FAIL diff --git a/tests/wpt/mozilla/meta/MANIFEST.json b/tests/wpt/mozilla/meta/MANIFEST.json index 3bd8906353e..1983cb90056 100644 --- a/tests/wpt/mozilla/meta/MANIFEST.json +++ b/tests/wpt/mozilla/meta/MANIFEST.json @@ -2435,6 +2435,18 @@ {} ] ], + "css/incremental_position.html": [ + [ + "/_mozilla/css/incremental_position.html", + [ + [ + "/_mozilla/css/incremental_position_ref.html", + "==" + ] + ], + {} + ] + ], "css/incremental_text_color_a.html": [ [ "/_mozilla/css/incremental_text_color_a.html", @@ -7911,6 +7923,11 @@ {} ] ], + "css/incremental_position_ref.html": [ + [ + {} + ] + ], "css/incremental_text_color_ref.html": [ [ {} @@ -22808,6 +22825,14 @@ "3235e9662e37dc723364a1dd39e07157868dd290", "support" ], + "css/incremental_position.html": [ + "849f3f5ae1df8ecf3bcf3f1723b5a755afeb3316", + "reftest" + ], + "css/incremental_position_ref.html": [ + "67ab51b29fb015b82bf98942e2e886b3de5ea2cd", + "support" + ], "css/incremental_text_color_a.html": [ "1846e2691b150cd2eb0b126c6d8f68f47d683fab", "reftest" diff --git a/tests/wpt/mozilla/tests/css/incremental_position.html b/tests/wpt/mozilla/tests/css/incremental_position.html new file mode 100644 index 00000000000..5aeb71915c2 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/incremental_position.html @@ -0,0 +1,27 @@ +<!doctype html> +<html class="reftest-wait"> + <head> + <meta charset="utf-8"> + <title>Incremental absolute position test</title> + <link rel="match" href="incremental_position_ref.html"> + <style> + #rect { + position: absolute; + border: 1px solid red; + width: 40px; + height: 40px; + } + </style> + </head> + <body> + <div id="rect"></div> + <script> + window.onload = function() { + document.body.offsetWidth; // force layout + var e = document.getElementById("rect"); + e.style.left = "100px"; + document.documentElement.classList.remove('reftest-wait'); + }; + </script> + </body> +</html> diff --git a/tests/wpt/mozilla/tests/css/incremental_position_ref.html b/tests/wpt/mozilla/tests/css/incremental_position_ref.html new file mode 100644 index 00000000000..432b3e5bbe8 --- /dev/null +++ b/tests/wpt/mozilla/tests/css/incremental_position_ref.html @@ -0,0 +1,19 @@ +<!doctype html> +<html> + <head> + <meta charset="utf-8"> + <title>Incremental absolute position reference</title> + <style> + #rect { + position: absolute; + border: 1px solid red; + width: 40px; + height: 40px; + left: 100px; + } + </style> + </head> + <body> + <div id="rect"></div> + </body> +</html> |