aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_thread.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-04-22 14:25:51 -0700
committerbors-servo <lbergstrom+bors@mozilla.com>2016-04-22 14:25:51 -0700
commit47a0f58f98e1a6ddcf5db24347fc6bf890d4a7d6 (patch)
tree996fe771cd42d716f721943a8aa0f51213daae9a /components/script/script_thread.rs
parent0a3a50a1293e4e8f3e04161014d03802765140c7 (diff)
parent7940b22158d892293641aa25df7720316db7e573 (diff)
downloadservo-47a0f58f98e1a6ddcf5db24347fc6bf890d4a7d6.tar.gz
servo-47a0f58f98e1a6ddcf5db24347fc6bf890d4a7d6.zip
Auto merge of #10654 - notriddle:no_resize_on_initial_load, r=asajeffrey
compositing/script: Do not dispatch the resize event when initially l… …oading. No bug report corresponds to this, but I noticed it while trying to reduce #10593 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/10654) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/script_thread.rs')
-rw-r--r--components/script/script_thread.rs32
1 files changed, 17 insertions, 15 deletions
diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs
index c7a6f007154..22d1ddb0206 100644
--- a/components/script/script_thread.rs
+++ b/components/script/script_thread.rs
@@ -61,7 +61,7 @@ use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ScriptLayoutChan};
use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{ConstellationChan, LoadData};
use msg::constellation_msg::{PipelineId, PipelineNamespace};
-use msg::constellation_msg::{SubpageId, WindowSizeData};
+use msg::constellation_msg::{SubpageId, WindowSizeData, WindowSizeType};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
@@ -635,8 +635,8 @@ impl ScriptThread {
}
}
- for (id, size) in resizes {
- self.handle_event(id, ResizeEvent(size));
+ for (id, (size, size_type)) in resizes {
+ self.handle_event(id, ResizeEvent(size, size_type));
}
// Store new resizes, and gather all other events.
@@ -689,9 +689,9 @@ impl ScriptThread {
self.handle_new_layout(new_layout_info);
})
}
- FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
+ FromConstellation(ConstellationControlMsg::Resize(id, size, size_type)) => {
self.profile_event(ScriptThreadEventCategory::Resize, || {
- self.handle_resize(id, size);
+ self.handle_resize(id, size, size_type);
})
}
FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
@@ -1020,10 +1020,10 @@ impl ScriptThread {
}
}
- fn handle_resize(&self, id: PipelineId, size: WindowSizeData) {
+ fn handle_resize(&self, id: PipelineId, size: WindowSizeData, size_type: WindowSizeType) {
if let Some(ref page) = self.find_subpage(id) {
let window = page.window();
- window.set_resize_event(size);
+ window.set_resize_event(size, size_type);
return;
}
let mut loads = self.incomplete_loads.borrow_mut();
@@ -1670,8 +1670,8 @@ impl ScriptThread {
}
match event {
- ResizeEvent(new_size) => {
- self.handle_resize_event(pipeline_id, new_size);
+ ResizeEvent(new_size, size_type) => {
+ self.handle_resize_event(pipeline_id, new_size, size_type);
}
MouseButtonEvent(event_type, button, point) => {
@@ -1831,7 +1831,7 @@ impl ScriptThread {
}
}
- fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData) {
+ fn handle_resize_event(&self, pipeline_id: PipelineId, new_size: WindowSizeData, size_type: WindowSizeType) {
let page = get_page(&self.root_page(), pipeline_id);
let window = page.window();
window.set_window_size(new_size);
@@ -1849,11 +1849,13 @@ impl ScriptThread {
// http://dev.w3.org/csswg/cssom-view/#resizing-viewports
// https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#event-type-resize
- let uievent = UIEvent::new(window.r(),
- DOMString::from("resize"), EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable, Some(window.r()),
- 0i32);
- uievent.upcast::<Event>().fire(window.upcast());
+ if size_type == WindowSizeType::Resize {
+ let uievent = UIEvent::new(window.r(),
+ DOMString::from("resize"), EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable, Some(window.r()),
+ 0i32);
+ uievent.upcast::<Event>().fire(window.upcast());
+ }
}
/// Initiate a non-blocking fetch for a specified resource. Stores the InProgressLoad