mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 1444904 - Get the root scroll frame id from WebRender r=kats
Instead of hard-cording the root scroll frame id, get the value from WebRender. This was previously hard-coded to 0, so when WebRender switched to using 1 for the root scroll frame id, the positioning of sticky frames were broken in subtle ways. This happened because they were being parented to a root reference frame (which now uses the 0 id) instead of the root scroll frame. MozReview-Commit-ID: 66ArgKHGpWE --HG-- extra : rebase_source : ff6937bf7fc8d4472eb074d0466c8dcd6fba54a8
This commit is contained in:
parent
08516a61ad
commit
f55533615b
@ -124,7 +124,7 @@ ScrollingLayersHelper::BeginItem(nsDisplayItem* aItem,
|
||||
// nested ScrollingLayersHelper may rely on things like TopmostScrollId and
|
||||
// TopmostClipId, so now we need to push at most two things onto the stack.
|
||||
|
||||
wr::WrScrollId rootId = wr::WrScrollId { 0 };
|
||||
wr::WrScrollId rootId = wr::WrScrollId::RootScrollNode();
|
||||
wr::WrScrollId leafmostId = ids.first.valueOr(rootId);
|
||||
|
||||
FrameMetrics::ViewID viewId = aItem->GetActiveScrolledRoot()
|
||||
@ -301,7 +301,7 @@ ScrollingLayersHelper::RecurseAndDefineClip(nsDisplayItem* aItem,
|
||||
MOZ_ASSERT(!ancestorIds.second);
|
||||
FrameMetrics::ViewID viewId = aChain->mASR ? aChain->mASR->GetViewId() : FrameMetrics::NULL_SCROLL_ID;
|
||||
|
||||
wr::WrScrollId rootId = wr::WrScrollId { 0 };
|
||||
wr::WrScrollId rootId = wr::WrScrollId::RootScrollNode();
|
||||
auto scrollId = mBuilder->GetScrollIdForDefinedScrollLayer(viewId).valueOr(rootId);
|
||||
if (mBuilder->TopmostScrollId() == scrollId) {
|
||||
if (mBuilder->TopmostIsClip()) {
|
||||
|
19
gfx/tests/reftest/1444904-ref.html
Normal file
19
gfx/tests/reftest/1444904-ref.html
Normal file
@ -0,0 +1,19 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#box {
|
||||
position: absolute;
|
||||
top: 80px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: green;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="height: 10000px;">
|
||||
<div id="box"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
36
gfx/tests/reftest/1444904.html
Normal file
36
gfx/tests/reftest/1444904.html
Normal file
@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#container {
|
||||
float: left;
|
||||
position: sticky;
|
||||
top: 0;
|
||||
margin-top: -20px;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
#target {
|
||||
margin-top: 80px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
background: green;
|
||||
}
|
||||
|
||||
#necessary-fixed-box {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body style="height: 10000px;">
|
||||
<div id="container">
|
||||
<div id="target"></div>
|
||||
<div id="necessary-fixed-box"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -11,3 +11,4 @@ fuzzy(100,30) == 1149923.html 1149923-ref.html # use fuzzy due to few distorted
|
||||
== 1424673.html 1424673-ref.html
|
||||
== 1429411.html 1429411-ref.html
|
||||
== 1435143.html 1435143-ref.html
|
||||
== 1444904.html 1444904-ref.html
|
||||
|
@ -941,7 +941,7 @@ Maybe<wr::WrScrollId>
|
||||
DisplayListBuilder::GetScrollIdForDefinedScrollLayer(layers::FrameMetrics::ViewID aViewId) const
|
||||
{
|
||||
if (aViewId == layers::FrameMetrics::NULL_SCROLL_ID) {
|
||||
return Some(wr::WrScrollId { 0 });
|
||||
return Some(wr::WrScrollId::RootScrollNode());
|
||||
}
|
||||
|
||||
auto it = mScrollIds.find(aViewId);
|
||||
@ -1320,7 +1320,7 @@ DisplayListBuilder::TopmostScrollId()
|
||||
return it->as<wr::WrScrollId>();
|
||||
}
|
||||
}
|
||||
return wr::WrScrollId { 0 };
|
||||
return wr::WrScrollId::RootScrollNode();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -22,5 +22,9 @@ Assign_WrVecU8(wr::WrVecU8& aVec, mozilla::ipc::ByteBuf&& aOther)
|
||||
aOther.mCapacity = 0;
|
||||
}
|
||||
|
||||
WrScrollId WrScrollId::RootScrollNode() {
|
||||
return WrScrollId { wr_root_scroll_node_id() };
|
||||
}
|
||||
|
||||
} // namespace wr
|
||||
} // namespace mozilla
|
||||
|
@ -783,6 +783,8 @@ struct WrScrollId {
|
||||
bool operator!=(const WrScrollId& other) const {
|
||||
return id != other.id;
|
||||
}
|
||||
|
||||
static WrScrollId RootScrollNode();
|
||||
};
|
||||
|
||||
// Corresponds to a clip id for a position:sticky clip in webrender. Similar
|
||||
|
@ -2243,3 +2243,13 @@ pub extern "C" fn wr_init_external_log_handler(log_filter: WrLogLevelFilter) {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_shutdown_external_log_handler() {
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wr_root_scroll_node_id() -> usize {
|
||||
// The PipelineId doesn't matter here, since we just want the numeric part of the id
|
||||
// produced for any given root reference frame.
|
||||
match ClipId::root_scroll_node(PipelineId(0, 0)) {
|
||||
ClipId::Clip(id, _) => id,
|
||||
_ => unreachable!("Got a non Clip ClipId for root reference frame."),
|
||||
}
|
||||
}
|
||||
|
@ -1528,6 +1528,10 @@ void wr_resource_updates_update_image(ResourceUpdates *aResources,
|
||||
WrVecU8 *aBytes)
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
uintptr_t wr_root_scroll_node_id()
|
||||
WR_FUNC;
|
||||
|
||||
WR_INLINE
|
||||
void wr_set_item_tag(WrState *aState,
|
||||
uint64_t aScrollId,
|
||||
|
Loading…
Reference in New Issue
Block a user