diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-14 12:08:34 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2019-01-14 16:10:27 +0100 |
commit | 059c9f4f7880a747c889d0b277b68edebb58e77a (patch) | |
tree | ff20769d573b6e6de941ed1ffe4caf92f1addbd8 /components/layout/construct.rs | |
parent | b9b70445cb0525f7efd7f40894c3ba941968521b (diff) | |
download | servo-059c9f4f7880a747c889d0b277b68edebb58e77a.tar.gz servo-059c9f4f7880a747c889d0b277b68edebb58e77a.zip |
Remove ComputedValueUtils
Diffstat (limited to 'components/layout/construct.rs')
-rw-r--r-- | components/layout/construct.rs | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/components/layout/construct.rs b/components/layout/construct.rs index a0bfcfd074e..8df40d5b893 100644 --- a/components/layout/construct.rs +++ b/components/layout/construct.rs @@ -1015,7 +1015,7 @@ impl<'a, ConcreteThreadSafeLayoutNode: ThreadSafeLayoutNode> } let node_style = node.style(self.style_context()); - if is_empty && node_style.has_padding_or_border() { + if is_empty && has_padding_or_border(&node_style) { // An empty inline box needs at least one fragment to draw its background and borders. let info = SpecificFragmentInfo::UnscannedText(Box::new( UnscannedTextFragmentInfo::new(Box::<str>::from(""), None), @@ -2191,26 +2191,19 @@ where ) } -/// Convenience methods for computed CSS values -trait ComputedValueUtils { - /// Returns true if this node has non-zero padding or border. - fn has_padding_or_border(&self) -> bool; -} - -impl ComputedValueUtils for ComputedValues { - fn has_padding_or_border(&self) -> bool { - let padding = self.get_padding(); - let border = self.get_border(); - - !padding.padding_top.is_definitely_zero() || - !padding.padding_right.is_definitely_zero() || - !padding.padding_bottom.is_definitely_zero() || - !padding.padding_left.is_definitely_zero() || - border.border_top_width.px() != 0. || - border.border_right_width.px() != 0. || - border.border_bottom_width.px() != 0. || - border.border_left_width.px() != 0. - } +/// Returns true if this node has non-zero padding or border. +fn has_padding_or_border(values: &ComputedValues) -> bool { + let padding = values.get_padding(); + let border = values.get_border(); + + !padding.padding_top.is_definitely_zero() || + !padding.padding_right.is_definitely_zero() || + !padding.padding_bottom.is_definitely_zero() || + !padding.padding_left.is_definitely_zero() || + border.border_top_width.px() != 0. || + border.border_right_width.px() != 0. || + border.border_bottom_width.px() != 0. || + border.border_left_width.px() != 0. } /// Maintains a stack of anonymous boxes needed to ensure that the flow tree is *legal*. The tree |