mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
script: Don't do anything before the window size comes in.
This fixes the `getBoundingClientRect()` content test.
This commit is contained in:
parent
c5d81f13c1
commit
10150b0ec5
3 changed files with 23 additions and 21 deletions
|
@ -388,6 +388,7 @@ impl Constellation {
|
|||
self.image_cache_task.clone(),
|
||||
self.resource_task.clone(),
|
||||
self.profiler_chan.clone(),
|
||||
self.window_size,
|
||||
self.opts.clone());
|
||||
let failure = ~"about:failure";
|
||||
let url = make_url(failure, None);
|
||||
|
@ -409,6 +410,7 @@ impl Constellation {
|
|||
self.image_cache_task.clone(),
|
||||
self.resource_task.clone(),
|
||||
self.profiler_chan.clone(),
|
||||
self.window_size,
|
||||
self.opts.clone());
|
||||
pipeline.load(url);
|
||||
|
||||
|
@ -545,6 +547,7 @@ impl Constellation {
|
|||
self.image_cache_task.clone(),
|
||||
self.resource_task.clone(),
|
||||
self.profiler_chan.clone(),
|
||||
self.window_size,
|
||||
self.opts.clone())
|
||||
};
|
||||
|
||||
|
@ -598,6 +601,7 @@ impl Constellation {
|
|||
self.image_cache_task.clone(),
|
||||
self.resource_task.clone(),
|
||||
self.profiler_chan.clone(),
|
||||
self.window_size,
|
||||
self.opts.clone());
|
||||
|
||||
pipeline.load(url);
|
||||
|
|
|
@ -6,6 +6,7 @@ use compositing::CompositorChan;
|
|||
use layout::layout_task::LayoutTask;
|
||||
|
||||
use extra::url::Url;
|
||||
use geom::size::Size2D;
|
||||
use gfx::opts::Opts;
|
||||
use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
|
||||
use gfx::render_task::{RenderChan, RenderTask};
|
||||
|
@ -85,6 +86,7 @@ impl Pipeline {
|
|||
image_cache_task: ImageCacheTask,
|
||||
resource_task: ResourceTask,
|
||||
profiler_chan: ProfilerChan,
|
||||
window_size: Size2D<uint>,
|
||||
opts: Opts)
|
||||
-> Pipeline {
|
||||
let (script_port, script_chan) = special_stream!(ScriptChan);
|
||||
|
@ -120,7 +122,8 @@ impl Pipeline {
|
|||
script_chan.clone(),
|
||||
constellation_chan.clone(),
|
||||
resource_task,
|
||||
image_cache_task.clone());
|
||||
image_cache_task.clone(),
|
||||
window_size);
|
||||
|
||||
RenderTask::create(id,
|
||||
render_port,
|
||||
|
|
|
@ -116,8 +116,8 @@ pub struct Page {
|
|||
/// What parts of the document are dirty, if any.
|
||||
damage: Option<DocumentDamage>,
|
||||
|
||||
/// The current size of the window, in pixels. If `None`, we do not know the window size yet.
|
||||
window_size: Option<Size2D<uint>>,
|
||||
/// The current size of the window, in pixels.
|
||||
window_size: Size2D<uint>,
|
||||
|
||||
js_info: Option<JSPageInfo>,
|
||||
|
||||
|
@ -146,7 +146,7 @@ pub struct PageTreeIterator<'self> {
|
|||
}
|
||||
|
||||
impl PageTree {
|
||||
fn new(id: PipelineId, layout_chan: LayoutChan) -> PageTree {
|
||||
fn new(id: PipelineId, layout_chan: LayoutChan, window_size: Size2D<uint>) -> PageTree {
|
||||
PageTree {
|
||||
page: @mut Page {
|
||||
id: id,
|
||||
|
@ -154,7 +154,7 @@ impl PageTree {
|
|||
layout_chan: layout_chan,
|
||||
layout_join_port: None,
|
||||
damage: None,
|
||||
window_size: None,
|
||||
window_size: window_size,
|
||||
js_info: None,
|
||||
url: None,
|
||||
next_subpage_id: SubpageId(0),
|
||||
|
@ -296,14 +296,6 @@ impl Page {
|
|||
}
|
||||
};
|
||||
|
||||
let window_size = match self.window_size {
|
||||
None => {
|
||||
debug!("not reflowing due to lack of a window size");
|
||||
return
|
||||
}
|
||||
Some(window_size) => window_size,
|
||||
};
|
||||
|
||||
match root {
|
||||
None => {},
|
||||
Some(root) => {
|
||||
|
@ -326,7 +318,7 @@ impl Page {
|
|||
document_root: root,
|
||||
url: self.url.get_ref().first().clone(),
|
||||
goal: goal,
|
||||
window_size: window_size,
|
||||
window_size: self.window_size,
|
||||
script_chan: script_chan,
|
||||
script_join_chan: join_chan,
|
||||
damage: replace(&mut self.damage, None).unwrap(),
|
||||
|
@ -437,12 +429,13 @@ impl ScriptTask {
|
|||
chan: ScriptChan,
|
||||
constellation_chan: ConstellationChan,
|
||||
resource_task: ResourceTask,
|
||||
img_cache_task: ImageCacheTask)
|
||||
img_cache_task: ImageCacheTask,
|
||||
window_size: Size2D<uint>)
|
||||
-> @mut ScriptTask {
|
||||
let js_runtime = js::rust::rt();
|
||||
|
||||
let script_task = @mut ScriptTask {
|
||||
page_tree: PageTree::new(id, layout_chan),
|
||||
page_tree: PageTree::new(id, layout_chan, window_size),
|
||||
|
||||
image_cache_task: img_cache_task,
|
||||
resource_task: resource_task,
|
||||
|
@ -474,7 +467,8 @@ impl ScriptTask {
|
|||
chan: ScriptChan,
|
||||
constellation_chan: ConstellationChan,
|
||||
resource_task: ResourceTask,
|
||||
image_cache_task: ImageCacheTask) {
|
||||
image_cache_task: ImageCacheTask,
|
||||
window_size: Size2D<uint>) {
|
||||
let parms = Cell::new((compositor,
|
||||
layout_chan,
|
||||
port,
|
||||
|
@ -500,7 +494,8 @@ impl ScriptTask {
|
|||
chan,
|
||||
constellation_chan,
|
||||
resource_task,
|
||||
image_cache_task);
|
||||
image_cache_task,
|
||||
window_size);
|
||||
script_task.start();
|
||||
}
|
||||
}
|
||||
|
@ -580,7 +575,7 @@ impl ScriptTask {
|
|||
let parent_page_tree = self.page_tree.find(old_id).expect("ScriptTask: received a layout
|
||||
whose parent has a PipelineId which does not correspond to a pipeline in the script
|
||||
task's page tree. This is a bug.");
|
||||
let new_page_tree = PageTree::new(new_id, layout_chan);
|
||||
let new_page_tree = PageTree::new(new_id, layout_chan, parent_page_tree.page.window_size);
|
||||
parent_page_tree.inner.push(new_page_tree);
|
||||
}
|
||||
|
||||
|
@ -634,7 +629,7 @@ impl ScriptTask {
|
|||
fn handle_resize_inactive_msg(&mut self, id: PipelineId, new_size: Size2D<uint>) {
|
||||
let page = self.page_tree.find(id).expect("Received resize message for PipelineId not associated
|
||||
with a page in the page tree. This is a bug.").page;
|
||||
page.window_size = Some(new_size);
|
||||
page.window_size = new_size;
|
||||
let last_loaded_url = replace(&mut page.url, None);
|
||||
for url in last_loaded_url.iter() {
|
||||
page.url = Some((url.first(), true));
|
||||
|
@ -846,7 +841,7 @@ impl ScriptTask {
|
|||
ResizeEvent(new_width, new_height) => {
|
||||
debug!("script got resize event: {:u}, {:u}", new_width, new_height);
|
||||
|
||||
page.window_size = Some(Size2D(new_width, new_height));
|
||||
page.window_size = Size2D(new_width, new_height);
|
||||
|
||||
if page.frame.is_some() {
|
||||
page.damage(ReflowDocumentDamage);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue