diff options
author | SendilKumar N <sendilkumarn@live.com> | 2017-03-10 13:55:24 +0800 |
---|---|---|
committer | SendilKumar N <sendilkumarn@live.com> | 2017-04-04 23:11:44 +0800 |
commit | 31dafcc5f3e503655cc3e72ae10a815c47f55801 (patch) | |
tree | 1dcb4a0ae879eb9df212c9f1f4509b22eea6972d /components/script/dom/htmlimageelement.rs | |
parent | 5421d833de30e0c963bc6241120263897d4fc68c (diff) | |
download | servo-31dafcc5f3e503655cc3e72ae10a815c47f55801.tar.gz servo-31dafcc5f3e503655cc3e72ae10a815c47f55801.zip |
making image element areas good at finding areas
linting errors
replaced with map
fixes comments
moving to document
added test cases
linting and updating manifest
changing test cases
linting fixes
manifest update
linting fixes
splitting the test cases into two
Diffstat (limited to 'components/script/dom/htmlimageelement.rs')
-rw-r--r-- | components/script/dom/htmlimageelement.rs | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs index acf1d2ed9ce..7cebebade0a 100644 --- a/components/script/dom/htmlimageelement.rs +++ b/components/script/dom/htmlimageelement.rs @@ -429,16 +429,12 @@ impl HTMLImageElement { return None } - let map = self.upcast::<Node>() - .following_siblings() - .filter_map(Root::downcast::<HTMLMapElement>) - .find(|n| n.upcast::<Element>().get_string_attribute(&LocalName::from("name")) == last); - - let elements: Vec<Root<HTMLAreaElement>> = map.unwrap().upcast::<Node>() - .children() - .filter_map(Root::downcast::<HTMLAreaElement>) - .collect(); - Some(elements) + let useMapElements = document_from_node(self).upcast::<Node>() + .traverse_preorder() + .filter_map(Root::downcast::<HTMLMapElement>) + .find(|n| n.upcast::<Element>().get_string_attribute(&LocalName::from("name")) == last); + + useMapElements.map(|mapElem| mapElem.get_area_elements()) } } |