Commit graph

492 commits

Author SHA1 Message Date
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
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
bb2536cd01 move Castable into dom::bindings::inheritance 2015-10-30 20:24:42 +09:00
Anthony Ramine
68014af78e Clean up the cast calls 2015-10-21 11:40:34 +02:00
Anthony Ramine
13ea3ac413 Introduce trait Castable
This trait is used to hold onto the downcast and upcast functions of all
castable IDL interfaces. A castable IDL interface is one which either derives
from or is derived by other interfaces.

The deriving relation is represented by implementations of marker trait
DerivedFrom<T: Castable> generated in InheritTypes.

/^[ ]*use dom::bindings::codegen::InheritTypes::.*(Base|Cast|Derived)/ {
    /::[a-zA-Z]+(Base|Cast|Derived);/d
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/([{ ])[a-zA-Z]+(Base|Cast|Derived), /\1/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    s/, [a-zA-Z]+(Base|Cast|Derived)([},])/\2/g
    /\{([a-zA-Z]+(Base|Cast|Derived))?\};$/d
    s/\{([a-zA-Z_]+)\};$/\1;/
}

s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.upcast::<\1>()/g
s/([a-zA-Z]+)Cast::from_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.upcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::from_ref\)/\(Castable::upcast::<\1>\)/g

s/([a-zA-Z]+)Cast::from_root/Root::upcast::<\1>/g

s/([a-zA-Z]+)Cast::from_layout_js\(\&([a-zA-Z_.]+)\)/\2.upcast::<\1>()/g

s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.r\(\))?\)/\2.downcast::<\1>()/g
s/([a-zA-Z]+)Cast::to_ref\(\&?\**([a-zA-Z_]+)(\.[a-zA-Z_]+\(\))?\)/\2\3.downcast::<\1>()/g
s/\(([a-zA-Z]+)Cast::to_ref\)/\(Castable::downcast::<\1>\)/g

s/([a-zA-Z]+)Cast::to_root/Root::downcast::<\1>/g

s/([a-zA-Z]+)Cast::to_layout_js\(&?([a-zA-Z_.]+(\(\))?)\)/\2.downcast::<\1>()/g

s/\.is_document\(\)/.is::<Document>()/g
s/\.is_htmlanchorelement\(\)/.is::<HTMLAnchorElement>()/g
s/\.is_htmlappletelement\(\)/.is::<HTMLAppletElement>()/g
s/\.is_htmlareaelement\(\)/.is::<HTMLAreaElement>()/g
s/\.is_htmlbodyelement\(\)/.is::<HTMLBodyElement>()/g
s/\.is_htmlembedelement\(\)/.is::<HTMLEmbedElement>()/g
s/\.is_htmlfieldsetelement\(\)/.is::<HTMLFieldSetElement>()/g
s/\.is_htmlformelement\(\)/.is::<HTMLFormElement>()/g
s/\.is_htmlframesetelement\(\)/.is::<HTMLFrameSetElement>()/g
s/\.is_htmlhtmlelement\(\)/.is::<HTMLHtmlElement>()/g
s/\.is_htmlimageelement\(\)/.is::<HTMLImageElement>()/g
s/\.is_htmllegendelement\(\)/.is::<HTMLLegendElement>()/g
s/\.is_htmloptgroupelement\(\)/.is::<HTMLOptGroupElement>()/g
s/\.is_htmloptionelement\(\)/.is::<HTMLOptionElement>()/g
s/\.is_htmlscriptelement\(\)/.is::<HTMLScriptElement>()/g
s/\.is_htmltabledatacellelement\(\)/.is::<HTMLTableDataCellElement>()/g
s/\.is_htmltableheadercellelement\(\)/.is::<HTMLTableHeaderCellElement>()/g
s/\.is_htmltablerowelement\(\)/.is::<HTMLTableRowElement>()/g
s/\.is_htmltablesectionelement\(\)/.is::<HTMLTableSectionElement>()/g
s/\.is_htmltitleelement\(\)/.is::<HTMLTitleElement>()/g
2015-10-21 11:37:16 +02:00
Adam Szopa
88991013ab Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
Leo Lahti
89e8a26539 Removed unsafe from 'query_selector_iter' 2015-10-20 09:11:06 +03:00
bors-servo
1a376aa75d Auto merge of #8060 - nox:deref-js, r=Ms2ger
Implement Deref<Target=T> for JS<T> where T: Reflectable

We can only borrow `JS<T>` from rooted things, so it's safe to deref it.
The only types that provide mutable `JS<T>` things are `MutHeap<JS<T>>` and
`MutNullableHeap<JS<T>>`, which don't actually expose that they contain
`JS<T>` values.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8060)
<!-- Reviewable:end -->
2015-10-19 06:32:05 -06:00
Anthony Ramine
e8f358d178 Do not root InputActivationState::checked_radio 2015-10-19 09:36:58 +02:00
Anthony Ramine
409b5e3695 Return a reference in Document::window() 2015-10-19 09:36:52 +02:00
Bobby Holley
75ec093334 Move Event States to |Element|.
Conceptually they belong there, rather than on |Node|.

Fixes #7934.
2015-10-16 17:56:31 -07:00
Eli Friedman
88a1cbb28b Stop implementing Copy for JS<T>.
A copy of a JS<T> doesn't have the rooting properties of the original,
so it makes no sense for it to implement Copy.
2015-10-15 14:02:45 -07:00
Anthony Ramine
7d6ea83479 Explicitly customise flags of new nodes where needed
Given codegen now generates the various TypeId enums, it seems pointless to
still have to write their respective values in every DOM struct inheriting from
Node just to set the initial IS_IN_DOC flag in Document and IN_ENABLED_STATE in
form controls.
2015-10-15 17:30:41 +02:00
Anthony Ramine
617fc08783 Generate all Derived implementations in codegen 2015-10-14 22:04:20 +02:00
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Corey Farwell
9b68d715de Explicitly place '/' before fragment for multipage spec links
This prevents us from 301 redirecting, which could cause the fragment to
get lost
2015-10-10 12:07:10 -04:00
Corey Farwell
85f2b6fc5b Replace usage of old-style WHATWG spec links 2015-10-10 11:55:09 -04:00
bors-servo
94dc98717b Auto merge of #7892 - anthgur:form-data-refactor, r=jdm
Refactor html form dataset collection

Factor out FormDatum collection for `<input>`
Improve early return logic for getting the FormDatum from an `<input>`
Condense element type patterns

Proposed to close #7851

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7892)
<!-- Reviewable:end -->
2015-10-07 08:32:44 -06:00
Anthony Urena
31980a7a34 Refactor html form dataset collection
Factor out FormDatum collection for <input>
Improve early return logic for getting the FormDatum from an <input>
Condense element type patterns
2015-10-07 10:22:02 -04:00
Maciej Skrzypkowski
7a5390d936 Removed unneeded pub annotations in HTMLInputElement #7897
get_size method appeared to be never used so I removed it.
2015-10-07 11:24:49 +02:00
bors-servo
e9842b7db2 Auto merge of #7777 - KiChjang:caseless-group-name-match, r=jdm
Add support for caseless group name matching in HTML input elements

Fixes #7749

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7777)
<!-- Reviewable:end -->
2015-10-02 13:26:05 -06:00
Keith Yeung
5c9a25d46b Add support for caseless group name matching in HTML input elements 2015-10-02 10:41:02 -07:00
bors-servo
94e85a5226 Auto merge of #7801 - aopicier:refactor_formcontrol, r=Manishearth
Refactor FormControl trait

The trait is now implemented for HTMLFooElement instead of
&HTMLFooElement and does no longer require an impl body.

Suggested by @Manishearth

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7801)
<!-- Reviewable:end -->
2015-09-30 19:06:18 -06:00
Philipp Hartwig
bae4abd388 Refactor FormControl trait
The trait is now implemented for HTMLFooElement instead of
&HTMLFooElement and does no longer require an impl body.
2015-09-30 22:02:56 +02:00
Jacob Parker
9cf43877f2 Only display text carets in text inputs 2015-09-27 19:23:20 -04:00
bors-servo
37ce248f31 Auto merge of #7733 - nox:checked, r=Manishearth
Properly consider radio button groups

Radio button groups with missing or empty names are always the only element of their respective radio button group.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7733)
<!-- Reviewable:end -->
2015-09-26 11:21:11 -06:00
Anthony Ramine
e72b77b1e3 Properly consider radio button groups
Radio button groups with missing or empty names are always the only element
of their respective radio button group.
2015-09-25 00:29:03 +02:00
Anthony Ramine
01ea761bd0 Use an atom for HTMLInputElement's name attribute's value 2015-09-25 00:04:43 +02:00
Manish Goregaokar
b677f0f4ae Add form getter for input/button elements; update test expectations 2015-09-24 11:58:24 +05:30
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Brandon Fairchild
de3547e401 Fix reported test-tidy errors for unmerged import blocks
This merges import blocks that were reported by tidy as unmerged.
2015-09-19 12:50:14 -04:00
Patrick Walton
357419dc8d layout: Query and maintain the position of the insertion point
throughout layout for input elements.
2015-09-17 13:31:12 +02:00