Bug 1490404 - Part 1: Be more consistent with display list and display list builder pointers and references r=mattwoodrow

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-06-06 17:54:13 +00:00
parent aba7a5f8f3
commit fbfcf25cc9
8 changed files with 119 additions and 114 deletions

View File

@ -5020,24 +5020,23 @@ already_AddRefed<SourceSurface> PresShell::RenderSelection(
aScreenRect, aFlags);
}
void PresShell::AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList,
void PresShell::AddPrintPreviewBackgroundItem(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
nsIFrame* aFrame,
const nsRect& aBounds) {
aList.AppendNewToBottom<nsDisplaySolidColor>(&aBuilder, aFrame, aBounds,
NS_RGB(115, 115, 115));
aList->AppendNewToBottom<nsDisplaySolidColor>(aBuilder, aFrame, aBounds,
NS_RGB(115, 115, 115));
}
static bool AddCanvasBackgroundColor(const nsDisplayList& aList,
static bool AddCanvasBackgroundColor(const nsDisplayList* aList,
nsIFrame* aCanvasFrame, nscolor aColor,
bool aCSSBackgroundColor) {
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
for (nsDisplayItem* i = aList->GetBottom(); i; i = i->GetAbove()) {
const DisplayItemType type = i->GetType();
if (i->Frame() == aCanvasFrame &&
type == DisplayItemType::TYPE_CANVAS_BACKGROUND_COLOR) {
nsDisplayCanvasBackgroundColor* bg =
static_cast<nsDisplayCanvasBackgroundColor*>(i);
auto* bg = static_cast<nsDisplayCanvasBackgroundColor*>(i);
bg->SetExtraBackgroundColor(aColor);
return true;
}
@ -5048,7 +5047,7 @@ static bool AddCanvasBackgroundColor(const nsDisplayList& aList,
nsDisplayList* sublist = i->GetSameCoordinateSystemChildren();
if (sublist && !(isBlendContainer && !aCSSBackgroundColor) &&
AddCanvasBackgroundColor(*sublist, aCanvasFrame, aColor,
AddCanvasBackgroundColor(sublist, aCanvasFrame, aColor,
aCSSBackgroundColor))
return true;
}
@ -5056,7 +5055,7 @@ static bool AddCanvasBackgroundColor(const nsDisplayList& aList,
}
void PresShell::AddCanvasBackgroundColorItem(
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
nsDisplayListBuilder* aBuilder, nsDisplayList* aList, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aBackstopColor,
AddCanvasBackgroundColorFlags aFlags) {
if (aBounds.IsEmpty()) {
@ -5112,8 +5111,8 @@ void PresShell::AddCanvasBackgroundColorItem(
}
if (!addedScrollingBackgroundColor || forceUnscrolledItem) {
aList.AppendNewToBottom<nsDisplaySolidColor>(&aBuilder, aFrame, aBounds,
bgcolor);
aList->AppendNewToBottom<nsDisplaySolidColor>(aBuilder, aFrame, aBounds,
bgcolor);
}
}

View File

@ -917,8 +917,8 @@ class PresShell final : public nsStubDocumentObserver,
* bounds aBounds representing the dark grey background behind the page of a
* print preview presentation.
*/
void AddPrintPreviewBackgroundItem(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList, nsIFrame* aFrame,
void AddPrintPreviewBackgroundItem(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList, nsIFrame* aFrame,
const nsRect& aBounds);
/**
@ -1564,7 +1564,7 @@ class PresShell final : public nsStubDocumentObserver,
* LayoutUseContainersForRootFrame has built the scrolling ContainerLayer.
*/
void AddCanvasBackgroundColorItem(
nsDisplayListBuilder& aBuilder, nsDisplayList& aList, nsIFrame* aFrame,
nsDisplayListBuilder* aBuilder, nsDisplayList* aList, nsIFrame* aFrame,
const nsRect& aBounds, nscolor aBackstopColor = NS_RGBA(0, 0, 0, 0),
AddCanvasBackgroundColorFlags aFlags =
AddCanvasBackgroundColorFlags::None);

View File

@ -3284,7 +3284,7 @@ bool nsLayoutUtils::CalculateAndSetDisplayPortMargins(
content, presShell, displayportMargins, 0, aRepaintMode);
}
bool nsLayoutUtils::MaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
bool nsLayoutUtils::MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
nsIFrame* aScrollFrame,
RepaintMode aRepaintMode) {
nsIContent* content = aScrollFrame->GetContent();
@ -3299,9 +3299,9 @@ bool nsLayoutUtils::MaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
// async-scrollable frame (i.e. one that WantsAsyncScroll()) has a
// displayport. If that's not the case yet, and we are async-scrollable, we
// will get a displayport.
if (aBuilder.IsPaintingToWindow() &&
if (aBuilder->IsPaintingToWindow() &&
nsLayoutUtils::AsyncPanZoomEnabled(aScrollFrame) &&
!aBuilder.HaveScrollableDisplayPort() &&
!aBuilder->HaveScrollableDisplayPort() &&
scrollableFrame->WantAsyncScroll()) {
// If we don't already have a displayport, calculate and set one.
if (!haveDisplayPort) {
@ -3314,7 +3314,7 @@ bool nsLayoutUtils::MaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
}
// Record that the we now have a scrollable display port.
aBuilder.SetHaveScrollableDisplayPort();
aBuilder->SetHaveScrollableDisplayPort();
return true;
}
return false;
@ -3354,7 +3354,7 @@ void nsLayoutUtils::SetZeroMarginDisplayPortOnAsyncScrollableAncestors(
}
bool nsLayoutUtils::MaybeCreateDisplayPortInFirstScrollFrameEncountered(
nsIFrame* aFrame, nsDisplayListBuilder& aBuilder) {
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder) {
nsIScrollableFrame* sf = do_QueryFrame(aFrame);
if (sf) {
if (MaybeCreateDisplayPort(aBuilder, aFrame, RepaintMode::Repaint)) {
@ -3428,8 +3428,8 @@ void nsLayoutUtils::ExpireDisplayPortOnAsyncScrollableAncestor(
}
}
void nsLayoutUtils::AddExtraBackgroundItems(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList,
void nsLayoutUtils::AddExtraBackgroundItems(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList,
nsIFrame* aFrame,
const nsRect& aCanvasArea,
const nsRegion& aVisibleRegion,
@ -3443,9 +3443,9 @@ void nsLayoutUtils::AddExtraBackgroundItems(nsDisplayListBuilder& aBuilder,
if (frameType == LayoutFrameType::Viewport &&
nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
nsRect bounds =
nsRect(aBuilder.ToReferenceFrame(aFrame), aFrame->GetSize());
nsRect(aBuilder->ToReferenceFrame(aFrame), aFrame->GetSize());
nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
&aBuilder, aFrame, bounds, bounds);
aBuilder, aFrame, bounds, bounds);
presShell->AddPrintPreviewBackgroundItem(aBuilder, aList, aFrame, bounds);
} else if (frameType != LayoutFrameType::Page) {
// For printing, this function is first called on an nsPageFrame, which
@ -3460,7 +3460,7 @@ void nsLayoutUtils::AddExtraBackgroundItems(nsDisplayListBuilder& aBuilder,
nsRect canvasArea = aVisibleRegion.GetBounds();
canvasArea.IntersectRect(aCanvasArea, canvasArea);
nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
&aBuilder, aFrame, canvasArea, canvasArea);
aBuilder, aFrame, canvasArea, canvasArea);
presShell->AddCanvasBackgroundColorItem(aBuilder, aList, aFrame, canvasArea,
aBackstop);
}
@ -3492,14 +3492,14 @@ static RetainedDisplayListBuilder* GetOrCreateRetainedDisplayListBuilder(
// #define PRINT_HITTESTINFO_STATS
#ifdef PRINT_HITTESTINFO_STATS
void PrintHitTestInfoStatsInternal(nsDisplayList& aList, int& aTotal,
void PrintHitTestInfoStatsInternal(nsDisplayList* aList, int& aTotal,
int& aHitTest, int& aVisible,
int& aSpecial) {
for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
for (nsDisplayItem* i = aList->GetBottom(); i; i = i->GetAbove()) {
aTotal++;
if (i->GetChildren()) {
PrintHitTestInfoStatsInternal(*i->GetChildren(), aTotal, aHitTest,
PrintHitTestInfoStatsInternal(i->GetChildren(), aTotal, aHitTest,
aVisible, aSpecial);
}
@ -3524,7 +3524,7 @@ void PrintHitTestInfoStatsInternal(nsDisplayList& aList, int& aTotal,
}
}
void PrintHitTestInfoStats(nsDisplayList& aList) {
void PrintHitTestInfoStats(nsDisplayList* aList) {
int total = 0;
int hitTest = 0;
int visible = 0;
@ -3537,7 +3537,7 @@ void PrintHitTestInfoStats(nsDisplayList& aList) {
printf(
"List %p: total items: %d, hit test items: %d, ratio: %f, visible: %d, "
"special: %d\n",
&aList, total, hitTest, ratio, visible, special);
aList, total, hitTest, ratio, visible, special);
}
#endif
@ -3552,6 +3552,16 @@ static void ApplyEffectsUpdates(
}
}
struct TemporaryDisplayListBuilder {
TemporaryDisplayListBuilder(nsIFrame* aFrame,
nsDisplayListBuilderMode aBuilderMode,
const bool aBuildCaret)
: mBuilder(aFrame, aBuilderMode, aBuildCaret) {}
nsDisplayListBuilder mBuilder;
nsDisplayList mList;
};
nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
nsIFrame* aFrame,
const nsRegion& aDirtyRegion,
@ -3607,19 +3617,17 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// disabled after creating the retained display list builder.
const bool useRetainedBuilder = retainedBuilder && retainingEnabled;
Maybe<nsDisplayListBuilder> nonRetainedBuilder;
Maybe<nsDisplayList> nonRetainedList;
nsDisplayListBuilder* builderPtr = nullptr;
nsDisplayList* listPtr = nullptr;
Maybe<TemporaryDisplayListBuilder> temporaryBuilder;
nsDisplayListBuilder* builder = nullptr;
nsDisplayList* list = nullptr;
if (useRetainedBuilder) {
builderPtr = retainedBuilder->Builder();
listPtr = retainedBuilder->List();
builder = retainedBuilder->Builder();
list = retainedBuilder->List();
} else {
nonRetainedBuilder.emplace(aFrame, aBuilderMode, buildCaret);
builderPtr = nonRetainedBuilder.ptr();
nonRetainedList.emplace();
listPtr = nonRetainedList.ptr();
temporaryBuilder.emplace(aFrame, aBuilderMode, buildCaret);
builder = &temporaryBuilder->mBuilder;
list = &temporaryBuilder->mList;
}
// Retained builder exists, but display list retaining is disabled.
@ -3631,31 +3639,28 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
retainedBuilder->List()->DeleteAll(retainedBuilder->Builder());
}
nsDisplayListBuilder& builder = *builderPtr;
nsDisplayList& list = *listPtr;
builder.BeginFrame();
builder->BeginFrame();
if (aFlags & PaintFrameFlags::InTransform) {
builder.SetInTransform(true);
builder->SetInTransform(true);
}
if (aFlags & PaintFrameFlags::SyncDecodeImages) {
builder.SetSyncDecodeImages(true);
builder->SetSyncDecodeImages(true);
}
if (aFlags & (PaintFrameFlags::WidgetLayers | PaintFrameFlags::ToWindow)) {
builder.SetPaintingToWindow(true);
builder->SetPaintingToWindow(true);
}
if (aFlags & PaintFrameFlags::ForWebRender) {
builder.SetPaintingForWebRender(true);
builder->SetPaintingForWebRender(true);
}
if (aFlags & PaintFrameFlags::IgnoreSuppression) {
builder.IgnorePaintSuppression();
builder->IgnorePaintSuppression();
}
if (nsIDocShell* doc = presContext->GetDocShell()) {
bool isActive = false;
doc->GetIsActive(&isActive);
builder.SetInActiveDocShell(isActive);
builder->SetInActiveDocShell(isActive);
}
nsIFrame* rootScrollFrame = presShell->GetRootScrollFrame();
@ -3666,7 +3671,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
nsRect displayPortBase = aFrame->GetVisualOverflowRectRelativeToSelf();
nsRect temp = displayPortBase;
Unused << rootScrollableFrame->DecideScrollableLayer(
&builder, &displayPortBase, &temp,
builder, &displayPortBase, &temp,
/* aSetBase = */ true);
}
@ -3688,11 +3693,11 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
if ((aFlags & PaintFrameFlags::WidgetLayers) &&
!(aFlags & PaintFrameFlags::DocumentRelative) &&
rootPresContext->NeedToComputePluginGeometryUpdates()) {
builder.SetWillComputePluginGeometry(true);
builder->SetWillComputePluginGeometry(true);
// Disable partial updates for this paint as the list we're about to
// build has plugin-specific differences that won't trigger invalidations.
builder.SetDisablePartialUpdates(true);
builder->SetDisablePartialUpdates(true);
}
nsRect canvasArea(nsPoint(0, 0), aFrame->GetSize());
@ -3714,7 +3719,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
devPixelOffset));
}
}
builder.SetIgnoreScrollFrame(rootScrollFrame);
builder->SetIgnoreScrollFrame(rootScrollFrame);
nsCanvasFrame* canvasFrame =
do_QueryFrame(rootScrollableFrame->GetScrolledFrame());
@ -3723,12 +3728,12 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// were are still filled with the background color.
canvasArea.UnionRect(
canvasArea,
canvasFrame->CanvasArea() + builder.ToReferenceFrame(canvasFrame));
canvasFrame->CanvasArea() + builder->ToReferenceFrame(canvasFrame));
}
}
builder.ClearHaveScrollableDisplayPort();
if (builder.IsPaintingToWindow()) {
builder->ClearHaveScrollableDisplayPort();
if (builder->IsPaintingToWindow()) {
MaybeCreateDisplayPortInFirstScrollFrameEncountered(aFrame, builder);
}
@ -3788,12 +3793,12 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
}
}
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(&builder,
nsDisplayListBuilder::AutoCurrentScrollParentIdSetter idSetter(builder,
id);
builder.SetVisibleRect(visibleRect);
builder.SetIsBuilding(true);
builder.SetAncestorHasApzAwareEventHandler(
builder->SetVisibleRect(visibleRect);
builder->SetIsBuilding(true);
builder->SetAncestorHasApzAwareEventHandler(
gfxPlatform::AsyncPanZoomEnabled() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell));
@ -3806,9 +3811,10 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// happens when the zooming or container scrolling prefs are toggled
// (manually by the user, or during test setup).
bool shouldAttemptPartialUpdate = useRetainedBuilder;
bool didBuildAsyncZoomContainer = builder.ShouldBuildAsyncZoomContainer();
builder.UpdateShouldBuildAsyncZoomContainer();
if (builder.ShouldBuildAsyncZoomContainer() !=
bool didBuildAsyncZoomContainer =
builder->ShouldBuildAsyncZoomContainer();
builder->UpdateShouldBuildAsyncZoomContainer();
if (builder->ShouldBuildAsyncZoomContainer() !=
didBuildAsyncZoomContainer) {
shouldAttemptPartialUpdate = false;
}
@ -3818,13 +3824,13 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// viewport.
if (shouldAttemptPartialUpdate) {
if (StaticPrefs::LayoutVerifyRetainDisplayList()) {
beforeMergeChecker.Set(&list, "BM");
beforeMergeChecker.Set(list, "BM");
}
updateState = retainedBuilder->AttemptPartialUpdate(
aBackstop, beforeMergeChecker ? &toBeMergedChecker : nullptr);
if ((updateState != PartialUpdateResult::Failed) &&
beforeMergeChecker) {
afterMergeChecker.Set(&list, "AM");
afterMergeChecker.Set(list, "AM");
}
}
@ -3832,7 +3838,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
(StaticPrefs::LayoutDisplayListBuildTwice() || afterMergeChecker)) {
updateState = PartialUpdateResult::Failed;
if (StaticPrefs::LayersDrawFPS()) {
if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
if (RefPtr<LayerManager> lm = builder->GetWidgetLayerManager()) {
if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
pt->dl2Ms() = (TimeStamp::Now() - dlStart).ToMilliseconds();
}
@ -3842,22 +3848,22 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
}
if (updateState == PartialUpdateResult::Failed) {
list.DeleteAll(&builder);
list->DeleteAll(builder);
builder.ClearRetainedWindowRegions();
builder.ClearWillChangeBudget();
builder->ClearRetainedWindowRegions();
builder->ClearWillChangeBudget();
builder.EnterPresShell(aFrame);
builder.SetDirtyRect(visibleRect);
aFrame->BuildDisplayListForStackingContext(&builder, &list);
builder->EnterPresShell(aFrame);
builder->SetDirtyRect(visibleRect);
aFrame->BuildDisplayListForStackingContext(builder, list);
AddExtraBackgroundItems(builder, list, aFrame, canvasArea,
visibleRegion, aBackstop);
builder.LeavePresShell(aFrame, &list);
builder->LeavePresShell(aFrame, list);
updateState = PartialUpdateResult::Updated;
if (afterMergeChecker) {
DisplayListChecker nonRetainedChecker(&list, "NR");
DisplayListChecker nonRetainedChecker(list, "NR");
std::stringstream ss;
ss << "**** Differences between retained-after-merged (AM) and "
<< "non-retained (NR) display lists:";
@ -3880,11 +3886,11 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
}
}
builder.SetIsBuilding(false);
builder.IncrementPresShellPaintCount(presShell);
builder->SetIsBuilding(false);
builder->IncrementPresShellPaintCount(presShell);
if (StaticPrefs::LayersDrawFPS()) {
if (RefPtr<LayerManager> lm = builder.GetWidgetLayerManager()) {
if (RefPtr<LayerManager> lm = builder->GetWidgetLayerManager()) {
if (PaintTiming* pt = ClientLayerManager::MaybeGetPaintTiming(lm)) {
pt->dlMs() = (TimeStamp::Now() - dlStart).ToMilliseconds();
}
@ -3893,14 +3899,14 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
}
MOZ_ASSERT(updateState != PartialUpdateResult::Failed);
builder.Check();
builder->Check();
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_BUILD_DISPLAYLIST_TIME,
startBuildDisplayList);
bool consoleNeedsDisplayList =
(gfxUtils::DumpDisplayList() || gfxEnv::DumpPaint()) &&
builder.IsInActiveDocShell();
builder->IsInActiveDocShell();
#ifdef MOZ_DUMP_PAINTING
FILE* savedDumpFile = gfxUtils::sDumpPaintFile;
#endif
@ -3941,7 +3947,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
visibleRect.x, visibleRect.y, visibleRect.width,
visibleRect.height)
.get();
nsFrame::PrintDisplayList(&builder, list, *ss, gfxEnv::DumpPaintToFile());
nsFrame::PrintDisplayList(builder, *list, *ss, gfxEnv::DumpPaintToFile());
if (gfxEnv::DumpPaint() || gfxEnv::DumpPaintItems()) {
// Flush stream now to avoid reordering dump output relative to
@ -3960,7 +3966,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// If we're finished building display list items for painting of the
// outermost pres shell, notify the widget about any toolbars we've
// encountered.
widget->UpdateThemeGeometries(builder.GetThemeGeometries());
widget->UpdateThemeGeometries(builder->GetThemeGeometries());
}
}
}
@ -3985,11 +3991,11 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
TimeStamp paintStart = TimeStamp::Now();
RefPtr<LayerManager> layerManager =
list.PaintRoot(&builder, aRenderingContext, flags);
list->PaintRoot(builder, aRenderingContext, flags);
Telemetry::AccumulateTimeDelta(Telemetry::PAINT_RASTERIZE_TIME, paintStart);
presShell->EndPaint();
builder.Check();
builder->Check();
if (StaticPrefs::GfxLoggingPaintedPixelCountEnabled()) {
TimeStamp now = TimeStamp::Now();
@ -4019,7 +4025,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
if (consoleNeedsDisplayList) {
*ss << "Painting --- after optimization:\n";
nsFrame::PrintDisplayList(&builder, list, *ss, gfxEnv::DumpPaintToFile());
nsFrame::PrintDisplayList(builder, *list, *ss, gfxEnv::DumpPaintToFile());
*ss << "Painting --- layer tree:\n";
if (layerManager) {
@ -4040,7 +4046,7 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
#endif
std::stringstream lsStream;
nsFrame::PrintDisplayList(&builder, list, lsStream);
nsFrame::PrintDisplayList(builder, *list, lsStream);
if (layerManager->GetRoot()) {
layerManager->GetRoot()->SetDisplayListLog(lsStream.str().c_str());
}
@ -4062,23 +4068,23 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
nsIWidget* widget = aFrame->GetNearestWidget();
if (widget) {
nsRegion opaqueRegion;
opaqueRegion.And(builder.GetWindowExcludeGlassRegion(),
builder.GetWindowOpaqueRegion());
opaqueRegion.And(builder->GetWindowExcludeGlassRegion(),
builder->GetWindowOpaqueRegion());
widget->UpdateOpaqueRegion(LayoutDeviceIntRegion::FromUnknownRegion(
opaqueRegion.ToNearestPixels(presContext->AppUnitsPerDevPixel())));
widget->UpdateWindowDraggingRegion(builder.GetWindowDraggingRegion());
widget->UpdateWindowDraggingRegion(builder->GetWindowDraggingRegion());
}
}
if (builder.WillComputePluginGeometry()) {
if (builder->WillComputePluginGeometry()) {
// For single process compute and apply plugin geometry updates to plugin
// windows, then request composition. For content processes skip eveything
// except requesting composition. Geometry updates were calculated and
// shipped to the chrome process in nsDisplayList when the layer
// transaction completed.
if (XRE_IsParentProcess()) {
rootPresContext->ComputePluginGeometryUpdates(aFrame, &builder, &list);
rootPresContext->ComputePluginGeometryUpdates(aFrame, builder, list);
// We're not going to get a WillPaintWindow event here if we didn't do
// widget invalidation, so just apply the plugin geometry update here
// instead. We could instead have the compositor send back an equivalent
@ -4097,25 +4103,25 @@ nsresult nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext,
// Disable partial updates for the following paint as well, as we now have
// a plugin-specific display list.
builder.SetDisablePartialUpdates(true);
builder->SetDisablePartialUpdates(true);
}
// Apply effects updates if we were actually painting
if (isForPainting) {
ApplyEffectsUpdates(builder.GetEffectUpdates());
ApplyEffectsUpdates(builder->GetEffectUpdates());
}
builder.Check();
builder->Check();
{
AUTO_PROFILER_TRACING("Paint", "DisplayListResources", GRAPHICS);
// Flush the list so we don't trigger the IsEmpty-on-destruction assertion
if (!useRetainedBuilder) {
list.DeleteAll(&builder);
list->DeleteAll(builder);
}
builder.EndFrame();
builder->EndFrame();
}
return NS_OK;
}

View File

@ -1101,7 +1101,7 @@ class nsLayoutUtils {
const nsRect& aTestRect);
static bool MaybeCreateDisplayPortInFirstScrollFrameEncountered(
nsIFrame* aFrame, nsDisplayListBuilder& aBuilder);
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder);
enum class PaintFrameFlags : uint32_t {
InTransform = 0x01,
@ -2248,8 +2248,8 @@ class nsLayoutUtils {
static mozilla::dom::Element* GetEditableRootContentByContentEditable(
mozilla::dom::Document* aDocument);
static void AddExtraBackgroundItems(nsDisplayListBuilder& aBuilder,
nsDisplayList& aList, nsIFrame* aFrame,
static void AddExtraBackgroundItems(nsDisplayListBuilder* aBuilder,
nsDisplayList* aList, nsIFrame* aFrame,
const nsRect& aCanvasArea,
const nsRegion& aVisibleRegion,
nscolor aBackstop);
@ -2824,7 +2824,7 @@ class nsLayoutUtils {
* Returns true if there is a displayport on an async scrollable scrollframe
* after this call, either because one was just added or it already existed.
*/
static bool MaybeCreateDisplayPort(nsDisplayListBuilder& aBuilder,
static bool MaybeCreateDisplayPort(nsDisplayListBuilder* aBuilder,
nsIFrame* aScrollFrame,
RepaintMode aRepaintMode);

View File

@ -542,7 +542,7 @@ void nsPageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect(aBuilder->ToReferenceFrame(child), child->GetSize());
PresContext()->GetPresShell()->AddCanvasBackgroundColorItem(
*aBuilder, content, child, backgroundRect, NS_RGBA(0, 0, 0, 0));
aBuilder, &content, child, backgroundRect, NS_RGBA(0, 0, 0, 0));
}
content.AppendNewToTop<nsDisplayTransform>(aBuilder, child, &content,

View File

@ -542,7 +542,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// background behind the page, not the canvas color. The canvas color gets
// painted on the page itself.
if (nsLayoutUtils::NeedsPrintPreviewBackground(presContext)) {
presShell->AddPrintPreviewBackgroundItem(*aBuilder, childItems, frame,
presShell->AddPrintPreviewBackgroundItem(aBuilder, &childItems, frame,
bounds);
} else {
// Add the canvas background color to the bottom of the list. This
@ -553,7 +553,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
AddCanvasBackgroundColorFlags::ForceDraw |
AddCanvasBackgroundColorFlags::AddForSubDocument;
presShell->AddCanvasBackgroundColorItem(
*aBuilder, childItems, frame, bounds, NS_RGBA(0, 0, 0, 0), flags);
aBuilder, &childItems, frame, bounds, NS_RGBA(0, 0, 0, 0), flags);
}
}
}
@ -629,7 +629,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
AddCanvasBackgroundColorFlags flags =
AddCanvasBackgroundColorFlags::ForceDraw |
AddCanvasBackgroundColorFlags::AppendUnscrolledOnly;
presShell->AddCanvasBackgroundColorItem(*aBuilder, childItems, this, bounds,
presShell->AddCanvasBackgroundColorItem(aBuilder, &childItems, this, bounds,
NS_RGBA(0, 0, 0, 0), flags);
}

View File

@ -964,7 +964,7 @@ static bool IsInPreserve3DContext(const nsIFrame* aFrame) {
}
static bool ProcessFrameInternal(nsIFrame* aFrame,
nsDisplayListBuilder& aBuilder,
nsDisplayListBuilder* aBuilder,
AnimatedGeometryRoot** aAGR, nsRect& aOverflow,
nsIFrame* aStopAtFrame,
nsTArray<nsIFrame*>& aOutFramesWithProps,
@ -1072,7 +1072,7 @@ static bool ProcessFrameInternal(nsIFrame* aFrame,
break;
}
if (currentFrame != aBuilder.RootReferenceFrame() &&
if (currentFrame != aBuilder->RootReferenceFrame() &&
currentFrame->IsStackingContext() &&
currentFrame->IsFixedPosContainingBlock()) {
CRR_LOG("Frame belongs to stacking context frame %p\n", currentFrame);
@ -1147,7 +1147,7 @@ static bool ProcessFrameInternal(nsIFrame* aFrame,
}
bool RetainedDisplayListBuilder::ProcessFrame(
nsIFrame* aFrame, nsDisplayListBuilder& aBuilder, nsIFrame* aStopAtFrame,
nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsIFrame* aStopAtFrame,
nsTArray<nsIFrame*>& aOutFramesWithProps, const bool aStopAtStackingContext,
nsRect* aOutDirty, AnimatedGeometryRoot** aOutModifiedAGR) {
if (aFrame->HasOverrideDirtyRegion()) {
@ -1161,7 +1161,7 @@ bool RetainedDisplayListBuilder::ProcessFrame(
// TODO: There is almost certainly a faster way of doing this, probably can be
// combined with the ancestor walk for TransformFrameRectToAncestor.
AnimatedGeometryRoot* agr =
aBuilder.FindAnimatedGeometryRootFor(aFrame)->GetAsyncAGR();
aBuilder->FindAnimatedGeometryRootFor(aFrame)->GetAsyncAGR();
CRR_LOG("Processing frame %p with agr %p\n", aFrame, agr->mFrame);
@ -1179,8 +1179,8 @@ bool RetainedDisplayListBuilder::ProcessFrame(
// If the modified frame is also a caret frame, include the caret area.
// This is needed because some frames (for example text frames without text)
// might have an empty overflow rect.
if (aFrame == aBuilder.GetCaretFrame()) {
overflow.UnionRect(overflow, aBuilder.GetCaretRect());
if (aFrame == aBuilder->GetCaretFrame()) {
overflow.UnionRect(overflow, aBuilder->GetCaretRect());
}
if (!ProcessFrameInternal(aFrame, aBuilder, &agr, overflow, aStopAtFrame,
@ -1284,7 +1284,7 @@ bool RetainedDisplayListBuilder::ComputeRebuildRegion(
mBuilder.AddFrameMarkedForDisplayIfVisible(f);
FindContainingBlocks(f, extraFrames);
if (!ProcessFrame(f, mBuilder, mBuilder.RootReferenceFrame(),
if (!ProcessFrame(f, &mBuilder, mBuilder.RootReferenceFrame(),
aOutFramesWithProps, true, aOutDirty, aOutModifiedAGR)) {
return false;
}
@ -1293,7 +1293,7 @@ bool RetainedDisplayListBuilder::ComputeRebuildRegion(
for (nsIFrame* f : extraFrames) {
mBuilder.MarkFrameModifiedDuringBuilding(f);
if (!ProcessFrame(f, mBuilder, mBuilder.RootReferenceFrame(),
if (!ProcessFrame(f, &mBuilder, mBuilder.RootReferenceFrame(),
aOutFramesWithProps, true, aOutDirty, aOutModifiedAGR)) {
return false;
}
@ -1453,7 +1453,7 @@ auto RetainedDisplayListBuilder::AttemptPartialUpdate(
&mBuilder, &modifiedDL);
if (!modifiedDL.IsEmpty()) {
nsLayoutUtils::AddExtraBackgroundItems(
mBuilder, modifiedDL, mBuilder.RootReferenceFrame(),
&mBuilder, &modifiedDL, mBuilder.RootReferenceFrame(),
nsRect(nsPoint(0, 0), mBuilder.RootReferenceFrame()->GetSize()),
mBuilder.RootReferenceFrame()->GetVisualOverflowRectRelativeToSelf(),
aBackstop);

View File

@ -156,7 +156,7 @@ struct RetainedDisplayListBuilder {
nsRect* aOutDirty,
AnimatedGeometryRoot** aOutModifiedAGR,
nsTArray<nsIFrame*>& aOutFramesWithProps);
bool ProcessFrame(nsIFrame* aFrame, nsDisplayListBuilder& aBuilder,
bool ProcessFrame(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder,
nsIFrame* aStopAtFrame,
nsTArray<nsIFrame*>& aOutFramesWithProps,
const bool aStopAtStackingContext, nsRect* aOutDirty,