mirror of
https://github.com/servo/servo.git
synced 2025-08-12 08:55:32 +01:00
Auto merge of #6538 - Ms2ger:a-cleanup, r=jdm
Some cleanup in HTMLAnchorElement. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6538) <!-- Reviewable:end -->
This commit is contained in:
commit
73b52c095a
1 changed files with 7 additions and 17 deletions
|
@ -69,15 +69,6 @@ impl<'a> VirtualMethods for &'a HTMLAnchorElement {
|
||||||
Some(htmlelement as &VirtualMethods)
|
Some(htmlelement as &VirtualMethods)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_event(&self, event: &Event) {
|
|
||||||
match self.super_type() {
|
|
||||||
Some(s) => {
|
|
||||||
s.handle_event(event);
|
|
||||||
}
|
|
||||||
None => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
fn parse_plain_attribute(&self, name: &Atom, value: DOMString) -> AttrValue {
|
||||||
match name {
|
match name {
|
||||||
&atom!("rel") => AttrValue::from_serialized_tokenlist(value),
|
&atom!("rel") => AttrValue::from_serialized_tokenlist(value),
|
||||||
|
@ -138,7 +129,7 @@ impl<'a> Activatable for &'a HTMLAnchorElement {
|
||||||
if let Some(element) = ElementCast::to_ref(target) {
|
if let Some(element) = ElementCast::to_ref(target) {
|
||||||
if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) {
|
if target.is_htmlimageelement() && element.has_attribute(&atom!("ismap")) {
|
||||||
|
|
||||||
let target_node = NodeCast::to_ref(target).unwrap();
|
let target_node = NodeCast::from_ref(element);
|
||||||
let rect = window_from_node(target_node).r().content_box_query(
|
let rect = window_from_node(target_node).r().content_box_query(
|
||||||
target_node.to_trusted_node_address());
|
target_node.to_trusted_node_address());
|
||||||
ismap_suffix = Some(
|
ismap_suffix = Some(
|
||||||
|
@ -150,14 +141,13 @@ impl<'a> Activatable for &'a HTMLAnchorElement {
|
||||||
|
|
||||||
//TODO: Step 4. Download the link is `download` attribute is set.
|
//TODO: Step 4. Download the link is `download` attribute is set.
|
||||||
|
|
||||||
let attr = element.get_attribute(&ns!(""), &atom!("href"));
|
if let Some(ref href) = element.get_attribute(&ns!(""), &atom!("href")) {
|
||||||
match attr {
|
let mut value = href.r().Value();
|
||||||
Some(ref href) => {
|
if let Some(suffix) = ismap_suffix {
|
||||||
let value = href.r().Value() + ismap_suffix.as_ref().map(|s| &**s).unwrap_or("");
|
value.push_str(&suffix);
|
||||||
debug!("clicked on link to {}", value);
|
|
||||||
doc.r().load_anchor_href(value);
|
|
||||||
}
|
}
|
||||||
None => ()
|
debug!("clicked on link to {}", value);
|
||||||
|
doc.r().load_anchor_href(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue