From 392afdb014246bf1824b8d5682c6e61a62cc9036 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 28 Mar 2014 13:20:45 -0700 Subject: [PATCH] layout: Implement `-servo-minimum-line-height` --- src/components/main/layout/box_.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/components/main/layout/box_.rs b/src/components/main/layout/box_.rs index a3da48433bd..a36b3048406 100644 --- a/src/components/main/layout/box_.rs +++ b/src/components/main/layout/box_.rs @@ -656,11 +656,13 @@ impl Box { } pub fn calculate_line_height(&self, font_size: Au) -> Au { - match self.line_height() { + let from_inline = match self.style().InheritedBox.get().line_height { line_height::Normal => font_size.scale_by(1.14), line_height::Number(l) => font_size.scale_by(l), line_height::Length(l) => l - } + }; + let minimum = self.style().InheritedBox.get()._servo_minimum_line_height; + Au::max(from_inline, minimum) } /// Populates the box model border parameters from the given computed style. @@ -888,10 +890,6 @@ impl Box { self.style().InheritedText.get().text_align } - pub fn line_height(&self) -> line_height::T { - self.style().InheritedBox.get().line_height - } - pub fn vertical_align(&self) -> vertical_align::T { self.style().Box.get().vertical_align } @@ -944,15 +942,6 @@ impl Box { } } - /// Returns true if this element is replaced content. This is true for images, form elements, - /// and so on. - pub fn is_replaced(&self) -> bool { - match self.specific { - ImageBox(..) => true, - _ => false, - } - } - /// Returns true if this element can be split. This is true for text boxes. pub fn can_split(&self) -> bool { match self.specific {