aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/document.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-03-04 04:00:30 +0530
committerbors-servo <lbergstrom+bors@mozilla.com>2016-03-04 04:00:30 +0530
commit37bcc161fe45bf8c1cb1172b8e0d12c7d03371b6 (patch)
tree3d2946b320f74975411fd99672c88de10042c1a2 /components/script/dom/document.rs
parent55fc48e4c46917a0f036d0054fac296bb5719434 (diff)
parent2507bfb2cf3a5d16d457bb8ebc56545d8d6cee09 (diff)
downloadservo-37bcc161fe45bf8c1cb1172b8e0d12c7d03371b6.tar.gz
servo-37bcc161fe45bf8c1cb1172b8e0d12c7d03371b6.zip
Auto merge of #9832 - metajack:suppress-reflows, r=mbrubeck
Suppress reflows before RefreshTick or FirstLoad This fixes a bug where partially loaded content is displayed to the user before it should be, usually before stylesheets have loaded. This commit supresses reflows until either FirstLoad or RefreshTick, whichever comes first. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9832) <!-- Reviewable:end -->
Diffstat (limited to 'components/script/dom/document.rs')
-rw-r--r--components/script/dom/document.rs22
1 files changed, 5 insertions, 17 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index ec0e78fafc2..7d0a3be8b14 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -80,7 +80,6 @@ use html5ever::tree_builder::{LimitedQuirks, NoQuirks, Quirks, QuirksMode};
use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::JS_GetRuntime;
use js::jsapi::{JSContext, JSObject, JSRuntime};
-use layout_interface::HitTestResponse;
use layout_interface::{LayoutChan, Msg, ReflowQueryType};
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState};
@@ -93,7 +92,7 @@ use num::ToPrimitive;
use script_thread::{MainThreadScriptMsg, Runnable};
use script_traits::{AnimationState, MouseButton, MouseEventType, MozBrowserEvent};
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
-use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
+use script_traits::{TouchEventType, TouchId};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::boxed::FnBox;
@@ -563,17 +562,6 @@ impl Document {
.map(Root::upcast)
}
- pub fn hit_test(&self, page_point: &Point2D<f32>, update_cursor: bool) -> Option<UntrustedNodeAddress> {
- assert!(self.GetDocumentElement().is_some());
- match self.window.layout().hit_test(*page_point, update_cursor) {
- Ok(HitTestResponse(node_address)) => Some(node_address),
- Err(()) => {
- debug!("layout query error");
- None
- }
- }
- }
-
// https://html.spec.whatwg.org/multipage/#current-document-readiness
pub fn set_ready_state(&self, state: DocumentReadyState) {
match state {
@@ -685,7 +673,7 @@ impl Document {
let page_point = Point2D::new(client_point.x + self.window.PageXOffset() as f32,
client_point.y + self.window.PageYOffset() as f32);
- let node = match self.hit_test(&page_point, false) {
+ let node = match self.window.hit_test_query(page_point, false) {
Some(node_address) => {
debug!("node address is {:?}", node_address);
node::from_untrusted_node_address(js_runtime, node_address)
@@ -814,7 +802,7 @@ impl Document {
let client_point = client_point.unwrap();
- let maybe_new_target = self.hit_test(&page_point, true).and_then(|address| {
+ let maybe_new_target = self.window.hit_test_query(page_point, true).and_then(|address| {
let node = node::from_untrusted_node_address(js_runtime, address);
node.inclusive_ancestors()
.filter_map(Root::downcast::<Element>)
@@ -908,7 +896,7 @@ impl Document {
TouchEventType::Cancel => "touchcancel",
};
- let node = match self.hit_test(&point, false) {
+ let node = match self.window.hit_test_query(point, false) {
Some(node_address) => node::from_untrusted_node_address(js_runtime, node_address),
None => return false,
};
@@ -2575,7 +2563,7 @@ impl DocumentMethods for Document {
let js_runtime = unsafe { JS_GetRuntime(window.get_cx()) };
- match self.hit_test(point, false) {
+ match self.window.hit_test_query(*point, false) {
Some(untrusted_node_address) => {
let node = node::from_untrusted_node_address(js_runtime, untrusted_node_address);
let parent_node = node.GetParentNode().unwrap();