aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/legacy.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2015-04-24 17:32:05 -0700
committerPatrick Walton <pcwalton@mimiga.net>2015-04-24 17:33:53 -0700
commit79336d21b530a3fc553fa75554dc668f3f5c7349 (patch)
treee3ecc2b5cc221974301c6b1556536f0f19d9f3e8 /components/style/legacy.rs
parent211ee668fae7f619ac7e09abd776a6f45fc40052 (diff)
downloadservo-79336d21b530a3fc553fa75554dc668f3f5c7349.tar.gz
servo-79336d21b530a3fc553fa75554dc668f3f5c7349.zip
style: Disregard the `size` attribute for input elements other than text
or password fields. HTML5 § 4.10.5.3.2 doesn't explicitly say to do this, but all other browser engines seem to do it. Improves the Google home page.
Diffstat (limited to 'components/style/legacy.rs')
-rw-r--r--components/style/legacy.rs32
1 files changed, 15 insertions, 17 deletions
diff --git a/components/style/legacy.rs b/components/style/legacy.rs
index 7ddee2f8a0d..2ce112a2f3a 100644
--- a/components/style/legacy.rs
+++ b/components/style/legacy.rs
@@ -167,25 +167,23 @@ impl PresentationalHintSynthesis for Stylist {
shareable);
}
name if *name == atom!("input") => {
- match element.get_integer_attribute(IntegerAttribute::Size) {
- Some(value) if value != 0 => {
- // Per HTML 4.01 § 17.4, this value is in characters if `type` is `text` or
- // `password` and in pixels otherwise.
- //
- // FIXME(pcwalton): More use of atoms, please!
- let value = match element.get_attr(&ns!(""), &atom!("type")) {
- Some("text") | Some("password") => {
- specified::Length::ServoCharacterWidth(specified::CharacterWidth(value))
+ // FIXME(pcwalton): More use of atoms, please!
+ match element.get_attr(&ns!(""), &atom!("type")) {
+ Some("text") | Some("password") => {
+ match element.get_integer_attribute(IntegerAttribute::Size) {
+ Some(value) if value != 0 => {
+ let value = specified::Length::ServoCharacterWidth(
+ specified::CharacterWidth(value));
+ matching_rules_list.vec_push(from_declaration(
+ PropertyDeclaration::Width(SpecifiedValue(
+ specified::LengthOrPercentageOrAuto::Length(value)))));
+ *shareable = false
}
- _ => specified::Length::Absolute(Au::from_px(value as isize)),
- };
- matching_rules_list.vec_push(from_declaration(
- PropertyDeclaration::Width(SpecifiedValue(
- specified::LengthOrPercentageOrAuto::Length(value)))));
- *shareable = false
+ Some(_) | None => {}
+ }
}
- Some(_) | None => {}
- }
+ _ => {}
+ };
}
name if *name == atom!("textarea") => {
match element.get_integer_attribute(IntegerAttribute::Cols) {