Commit graph

147 commits

Author SHA1 Message Date
UK992
93a103ba73 Reorder use statements 2016-09-09 04:55:19 +02:00
Kuba Birecki
85f4da18a6 Inline DOM element creation into box expressions in components/script/dom/ 2016-07-14 08:44:22 +02:00
Connor Brewster
5f7324a9a5 Make all task source runnables cancellable
Implement all Runnable methods on CancellableRunnable to redirect to their inner runnable
2016-07-13 09:59:51 -06:00
Ms2ger
684510bc94 Stop re-exporting AttrValue. 2016-06-07 13:15:23 +02:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Ms2ger
cc2b2b50a7 Remove ConstellationChan.
It's a pointless abstraction that propagates the obsolete chan terminology,
swaps the order in which the sender and receiver are returned, and hides a
source of panics.
2016-05-19 17:13:44 +02:00
Per Lundberg
2f7ed1d73e Removed unused imports
This fixes #11185.
2016-05-15 22:24:26 +03:00
Keith Yeung
f60de52aae Fire 'select' event in SetSelectionRange 2016-05-12 10:44:04 -04:00
Keith Yeung
cc049515dc Implement user interaction task source 2016-05-11 10:12:25 -04:00
bors-servo
ac8406f4ae Auto merge of #10834 - yoava333:master, r=SimonSapin
added support for :read-only and :read-write pseudo-classes

partial fix for https://github.com/servo/servo/issues/10732

It's not a full fix because:
1. there's a bug in wpt-test https://github.com/w3c/web-platform-tests/issues/2889#issuecomment-214144420
2. we don't fully support all input types (namely image, color, hidden and range), which are defaulted to input text. this means that :read-write which is applicable to input text is mis-handled in those cases.
3. we don't support contenteditable, which is also possibly :read-write

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10834)
<!-- Reviewable:end -->
2016-04-29 08:12:18 -07:00
Ms2ger
897be5f6ee Reduce channel cloning. 2016-04-29 14:55:52 +02:00
Matt Brubeck
c4872d9544 Replace range::Range with std::ops::Range in script 2016-04-28 14:54:07 -07:00
Matt Brubeck
659305fe0a Use byte indices instead of char indices for text runs
Replace character indices with UTF-8 byte offsets throughout the code dealing
with text shaping and breaking.  This eliminates a lot of complexity when
converting from one to the other, and interoperates better with the rest of
the Rust ecosystem.
2016-04-28 14:32:14 -07:00
Yoav Alon
9bf909ac2f added support for :read-only and :read-write pseudo-classes
partial fix for https://github.com/servo/servo/issues/10732
2016-04-27 01:38:58 +03:00
Alberto Corona
5e863f2eb8
Implement HTMLTextArea.setSelectionRange 2016-04-17 17:27:26 +02:00
Corey Farwell
11a3ce1257 Remove get_* on getters as per RFC 0344.
https://github.com/rust-lang/rfcs/blob/master/text/0344-conventions-galore.md#gettersetter-apis

https://github.com/servo/servo/issues/6224
2016-04-10 22:49:35 -04:00
bors-servo
0489280ded Auto merge of #10347 - mbrubeck:incremental-selection, r=pcwalton
Fix incremental reflow of text selection changes

r? @emilio or @pcwalton

CC @paulrouget: This fixes a bug in the browser.html URL bar auto-completion.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10347)
<!-- Reviewable:end -->
2016-04-02 19:54:50 +05:30
Matt Brubeck
776aae6399 Fix incremental reflow of text selection changes
Also replace force_relayout methods with direct Node::dirty calls, for
clarity.
2016-04-01 22:00:05 -07:00
Corey Farwell
ef3c830e61 Add a spec links for <textarea> magic number constants. 2016-03-31 23:42:03 -04:00
Matt Brubeck
6171000875 Highlight selected text in input fields
Fixes #9993.  This does not yet allow stylesheets to set the selection colors;
instead it uses a hard-coded orange background and white foreground.
2016-03-24 18:33:26 -07:00
Sagar Muchhal
051ffba0e5 Implement initial pieces of form validation. 2016-03-24 09:07:38 -04:00
Emilio Cobos Álvarez
a1c830f1c1 Update rust-selectors
This commits updates rust-selectors to use the generic parser, and as
such it moves the element state into the style crate.
2016-02-03 02:11:31 +01:00
Manish Goregaokar
23e7dfa57b Relayout text input elements on blur 2016-01-03 13:18:24 +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
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
Corey Farwell
3eb585f547 Remove fields with parsed attribute values on HTMLTextAreaElement
https://github.com/servo/servo/issues/7863
2015-12-30 12:27:13 -08: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
Arthur Skobara
8acb21a594 Remove from Trusted::new an unnecessary argument 2015-12-12 22:31:19 +06: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
Keith Yeung
8d90034d29 Split fn script_chan into 5 different task channel fn 2015-12-06 12:12:14 -08: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
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
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
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
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09: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