mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #9119 - TheKK:input_element_size, r=eefriedman
Parse size attribute of HTMLInputElemnt correctly Should fix #8773 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9119) <!-- Reviewable:end -->
This commit is contained in:
commit
64e968d8bc
4 changed files with 5058 additions and 6 deletions
|
@ -358,16 +358,21 @@ impl LayoutElementHelpers for LayoutJS<Element> {
|
||||||
|
|
||||||
let size = if let Some(this) = self.downcast::<HTMLInputElement>() {
|
let size = if let Some(this) = self.downcast::<HTMLInputElement>() {
|
||||||
// FIXME(pcwalton): More use of atoms, please!
|
// FIXME(pcwalton): More use of atoms, please!
|
||||||
// FIXME(Ms2ger): this is nonsense! Invalid values also end up as
|
|
||||||
// a text field
|
|
||||||
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("type")) {
|
match (*self.unsafe_get()).get_attr_val_for_layout(&ns!(), &atom!("type")) {
|
||||||
Some("text") | Some("password") => {
|
// Not text entry widget
|
||||||
|
Some("hidden") | Some("date") | Some("month") | Some("week") |
|
||||||
|
Some("time") | Some("datetime-local") | Some("number") | Some("range") |
|
||||||
|
Some("color") | Some("checkbox") | Some("radio") | Some("file") |
|
||||||
|
Some("submit") | Some("image") | Some("reset") | Some("button") => {
|
||||||
|
None
|
||||||
|
},
|
||||||
|
// Others
|
||||||
|
_ => {
|
||||||
match this.get_size_for_layout() {
|
match this.get_size_for_layout() {
|
||||||
0 => None,
|
0 => None,
|
||||||
s => Some(s as i32),
|
s => Some(s as i32),
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
_ => None,
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,8 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Unrecognized type should fallback as text type</title>
|
||||||
|
<link rel="match" href="unrecognized-type-should-fallback-as-text-type-ref.html">
|
||||||
|
<body>
|
||||||
|
<input type="text">
|
||||||
|
<input type="text">
|
||||||
|
</body>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<!doctype html>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<title>Unrecognized type should fallback as text type</title>
|
||||||
|
<link rel="match" href="unrecognized-type-should-fallback-as-text-type-ref.html">
|
||||||
|
<body>
|
||||||
|
<input>
|
||||||
|
<input type="unknown">
|
||||||
|
</body>
|
Loading…
Add table
Add a link
Reference in a new issue