diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2017-04-24 10:35:52 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-24 10:35:52 -0500 |
commit | ef3903163da57ef31ee0a2566b627c58473bdaab (patch) | |
tree | 28758ca95e671f5d99d2292cdf133ba561510e92 /components/script/dom | |
parent | 4263b798ad3969ceeb86e607d5f13eeadd2db6dd (diff) | |
parent | 853c91781e921bcb7a0c539f970c2f6c4c9d3302 (diff) | |
download | servo-ef3903163da57ef31ee0a2566b627c58473bdaab.tar.gz servo-ef3903163da57ef31ee0a2566b627c58473bdaab.zip |
Auto merge of #16530 - metajack:kill-domrectlist, r=nox
Remove DOMRectList and use sequences instead.
DOMRectList was removed last back in 2015. See
https://www.w3.org/Bugs/Public/show_bug.cgi?id=26200 for details.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they are covered by existing tests
<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->
<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/16530)
<!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom')
-rw-r--r-- | components/script/dom/domrectlist.rs | 58 | ||||
-rw-r--r-- | components/script/dom/element.rs | 8 | ||||
-rw-r--r-- | components/script/dom/mod.rs | 1 | ||||
-rw-r--r-- | components/script/dom/webidls/DOMRectList.webidl | 11 | ||||
-rw-r--r-- | components/script/dom/webidls/Element.webidl | 3 | ||||
-rw-r--r-- | components/script/dom/webidls/Range.webidl | 3 |
6 files changed, 7 insertions, 77 deletions
diff --git a/components/script/dom/domrectlist.rs b/components/script/dom/domrectlist.rs deleted file mode 100644 index a7d99b99448..00000000000 --- a/components/script/dom/domrectlist.rs +++ /dev/null @@ -1,58 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -use dom::bindings::codegen::Bindings::DOMRectListBinding; -use dom::bindings::codegen::Bindings::DOMRectListBinding::DOMRectListMethods; -use dom::bindings::js::{JS, Root}; -use dom::bindings::reflector::{Reflector, reflect_dom_object}; -use dom::domrect::DOMRect; -use dom::window::Window; -use dom_struct::dom_struct; - -#[dom_struct] -pub struct DOMRectList { - reflector_: Reflector, - rects: Vec<JS<DOMRect>>, -} - -impl DOMRectList { - fn new_inherited<T>(rects: T) -> DOMRectList - where T: Iterator<Item = Root<DOMRect>> - { - DOMRectList { - reflector_: Reflector::new(), - rects: rects.map(|r| JS::from_ref(&*r)).collect(), - } - } - - pub fn new<T>(window: &Window, rects: T) -> Root<DOMRectList> - where T: Iterator<Item = Root<DOMRect>> - { - reflect_dom_object(box DOMRectList::new_inherited(rects), - window, - DOMRectListBinding::Wrap) - } -} - -impl DOMRectListMethods for DOMRectList { - // https://drafts.fxtf.org/geometry/#dom-domrectlist-length - fn Length(&self) -> u32 { - self.rects.len() as u32 - } - - // https://drafts.fxtf.org/geometry/#dom-domrectlist-item - fn Item(&self, index: u32) -> Option<Root<DOMRect>> { - let rects = &self.rects; - if index < rects.len() as u32 { - Some(Root::from_ref(&*rects[index as usize])) - } else { - None - } - } - - // check-tidy: no specs after this line - fn IndexedGetter(&self, index: u32) -> Option<Root<DOMRect>> { - self.Item(index) - } -} diff --git a/components/script/dom/element.rs b/components/script/dom/element.rs index aafee25867c..7b56b6c6e81 100644 --- a/components/script/dom/element.rs +++ b/components/script/dom/element.rs @@ -34,7 +34,6 @@ use dom::create::create_element; use dom::document::{Document, LayoutDocumentHelpers}; use dom::documentfragment::DocumentFragment; use dom::domrect::DOMRect; -use dom::domrectlist::DOMRectList; use dom::domtokenlist::DOMTokenList; use dom::event::Event; use dom::eventtarget::EventTarget; @@ -1632,17 +1631,16 @@ impl ElementMethods for Element { } // https://drafts.csswg.org/cssom-view/#dom-element-getclientrects - fn GetClientRects(&self) -> Root<DOMRectList> { + fn GetClientRects(&self) -> Vec<Root<DOMRect>> { let win = window_from_node(self); let raw_rects = self.upcast::<Node>().content_boxes(); - let rects = raw_rects.iter().map(|rect| { + raw_rects.iter().map(|rect| { DOMRect::new(win.upcast(), rect.origin.x.to_f64_px(), rect.origin.y.to_f64_px(), rect.size.width.to_f64_px(), rect.size.height.to_f64_px()) - }); - DOMRectList::new(&win, rects) + }).collect() } // https://drafts.csswg.org/cssom-view/#dom-element-getboundingclientrect diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs index 83efe407f3e..70d1f30bd4a 100644 --- a/components/script/dom/mod.rs +++ b/components/script/dom/mod.rs @@ -272,7 +272,6 @@ pub mod dompoint; pub mod dompointreadonly; pub mod domquad; pub mod domrect; -pub mod domrectlist; pub mod domrectreadonly; pub mod domstringmap; pub mod domtokenlist; diff --git a/components/script/dom/webidls/DOMRectList.webidl b/components/script/dom/webidls/DOMRectList.webidl deleted file mode 100644 index dfb33639c93..00000000000 --- a/components/script/dom/webidls/DOMRectList.webidl +++ /dev/null @@ -1,11 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -// http://dev.w3.org/fxtf/geometry/#DOMRectList -[NoInterfaceObject, Exposed=(Window,Worker)] -//[ArrayClass] -interface DOMRectList { - readonly attribute unsigned long length; - getter DOMRect? item(unsigned long index); -}; diff --git a/components/script/dom/webidls/Element.webidl b/components/script/dom/webidls/Element.webidl index 1662dda36d6..c099b2a04ae 100644 --- a/components/script/dom/webidls/Element.webidl +++ b/components/script/dom/webidls/Element.webidl @@ -81,7 +81,8 @@ interface Element : Node { // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-element-interface partial interface Element { - DOMRectList getClientRects(); + sequence<DOMRect> getClientRects(); + [NewObject] DOMRect getBoundingClientRect(); void scroll(optional ScrollToOptions options); diff --git a/components/script/dom/webidls/Range.webidl b/components/script/dom/webidls/Range.webidl index c40f2ecb161..1daf2d8182f 100644 --- a/components/script/dom/webidls/Range.webidl +++ b/components/script/dom/webidls/Range.webidl @@ -82,6 +82,7 @@ partial interface Range { // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-range-interface partial interface Range { - // DOMRectList? getClientRects(); + // sequence<DOMRect> getClientRects(); + // [NewObject] // DOMRect getBoundingClientRect(); }; |