Issue #1355 - Store the dirty rect on the display list builder rather than passing it as a parameter to BuildDisplayList

Also fix build bustage for De-unified layout/xul in nsRootBoxFrame.cpp
This commit is contained in:
win7-7 2020-05-08 15:20:01 +03:00 committed by Roy Tam
commit 85b85bac28
154 changed files with 259 additions and 430 deletions

View file

@ -3031,7 +3031,6 @@ struct HoveredStateComparator
void
ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists,
bool aCreateLayer,
bool aPositioned)
@ -3093,23 +3092,25 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
// zoomable, and where the scrollbar sizes are bounded by the widget.
nsRect dirty = mIsRoot && mOuter->PresContext()->IsRootContentDocument()
? scrollParts[i]->GetVisualOverflowRectRelativeToParent()
: aDirtyRect;
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, scrollParts[i],
dirty + mOuter->GetOffsetTo(scrollParts[i]), true);
: aBuilder->GetDirtyRect();
// Always create layers for overlay scrollbars so that we don't create a
// giant layer covering the whole scrollport if both scrollbars are visible.
bool isOverlayScrollbar = (flags != 0) && overlayScrollbars;
bool createLayer = aCreateLayer || isOverlayScrollbar;
nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter
infoSetter(aBuilder, scrollTargetId, flags, createLayer);
nsDisplayListCollection partList;
mOuter->BuildDisplayListForChild(
aBuilder, scrollParts[i], dirty, partList,
nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
{
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, mOuter,
dirty, true);
nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter
infoSetter(aBuilder, scrollTargetId, flags, createLayer);
mOuter->BuildDisplayListForChild(
aBuilder, scrollParts[i], partList,
nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
}
if (createLayer) {
appendToTopFlags |= APPEND_OWN_LAYER;
}
@ -3117,11 +3118,18 @@ ScrollFrameHelper::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
appendToTopFlags |= APPEND_POSITIONED;
}
{
nsDisplayListBuilder::AutoBuildingDisplayList
buildingForChild(aBuilder, scrollParts[i],
dirty + mOuter->GetOffsetTo(scrollParts[i]), true);
nsDisplayListBuilder::AutoCurrentScrollbarInfoSetter
infoSetter(aBuilder, scrollTargetId, flags, createLayer);
// DISPLAY_CHILD_FORCE_STACKING_CONTEXT put everything into
// partList.PositionedDescendants().
::AppendToTop(aBuilder, aLists,
partList.PositionedDescendants(), scrollParts[i],
appendToTopFlags);
}
}
}
@ -3246,7 +3254,6 @@ ClipListsExceptCaret(nsDisplayListCollection* aLists,
void
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (aBuilder->IsForFrameVisibility()) {
@ -3283,7 +3290,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// had dirty rects saved for them by their parent frames calling
// MarkOutOfFlowChildrenForDisplayList, so it's safe to restrict our
// dirty rect here.
nsRect dirtyRect = aDirtyRect;
nsRect dirtyRect = aBuilder->GetDirtyRect();
if (!ignoringThisScrollFrame) {
dirtyRect = dirtyRect.Intersect(mScrollPort);
}
@ -3325,20 +3332,20 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (addScrollBars) {
// Add classic scrollbars.
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists,
createLayersForScrollbars, false);
AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, false);
}
nsDisplayListBuilder::AutoBuildingDisplayList
building(aBuilder, mOuter, dirtyRect, aBuilder->IsAtRootOfPseudoStackingContext());
// Don't clip the scrolled child, and don't paint scrollbars/scrollcorner.
// The scrolled frame shouldn't have its own background/border, so we
// can just pass aLists directly.
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame,
dirtyRect, aLists);
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, aLists);
if (addScrollBars) {
// Add overlay scrollbars.
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists,
createLayersForScrollbars, true);
AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, true);
}
return;
@ -3376,8 +3383,7 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// Note that this does not apply for overlay scrollbars; those are drawn
// in the positioned-elements layer on top of everything else by the call
// to AppendScrollPartsTo(..., true) further down.
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists,
createLayersForScrollbars, false);
AppendScrollPartsTo(aBuilder, aLists, createLayersForScrollbars, false);
const nsStyleDisplay* disp = mOuter->StyleDisplay();
if (disp && (disp->mWillChangeBitField & NS_STYLE_WILL_CHANGE_SCROLL)) {
@ -3506,7 +3512,10 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
scrolledRectClipState.ClipContainingBlockDescendants(
scrolledRectClip + aBuilder->ToReferenceFrame(mOuter));
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, dirtyRect, scrolledContent);
nsDisplayListBuilder::AutoBuildingDisplayList
building(aBuilder, mOuter, dirtyRect, aBuilder->IsAtRootOfPseudoStackingContext());
mOuter->BuildDisplayListForChild(aBuilder, mScrolledFrame, scrolledContent);
}
if (contentBoxClipForNonCaretContent) {
@ -3593,8 +3602,8 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
}
// Now display overlay scrollbars and the resizer, if we have one.
AppendScrollPartsTo(aBuilder, aDirtyRect, scrolledContent,
createLayersForScrollbars, true);
AppendScrollPartsTo(aBuilder, scrolledContent, createLayersForScrollbars, true);
scrolledContent.MoveTo(aLists);
}
@ -6175,3 +6184,4 @@ ScrollFrameHelper::UsesContainerScrolling() const
}
return false;
}