aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/node.rs
Commit message (Collapse)AuthorAgeFilesLines
...
* Get rid of a bunch of explicit derefsDavid Zbarsky2015-11-031-49/+49
|
* merge from masterrohan.prinja2015-11-031-14/+10
|\
| * Removed JS::root Fixes #8251nxnfufunezn2015-10-311-12/+8
| |
| * Fix some rust-clippy violationsCorey Farwell2015-10-301-2/+2
| |
* | rearrange imports to be in alphabetical orderrohan.prinja2015-10-301-4/+3
| |
* | replace InheritTypes imports with inheritance importsrohan.prinja2015-10-301-2/+2
| |
* | more refactoringrohan.prinja2015-10-301-1/+2
| |
* | move Castable into dom::bindings::inheritancerohan.prinja2015-10-301-1/+2
|/
* remove get_rooted() and replace all references to it with references to get()rohan.prinja2015-10-291-10/+10
|
* Remove HAS_DIRTY_SIBLINGS.Bobby Holley2015-10-211-32/+5
| | | | | | This isn't doing anything right now, and we're not even setting it properly in dirty_impl the |dirty_subtree(self)| was causing us to hit the skip case for step 3.
* Clean up the cast callsAnthony Ramine2015-10-211-60/+37
|
* Introduce trait CastableAnthony Ramine2015-10-211-93/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Removed unsafe from 'query_selector_iter'Leo Lahti2015-10-201-5/+3
|
* Auto merge of #8060 - nox:deref-js, r=Ms2gerbors-servo2015-10-191-4/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | 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 -->
| * Return a reference in Document::window()Anthony Ramine2015-10-191-4/+4
| |
* | Auto merge of #7935 - bholley:eventstate_element, r=noxbors-servo2015-10-191-158/+9
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 -->
| * | Move what is now an |impl Element| block to element.rs.Bobby Holley2015-10-161-50/+1
| | | | | | | | | | | | This is a simple cut/paste.
| * | Move Event States to |Element|.Bobby Holley2015-10-161-118/+18
| |/ | | | | | | | | | | Conceptually they belong there, rather than on |Node|. Fixes #7934.
* / Implement HTMLTableRowElement insertCell and deleteCellCorey Farwell2015-10-171-1/+66
|/
* Fix remaining MutHeap methods not to expose JS<T>.Eli Friedman2015-10-151-1/+1
|
* Make get() and set() on MutNullableHeap use the correct types.Eli Friedman2015-10-151-22/+22
| | | | | | get() must always return a rooted value, because we have no way of ensuring the value won't be invalidated. set() takes an &T because it's convenient; there isn't any need to expose JS<T>.
* Update script to work with lint changesManish Goregaokar2015-10-161-0/+2
|
* Explicitly customise flags of new nodes where neededAnthony Ramine2015-10-151-22/+12
| | | | | | | 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.
* Generate all Derived implementations in codegenAnthony Ramine2015-10-141-10/+1
|
* Generate the TypeId enums in codegenAnthony Ramine2015-10-141-20/+11
|
* Refactor away duplication of get_rooted functionalityPierre Chevalier2015-10-081-10/+10
| | | | | | | | | | | | | | Refactor .get().map(Root::from_rooted) and .get().map(|foo| foo.root()) to .get_rooted() on MutNullableHeap objects. First part done mechanically with the following comand: sed -i s/"get().map(Root::from_rooted)"/"get_rooted()"/g *.rs Second part done manually after finding them with git grep ".get().map(" Fixes 7929.
* Refactor Error enum usage to consistently be qualifiedAnthony Urena2015-10-061-35/+34
|
* Split Au type into separate crate, with minimal dependencies.Glenn Watson2015-10-011-1/+1
|
* script: Stop copying the document URL.Patrick Walton2015-09-241-1/+1
|
* sorted the extern crate, mod & use declarationsRavi Shankar2015-09-241-8/+7
|
* Auto merge of #7611 - nox:cache-element-id, r=frewsxcvbors-servo2015-09-201-17/+11
|\ | | | | | | | | | | | | | | | | | | | | | | | | Cache the `id` attribute on Element Thanks to @asabil for the original work, I only rebased it. Fixes #6359 and #7040. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7611) <!-- Reviewable:end -->
| * Fix Node::query_selector() and Node::query_selector_iter()Anthony Ramine2015-09-131-8/+5
| | | | | | | | These should not find the root of the tree to start matching.
| * Fix cloning of Element's attributesAnthony Ramine2015-09-131-9/+6
| | | | | | | | | | No virtual method was invoked when copies of attributes were appended to newly-cloned elements.
* | Fix reported test-tidy errors for unmerged import blocksBrandon Fairchild2015-09-191-9/+8
|/ | | | This merges import blocks that were reported by tidy as unmerged.
* Introduce [Abstract] to mark non-leaf interfacesAnthony Ramine2015-09-131-16/+2
| | | | | | | Some interfaces like Node, CharacterData and HTMLTableCellElement are never instantiated directly, only their descendant interfaces are. Those are marked with [Abstract] to set their type_id to None instead of having dummy values in the TypeId enums.
* Move EventTargetTypeId/NodeTypeId to DOMClassMichael Wu2015-09-121-25/+48
|
* Implement adopting stepsAnthony Ramine2015-09-081-14/+9
| | | | | https://dom.spec.whatwg.org/#concept-node-adopt https://github.com/whatwg/dom/pull/66
* Implement FromIterator<Root<A>> for RootedVec<JS<A>> (fixes #5117)Anthony Ramine2015-08-311-2/+1
|
* Make the traits for the IDL interfaces take &selfAnthony Ramine2015-08-271-29/+29
|
* Remove AttributeHandlersAnthony Ramine2015-08-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | On components/script/*.rs: # Remove imports. /^ *use dom::element::\{.*AttributeHandlers/ { s/\{AttributeHandlers, /\{/ s/, AttributeHandlers//g s/\{([a-zA-Z]+)\}/\1/ /\{\}/d s/::self;$/;/ } /^ *use dom::element::\{?AttributeHandlers\}?;$/d # Remove AttributeHandlers. /^pub trait AttributeHandlers \{$/,/^\}$/D # Patch AttributeHandlers methods. /^impl<'a> AttributeHandlers for &'a Element \{/,/^\}$/ { s/^impl<'a> AttributeHandlers for &'a Element \{/impl Element {/ /^ *fn /s/\(self([,)])/\(\&self\1/ /^ *fn.*\(&self/s/fn/pub fn/ } The few error cases were then fixed by hand.
* Remove helper traitsAnthony Ramine2015-08-271-200/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* make dom_struct derive HeapSizeOf,João Oliveira2015-08-271-1/+0
| | | | closes #7357
* Auto merge of #7397 - Manishearth:doublepointer-meet-fire, r=noxbors-servo2015-08-261-2/+2
|\ | | | | | | | | | | | | | | | | | | Remove doublepointer in VirtualMethods, and from_borrowed_ref <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7397) <!-- Reviewable:end -->
| * Remove doublepointer in VirtualMethods, and from_borrowed_refManish Goregaokar2015-08-271-2/+2
| | | | | | | | | | | | | | | | | | 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}" ```
* | Auto merge of #7334 - servo:active, r=SimonSapinbors-servo2015-08-241-0/+24
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | Parse :active pseudo-class selector. This is #7258 with a spec link added in doc-comment. The pseudo-class is never matched, but this can still help with stylesheets like `a:hover, a:active { color: something }` where failing to parse one pseudo-class makes the entire selector list invalid. I filed #7333 about actually making it match. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7334) <!-- Reviewable:end -->
| * Add spec link for the IN_ACTIVE_STATE flag.Simon Sapin2015-08-241-1/+3
| |
| * script: Update `rust-selectors` to get `:active` support.Patrick Walton2015-08-171-0/+22
| | | | | | | | | | | | | | | | I couldn't find the place in the spec where the precise behavior of `:active` is described, so I don't set it. However, all the machinery to keep track of its status is in place. Improves YouTube.
* | sort all usesJohann Tuffe2015-08-201-10/+10
| |
* | Cleanup NodeIterator, Range, ServoHTMLParser, TextEncoder, URLHelper, URL, ↵Manish Goregaokar2015-08-181-7/+2
| | | | | | | | VirtualMethods
* | Cleanup node.rsManish Goregaokar2015-08-181-20/+14
| |