compositing/script: Do not dispatch the resize event when initially loading.

No bug report corresponds to this, but I noticed it while trying to
reduce #10593
This commit is contained in:
Michael Howell 2016-04-16 14:04:03 -07:00
parent 75d99eec0f
commit 7940b22158
10 changed files with 103 additions and 48 deletions

View file

@ -56,7 +56,7 @@ use js::rust::Runtime;
use layout_interface::{LayoutChan, LayoutRPC};
use libc;
use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WindowSizeType};
use net_traits::image::base::{Image, ImageMetadata};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
use net_traits::response::HttpsState;
@ -294,7 +294,7 @@ no_jsmanaged_fields!(PropertyDeclarationBlock);
no_jsmanaged_fields!(HashSet<T>);
// These three are interdependent, if you plan to put jsmanaged data
// in one of these make sure it is propagated properly to containing structs
no_jsmanaged_fields!(SubpageId, WindowSizeData, PipelineId);
no_jsmanaged_fields!(SubpageId, WindowSizeData, WindowSizeType, PipelineId);
no_jsmanaged_fields!(TimerEventId, TimerSource);
no_jsmanaged_fields!(WorkerId);
no_jsmanaged_fields!(QuirksMode);

View file

@ -43,7 +43,8 @@ use js::rust::Runtime;
use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleResponse, ScriptReflow};
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowQueryType, MarginStyleResponse};
use libc;
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData};
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId};
use msg::constellation_msg::{WindowSizeData, WindowSizeType};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::ResourceThread;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
@ -181,7 +182,7 @@ pub struct Window {
next_subpage_id: Cell<SubpageId>,
/// Pending resize event, if any.
resize_event: Cell<Option<WindowSizeData>>,
resize_event: Cell<Option<(WindowSizeData, WindowSizeType)>>,
/// Pipeline id associated with this page.
id: PipelineId,
@ -1280,11 +1281,11 @@ impl Window {
self.pending_reflow_count.set(self.pending_reflow_count.get() + 1);
}
pub fn set_resize_event(&self, event: WindowSizeData) {
self.resize_event.set(Some(event));
pub fn set_resize_event(&self, event: WindowSizeData, event_type: WindowSizeType) {
self.resize_event.set(Some((event, event_type)));
}
pub fn steal_resize_event(&self) -> Option<WindowSizeData> {
pub fn steal_resize_event(&self) -> Option<(WindowSizeData, WindowSizeType)> {
let event = self.resize_event.get();
self.resize_event.set(None);
event