mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #15882 - ak1t0:clean-up-htmlimageelement, r=Ms2ger
Clean up HTMLImageElement::areas <!-- 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 - [X] These changes fix #15835 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because github issue says no tests needed. <!-- 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/15882) <!-- Reviewable:end -->
This commit is contained in:
commit
94c344a014
1 changed files with 10 additions and 17 deletions
|
@ -413,25 +413,18 @@ impl HTMLImageElement {
|
|||
}
|
||||
pub fn areas(&self) -> Option<Vec<Root<HTMLAreaElement>>> {
|
||||
let elem = self.upcast::<Element>();
|
||||
let usemap_attr;
|
||||
if elem.has_attribute(&LocalName::from("usemap")) {
|
||||
usemap_attr = elem.get_string_attribute(&local_name!("usemap"));
|
||||
} else {
|
||||
return None;
|
||||
let usemap_attr = match elem.get_attribute(&ns!(), &local_name!("usemap")) {
|
||||
Some(attr) => attr,
|
||||
None => return None,
|
||||
};
|
||||
|
||||
let value = usemap_attr.value();
|
||||
let (first, last) = value.split_at(1);
|
||||
|
||||
if first != "#" || last.len() == 0 {
|
||||
return None
|
||||
}
|
||||
|
||||
let (first, last) = usemap_attr.split_at(1);
|
||||
|
||||
match first {
|
||||
"#" => {},
|
||||
_ => return None,
|
||||
};
|
||||
|
||||
match last.len() {
|
||||
0 => return None,
|
||||
_ => {},
|
||||
};
|
||||
|
||||
let map = self.upcast::<Node>()
|
||||
.following_siblings()
|
||||
.filter_map(Root::downcast::<HTMLMapElement>)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue