servo: Merge #5836 - style: Disregard the `size` attribute for input elements other than text or password fields (from pcwalton:input-size); r=mbrubeck

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.

r? @mbrubeck

Source-Repo: https://github.com/servo/servo
Source-Revision: f010c8331304dcdd40f40fe844087399078532d0
This commit is contained in:
Patrick Walton 2015-04-24 20:06:41 -05:00
Родитель ef6fbba28f
Коммит 27d72a281c
2 изменённых файлов: 16 добавлений и 18 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -4,7 +4,7 @@ textarea { background: white; min-height: 1.0em; padding: 0em; pa
button,
input[type="button"],
input[type="submit"],
input[type="reset"] { background: lightgrey; border-top: solid 1px #EEEEEE; border-left: solid 1px #CCCCCC; border-right: solid 1px #999999; border-bottom: solid 1px #999999; text-align: center; vertical-align: middle; color: black; width: 100%; }
input[type="reset"] { background: lightgrey; border-top: solid 1px #EEEEEE; border-left: solid 1px #CCCCCC; border-right: solid 1px #999999; border-bottom: solid 1px #999999; text-align: center; vertical-align: middle; color: black; }
input[type="hidden"] { display: none !important }
input[type="checkbox"],
input[type="radio"] { font-family: monospace !important; border: none !important; background: transparent; }