mirror of
https://github.com/servo/servo.git
synced 2025-07-29 10:10:34 +01:00
Change LengthOrPercentageOrAuto to make use of NoCalcLength
This commit is contained in:
parent
590c9579f0
commit
bdb08b9a82
5 changed files with 35 additions and 42 deletions
|
@ -503,14 +503,12 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
};
|
||||
|
||||
if let Some(size) = size {
|
||||
let value = specified::Length::NoCalc(
|
||||
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size)));
|
||||
let value = specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(size));
|
||||
hints.push(from_declaration(
|
||||
PropertyDeclaration::Width(DeclaredValue::Value(
|
||||
specified::LengthOrPercentageOrAuto::Length(value)))));
|
||||
}
|
||||
|
||||
|
||||
let width = if let Some(this) = self.downcast::<HTMLIFrameElement>() {
|
||||
this.get_width()
|
||||
} else if let Some(this) = self.downcast::<HTMLImageElement>() {
|
||||
|
@ -536,7 +534,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
}
|
||||
LengthOrPercentageOrAuto::Length(length) => {
|
||||
let width_value = specified::LengthOrPercentageOrAuto::Length(
|
||||
specified::Length::NoCalc(specified::NoCalcLength::Absolute(length)));
|
||||
specified::NoCalcLength::Absolute(length));
|
||||
hints.push(from_declaration(
|
||||
PropertyDeclaration::Width(DeclaredValue::Value(width_value))));
|
||||
}
|
||||
|
@ -561,7 +559,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
}
|
||||
LengthOrPercentageOrAuto::Length(length) => {
|
||||
let height_value = specified::LengthOrPercentageOrAuto::Length(
|
||||
specified::Length::NoCalc(specified::NoCalcLength::Absolute(length)));
|
||||
specified::NoCalcLength::Absolute(length));
|
||||
hints.push(from_declaration(
|
||||
PropertyDeclaration::Height(DeclaredValue::Value(height_value))));
|
||||
}
|
||||
|
@ -583,14 +581,12 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
// scrollbar size into consideration (but we don't have a scrollbar yet!)
|
||||
//
|
||||
// https://html.spec.whatwg.org/multipage/#textarea-effective-width
|
||||
let value = specified::Length::NoCalc(
|
||||
specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols)));
|
||||
let value = specified::NoCalcLength::ServoCharacterWidth(specified::CharacterWidth(cols));
|
||||
hints.push(from_declaration(
|
||||
PropertyDeclaration::Width(DeclaredValue::Value(
|
||||
specified::LengthOrPercentageOrAuto::Length(value)))));
|
||||
}
|
||||
|
||||
|
||||
let rows = if let Some(this) = self.downcast::<HTMLTextAreaElement>() {
|
||||
match this.get_rows() {
|
||||
0 => None,
|
||||
|
@ -604,8 +600,7 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
|||
// TODO(mttr) This should take scrollbar size into consideration.
|
||||
//
|
||||
// https://html.spec.whatwg.org/multipage/#textarea-effective-height
|
||||
let value = specified::Length::NoCalc(
|
||||
specified::NoCalcLength::FontRelative(specified::FontRelativeLength::Em(rows as CSSFloat)));
|
||||
let value = specified::NoCalcLength::FontRelative(specified::FontRelativeLength::Em(rows as CSSFloat));
|
||||
hints.push(from_declaration(
|
||||
PropertyDeclaration::Height(DeclaredValue::Value(
|
||||
specified::LengthOrPercentageOrAuto::Length(value)))));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue