Move fragment navigation into Document object

Move the `check_and_scroll_fragment()` method into Document, make the
mothod set the fragment of url after navigation, and use the
`perform_a_scroll()` method to scroll rather than an individual
method. Also removes the broken `Window.fragment` fields.
This commit is contained in:
Pu Xingyu 2016-11-18 12:33:30 +08:00
parent eca8f1d0b4
commit 9863149043
5 changed files with 65 additions and 82 deletions

View file

@ -40,7 +40,7 @@ impl Location {
setter: fn(&mut ServoUrl, USVString)) {
let mut url = self.window.get_url();
setter(&mut url, value);
self.window.load_url(url, false, None);
self.window.load_url(url, false, false, None);
}
}
@ -51,7 +51,7 @@ impl LocationMethods for Location {
// _entry settings object_.
let base_url = self.window.get_url();
if let Ok(url) = base_url.join(&url.0) {
self.window.load_url(url, false, None);
self.window.load_url(url, false, false, None);
Ok(())
} else {
Err(Error::Syntax)
@ -60,7 +60,8 @@ impl LocationMethods for Location {
// https://html.spec.whatwg.org/multipage/#dom-location-reload
fn Reload(&self) {
self.window.load_url(self.get_url(), true, None);
self.window.load_url(self.get_url(), true, true, None);
}
}
// https://html.spec.whatwg.org/multipage/#dom-location-hash
@ -109,7 +110,7 @@ impl LocationMethods for Location {
// https://html.spec.whatwg.org/multipage/#dom-location-href
fn SetHref(&self, value: USVString) {
if let Ok(url) = self.window.get_url().join(&value.0) {
self.window.load_url(url, false, None);
self.window.load_url(url, false, false, None);
}
}