servo/components
bors-servo 6a6da9c2a4 Auto merge of #19471 - jonleighton:input-type, r=jdm
Expand InputType to cover all possible types

This came out of a conversation with nox in IRC:
https://mozilla.logbot.info/servo/20171201#c13946454-c13946594

The code I was working on which motivated this change is here:
https://github.com/servo/servo/pull/19461

Previously, InputType::Text was used to represent several different
values of the type attribute on an input element.

If an input element doesn't have a type attribute, or its type attribute
doesn't contain a recognised value, then the input's type defaults to
"text".

Before this change, there were a number of checks in the code which
directly looked at the type attribute. If those checks matched against
the value "text", then they were potentially buggy, since an input with
type=invalid should also behave like an input with type=text.

Rather than have every conditional which cares about the input type also
have to deal with invalid input types, we can convert the type attribute
to an InputType enum once, and then match against the enum.

A secondary benefit is that the compiler can tell us whether we've
missed branches in a match expression. While working on this I
discovered that the HTMLInputElement::value_mode() method misses a case
for inputs with type=hidden (this resulted in a failing WPT test
passing).

I've also implemented the Default trait for InputType, so we now only
have one place in the code which knows that InputType::Text is the
default, where previously there were several.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19471)
<!-- Reviewable:end -->
2017-12-06 14:16:04 -06:00
..
allocator FreeType: don’t use usable_size() as deallocation size 2017-10-30 18:22:30 +01:00
atoms Expand InputType to cover all possible types 2017-12-06 21:11:39 +01:00
bluetooth Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
bluetooth_traits Update WR (details below): 2017-10-16 16:33:24 +10:00
canvas style: Update cssparser to 0.23. 2017-12-05 10:01:37 +01:00
canvas_traits Auto merge of #19487 - Eijebong:bump, r=jdm 2017-12-05 10:31:16 -06:00
compositing WR update to 4595561c49939cb21be9554c1b85c244508bde73 2017-11-23 14:51:11 -05:00
config Update lazy_static to 1.0 2017-12-04 22:51:13 +01:00
constellation Use FetchCanceller for document loads 2017-11-22 14:06:27 -08:00
debugger
deny_public_fields
devtools Update cookie to 0.10 2017-11-24 10:49:14 +01:00
devtools_traits Update cookie to 0.10 2017-11-24 10:49:14 +01:00
dom_struct Replace all uses of the heapsize crate with malloc_size_of. 2017-10-18 22:20:37 +11:00
domobject_derive
fallible Update smallvec to 0.6 2017-12-05 12:03:20 +01:00
geometry Replace all uses of the heapsize crate with malloc_size_of. 2017-10-18 22:20:37 +11:00
gfx style: Make all keywords CamelCase for consistency. 2017-12-06 02:35:10 +01:00
gfx_traits Auto merge of #18921 - mrobinson:incremental-stacking-context-ids, r=emilio 2017-10-18 21:34:23 -05:00
hashglobe hashglobe: Dump more information if out of memory while allocating a table. 2017-12-06 16:37:14 +08:00
jstraceable_derive
layout style: Make all keywords CamelCase for consistency. 2017-12-06 02:35:10 +01:00
layout_thread Update lazy_static to 1.0 2017-12-04 22:51:13 +01:00
layout_traits Update WR (details below): 2017-10-16 16:33:24 +10:00
malloc_size_of Update smallvec to 0.6 2017-12-05 12:03:20 +01:00
malloc_size_of_derive Overhaul MallocSizeOf and related things. 2017-09-12 12:37:51 +10:00
metrics added navigation start for interactive metrics 2017-11-14 15:21:35 +00:00
msg Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
net Auto merge of #19487 - Eijebong:bump, r=jdm 2017-12-05 10:31:16 -06:00
net_traits Update lazy_static to 1.0 2017-12-04 22:51:13 +01:00
nonzero Replace NonZeroU32 and NonZeroUsize with a generic NonZero 2017-10-16 20:19:19 +02:00
profile added time to interactive metrics, refactored metrics to use traits 2017-10-24 21:02:56 +01:00
profile_traits added time to interactive metrics, refactored metrics to use traits 2017-10-24 21:02:56 +01:00
rand Update lazy_static to 1.0 2017-12-04 22:51:13 +01:00
range Replace all uses of the heapsize crate with malloc_size_of. 2017-10-18 22:20:37 +11:00
remutex Update lazy_static to 1.0 2017-12-04 22:51:13 +01:00
script Auto merge of #19471 - jonleighton:input-type, r=jdm 2017-12-06 14:16:04 -06:00
script_layout_interface style: Make all keywords CamelCase for consistency. 2017-12-06 02:35:10 +01:00
script_plugins Make the unrooted_must_root conditional on a default Cargo feature. 2017-11-02 15:08:04 +01:00
script_traits Update cookie to 0.10 2017-11-24 10:49:14 +01:00
selectors Update smallvec to 0.6 2017-12-05 12:03:20 +01:00
servo WR update to 4595561c49939cb21be9554c1b85c244508bde73 2017-11-23 14:51:11 -05:00
servo_arc servo_arc: Add some #[inline] and repr(C) annotations. 2017-12-01 14:34:38 +01:00
size_of_test
style style: Make all keywords CamelCase for consistency. 2017-12-06 02:35:10 +01:00
style_derive style: Remove mozmm CSS unit. 2017-11-14 14:25:40 +01:00
style_traits style: Update cssparser to 0.23. 2017-12-05 10:01:37 +01:00
url Replace all uses of the heapsize crate with malloc_size_of. 2017-10-18 22:20:37 +11:00
webdriver_server Update cookie to 0.10 2017-11-24 10:49:14 +01:00
webvr Update WR (details below): 2017-10-16 16:33:24 +10:00
webvr_traits Update WR (details below): 2017-10-16 16:33:24 +10:00