Commit graph

367 commits

Author SHA1 Message Date
Bobby Holley
7fa7936657 Implement attribute restyle hints.
Fixes #6942.
2015-11-10 11:57:24 -08:00
Eli Friedman
4b68fc18c3 Move storage of bgcolor for <tr> and <tbody>. 2015-11-09 12:27:16 -08:00
Eli Friedman
af78173243 Move more unsafe layout calls onto LayoutJS. 2015-11-09 10:47:38 -08:00
Eli Friedman
5293afc122 Move unsafe layout calls onto LayoutJS. 2015-11-09 10:47:37 -08:00
Corey Farwell
ee0800abe9 Implement <hr> 'color' attribute 2015-11-08 18:34:27 -05:00
Bobby Holley
7dba4447f1 Store pristine element state rather than a set of changes.
This is the strategy we'll need to take for attributes, and so this change
puts us in a position to handle attributes and state the same way.

This does mean that we stop taking care to track the situations where our
state has reverted to the original state, with no net change. I think that's
probably of negligible value though.
2015-11-04 19:09:58 -08: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
425c0b85d9 make test-tidy happy + fix some merge errors 2015-11-03 19:11:01 +09: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
David Zbarsky
00980ea595 Implement calc expressions for more value types 2015-11-01 23:16:14 -08:00
bors-servo
53d8f04ac4 Auto merge of #8260 - martiansideofthemoon:my-code-fix, r=Manishearth
Implementing activation behavior for <label>

Attempt to resolve #8179 
@Manishearth , could you give me some resources having more information about what each function in `Activatable` does? The code compiles on my machine but I guess a lot more is needed

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8260)
<!-- Reviewable:end -->
2015-10-31 22:25:27 +05:30
KALPESH KRISHNA
af91c980f2 Implementing activation behavior for <label> 2015-10-31 21:12:22 +05:30
nxnfufunezn
d8ef3809a6 Removed JS::root Fixes #8251 2015-10-31 18:15:16 +05:30
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
Michael Wu
434a5f1d8b Initialize dom struct fields in declaration order 2015-10-30 15:40:43 -04:00
Michael Wu
7e786fb8ac Infer types when appropriate 2015-10-30 15:23:29 -04:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
9fd823e449 replace InheritTypes imports with inheritance imports 2015-10-30 20:26:30 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
rohan.prinja
bb2536cd01 move Castable into dom::bindings::inheritance 2015-10-30 20:24:42 +09:00
Bobby Holley
069c40f788 Check modified event state from layout and dirty it there.
This adds some overhead, but also provides the small performance benefit of
avoiding dirtying in the case where an event state is toggled an even
number of times between reflows.

The main benefit here though is that it sets us up to be smarter about
what we mark as dirty using restyle hints.
2015-10-27 12:48:48 -07:00
Tetsuharu OHZEKI
04967ed97e script: Element.webkitMatchesSelector()
spec:
9ac9c15486
2015-10-25 15:27:20 +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
bors-servo
2e308e9ecc Auto merge of #8068 - martiansideofthemoon:my-code-fix, r=Manishearth
Implementing getAttributeNode() and similar methods

Attempting to solve #8066 Does it look good so far @Manishearth ?

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/8068)
<!-- Reviewable:end -->
2015-10-19 07:58:41 -06: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
KALPESH KRISHNA
3971b8ce27 Implementing getAttributeNode() and similar methods. 2015-10-19 16:14:43 +05:30
bors-servo
ff2151b8bb Auto merge of #7935 - bholley:eventstate_element, r=nox
Move event state from Node to Element

Just getting my feet wet with Rust here. Please feel free to nit the hell out of it stylistically and idiomatically. :-)

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7935)
<!-- Reviewable:end -->
2015-10-19 02:47:21 -06:00
Anthony Ramine
409b5e3695 Return a reference in Document::window() 2015-10-19 09:36:52 +02:00
Till Schneidereit
4c1c05fac6 Improve implementation of DOMRect and implement DOMRectReadOnly
Passes most tests from test-css.
2015-10-17 22:47:01 +02:00
Bobby Holley
ac8d57cda7 Move what is now an |impl Element| block to element.rs.
This is a simple cut/paste.
2015-10-16 17:56:32 -07: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
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
64f4835a4f Implement <body>'s "text" attribute 2015-10-08 10:55:12 -04:00
bors-servo
f5cd90805e Auto merge of #7882 - anthgur:consistent-enum-use, r=Ms2ger
Refactor Error enum usage to consistently be qualified

Closes #7869

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7882)
<!-- Reviewable:end -->
2015-10-06 04:58:17 -06:00
Anthony Urena
ba86131cd5 Refactor Error enum usage to consistently be qualified 2015-10-06 05:43:52 -04:00
Ms2ger
cd7b4d4e61 Define the parsed attribute getters for HTMLTableCellElement on LayoutJS.
This documents their intended usage and prevents script callers from using
them.
2015-10-06 09:40:33 +02:00
Ms2ger
1552022d96 Move some methods from RawLayoutElementHelpers to LayoutElementHelpers.
This is part of a long-term plan to ensure layout never has access to
unwrapped pointers to DOM objects. The remaining methods on the
RawLayoutElementHelpers trait are harder to move, because of the lifetimes in
their signatures.
2015-10-05 11:40:37 +02:00
Corey Farwell
74e4c4fdc7 Implement size attribute for <font> element 2015-09-30 22:51:30 -04:00
Glenn Watson
339a3f869b Split Au type into separate crate, with minimal dependencies. 2015-10-01 07:16:11 +10:00
Patrick Walton
075fd6818c script: Wrap a long line. 2015-09-24 18:54:54 -07:00
Ravi Shankar
889eec364b sorted the extern crate, mod & use declarations 2015-09-24 02:12:45 +05:30
Corey Farwell
fe7647a43e Prefer element casting over mem::transmute 2015-09-22 18:38:31 -04:00