Commit graph

58 commits

Author SHA1 Message Date
vrod
defaa5bee7 Implement HTMLLIElement#value 2016-07-28 21:07:21 -03: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
Josh Matthews
53f9307fb7 Add stubs for src and currentSrc for HTMLMediaElement. 2016-05-03 16:25:21 -04:00
Jonathan Schuster
4bb5cd1285 Move comment about removing steps 2016-02-13 14:22:10 -05:00
Lanza
cfc3500dbf Implement HTMLDetailsElement. Fixes #9216 2016-01-20 16:15:37 +01: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
ee0800abe9 Implement <hr> 'color' attribute 2015-11-08 18:34:27 -05: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
bb2536cd01 move Castable into dom::bindings::inheritance 2015-10-30 20:24:42 +09:00
Corey Farwell
f97d1d148b Implement 'control' attribute for <label> elements 2015-10-25 08:06:31 -04: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
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Corey Farwell
81e034885b Cleanup code that was warned by rust-clippy 2015-10-11 20:47:45 -04:00
James Gilbertson
d0ace58452 Handle <meta name=viewport> elements when added to document 2015-09-30 20:31:35 -07:00
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
Anthony Ramine
a5cefe41d0 Implement adopting and cloning steps for HTMLTemplateElement 2015-09-08 10:28:23 +02:00
Anthony Ramine
e2b8febfd5 Implement adopting steps
https://dom.spec.whatwg.org/#concept-node-adopt
https://github.com/whatwg/dom/pull/66
2015-09-08 09:32:49 +02:00
Anthony Ramine
58e1bd0e57 Introduce VirtualMethods::attribute_mutated()
This replaces before_remove_attr(), after_remove_attr() and after_set_attr().
The virtual method takes the mutated attribute and an AttributeMutation value
to disambiguate between "attribute is changed", "attribute is added" and
"attribute is removed".

In the case of "attribute is changed", the mutation value contains a reference
to the old value of the mutated attribute, which is used to unregister outdated
named elements when the "id" attribute is changed on an element.

This greatly simplifies the handling of attributes, which in many cases don't
have any specific behaviour whether they are removed or changed or added. It
also fixes a few bugs where things were put in before_remove_attr() instead of
after_remove_attr() (e.g. when removing an href attribute from a base element).

A few helper functions in Element were also renamed and made private.
2015-09-02 15:45:38 +02:00
Anthony Ramine
c831c2c0a5 Remove helper traits
Now that JSRef<T> is gone, there is no need to have helper traits.

On components/script/*.rs:

    # Remove imports.
    /^ *use dom::[a-z]+::\{.*Helpers/ {
        s/\{(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers, /\{/
        s/, (Raw[^L]|[^L][^a])[a-zA-Z]+Helpers([,}])/\2/g
        s/\{([a-zA-Z]+)\}/\1/
        /\{\}/d
        s/::self;$/;/
    }
    /^ *use dom::[a-z]+::\{?(Raw[^L]|[^L][^a])[a-zA-Z]+Helpers\}?;$/d

On components/script/dom/*.rs:

    # Ignore layout things.
    /^(pub )?(impl|trait).*Layout.* \{/,/^}$/ { P; D; }

    # Delete helpers traits.
    /^(pub )?trait ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? \{$/,/^\}$/D

    # Patch private helpers.
    /^impl.*Private.*Helpers/,/^\}$/ {
        s/^impl<'a> Private([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for &'a ([^ ]+) \{$/impl \3 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

    # Patch public helpers.
    /^impl.*Helpers/,/^\}$/ {
        s/^impl(<'a>)? ([^L][^ ]|L[^a])[^ ]+Helpers(<'a>)? for (&'a )?([^ ]+) \{$/impl \5 {/
        /^ *(unsafe )?fn .*\(self.*[<&]'a/ {
            s/&'a /\&/g
            s/<'a, /</g
        }
        /^ *(unsafe )?fn .*\(&?self[,)]/s/(unsafe )?fn/pub &/
        /^ *pub (unsafe )?fn /s/\(self([,)])/\(\&self\1/
    }

The few error cases were then fixed by hand.
2015-08-27 16:59:02 +02:00
Manish Goregaokar
b33c5427bc Remove doublepointer in VirtualMethods, and from_borrowed_ref
Most of the heavy lifting done by:

```
$ ls *rs | xargs gawk -i inplace '/let .*: &&.*from_borrowed_ref/{sub("&&", "\\&");sub("_borrowed_","_");} {print $0}'
$ ls *rs | xargs gawk -i inplace "/impl.*VirtualMethods/{in_vm=1; sub(/<'a>/,\"\");sub(/&'a /,\"\")} /^}\$/{in_vm=0;} in_vm{\$0=gensub(/\\*self([^.])/,\"self\\\1\",\"g\"); sub(/from_borrowed_ref/,\"from_ref\")} {print}"
```
2015-08-27 02:14:48 +05:30
Johann Tuffe
ec07178b6f sort all uses 2015-08-20 20:47:12 +08:00
Manish Goregaokar
19241c95f7 Cleanup NodeIterator, Range, ServoHTMLParser, TextEncoder, URLHelper, URL, VirtualMethods 2015-08-18 19:37:42 +05:30
Ms2ger
92e64e607c Implement VirtualMethods for HTMLBaseElement. 2015-08-08 11:26:31 +02:00
Anthony Ramine
7b40cc9fd7 Introduce VirtualMethods::children_changed()
This virtual method mimics the behaviour of mutation observers and make it more
viable than the older child_inserted(), which didn't cover removed nodes and
was called as many times as there were inserted nodes.

A few other shortcomings where remove_child() was called directly instead of
Node::remove() were also fixed while at it.
2015-07-25 19:09:40 +02:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
bors-servo
fada39164c Auto merge of #5858 - pgonda:tabindex-focus-flag, r=jdm
Added support for the tabindex field, also added its correct defaults (-2 TODOs for things not supported in Servo yet).  Also added tabindex logic into Element::is_focusable_area.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5858)
<!-- Reviewable:end -->
2015-05-20 14:34:31 -05:00
Peter
1c96eed544 fixes #5603, adds support for tabindex 2015-05-20 10:34:16 -04:00
Patrick Walton
7d9eda916b script: Implement the color attribute of the <font> element.
Improves Hacker News.
2015-05-19 16:31:20 -07:00
Anthony Ramine
69220dfc10 Make HTMLFormElement name attribute use an atom 2015-05-14 18:28:42 +02:00
Anthony Ramine
b86672af0c Implement HTMLAppletElement.name 2015-05-14 18:28:39 +02:00
Manish Goregaokar
596e03e546 Basic userscript support 2015-03-22 15:13:11 +05:30
Zack Slayton
08ac0766ed Use new if let syntax wherever possible. Fixes #4153. 2015-03-10 09:18:55 -04:00
Ms2ger
505159a464 Import the util crate as util rather than servo_util.
This used to conflict with the util crate from the standard library, which
has long since been removed.

The import in layout has not been changed because of a conflict with the
util mod there.
2015-01-29 12:16:41 +01:00
Ms2ger
f8ac1777ff Don't shadow lifetimes in script. 2015-01-28 13:48:28 +01:00
Ms2ger
76b0e2d3c7 Simplify vtable_for. 2015-01-05 08:55:00 +01:00
bors-servo
ba8cf6b0e6 auto merge of #4542 : servo/servo/pre-rustup_20141221, r=saneyuki
In particular, this contains changes to qualify enums where rust will require it, and to stop using some features that will be removed.
2015-01-04 12:39:47 -07:00
Ms2ger
76b8810a86 Disambiguate trait object reference syntax. 2015-01-04 11:59:51 +01:00
Megha Gupta
5031096853 Fix inheritance enums for htmlmediaelement and htmltablecellelement 2015-01-02 23:10:32 +05:30
Megha Gupta
f85b9e37cc Add HTMLElementTypeId enum (fixes #3625) 2015-01-02 23:10:31 +05:30
Ms2ger
466faac2a5 Update rustc to revision 3dcd2157403163789aaf21a9ab3c4d30a7c6494d. 2014-12-17 15:19:45 -05:00
Patrick Walton
a1ea44b294 style: Address review comments relating to bgcolor and column spans 2014-12-15 18:09:44 -08:00
Patrick Walton
10f1ed5e31 style: Parse the legacy border attribute per the legacy HTML specification.
Additionally, this patch cleans up some miscellaneous formatting issues
and refactors files in `layout/css/` somewhat to eliminate needless
levels of indirection. It also fixes our handling of presentational
hints that only apply if border is nonzero.
2014-12-15 17:41:37 -08:00
Patrick Walton
8b2aadc30b ports/cef: Implement accelerated compositing for the CEF port. 2014-12-10 08:35:47 -08:00
Achal Shah
23ed1f705b Implement HTML{Anchor,Area,Link}Element.relList.
https://github.com/servo/servo/issues/3994
2014-11-23 23:37:13 -08:00
Ms2ger
214c356ecd Pass an Atom to VirtualMethods::parse_plain_attribute. 2014-11-05 16:19:11 +01:00
Matt Brubeck
598150ea78 Implement cloning steps for script element 2014-10-29 14:31:47 -07:00
Matt Brubeck
fe123ad07c Switch to synchronous script loading
This removes the old code for asyncronously loading scripts during HTML
parsing and then executing them afterward.

Fixes #3356.
2014-10-29 14:31:47 -07:00