Commit graph

423 commits

Author SHA1 Message Date
bors-servo
099beee85c Auto merge of #8983 - Manishearth:cursors, r=jdm
Various textinput fixes

 - Currently the cursor sticks around if you click elsewhere. Now the text inputs are relayout-ed on blur.
 - Currently whitespace gets collapsed in text input (https://github.com/servo/servo/issues/8772). Not anymore.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8983)
<!-- Reviewable:end -->
2016-01-11 23:21:03 +05:30
rohan.prinja
1f02c4ebbb task -> thread 2016-01-10 17:58:13 +09:00
Brandon Fairchild
fb0304cfdb Rename fire_simple_event_params to fire_event
Fixes #9180.
2016-01-07 13:49:49 -05:00
Manish Goregaokar
f67e208630 Remove virtual call and unconditionally dirty node on set_focus_state 2016-01-07 13:38:05 +05:30
Guillaume Gomez
99ac1a81cc Generate PartialEq automatically 2016-01-03 18:07:09 +01:00
Manish Goregaokar
23e7dfa57b Relayout text input elements on blur 2016-01-03 13:18:24 +05:30
bors-servo
7f156b8c12 Auto merge of #9072 - Manishearth:password-placeholder, r=eefriedman
Fix placeholders for password inputs

currently they show dots instead of the placeholder text

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9072)
<!-- Reviewable:end -->
2016-01-03 10:21:26 +05:30
Manish Goregaokar
cc5844a373 Move placeholder logic out of get_raw_textinput_value 2016-01-03 09:47:30 +05:30
bors-servo
9da739acef Auto merge of #9123 - karyon:clippy_cleanup, r=Manishearth
Fix a bunch of clippy lints

This fixes about 130 clippy lints. Let me know if i should split up the commit.

I wasn't sure about some of the changes, especially map_or instead of map(...).unwrap_or(...) and if let instead of single arm match were not always a strict improvement in my opinion, but i'll leave that decision to the reviewer :)

There are about 150 lints left which i thought were clippy bugs or i didn't know how to fix.

cc @Manishearth

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9123)
<!-- Reviewable:end -->
2016-01-03 09:16:34 +05:30
Iszak Bryan
603d0a54ea Use atom's for matching to gain performance benefits 2016-01-03 00:13:52 +00:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
Chad Kimes
0e663e0f2f De-duplicate input event send code 2016-01-02 11:31:22 -05:00
Chad Kimes
12a0884f51 Add 'input' event for HTMLInputElement 2016-01-02 11:07:12 -05:00
Manish Goregaokar
6a0ec85d43 Fix placeholders for password inputs
currently they show dots
2015-12-27 00:18:06 +05:30
bors-servo
89ab368258 Auto merge of #8506 - nox:finish-ranges, r=dzbarsky
Properly propagate changes when range or trees are mutated

Does the same thing as #6817, but storing Range instances directly in their start and end containers.

Cc @dzbarsky

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8506)
<!-- Reviewable:end -->
2015-12-26 04:08:15 +05:30
Arthur Skobara
d38771e270 Implement EventTarget::fire_simple_event and EventTarget::fire_simple_event_params 2015-12-22 13:47:57 +06:00
Keith Yeung
3395e54585 Implement basic framework for static and interactive validation on forms 2015-12-15 16:34:42 -08:00
Arthur Skobara
8d2f9fc586 Add comments for the "Constructing the form data set" algorithm 2015-12-14 08:37:30 +06:00
Anthony Ramine
8f01790f06 Introduce UnbindContext
This holds the context that describes the original node that was removed from a tree
when unbinding from a tree.
2015-12-13 21:14:31 +01:00
Corey Farwell
4accaf50b2 Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s
everywhere, which can cause unnecessary allocations to occur since
they'll end up as `Atom`s anyways.
2015-12-10 23:47:25 -05:00
Tomas Cernaj
5507be2653 Move ScriptMsg from msg crate into script_traits 2015-12-09 20:50:11 +01:00
bors-servo
63762d2b52 Auto merge of #8786 - eefriedman:localname-atom, r=jdm
Remove unnecessary conversion to/from DOMString for localName.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8786)
<!-- Reviewable:end -->
2015-12-03 15:05:22 +05:30
Sam Gibson
9668500e97 Makes setting negative values to maxLength throw an IndexSize exception 2015-12-03 14:00:59 +11:00
Sam Gibson
6d1624f9d0 Add additional WPT tests for maxlength parser set 2015-12-03 14:00:57 +11:00
Sam Gibson
85b99f8ba4 Fix typo in error message 2015-12-03 14:00:56 +11:00
Sam Gibson
ecc7035de6 Correct the default max length 2015-12-03 14:00:55 +11:00
Sam Gibson
eecdfdf6c1 Makes int_getter macro, and uses -1 as default maxlength instead of maxint 2015-12-03 14:00:52 +11:00
Sam Gibson
d26c555e2a Adds support for input element's maxlength attr
servo/servo#7320
servo/servo#7004
2015-12-03 14:00:51 +11:00
Eli Friedman
e42dcb3712 Remove unnecessary conversion to/from DOMString for localName. 2015-12-02 13:42:45 -08:00
Eli Friedman
c02c0576c8 Compute attribute name atoms at compile-time. 2015-11-27 15:42:34 -08:00
Alan Jeffrey
3dec6edd10 Update string_cache to 0.2.
Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
2015-11-25 10:13:21 -06:00
Keith Yeung
19294db6e5 Split ConstellationMsg into ScriptMsg and CompositorMsg 2015-11-16 23:10:53 -08:00
Corey Farwell
7b8d5bbb97 Prefer atoms over strs for string comparisons 2015-11-12 23:46:48 -05:00
Alan Jeffrey
5db67b5981 Added in-place mutation to DOMString.
The methods which are currently implemented are the ones on String that are currently being used:
string.push_str(...), string.clear() and string.extend(...). We may want to revisit this API.
2015-11-12 17:53:01 -06:00
Alan Jeffrey
84bde75b42 Replaced DOMString constructor by conversion functions.
Replaced DOMString(...) by DOMString::from(...).
Replaced ....0 by String::from(...).
Removed any uses of .to_owner() in DOMString::from("...").
2015-11-12 17:52:59 -06:00
Sylvester Willis
4adf502846 Added call to event.PreventDefault on html text inputs and textareas.
This change should prevent page scrolling when up/down buttons are pressed.
2015-11-07 20:51:16 -05:00
Corey Farwell
606d4cf443 'type' attribute on HTMLInputElement should be stored as an Atom
Fixes #8180
2015-11-06 21:07:01 -05:00
Ms2ger
6b75078503 Make DOMString a newtype around String, rather than a typedef.
This should make it somewhat easier to experiment with alternative
representations in the future. To reduce churn, this commit leaves the String
field public, though.

Also, this will allow us to use the default String type to represent the IDL
USVString type, which explicitly forbids unpaired surrogates, ans as such is
a better match to the Rust String type.
2015-11-04 12:09:11 +01:00
Ms2ger
e6aa976462 Use DOMString::new() somewhat consistently. 2015-11-04 12:09:10 +01:00
David Zbarsky
722aa86c89 Get rid of a bunch of explicit derefs 2015-11-03 19:51:46 -08:00
bors-servo
e91169c0e2 Auto merge of #8265 - fiji-flo:password_caret, r=eefriedman
add get_raw_layout_value (HTMLInputElementHelpers)

This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8265)
<!-- Reviewable:end -->
2015-11-04 05:29:59 +05:30
Florian Merz
a918df9e6f change comments to complete sentences 2015-11-03 23:53:34 +01:00
Florian Merz
c26b80cf4f add get_insertion_point_index_for_layout
This resolves #8107
Previously the index of the insetion point for a password input was
calculated using the scrambled string based on the edit point in the
raw string. That could lead to a wrong position of the caret. This
commit changes this behavior to calculate the insertion point using
the raw string.
This is done in
`HTMLInputElementHelpers::get_insertion_point_index_for_layout`
and relies on a 1:1 mapping of the chars in the raw input to the
scrambled chars (currently bullets) in the password input.
2015-11-03 21:55:41 +01:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
Ms2ger
0dacd33102 Remove RawLayoutHTMLInputElementHelpers. 2015-11-02 11:42:39 +01:00
bors-servo
35b452660b Auto merge of #8193 - dzbarsky:event_type, r=nox
Use an Atom for Event.type

Depends on https://github.com/servo/string-cache/pull/113

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8193)
<!-- Reviewable:end -->
2015-11-02 05:57:28 +05:30
David Zbarsky
0070adb71f Use an Atom for Event.type 2015-11-01 09:42:11 -08:00
Corey Farwell
9df375195e Implement 'labels' attribute on 'labelable elements' 2015-11-01 09:50:14 -05:00
Bobby Holley
79ac365a68 Move EventState to rust-selectors. 2015-10-30 21:02:35 -07:00
Bobby Holley
f7f27a8146 Hoist checked and indeterminate state into EventState.
This is necessary for those selectors to take advantage of restyle hints.
2015-10-30 21:01:50 -07:00