Create proper root ClipId when scrolling from script

WebRender currently makes a distinction between an external ClipId with
id equal to 0 and the root scroll ClipId. We need to detect this
situation and properly form the ClipId for the root.
This commit is contained in:
Martin Robinson 2017-04-19 12:55:59 +02:00
parent 0a54d5a025
commit 6017dc0836
4 changed files with 59 additions and 1 deletions

View file

@ -797,7 +797,12 @@ impl<Window: WindowMethods> IOCompositor<Window> {
pipeline_id: PipelineId,
scroll_root_id: ScrollRootId,
point: Point2D<f32>) {
let id = ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender());
let id = if scroll_root_id.0 == 0 {
ClipId::root_scroll_node(pipeline_id.to_webrender())
} else {
ClipId::new(scroll_root_id.0 as u64, pipeline_id.to_webrender())
};
self.webrender_api.scroll_node_with_id(LayoutPoint::from_untyped(&point), id);
}

View file

@ -6485,6 +6485,18 @@
{}
]
],
"mozilla/scroll_root.html": [
[
"/_mozilla/mozilla/scroll_root.html",
[
[
"/_mozilla/mozilla/scroll_root_ref.html",
"=="
]
],
{}
]
],
"mozilla/scrolling_div_background_borders.html": [
[
"/_mozilla/mozilla/scrolling_div_background_borders.html",
@ -11007,6 +11019,11 @@
{}
]
],
"mozilla/scroll_root_ref.html": [
[
{}
]
],
"mozilla/scrolling_div_background_borders_background.png": [
[
{}
@ -31289,6 +31306,14 @@
"b9917be5fed364dbc46264f641f54f275b5c054a",
"testharness"
],
"mozilla/scroll_root.html": [
"21c447dd041a77fb54e2b28c8b76de684afb9560",
"reftest"
],
"mozilla/scroll_root_ref.html": [
"ce75eb73232617c77309aca879ba8d34461538a6",
"support"
],
"mozilla/scroll_top_null_target.html": [
"8e419c3f33fba1bc1444cf4c6dd3e5977f6fd841",
"testharness"

View file

@ -0,0 +1,17 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Verify that scrolling the root does actually do a visual scroll</title>
<link rel="match" href="scroll_root_ref.html">
<style>
body {
background: green;
}
</style>
</head>
<body onload="window.scrollBy(0, 2000);">
<div style="width: 100px; height: 100px; background: red;"></div>
<div style="height: 10000px"></div>
</body>
</html>

View file

@ -0,0 +1,11 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<style>
body {
background: green;
}
</style>
</head>
</html>