aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/layout/incremental.rs
diff options
context:
space:
mode:
authorJack Moffitt <jack@metajack.im>2014-08-28 09:34:23 -0600
committerJack Moffitt <jack@metajack.im>2014-09-08 20:21:42 -0600
commitc6ab60dbfc6da7b4f800c9e40893c8b58413960c (patch)
treed1d74076cf7fa20e4f77ec7cb82cae98b67362cb /src/components/layout/incremental.rs
parentdb2f642c32fc5bed445bb6f2e45b0f6f0b4342cf (diff)
downloadservo-c6ab60dbfc6da7b4f800c9e40893c8b58413960c.tar.gz
servo-c6ab60dbfc6da7b4f800c9e40893c8b58413960c.zip
Cargoify servo
Diffstat (limited to 'src/components/layout/incremental.rs')
-rw-r--r--src/components/layout/incremental.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/src/components/layout/incremental.rs b/src/components/layout/incremental.rs
deleted file mode 100644
index d04c068b6aa..00000000000
--- a/src/components/layout/incremental.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * 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 style::ComputedValues;
-
-bitflags! {
- #[doc = "Individual layout actions that may be necessary after restyling."]
- flags RestyleDamage: int {
- #[doc = "Repaint the node itself."]
- #[doc = "Currently unused; need to decide how this propagates."]
- static Repaint = 0x01,
-
- #[doc = "Recompute intrinsic inline_sizes (minimum and preferred)."]
- #[doc = "Propagates down the flow tree because the computation is"]
- #[doc = "bottom-up."]
- static BubbleISizes = 0x02,
-
- #[doc = "Recompute actual inline_sizes and block_sizes."]
- #[doc = "Propagates up the flow tree because the computation is"]
- #[doc = "top-down."]
- static Reflow = 0x04
- }
-}
-
-impl RestyleDamage {
- /// Elements of self which should also get set on any ancestor flow.
- pub fn propagate_up(self) -> RestyleDamage {
- self & Reflow
- }
-
- /// Elements of self which should also get set on any child flows.
- pub fn propagate_down(self) -> RestyleDamage {
- self & BubbleISizes
- }
-}
-
-// NB: We need the braces inside the RHS due to Rust #8012. This particular
-// version of this macro might be safe anyway, but we want to avoid silent
-// breakage on modifications.
-macro_rules! add_if_not_equal(
- ($old:ident, $new:ident, $damage:ident,
- [ $($effect:ident),* ], [ $($style_struct_getter:ident.$name:ident),* ]) => ({
- if $( ($old.$style_struct_getter().$name != $new.$style_struct_getter().$name) )||* {
- $damage.insert($($effect)|*);
- }
- })
-)
-
-pub fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> RestyleDamage {
- let mut damage = RestyleDamage::empty();
-
- // This checks every CSS property, as enumerated in
- // impl<'self> CssComputedStyle<'self>
- // in src/support/netsurfcss/rust-netsurfcss/netsurfcss.rc.
-
- // FIXME: We can short-circuit more of this.
-
- add_if_not_equal!(old, new, damage, [ Repaint ],
- [ get_color.color, get_background.background_color,
- get_border.border_top_color, get_border.border_right_color,
- get_border.border_bottom_color, get_border.border_left_color ]);
-
- add_if_not_equal!(old, new, damage, [ Repaint, BubbleISizes, Reflow ],
- [ get_border.border_top_width, get_border.border_right_width,
- get_border.border_bottom_width, get_border.border_left_width,
- get_margin.margin_top, get_margin.margin_right,
- get_margin.margin_bottom, get_margin.margin_left,
- get_padding.padding_top, get_padding.padding_right,
- get_padding.padding_bottom, get_padding.padding_left,
- get_box.position, get_box.width, get_box.height, get_box.float, get_box.display,
- get_font.font_family, get_font.font_size, get_font.font_style, get_font.font_weight,
- get_inheritedtext.text_align, get_text.text_decoration, get_inheritedbox.line_height ]);
-
- // FIXME: test somehow that we checked every CSS property
-
- damage
-}