mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Makes layout respect <textarea> rows attribute
review addresssing
This commit is contained in:
parent
2c7f6076d1
commit
fc0748f50e
4 changed files with 44 additions and 6 deletions
|
@ -6,8 +6,8 @@
|
|||
//! `<input size>`, and so forth.
|
||||
|
||||
use node::{TElement, TElementAttributes, TNode};
|
||||
use properties::{BackgroundColorDeclaration, BorderBottomWidthDeclaration};
|
||||
use properties::{BorderLeftWidthDeclaration, BorderRightWidthDeclaration};
|
||||
use properties::{BackgroundColorDeclaration, BorderBottomWidthDeclaration, CSSFloat};
|
||||
use properties::{BorderLeftWidthDeclaration, BorderRightWidthDeclaration, HeightDeclaration};
|
||||
use properties::{BorderTopWidthDeclaration, SpecifiedValue, WidthDeclaration, specified};
|
||||
use selector_matching::{DeclarationBlock, Stylist};
|
||||
|
||||
|
@ -27,6 +27,7 @@ pub enum IntegerAttribute {
|
|||
/// `<input size>`
|
||||
SizeIntegerAttribute,
|
||||
ColsIntegerAttribute,
|
||||
RowsIntegerAttribute,
|
||||
}
|
||||
|
||||
/// Legacy presentational attributes that take a nonnegative integer as defined in HTML5 § 2.4.4.2.
|
||||
|
@ -164,7 +165,7 @@ impl PresentationalHintSynthesis for Stylist {
|
|||
name if *name == atom!("textarea") => {
|
||||
match element.get_integer_attribute(ColsIntegerAttribute) {
|
||||
Some(value) if value != 0 => {
|
||||
// TODO ServoCharacterWidth uses the size math for <input type="text">, but
|
||||
// TODO(mttr) ServoCharacterWidth uses the size math for <input type="text">, but
|
||||
// the math for <textarea> is a little different since we need to take
|
||||
// scrollbar size into consideration (but we don't have a scrollbar yet!)
|
||||
//
|
||||
|
@ -177,6 +178,19 @@ impl PresentationalHintSynthesis for Stylist {
|
|||
}
|
||||
Some(_) | None => {}
|
||||
}
|
||||
match element.get_integer_attribute(RowsIntegerAttribute) {
|
||||
Some(value) if value != 0 => {
|
||||
// TODO(mttr) This should take scrollbar size into consideration.
|
||||
//
|
||||
// https://html.spec.whatwg.org/multipage/rendering.html#textarea-effective-height
|
||||
let value = specified::Em(value as CSSFloat);
|
||||
matching_rules_list.vec_push(DeclarationBlock::from_declaration(
|
||||
HeightDeclaration(SpecifiedValue(specified::LPA_Length(
|
||||
value)))));
|
||||
*shareable = false
|
||||
}
|
||||
Some(_) | None => {}
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue