Bug 1520301 - Fix scroll frame default positioning r=jrmuizel

When scroll frames are created, and no explicit parent is provided,
the old code used to take the ClipID from the c/s stack. The stack
has been removed on WR side, and this parent assignment got lost.

This change takes the SpatialID from the top of the stack on Gecko
side to replicate the old behavior.

Differential Revision: https://phabricator.services.mozilla.com/D16732

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Dzmitry Malyshau 2019-01-17 16:43:08 +00:00
parent f7d975f8af
commit 1ab11075de
4 changed files with 16 additions and 2 deletions

View File

@ -0,0 +1,5 @@
<body style="margin-left: 0px">
<div style="margin-left: 200px; width: 200px; height: 100px; overflow: auto;">
<div style="background-color: red; height: 200px;"/>
</div>
</body>

View File

@ -0,0 +1,5 @@
<body>
<div style="left: 400px; position: fixed; transform: translateX(-200px); width: 200px; height: 100px; overflow: auto;">
<div style="background-color: red; height: 200px;"/>
</div>
</body>

View File

@ -16,3 +16,4 @@ fuzzy(0-100,0-30) == 1149923.html 1149923-ref.html # use fuzzy due to few distor
== 1461313.html 1461313-ref.html
fuzzy(5-32,21908-26621) fuzzy-if(webrender,0-1,0-3) == 1463802.html 1463802-ref.html
fuzzy(0-11,0-4) == 1474722.html 1474722-ref.html
== 1519754.html 1519754-ref.html

View File

@ -797,10 +797,13 @@ wr::WrSpaceAndClip DisplayListBuilder::DefineScrollLayer(
return it->second;
}
auto rootSpaceAndClip = wr::RootScrollNode();
// We haven't defined aViewId before, so let's define it now.
wr::WrSpaceAndClip defaultParent = wr::RootScrollNode();
//Note: we are currently ignoring the clipId on the stack here
defaultParent.space = mCurrentSpaceAndClipChain.space;
auto spaceAndClip = wr_dp_define_scroll_layer(
mWrState, aViewId, aParent ? aParent.ptr() : &rootSpaceAndClip,
mWrState, aViewId, aParent ? aParent.ptr() : &defaultParent,
aContentRect, aClipRect);
WRDL_LOG("DefineScrollLayer id=%" PRIu64 "/%zu p=%s co=%s cl=%s\n", mWrState,