mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
navigation bug fix
This commit is contained in:
parent
b7e2eab2f4
commit
43491d5b23
4 changed files with 17 additions and 14 deletions
|
@ -320,8 +320,7 @@ impl Constellation {
|
||||||
if url.path.ends_with(".js") {
|
if url.path.ends_with(".js") {
|
||||||
pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
|
pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
|
||||||
} else {
|
} else {
|
||||||
pipeline.load(url);
|
pipeline.load(url, Some(constellation_msg::Load));
|
||||||
pipeline.navigation_type = Some(constellation_msg::Load);
|
|
||||||
|
|
||||||
self.pending_frames.push(FrameChange{
|
self.pending_frames.push(FrameChange{
|
||||||
before: None,
|
before: None,
|
||||||
|
@ -374,6 +373,7 @@ impl Constellation {
|
||||||
source's Url is None. There should never be a LoadUrlIframeMsg from a pipeline
|
source's Url is None. There should never be a LoadUrlIframeMsg from a pipeline
|
||||||
that was never given a url to load.");
|
that was never given a url to load.");
|
||||||
|
|
||||||
|
// FIXME(tkuehn): Need to follow the standardized spec for checking same-origin
|
||||||
let pipeline = @mut if (source_url.host == url.host &&
|
let pipeline = @mut if (source_url.host == url.host &&
|
||||||
source_url.port == url.port) {
|
source_url.port == url.port) {
|
||||||
// Reuse the script task if same-origin url's
|
// Reuse the script task if same-origin url's
|
||||||
|
@ -400,8 +400,7 @@ impl Constellation {
|
||||||
if url.path.ends_with(".js") {
|
if url.path.ends_with(".js") {
|
||||||
pipeline.execute(url);
|
pipeline.execute(url);
|
||||||
} else {
|
} else {
|
||||||
pipeline.load(url);
|
pipeline.load(url, None);
|
||||||
pipeline.navigation_type = None;
|
|
||||||
}
|
}
|
||||||
frame_tree.children.push(@mut FrameTree {
|
frame_tree.children.push(@mut FrameTree {
|
||||||
pipeline: pipeline,
|
pipeline: pipeline,
|
||||||
|
@ -445,8 +444,7 @@ impl Constellation {
|
||||||
if url.path.ends_with(".js") {
|
if url.path.ends_with(".js") {
|
||||||
pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
|
pipeline.script_chan.send(ExecuteMsg(pipeline.id, url));
|
||||||
} else {
|
} else {
|
||||||
pipeline.load(url);
|
pipeline.load(url, Some(constellation_msg::Load));
|
||||||
pipeline.navigation_type = Some(constellation_msg::Load);
|
|
||||||
|
|
||||||
let parent = if self.current_frame().get_ref().pipeline.id == source_id {
|
let parent = if self.current_frame().get_ref().pipeline.id == source_id {
|
||||||
// source_id is the root of the current frame tree; replace whole tree
|
// source_id is the root of the current frame tree; replace whole tree
|
||||||
|
@ -494,8 +492,7 @@ impl Constellation {
|
||||||
|
|
||||||
for destination_frame.iter().advance |frame| {
|
for destination_frame.iter().advance |frame| {
|
||||||
let pipeline = &frame.pipeline;
|
let pipeline = &frame.pipeline;
|
||||||
pipeline.navigation_type = Some(constellation_msg::Navigate);
|
pipeline.reload(Some(constellation_msg::Navigate));
|
||||||
pipeline.reload();
|
|
||||||
}
|
}
|
||||||
self.compositor_chan.send(SetIds(destination_frame.to_sendable(), self.chan.clone()));
|
self.compositor_chan.send(SetIds(destination_frame.to_sendable(), self.chan.clone()));
|
||||||
|
|
||||||
|
|
|
@ -137,8 +137,9 @@ impl Pipeline {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(&mut self, url: Url) {
|
pub fn load(&mut self, url: Url, navigation_type: Option<NavigationType>) {
|
||||||
self.url = Some(url.clone());
|
self.url = Some(url.clone());
|
||||||
|
self.navigation_type = navigation_type;
|
||||||
self.script_chan.send(LoadMsg(self.id, url));
|
self.script_chan.send(LoadMsg(self.id, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,9 +156,10 @@ impl Pipeline {
|
||||||
self.render_chan.send(PaintPermissionRevoked);
|
self.render_chan.send(PaintPermissionRevoked);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reload(&self) {
|
pub fn reload(&mut self, navigation_type: Option<NavigationType>) {
|
||||||
for self.url.iter().advance |url| {
|
if self.url.is_some() {
|
||||||
self.script_chan.send(LoadMsg(self.id, url.clone()));
|
let url = self.url.get_ref().clone();
|
||||||
|
self.load(url, navigation_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,6 +241,7 @@ pub fn parse_html(cx: *JSContext,
|
||||||
url: Url,
|
url: Url,
|
||||||
resource_task: ResourceTask,
|
resource_task: ResourceTask,
|
||||||
image_cache_task: ImageCacheTask) -> HtmlParserResult {
|
image_cache_task: ImageCacheTask) -> HtmlParserResult {
|
||||||
|
debug!("Hubbub: parsing %?", url);
|
||||||
// Spawn a CSS parser to receive links to CSS style sheets.
|
// Spawn a CSS parser to receive links to CSS style sheets.
|
||||||
let resource_task2 = resource_task.clone();
|
let resource_task2 = resource_task.clone();
|
||||||
|
|
||||||
|
|
|
@ -560,6 +560,8 @@ impl ScriptTask {
|
||||||
/// The entry point to document loading. Defines bindings, sets up the window and document
|
/// The entry point to document loading. Defines bindings, sets up the window and document
|
||||||
/// objects, parses HTML and CSS, and kicks off initial layout.
|
/// objects, parses HTML and CSS, and kicks off initial layout.
|
||||||
fn load(&mut self, pipeline_id: PipelineId, url: Url) {
|
fn load(&mut self, pipeline_id: PipelineId, url: Url) {
|
||||||
|
debug!("ScriptTask: loading %?", url);
|
||||||
|
|
||||||
let page = self.page_tree.find(pipeline_id).expect("ScriptTask: received a load
|
let page = self.page_tree.find(pipeline_id).expect("ScriptTask: received a load
|
||||||
message for a layout channel that is not associated with this script task. This
|
message for a layout channel that is not associated with this script task. This
|
||||||
is a bug.").page;
|
is a bug.").page;
|
||||||
|
@ -569,8 +571,8 @@ impl ScriptTask {
|
||||||
if *last_loaded_url == url {
|
if *last_loaded_url == url {
|
||||||
if needs_reflow {
|
if needs_reflow {
|
||||||
page.reflow_all(ReflowForDisplay, self.chan.clone(), self.compositor);
|
page.reflow_all(ReflowForDisplay, self.chan.clone(), self.compositor);
|
||||||
page.url = Some((last_loaded_url.clone(), false));
|
|
||||||
}
|
}
|
||||||
|
page.url = Some((last_loaded_url.clone(), false));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -758,10 +760,11 @@ impl ScriptTask {
|
||||||
// if the node's element is "a," load url from href attr
|
// if the node's element is "a," load url from href attr
|
||||||
let href = element.get_attr("href");
|
let href = element.get_attr("href");
|
||||||
for href.iter().advance |href| {
|
for href.iter().advance |href| {
|
||||||
debug!("clicked on link to %s", *href);
|
debug!("ScriptTask: clicked on link to %s", *href);
|
||||||
let current_url = do page.url.map |&(ref url, _)| {
|
let current_url = do page.url.map |&(ref url, _)| {
|
||||||
url.clone()
|
url.clone()
|
||||||
};
|
};
|
||||||
|
debug!("ScriptTask: current url is %?", current_url);
|
||||||
let url = make_url(href.to_owned(), current_url);
|
let url = make_url(href.to_owned(), current_url);
|
||||||
self.constellation_chan.send(LoadUrlMsg(page.id, url, from_value(page.window_size.get())));
|
self.constellation_chan.send(LoadUrlMsg(page.id, url, from_value(page.window_size.get())));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue