aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2018-01-16 18:47:05 +0100
committerMartin Robinson <mrobinson@igalia.com>2018-02-06 15:10:35 +0100
commit99eb457fc7afb0cd4178ae955d0d998e253b25f2 (patch)
tree7be3fa7b2607a271983fede7720c984610e4b255 /components/script
parent984f3ccc414bf420787efcb10eebe48cf2cbca36 (diff)
downloadservo-99eb457fc7afb0cd4178ae955d0d998e253b25f2.tar.gz
servo-99eb457fc7afb0cd4178ae955d0d998e253b25f2.zip
Update WebRender
This allows servo to use the ExternalScrollId API from WebRender fixing some issues related to duplicate scroll root ids. Fixes #17176. Fixes #19287. Fixes #19648.
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/document.rs4
-rw-r--r--components/script/dom/window.rs34
2 files changed, 20 insertions, 18 deletions
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 436d4e71d1a..0ed2c25ff4b 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -141,7 +141,6 @@ use time;
use timers::OneshotTimerCallback;
use url::Host;
use url::percent_encoding::percent_decode;
-use webrender_api::ClipId;
/// The number of times we are allowed to see spurious `requestAnimationFrame()` calls before
/// falling back to fake ones.
@@ -730,11 +729,10 @@ impl Document {
if let Some((x, y)) = point {
// Step 3
let global_scope = self.window.upcast::<GlobalScope>();
- let webrender_pipeline_id = global_scope.pipeline_id().to_webrender();
self.window.update_viewport_for_scroll(x, y);
self.window.perform_a_scroll(x,
y,
- ClipId::root_scroll_node(webrender_pipeline_id),
+ global_scope.pipeline_id().root_scroll_id(),
ScrollBehavior::Instant,
target.r());
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index e9055f54ea0..c92a04c7cd4 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -72,7 +72,7 @@ use script_layout_interface::{TrustedNodeAddress, PendingImageState};
use script_layout_interface::message::{Msg, Reflow, ReflowGoal, ScriptReflow};
use script_layout_interface::reporter::CSSErrorReporter;
use script_layout_interface::rpc::{ContentBoxResponse, ContentBoxesResponse, LayoutRPC};
-use script_layout_interface::rpc::{NodeScrollRootIdResponse, ResolvedStyleResponse, TextIndexResponse};
+use script_layout_interface::rpc::{NodeScrollIdResponse, ResolvedStyleResponse, TextIndexResponse};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThreadEventCategory, Runtime};
use script_thread::{ImageCacheMsg, MainThreadScriptChan, MainThreadScriptMsg};
use script_thread::{ScriptThread, SendableMainThreadScriptChan};
@@ -120,7 +120,7 @@ use timers::{IsInterval, TimerCallback};
use tinyfiledialogs::{self, MessageBoxIcon};
use url::Position;
use webdriver_handlers::jsval_to_webdriver;
-use webrender_api::{ClipId, DocumentId};
+use webrender_api::{ExternalScrollId, DocumentId};
use webvr_traits::WebVRMsg;
/// Current state of the window object
@@ -1141,7 +1141,7 @@ impl Window {
self.update_viewport_for_scroll(x, y);
self.perform_a_scroll(x,
y,
- global_scope.pipeline_id().root_scroll_node(),
+ global_scope.pipeline_id().root_scroll_id(),
behavior,
None);
}
@@ -1150,14 +1150,14 @@ impl Window {
pub fn perform_a_scroll(&self,
x: f32,
y: f32,
- scroll_root_id: ClipId,
+ scroll_id: ExternalScrollId,
_behavior: ScrollBehavior,
_element: Option<&Element>) {
// TODO Step 1
// TODO(mrobinson, #18709): Add smooth scrolling support to WebRender so that we can
// properly process ScrollBehavior here.
self.layout_chan.send(Msg::UpdateScrollStateFromScript(ScrollState {
- scroll_root_id: scroll_root_id,
+ scroll_id,
scroll_offset: Vector2D::new(-x, -y),
})).unwrap();
}
@@ -1412,13 +1412,17 @@ impl Window {
}
// https://drafts.csswg.org/cssom-view/#element-scrolling-members
- pub fn scroll_node(&self,
- node: &Node,
- x_: f64,
- y_: f64,
- behavior: ScrollBehavior) {
- if !self.reflow(ReflowGoal::NodeScrollRootIdQuery(node.to_trusted_node_address()),
- ReflowReason::Query) {
+ pub fn scroll_node(
+ &self,
+ node: &Node,
+ x_: f64,
+ y_: f64,
+ behavior: ScrollBehavior
+ ) {
+ if !self.reflow(
+ ReflowGoal::NodeScrollIdQuery(node.to_trusted_node_address()),
+ ReflowReason::Query
+ ) {
return;
}
@@ -1428,12 +1432,12 @@ impl Window {
self.scroll_offsets.borrow_mut().insert(node.to_untrusted_node_address(),
Vector2D::new(x_ as f32, y_ as f32));
- let NodeScrollRootIdResponse(scroll_root_id) = self.layout_rpc.node_scroll_root_id();
+ let NodeScrollIdResponse(scroll_id) = self.layout_rpc.node_scroll_id();
// Step 12
self.perform_a_scroll(x_.to_f32().unwrap_or(0.0f32),
y_.to_f32().unwrap_or(0.0f32),
- scroll_root_id,
+ scroll_id,
behavior,
None);
}
@@ -1888,7 +1892,7 @@ fn debug_reflow_events(id: PipelineId, reflow_goal: &ReflowGoal, reason: &Reflow
ReflowGoal::NodesFromPointQuery(..) => "\tNodesFromPointQuery",
ReflowGoal::NodeGeometryQuery(_n) => "\tNodeGeometryQuery",
ReflowGoal::NodeScrollGeometryQuery(_n) => "\tNodeScrollGeometryQuery",
- ReflowGoal::NodeScrollRootIdQuery(_n) => "\tNodeScrollRootIdQuery",
+ ReflowGoal::NodeScrollIdQuery(_n) => "\tNodeScrollIdQuery",
ReflowGoal::ResolvedStyleQuery(_, _, _) => "\tResolvedStyleQuery",
ReflowGoal::OffsetParentQuery(_n) => "\tOffsetParentQuery",
ReflowGoal::StyleQuery(_n) => "\tStyleQuery",