Backed out changeset 32958aa32cb5 (bug 1415485) for frequently failing for failing reftest layout/reftests/async-scrolling/position-fixed-in-scroll-container.html on Linux x64 QuantumRender. r=backout a=backout on a CLOSED TREE

This commit is contained in:
Sebastian Hengst 2017-11-14 14:47:14 +02:00
parent 176cfc3790
commit 31bab6f683
5 changed files with 37 additions and 77 deletions

View File

@ -644,7 +644,7 @@ private:
DECL_GFX_PREF(Live, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.build-twice", LayoutDisplayListBuildTwice, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.retain", LayoutRetainDisplayList, bool, true);
DECL_GFX_PREF(Once, "layout.display-list.retain", LayoutRetainDisplayList, bool, true);
DECL_GFX_PREF(Live, "layout.display-list.rebuild-frame-limit", LayoutRebuildFrameLimit, uint32_t, 500);
DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false);
DECL_GFX_PREF(Live, "layout.display-list.dump-content", LayoutDumpDisplayListContent, bool, false);

View File

@ -3593,33 +3593,6 @@ nsLayoutUtils::AddExtraBackgroundItems(nsDisplayListBuilder& aBuilder,
}
}
/**
* Returns a retained display list builder for frame |aFrame|. If there is no
* retained display list builder property set for the frame, and if the flag
* |aRetainingEnabled| is true, a new retained display list builder is created,
* stored as a property for the frame, and returned.
*/
static RetainedDisplayListBuilder*
GetOrCreateRetainedDisplayListBuilder(nsIFrame* aFrame, bool aRetainingEnabled,
bool aBuildCaret)
{
RetainedDisplayListBuilder* retainedBuilder =
aFrame->GetProperty(RetainedDisplayListBuilder::Cached());
if (retainedBuilder) {
return retainedBuilder;
}
if (aRetainingEnabled) {
retainedBuilder =
new RetainedDisplayListBuilder(aFrame, nsDisplayListBuilderMode::PAINTING,
aBuildCaret);
aFrame->SetProperty(RetainedDisplayListBuilder::Cached(), retainedBuilder);
}
return retainedBuilder;
}
nsresult
nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
const nsRegion& aDirtyRegion, nscolor aBackstop,
@ -3656,28 +3629,31 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
TimeStamp startBuildDisplayList = TimeStamp::Now();
const bool buildCaret = !(aFlags & PaintFrameFlags::PAINT_HIDE_CARET);
const bool isForPainting = (aFlags & PaintFrameFlags::PAINT_WIDGET_LAYERS) &&
aBuilderMode == nsDisplayListBuilderMode::PAINTING;
// Retained display list builder is currently only used for content processes.
const bool retainingEnabled = isForPainting &&
gfxPrefs::LayoutRetainDisplayList() && XRE_IsContentProcess();
RetainedDisplayListBuilder* retainedBuilder =
GetOrCreateRetainedDisplayListBuilder(aFrame, retainingEnabled, buildCaret);
// Only use the retained display list builder if the retaining is currently
// enabled. This check is needed because it is possible that the pref has been
// 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;
RetainedDisplayListBuilder* retainedBuilder = nullptr;
if (useRetainedBuilder) {
const bool buildCaret = !(aFlags & PaintFrameFlags::PAINT_HIDE_CARET);
// Enable display list retaining if the pref is set and if we are in a
// content process.
const bool retainDisplayList =
gfxPrefs::LayoutRetainDisplayList() && XRE_IsContentProcess();
if (retainDisplayList &&
aBuilderMode == nsDisplayListBuilderMode::PAINTING &&
(aFlags & PaintFrameFlags::PAINT_WIDGET_LAYERS)) {
retainedBuilder = aFrame->GetProperty(RetainedDisplayListBuilder::Cached());
if (!retainedBuilder) {
retainedBuilder =
new RetainedDisplayListBuilder(aFrame, aBuilderMode, buildCaret);
aFrame->SetProperty(RetainedDisplayListBuilder::Cached(), retainedBuilder);
}
MOZ_ASSERT(retainedBuilder);
builderPtr = retainedBuilder->Builder();
listPtr = retainedBuilder->List();
} else {
@ -3686,16 +3662,6 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
nonRetainedList.emplace(builderPtr);
listPtr = nonRetainedList.ptr();
}
// Retained builder exists, but display list retaining is disabled.
if (!useRetainedBuilder && retainedBuilder) {
// Clear the modified frames lists and frame properties.
retainedBuilder->ClearModifiedFrameProps();
// Clear the retained display list.
retainedBuilder->List()->DeleteAll(retainedBuilder->Builder());
}
nsDisplayListBuilder& builder = *builderPtr;
nsDisplayList& list = *listPtr;
@ -3825,12 +3791,14 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
builder.IsBuildingLayerEventRegions() &&
nsLayoutUtils::HasDocumentLevelListenersForApzAwareEvents(presShell));
const bool paintedPreviously =
aFrame->HasProperty(nsIFrame::ModifiedFrameList());
// Attempt to do a partial build and merge into the existing list.
// This calls BuildDisplayListForStacking context on a subset of the
// viewport.
bool merged = false;
if (useRetainedBuilder) {
if (retainedBuilder && paintedPreviously) {
merged = retainedBuilder->AttemptPartialUpdate(aBackstop);
}
@ -4058,11 +4026,12 @@ nsLayoutUtils::PaintFrame(gfxContext* aRenderingContext, nsIFrame* aFrame,
AUTO_PROFILER_TRACING("Paint", "DisplayListResources");
// Flush the list so we don't trigger the IsEmpty-on-destruction assertion
if (!useRetainedBuilder) {
if (!retainedBuilder) {
list.DeleteAll(&builder);
builder.EndFrame();
} else {
builder.EndFrame();
}
builder.EndFrame();
}
return NS_OK;
}

View File

@ -1040,6 +1040,14 @@ nsIFrame::MarkNeedsDisplayItemRebuild()
modifiedFrames->AppendElement(this);
// TODO: this is a bit of a hack. We are using ModifiedFrameList property to
// decide whether we are trying to reuse the display list.
if (displayRoot != rootFrame &&
!displayRoot->HasProperty(nsIFrame::ModifiedFrameList())) {
displayRoot->SetProperty(nsIFrame::ModifiedFrameList(),
new nsTArray<nsIFrame*>());
}
MOZ_ASSERT(PresContext()->LayoutPhaseCount(eLayoutPhase_DisplayListBuilding) == 0);
SetFrameIsModified(true);

View File

@ -777,15 +777,6 @@ ClearFrameProps(nsTArray<nsIFrame*>& aFrames)
}
}
void
RetainedDisplayListBuilder::ClearModifiedFrameProps()
{
nsTArray<nsIFrame*> modifiedFrames =
GetModifiedFrames(mBuilder.RootReferenceFrame());
ClearFrameProps(modifiedFrames);
}
bool
RetainedDisplayListBuilder::AttemptPartialUpdate(nscolor aBackstop)
{

View File

@ -28,14 +28,6 @@ struct RetainedDisplayListBuilder {
bool AttemptPartialUpdate(nscolor aBackstop);
/**
* Iterates through the display list builder reference frame document and
* subdocuments, and clears the modified frame lists from the root frames.
* Also clears the frame properties set by RetainedDisplayListBuilder for all
* the frames in the modified frame lists.
*/
void ClearModifiedFrameProps();
NS_DECLARE_FRAME_PROPERTY_DELETABLE(Cached, RetainedDisplayListBuilder)
private: