aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/htmlareaelement.rs
diff options
context:
space:
mode:
authorPeijun Ma <peijun.ma@protonmail.com>2019-01-27 18:05:37 -0500
committerPeijun Ma <peijun.ma@protonmail.com>2019-01-30 00:24:11 -0500
commite4ffd164495cada2f37741c3ce674d990103c34b (patch)
treebba0a2537c8610b1a38dda9dacdb8d80c6a00f54 /components/script/dom/htmlareaelement.rs
parent62ff03213055d1aae74640ad551ce0908bd26bbd (diff)
downloadservo-e4ffd164495cada2f37741c3ce674d990103c34b.tar.gz
servo-e4ffd164495cada2f37741c3ce674d990103c34b.zip
Refactor follow_hyperlink and its callers
Now they follow the new spec stated at: https://html.spec.whatwg.org/multipage/links.html#following-hyperlinks-2 It seems like choosing a browsing context is already done in the follow_hyperlink method, so I have removed the TODO in activation_behavior for HTMLAreaElement. The tests in tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/ pass in release builds, but still don't pass in dev build, since the timeout in tests/wpt/web-platform-tests/html/semantics/links/following-hyperlinks/activation-behavior.window.js seems to be too short for dev builds. Navigating to error page on failed URL parsing is still not implemented. There seem to be potential code duplication in activation_behavior methods for both htmlanchorelement.rs and htmlareaelement.rs, in: let referrer_policy = match self.RelList().Contains("noreferrer".into()) { true => Some(ReferrerPolicy::NoReferrer), false => None, }; I didn't pull them out to a separate function since I don't know where I would put that new function.
Diffstat (limited to 'components/script/dom/htmlareaelement.rs')
-rw-r--r--components/script/dom/htmlareaelement.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/components/script/dom/htmlareaelement.rs b/components/script/dom/htmlareaelement.rs
index 32a5e8ef89a..a1cf35a7eeb 100644
--- a/components/script/dom/htmlareaelement.rs
+++ b/components/script/dom/htmlareaelement.rs
@@ -16,7 +16,7 @@ use crate::dom::event::Event;
use crate::dom::eventtarget::EventTarget;
use crate::dom::htmlanchorelement::follow_hyperlink;
use crate::dom::htmlelement::HTMLElement;
-use crate::dom::node::{document_from_node, Node};
+use crate::dom::node::Node;
use crate::dom::virtualmethods::VirtualMethods;
use dom_struct::dom_struct;
use euclid::Point2D;
@@ -332,18 +332,10 @@ impl Activatable for HTMLAreaElement {
}
fn activation_behavior(&self, _event: &Event, _target: &EventTarget) {
- // Step 1
- let doc = document_from_node(self);
- if !doc.is_fully_active() {
- return;
- }
- // Step 2
- // TODO : We should be choosing a browsing context and navigating to it.
- // Step 3
let referrer_policy = match self.RelList().Contains("noreferrer".into()) {
true => Some(ReferrerPolicy::NoReferrer),
false => None,
};
- follow_hyperlink(self.upcast::<Element>(), None, referrer_policy);
+ follow_hyperlink(self.as_element(), None, referrer_policy);
}
}