Backed out 2 changesets (bug 1379458) for causing failures at nsGfxScrollFrame.cpp. CLOSED TREE

Backed out changeset dd6888957eff (bug 1379458)
Backed out changeset 3239f01e81d7 (bug 1379458)
This commit is contained in:
Butkovits Atila 2022-10-29 22:15:03 +03:00
Родитель 6b40db5949
Коммит 0dc4da0978
6 изменённых файлов: 78 добавлений и 50 удалений

Просмотреть файл

@ -1452,6 +1452,11 @@ static nsIFrame* GetNearestScrollableOrOverflowClipFrame(
"GetNearestScrollableOrOverflowClipFrame expects a non-null frame");
auto GetNextFrame = [aFlags](const nsIFrame* aFrame) -> nsIFrame* {
if (aFlags & nsLayoutUtils::SCROLLABLE_FOLLOW_OOF_TO_PLACEHOLDER) {
return (aFlags & nsLayoutUtils::SCROLLABLE_SAME_DOC)
? nsLayoutUtils::GetParentOrPlaceholderFor(aFrame)
: nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(aFrame);
}
return (aFlags & nsLayoutUtils::SCROLLABLE_SAME_DOC)
? aFrame->GetParent()
: nsLayoutUtils::GetCrossDocParentFrameInProcess(aFrame);
@ -2888,7 +2893,8 @@ nsIScrollableFrame* nsLayoutUtils::GetAsyncScrollableAncestorFrame(
nsIFrame* aTarget) {
uint32_t flags = nsLayoutUtils::SCROLLABLE_ALWAYS_MATCH_ROOT |
nsLayoutUtils::SCROLLABLE_ONLY_ASYNC_SCROLLABLE |
nsLayoutUtils::SCROLLABLE_FIXEDPOS_FINDS_ROOT;
nsLayoutUtils::SCROLLABLE_FIXEDPOS_FINDS_ROOT |
nsLayoutUtils::SCROLLABLE_FOLLOW_OOF_TO_PLACEHOLDER;
return nsLayoutUtils::GetNearestScrollableFrame(aTarget, flags);
}
@ -3312,9 +3318,6 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
autoRecording;
ViewID id = ScrollableLayerGuid::NULL_SCROLL_ID;
nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(
builder);
if (presShell->GetDocument() &&
presShell->GetDocument()->IsRootDisplayDocument() &&
!presShell->GetRootScrollFrame()) {
@ -3347,7 +3350,7 @@ void nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
}
}
asrSetter.SetCurrentScrollParentId(id);
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(builder, id);
builder->SetVisibleRect(visibleRect);
builder->SetIsBuilding(true);

Просмотреть файл

@ -623,6 +623,14 @@ class nsLayoutUtils {
* would be undesirable as a 'position:sticky' container for content).
*/
SCROLLABLE_STOP_AT_PAGE = 0x20,
/**
* If the SCROLLABLE_FOLLOW_OOF_TO_PLACEHOLDER flag is set, we navigate
* from out-of-flow frames to their placeholder frame rather than their
* parent frame.
* Note, fixed-pos frames are out-of-flow frames, but
* SCROLLABLE_FIXEDPOS_FINDS_ROOT takes precedence over this.
*/
SCROLLABLE_FOLLOW_OOF_TO_PLACEHOLDER = 0x40
};
/**
* GetNearestScrollableFrame locates the first ancestor of aFrame

Просмотреть файл

@ -4166,8 +4166,18 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
{
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
// Note that setting the current scroll parent id here means that positioned
// children of this scroll info layer will pick up the scroll info layer as
// their scroll handoff parent. This is intentional because that is what
// happens for positioned children of scroll layers, and we want to maintain
// consistent behaviour between scroll layers and scroll info layers.
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(
aBuilder,
couldBuildLayer && mScrolledFrame->GetContent()
? nsLayoutUtils::FindOrCreateIDFor(mScrolledFrame->GetContent())
: aBuilder->GetCurrentScrollParentId());
DisplayListClipState::AutoSaveRestore clipState(aBuilder);
// If we're building an async zoom container, clip the contents inside
// to the layout viewport (scrollPortClip). The composition bounds clip
// (clipRect) will be applied to the zoom container itself in
@ -4300,13 +4310,13 @@ void ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (aBuilder->IsPaintingToWindow()) {
mIsParentToActiveScrollFrames =
ShouldActivateAllScrollFrames()
? asrSetter.GetContainsNonMinimalDisplayPort()
: asrSetter.ShouldForceLayerForScrollParent();
? idSetter.GetContainsNonMinimalDisplayPort()
: idSetter.ShouldForceLayerForScrollParent();
}
if (asrSetter.ShouldForceLayerForScrollParent()) {
if (idSetter.ShouldForceLayerForScrollParent()) {
// Note that forcing layerization of scroll parents follows the scroll
// handoff chain which is subject to the out-of-flow-frames caveat noted
// above (where the asrSetter variable is created).
// above (where the idSetter variable is created).
MOZ_ASSERT(couldBuildLayer && mScrolledFrame->GetContent() &&
aBuilder->IsPaintingToWindow());
if (!mWillBuildScrollableLayer) {

Просмотреть файл

@ -464,6 +464,14 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
visible, dirty);
if (subdocRootFrame) {
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(
aBuilder,
ignoreViewportScrolling && rootScrollFrame &&
rootScrollFrame->GetContent()
? nsLayoutUtils::FindOrCreateIDFor(rootScrollFrame->GetContent())
: aBuilder->GetCurrentScrollParentId());
bool hasDocumentLevelListenersForApzAwareEvents =
gfxPlatform::AsyncPanZoomEnabled() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell);

Просмотреть файл

@ -394,10 +394,6 @@ void nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter::
// Set the builder's mCurrentActiveScrolledRoot.
mBuilder->mCurrentActiveScrolledRoot = aActiveScrolledRoot;
// Update the current scroll parent id to match the new
// active scrolled root.
UpdateCurrentScrollParentId();
// We also need to adjust the builder's mCurrentContainerASR.
// mCurrentContainerASR needs to be an ASR that all the container's
// contents have finite bounds with respect to. If aActiveScrolledRoot

Просмотреть файл

@ -1101,41 +1101,25 @@ class nsDisplayListBuilder {
};
/**
* Used to update the current active scrolled root on the display list
* builder, and to create new active scrolled roots.
* A helper class to temporarily set the value of mCurrentScrollParentId.
*/
class AutoCurrentActiveScrolledRootSetter {
class AutoCurrentScrollParentIdSetter {
public:
explicit AutoCurrentActiveScrolledRootSetter(nsDisplayListBuilder* aBuilder)
AutoCurrentScrollParentIdSetter(nsDisplayListBuilder* aBuilder,
ViewID aScrollId)
: mBuilder(aBuilder),
mSavedActiveScrolledRoot(aBuilder->mCurrentActiveScrolledRoot),
mContentClipASR(aBuilder->ClipState().GetContentClipASR()),
mDescendantsStartIndex(aBuilder->mActiveScrolledRoots.Length()),
mUsed(false),
mOldScrollParentId(aBuilder->mCurrentScrollParentId),
mOldValue(aBuilder->mCurrentScrollParentId),
mOldForceLayer(aBuilder->mForceLayerForScrollParent),
mOldContainsNonMinimalDisplayPort(
mBuilder->mContainsNonMinimalDisplayPort),
mCanBeScrollParent(true) {
UpdateCurrentScrollParentId();
}
void SetCurrentScrollParentId(ViewID aScrollId) {
// If this AutoCurrentActiveScrolledRootSetter has the same aScrollId as
// the previous one on the stack, then that means the scrollframe that
mBuilder->mContainsNonMinimalDisplayPort) {
// If this AutoCurrentScrollParentIdSetter has the same scrollId as the
// previous one on the stack, then that means the scrollframe that
// created this isn't actually scrollable and cannot participate in
// scroll handoff. We set mCanBeScrollParent to false to indicate this.
mCanBeScrollParent = (mOldScrollParentId != aScrollId);
mBuilder->mCurrentScrollParentId = aScrollId;
mBuilder->mForceLayerForScrollParent = false;
mBuilder->mContainsNonMinimalDisplayPort = false;
}
void UpdateCurrentScrollParentId() {
ViewID scrollId = mBuilder->mCurrentActiveScrolledRoot
? mBuilder->mCurrentActiveScrolledRoot->GetViewId()
: layers::ScrollableLayerGuid::NULL_SCROLL_ID;
SetCurrentScrollParentId(scrollId);
mCanBeScrollParent = (mOldValue != aScrollId);
aBuilder->mCurrentScrollParentId = aScrollId;
aBuilder->mForceLayerForScrollParent = false;
aBuilder->mContainsNonMinimalDisplayPort = false;
}
bool ShouldForceLayerForScrollParent() const {
@ -1150,9 +1134,8 @@ class nsDisplayListBuilder {
return mCanBeScrollParent && mBuilder->mContainsNonMinimalDisplayPort;
}
~AutoCurrentActiveScrolledRootSetter() {
mBuilder->mCurrentActiveScrolledRoot = mSavedActiveScrolledRoot;
mBuilder->mCurrentScrollParentId = mOldScrollParentId;
~AutoCurrentScrollParentIdSetter() {
mBuilder->mCurrentScrollParentId = mOldValue;
if (mCanBeScrollParent) {
// If this flag is set, caller code is responsible for having dealt
// with the current value of mBuilder->mForceLayerForScrollParent, so
@ -1168,6 +1151,31 @@ class nsDisplayListBuilder {
mOldContainsNonMinimalDisplayPort;
}
private:
nsDisplayListBuilder* mBuilder;
ViewID mOldValue;
bool mOldForceLayer;
bool mOldContainsNonMinimalDisplayPort;
bool mCanBeScrollParent;
};
/**
* Used to update the current active scrolled root on the display list
* builder, and to create new active scrolled roots.
*/
class AutoCurrentActiveScrolledRootSetter {
public:
explicit AutoCurrentActiveScrolledRootSetter(nsDisplayListBuilder* aBuilder)
: mBuilder(aBuilder),
mSavedActiveScrolledRoot(aBuilder->mCurrentActiveScrolledRoot),
mContentClipASR(aBuilder->ClipState().GetContentClipASR()),
mDescendantsStartIndex(aBuilder->mActiveScrolledRoots.Length()),
mUsed(false) {}
~AutoCurrentActiveScrolledRootSetter() {
mBuilder->mCurrentActiveScrolledRoot = mSavedActiveScrolledRoot;
}
void SetCurrentActiveScrolledRoot(
const ActiveScrolledRoot* aActiveScrolledRoot);
@ -1177,7 +1185,6 @@ class nsDisplayListBuilder {
mBuilder->mCurrentActiveScrolledRoot, aScrollableFrame);
mBuilder->mCurrentActiveScrolledRoot = asr;
mUsed = true;
UpdateCurrentScrollParentId();
}
void InsertScrollFrame(nsIScrollableFrame* aScrollableFrame);
@ -1208,10 +1215,6 @@ class nsDisplayListBuilder {
* class.
*/
bool mUsed;
ViewID mOldScrollParentId;
bool mOldForceLayer;
bool mOldContainsNonMinimalDisplayPort;
bool mCanBeScrollParent;
};
/**