Merge mozilla-central to autoland. CLOSED TREE

This commit is contained in:
Csoregi Natalia 2019-04-15 18:27:25 +03:00
Родитель 772d2d3a49 f2e030efe7
Коммит 9b4cbfd8ef
17 изменённых файлов: 197 добавлений и 329 удалений

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

@ -218,7 +218,7 @@ static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,
void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
mDisableSubpixelAA);
nscolor foregroundColor =
nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);

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

@ -106,11 +106,8 @@ static void BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
asrSetter.SetCurrentActiveScrolledRoot(
savedOutOfFlowData->mContainingBlockActiveScrolledRoot);
}
// This function jumps into random frames that may not be descendants of
// aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
// Request recalculation of mInInvalidSubtree.
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, aFrame, visible, dirty, nsDisplayListBuilder::RIIS_YES);
aBuilder, aFrame, visible, dirty);
nsDisplayList list;
aFrame->BuildDisplayListForStackingContext(aBuilder, &list);
@ -156,10 +153,8 @@ void ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* backdropFrame =
static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame();
MOZ_ASSERT(backdropFrame);
BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList);
}
BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
}
}

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

@ -646,7 +646,7 @@ void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
}
ImgDrawResult result = static_cast<nsBulletFrame*>(mFrame)->PaintBullet(
*aCtx, ToReferenceFrame(), GetPaintRect(), flags, IsSubpixelAADisabled());
*aCtx, ToReferenceFrame(), GetPaintRect(), flags, mDisableSubpixelAA);
nsDisplayBulletGeometry::UpdateDrawResult(this, result);
}

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

@ -3807,15 +3807,8 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
NS_ASSERTION(!isStackingContext || pseudoStackingContext,
"Stacking contexts must also be pseudo-stacking-contexts");
// nsBlockFrame paints pushed floats directly, rather than through their
// placeholder, which is why we force a recallculation of InInvalidSubtree
// state.
auto recalcInInvalidSubtree =
(child->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT)
? nsDisplayListBuilder::RIIS_YES
: nsDisplayListBuilder::RIIS_NO;
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, child, visible, dirty, recalcInInvalidSubtree);
aBuilder, child, visible, dirty);
DisplayListClipState::AutoClipMultiple clipState(aBuilder);
nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(aBuilder);
CheckForApzAwareEventHandlers(aBuilder, child);

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

@ -3764,12 +3764,6 @@ void ScrollFrameHelper::MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
nsDisplayList topLayerList;
viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList);
if (!topLayerList.IsEmpty()) {
// This function jumps into random frames that may not be descendants of
// aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
// Request recalculation of mInInvalidSubtree.
nsDisplayListBuilder::AutoBuildingDisplayList buildingDisplayList(
aBuilder, viewportFrame, nsDisplayListBuilder::RIIS_YES);
// Wrap the whole top layer in a single item with maximum z-index,
// and append it at the very end, so that it stays at the topmost.
nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>(

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

@ -457,7 +457,7 @@ class nsDisplayHeaderFooter final : public nsDisplayItem {
MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
#endif
static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter(
*aCtx, ToReferenceFrame(), IsSubpixelAADisabled());
*aCtx, ToReferenceFrame(), mDisableSubpixelAA);
}
NS_DISPLAY_DECL_NAME("HeaderFooter", TYPE_HEADER_FOOTER)
@ -524,12 +524,8 @@ void nsPageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
while ((page = GetNextPage(page)) != nullptr) {
nsRect childVisible = visibleRect + child->GetOffsetTo(page);
// This function jumps into random frames that may not be descendants of
// aBuilder->mCurrentFrame, so aBuilder->mInInvalidSubtree is unrelated.
// Request recalculation of mInInvalidSubtree.
nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, page, childVisible, childVisible,
nsDisplayListBuilder::RIIS_YES);
aBuilder, page, childVisible, childVisible);
BuildDisplayListForExtraPage(aBuilder, this, page, &content);
}

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

@ -435,7 +435,7 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
needsOwnLayer = true;
}
if (subdocRootFrame && aBuilder->IsRetainingDisplayList()) {
if (aBuilder->IsRetainingDisplayList()) {
// Caret frame changed, rebuild the entire subdoc.
// We could just invalidate the old and new frame
// areas and save some work here. RetainedDisplayListBuilder
@ -443,7 +443,6 @@ void nsSubDocumentFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
// subdocs in advance.
if (mPreviousCaret != aBuilder->GetCaretFrame()) {
dirty = visible;
aBuilder->MarkFrameModifiedDuringBuilding(subdocRootFrame);
aBuilder->RebuildAllItemsInCurrentSubtree();
// Mark the old caret frame as invalid so that we remove the
// old nsDisplayCaret. We don't mark the current frame as invalid

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

@ -195,6 +195,11 @@ mozilla::LayerState nsDisplayRemote::GetLayerState(
return mozilla::LAYER_ACTIVE_FORCE;
}
bool nsDisplayRemote::HasDeletedFrame() const {
// RenderFrame might change without invalidating nsSubDocumentFrame.
return !GetFrameLoader() || nsDisplayItem::HasDeletedFrame();
}
already_AddRefed<Layer> nsDisplayRemote::BuildLayer(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aContainerParameters) {

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

@ -90,8 +90,6 @@ class RenderFrame final {
* nsFrameLoader) into its parent frame's layer tree.
*/
class nsDisplayRemote final : public nsDisplayItem {
friend class nsDisplayItem;
typedef mozilla::dom::TabId TabId;
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;
@ -105,6 +103,8 @@ class nsDisplayRemote final : public nsDisplayItem {
public:
nsDisplayRemote(nsDisplayListBuilder* aBuilder, nsSubDocumentFrame* aFrame);
bool HasDeletedFrame() const override;
LayerState GetLayerState(
nsDisplayListBuilder* aBuilder, LayerManager* aManager,
const ContainerLayerParameters& aParameters) override;

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

@ -141,10 +141,11 @@ bool RetainedDisplayListBuilder::PreProcessDisplayList(
MOZ_RELEASE_ASSERT(aList->mOldItems.IsEmpty());
while (nsDisplayItem* item = aList->RemoveBottom()) {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
item->SetMergedPreProcessed(false, true);
item->mMergedItem = false;
item->mPreProcessedItem = true;
#endif
if (!item->CanBeReused() || item->HasDeletedFrame()) {
if (item->HasDeletedFrame() || !item->CanBeReused()) {
size_t i = aList->mOldItems.Length();
aList->mOldItems.AppendElement(OldItemInfo(nullptr));
item->Destroy(&mBuilder);
@ -213,9 +214,10 @@ void RetainedDisplayListBuilder::IncrementSubDocPresShellPaintCount(
mBuilder.IncrementPresShellPaintCount(presShell);
}
bool AnyContentAncestorModified(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
nsIFrame* f = aFrame;
while (f) {
static bool AnyContentAncestorModified(nsIFrame* aFrame,
nsIFrame* aStopAtFrame = nullptr) {
for (nsIFrame* f = aFrame; f;
f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f)) {
if (f->IsFrameModified()) {
return true;
}
@ -223,12 +225,6 @@ bool AnyContentAncestorModified(nsIFrame* aFrame, nsIFrame* aStopAtFrame) {
if (aStopAtFrame && f == aStopAtFrame) {
break;
}
if (f->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
f = f->GetParent();
} else {
f = nsLayoutUtils::GetParentOrPlaceholderForCrossDoc(f);
}
}
return false;
@ -279,14 +275,6 @@ static void UpdateASR(nsDisplayItem* aItem,
wrapList->UpdateHitTestInfoActiveScrolledRoot(*asr);
}
OldItemInfo::OldItemInfo(nsDisplayItem* aItem)
: mItem(aItem), mUsed(false), mDiscarded(false) {
if (mItem) {
// Clear cached modified frame state when adding an item to the old list.
mItem->SetModifiedFrame(false);
}
}
void OldItemInfo::AddedMatchToMergedList(RetainedDisplayListBuilder* aBuilder,
MergedListIndex aIndex) {
AddedToMergedList(aIndex);
@ -304,7 +292,7 @@ void OldItemInfo::Discard(RetainedDisplayListBuilder* aBuilder,
}
bool OldItemInfo::IsChanged() {
return !mItem || !mItem->CanBeReused() || mItem->HasDeletedFrame();
return !mItem || mItem->HasDeletedFrame() || !mItem->CanBeReused();
}
/**
@ -319,14 +307,14 @@ bool OldItemInfo::IsChanged() {
class MergeState {
public:
MergeState(RetainedDisplayListBuilder* aBuilder,
RetainedDisplayList& aOldList, nsDisplayItem* aOuterItem)
RetainedDisplayList& aOldList, uint32_t aOuterKey)
: mBuilder(aBuilder),
mOldList(&aOldList),
mOldItems(std::move(aOldList.mOldItems)),
mOldDAG(
std::move(*reinterpret_cast<DirectedAcyclicGraph<OldListUnits>*>(
&aOldList.mDAG))),
mOuterItem(aOuterItem),
mOuterKey(aOuterKey),
mResultIsModified(false) {
mMergedDAG.EnsureCapacityFor(mOldDAG);
MOZ_RELEASE_ASSERT(mOldItems.Length() == mOldDAG.Length());
@ -335,9 +323,7 @@ class MergeState {
Maybe<MergedListIndex> ProcessItemFromNewList(
nsDisplayItem* aNewItem, const Maybe<MergedListIndex>& aPreviousItem) {
OldListIndex oldIndex;
MOZ_DIAGNOSTIC_ASSERT(aNewItem->HasModifiedFrame() ==
HasModifiedFrame(aNewItem));
if (!aNewItem->HasModifiedFrame() &&
if (!HasModifiedFrame(aNewItem) &&
HasMatchingItemInOldList(aNewItem, &oldIndex)) {
nsDisplayItem* oldItem = mOldItems[oldIndex.val].mItem;
MOZ_DIAGNOSTIC_ASSERT(oldItem->GetPerFrameKey() ==
@ -477,11 +463,10 @@ class MergeState {
aItem->Frame()->GetProperty(nsIFrame::DisplayItems());
// Look for an item that matches aItem's frame and per-frame-key, but isn't
// the same item.
uint32_t outerKey = mOuterItem ? mOuterItem->GetPerFrameKey() : 0;
for (nsDisplayItem* i : *items) {
if (i != aItem && i->Frame() == aItem->Frame() &&
i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
if (i->GetOldListIndex(mOldList, outerKey, aOutIndex)) {
if (i->GetOldListIndex(mOldList, mOuterKey, aOutIndex)) {
return true;
}
}
@ -490,8 +475,7 @@ class MergeState {
}
bool HasModifiedFrame(nsDisplayItem* aItem) {
nsIFrame* stopFrame = mOuterItem ? mOuterItem->Frame() : nullptr;
return AnyContentAncestorModified(aItem->FrameForInvalidation(), stopFrame);
return AnyContentAncestorModified(aItem->FrameForInvalidation());
}
void UpdateContainerASR(nsDisplayItem* aItem) {
@ -512,11 +496,12 @@ class MergeState {
for (nsDisplayItem* i : *items) {
if (i->Frame() == aItem->Frame() &&
i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
MOZ_DIAGNOSTIC_ASSERT(!i->IsMergedItem());
MOZ_DIAGNOSTIC_ASSERT(!i->mMergedItem);
}
}
aItem->SetMergedPreProcessed(true, false);
aItem->mMergedItem = true;
aItem->mPreProcessedItem = false;
#endif
mMergedItems.AppendToTop(aItem);
@ -634,7 +619,7 @@ class MergeState {
// and assert when we try swap the contents
nsDisplayList mMergedItems;
DirectedAcyclicGraph<MergedListUnits> mMergedDAG;
nsDisplayItem* mOuterItem;
uint32_t mOuterKey;
bool mResultIsModified;
};
@ -656,7 +641,8 @@ bool RetainedDisplayListBuilder::MergeDisplayLists(
nsDisplayItem* aOuterItem) {
AUTO_PROFILER_LABEL_CATEGORY_PAIR(GRAPHICS_DisplayListMerging);
MergeState merge(this, *aOldList, aOuterItem);
MergeState merge(this, *aOldList,
aOuterItem ? aOuterItem->GetPerFrameKey() : 0);
Maybe<MergedListIndex> previousItemIndex;
while (nsDisplayItem* item = aNewList->RemoveBottom()) {

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

@ -139,7 +139,8 @@ struct RetainedDisplayListBuilder;
class nsDisplayItem;
struct OldItemInfo {
explicit OldItemInfo(nsDisplayItem* aItem);
explicit OldItemInfo(nsDisplayItem* aItem)
: mItem(aItem), mUsed(false), mDiscarded(false) {}
void AddedToMergedList(MergedListIndex aIndex) {
MOZ_ASSERT(!IsUsed());
@ -168,7 +169,4 @@ struct OldItemInfo {
nsTArray<MergedListIndex> mDirectPredecessors;
};
bool AnyContentAncestorModified(nsIFrame* aFrame,
nsIFrame* aStopAtFrame = nullptr);
#endif // RETAINEDDISPLAYLISTHELPERS_H_

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

@ -101,7 +101,6 @@
#include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/layout/RenderFrame.h"
using namespace mozilla;
using namespace mozilla::layers;
@ -136,7 +135,7 @@ void AssertUniqueItem(nsDisplayItem* aItem) {
for (nsDisplayItem* i : *items) {
if (i != aItem && !i->HasDeletedFrame() && i->Frame() == aItem->Frame() &&
i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
if (i->IsPreProcessedItem()) {
if (i->mPreProcessedItem) {
continue;
}
MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!");
@ -3172,9 +3171,18 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const ActiveScrolledRoot* aActiveScrolledRoot)
: mFrame(aFrame),
mItemFlags(),
mActiveScrolledRoot(aActiveScrolledRoot),
mAnimatedGeometryRoot(nullptr) {
mAnimatedGeometryRoot(nullptr),
mForceNotVisible(aBuilder->IsBuildingInvisibleItems()),
mDisableSubpixelAA(false),
mReusedItem(false),
mPaintRectValid(false),
mCanBeReused(true)
#ifdef MOZ_DUMP_PAINTING
,
mPainted(false)
#endif
{
MOZ_COUNT_CTOR(nsDisplayItem);
if (aBuilder->IsRetainingDisplayList()) {
mFrame->AddDisplayItem(this);
@ -3200,12 +3208,9 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
SetBuildingRect(visible);
const nsStyleDisplay* disp = mFrame->StyleDisplay();
if (mFrame->BackfaceIsHidden(disp)) {
mItemFlags += ItemFlag::BackfaceHidden;
}
if (mFrame->Combines3DTransformWithAncestors(disp)) {
mItemFlags += ItemFlag::Combines3DTransformWithAncestors;
}
mBackfaceIsHidden = mFrame->BackfaceIsHidden(disp);
mCombines3DTransformWithAncestors =
mFrame->Combines3DTransformWithAncestors(disp);
}
/* static */
@ -3221,24 +3226,6 @@ bool nsDisplayItem::ForceActiveLayers() {
return sForce;
}
bool nsDisplayItem::HasModifiedFrame() const {
return mItemFlags.contains(ItemFlag::ModifiedFrame);
}
void nsDisplayItem::SetModifiedFrame(bool aModified) {
if (aModified) {
mItemFlags += ItemFlag::ModifiedFrame;
} else {
mItemFlags -= ItemFlag::ModifiedFrame;
}
}
bool nsDisplayItem::HasDeletedFrame() const {
return mItemFlags.contains(ItemFlag::DeletedFrame) ||
(GetType() == DisplayItemType::TYPE_REMOTE &&
!static_cast<const nsDisplayRemote*>(this)->GetFrameLoader());
}
int32_t nsDisplayItem::ZIndex() const { return mFrame->ZIndex(); }
bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
@ -3249,7 +3236,7 @@ bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
bool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (ForceNotVisible() && !GetSameCoordinateSystemChildren()) {
if (mForceNotVisible && !GetSameCoordinateSystemChildren()) {
// mForceNotVisible wants to ensure that this display item doesn't render
// anything itself. If this item has contents, then we obviously want to
// render those, so we don't need this check in that case.
@ -3314,8 +3301,6 @@ void nsDisplayItem::FuseClipChainUpTo(nsDisplayListBuilder* aBuilder,
}
}
void nsDisplayItem::SetDeletedFrame() { mItemFlags += ItemFlag::DeletedFrame; }
bool nsDisplayItem::ShouldUseAdvancedLayer(LayerManager* aManager,
PrefFunc aFunc) const {
return CanUseAdvancedLayer(aManager) ? aFunc() : false;
@ -6713,10 +6698,13 @@ nsIFrame* nsDisplaySubDocument::FrameForInvalidation() const {
return mSubDocFrame ? mSubDocFrame : mFrame;
}
bool nsDisplaySubDocument::HasDeletedFrame() const {
return !mSubDocFrame || nsDisplayItem::HasDeletedFrame();
}
void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) {
if (aFrame == mSubDocFrame) {
mSubDocFrame = nullptr;
SetDeletedFrame();
}
nsDisplayItem::RemoveFrame(aFrame);
}
@ -8956,7 +8944,7 @@ void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS);
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
mDisableSubpixelAA);
RenderToContext(aCtx, aBuilder);
}
@ -10284,86 +10272,3 @@ PaintTelemetry::AutoRecord::~AutoRecord() {
}
} // namespace mozilla
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
static nsIFrame* GetSelfOrPlaceholderFor(nsIFrame* aFrame) {
if (aFrame->GetStateBits() & NS_FRAME_IS_PUSHED_FLOAT) {
return aFrame;
}
if ((aFrame->GetStateBits() & NS_FRAME_OUT_OF_FLOW) &&
!aFrame->GetPrevInFlow()) {
return aFrame->GetPlaceholderFrame();
}
return aFrame;
}
static nsIFrame* GetAncestorFor(nsIFrame* aFrame) {
nsIFrame* f = GetSelfOrPlaceholderFor(aFrame);
MOZ_ASSERT(f);
return nsLayoutUtils::GetCrossDocParentFrame(f);
}
#endif
nsDisplayListBuilder::AutoBuildingDisplayList::AutoBuildingDisplayList(
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect, const nsRect& aDirtyRect,
const bool aIsTransformed, RecalcInInvalidSubtree aRecalcInvalidSubtree)
: mBuilder(aBuilder),
mPrevFrame(aBuilder->mCurrentFrame),
mPrevReferenceFrame(aBuilder->mCurrentReferenceFrame),
mPrevHitTestArea(aBuilder->mHitTestArea),
mPrevHitTestInfo(aBuilder->mHitTestInfo),
mPrevOffset(aBuilder->mCurrentOffsetToReferenceFrame),
mPrevVisibleRect(aBuilder->mVisibleRect),
mPrevDirtyRect(aBuilder->mDirtyRect),
mPrevAGR(aBuilder->mCurrentAGR),
mPrevAncestorHasApzAwareEventHandler(
aBuilder->mAncestorHasApzAwareEventHandler),
mPrevBuildingInvisibleItems(aBuilder->mBuildingInvisibleItems),
mPrevInInvalidSubtree(aBuilder->mInInvalidSubtree) {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
// Validate that aForChild is being visited from it's parent frame if
// recalculation of mInInvalidSubtree isn't requested.
const nsIFrame* ancestor = GetAncestorFor(aForChild);
MOZ_DIAGNOSTIC_ASSERT(aRecalcInvalidSubtree ==
nsDisplayListBuilder::RIIS_YES ||
aForChild == mPrevFrame || ancestor == mPrevFrame);
#endif
if (aIsTransformed) {
aBuilder->mCurrentOffsetToReferenceFrame = nsPoint();
aBuilder->mCurrentReferenceFrame = aForChild;
} else if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
aBuilder->mCurrentOffsetToReferenceFrame += aForChild->GetPosition();
} else {
aBuilder->mCurrentReferenceFrame = aBuilder->FindReferenceFrameFor(
aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
}
bool isAsync;
mCurrentAGRState = aBuilder->IsAnimatedGeometryRoot(aForChild, isAsync);
if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
if (mCurrentAGRState == AGR_YES) {
aBuilder->mCurrentAGR =
aBuilder->WrapAGRForFrame(aForChild, isAsync, aBuilder->mCurrentAGR);
}
} else if (aBuilder->mCurrentFrame != aForChild) {
aBuilder->mCurrentAGR = aBuilder->FindAnimatedGeometryRootFor(aForChild);
}
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(
aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
if (!aRecalcInvalidSubtree) {
aBuilder->mInInvalidSubtree = aBuilder->mInInvalidSubtree ||
aForChild->IsFrameModified();
} else {
aBuilder->mInInvalidSubtree = AnyContentAncestorModified(aForChild);
}
aBuilder->mCurrentFrame = aForChild;
aBuilder->mVisibleRect = aVisibleRect;
aBuilder->mDirtyRect =
aBuilder->mInInvalidSubtree ? aVisibleRect : aDirtyRect;
}

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

@ -441,11 +441,6 @@ class nsDisplayListBuilder {
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::Maybe<mozilla::layers::ScrollDirection> MaybeScrollDirection;
/**
* Does InInvalidSubtree need to recalculated?
*/
enum RecalcInInvalidSubtree { RIIS_NO, RIIS_YES };
/**
* @param aReferenceFrame the frame at the root of the subtree; its origin
* is the origin of the reference coordinate system for this display list
@ -1137,25 +1132,59 @@ class nsDisplayListBuilder {
class AutoBuildingDisplayList {
public:
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
RecalcInInvalidSubtree aRecalcInvalidSubtree)
: AutoBuildingDisplayList(
aBuilder, aForChild, aBuilder->GetVisibleRect(),
aBuilder->GetDirtyRect(), aForChild->IsTransformed(),
aRecalcInvalidSubtree) {}
AutoBuildingDisplayList(
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect, const nsRect& aDirtyRect,
RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO)
const nsRect& aVisibleRect,
const nsRect& aDirtyRect)
: AutoBuildingDisplayList(aBuilder, aForChild, aVisibleRect, aDirtyRect,
aForChild->IsTransformed(),
aRecalcInvalidSubtree) {}
aForChild->IsTransformed()) {}
AutoBuildingDisplayList(
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect, const nsRect& aDirtyRect,
const bool aIsTransformed,
RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO);
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect,
const nsRect& aDirtyRect, const bool aIsTransformed)
: mBuilder(aBuilder),
mPrevFrame(aBuilder->mCurrentFrame),
mPrevReferenceFrame(aBuilder->mCurrentReferenceFrame),
mPrevHitTestArea(aBuilder->mHitTestArea),
mPrevHitTestInfo(aBuilder->mHitTestInfo),
mPrevOffset(aBuilder->mCurrentOffsetToReferenceFrame),
mPrevVisibleRect(aBuilder->mVisibleRect),
mPrevDirtyRect(aBuilder->mDirtyRect),
mPrevAGR(aBuilder->mCurrentAGR),
mPrevAncestorHasApzAwareEventHandler(
aBuilder->mAncestorHasApzAwareEventHandler),
mPrevBuildingInvisibleItems(aBuilder->mBuildingInvisibleItems),
mPrevInInvalidSubtree(aBuilder->mInInvalidSubtree) {
if (aIsTransformed) {
aBuilder->mCurrentOffsetToReferenceFrame = nsPoint();
aBuilder->mCurrentReferenceFrame = aForChild;
} else if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
aBuilder->mCurrentOffsetToReferenceFrame += aForChild->GetPosition();
} else {
aBuilder->mCurrentReferenceFrame = aBuilder->FindReferenceFrameFor(
aForChild, &aBuilder->mCurrentOffsetToReferenceFrame);
}
bool isAsync;
mCurrentAGRState = aBuilder->IsAnimatedGeometryRoot(aForChild, isAsync);
if (aBuilder->mCurrentFrame == aForChild->GetParent()) {
if (mCurrentAGRState == AGR_YES) {
aBuilder->mCurrentAGR = aBuilder->WrapAGRForFrame(
aForChild, isAsync, aBuilder->mCurrentAGR);
}
} else if (aBuilder->mCurrentFrame != aForChild) {
aBuilder->mCurrentAGR =
aBuilder->FindAnimatedGeometryRootFor(aForChild);
}
MOZ_ASSERT(nsLayoutUtils::IsAncestorFrameCrossDoc(
aBuilder->RootReferenceFrame(), *aBuilder->mCurrentAGR));
aBuilder->mInInvalidSubtree =
aBuilder->mInInvalidSubtree || aForChild->IsFrameModified();
aBuilder->mCurrentFrame = aForChild;
aBuilder->mVisibleRect = aVisibleRect;
aBuilder->mDirtyRect =
aBuilder->mInInvalidSubtree ? aVisibleRect : aDirtyRect;
}
void SetReferenceFrameAndCurrentOffset(const nsIFrame* aFrame,
const nsPoint& aOffset) {
@ -1731,7 +1760,17 @@ class nsDisplayListBuilder {
return false;
}
bool MarkCurrentFrameModifiedDuringBuilding() {
if (MarkFrameModifiedDuringBuilding(const_cast<nsIFrame*>(mCurrentFrame))) {
mInInvalidSubtree = true;
mDirtyRect = mVisibleRect;
return true;
}
return false;
}
void RebuildAllItemsInCurrentSubtree() {
mInInvalidSubtree = true;
mDirtyRect = mVisibleRect;
}
@ -2072,22 +2111,11 @@ MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder,
}
}
if (aBuilder->InInvalidSubtree() ||
item->FrameForInvalidation()->IsFrameModified()) {
item->SetModifiedFrame(true);
}
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (aBuilder->IsRetainingDisplayList() && !aBuilder->IsInPageSequence() &&
aBuilder->IsBuilding()) {
AssertUniqueItem(item);
}
// Verify that InInvalidSubtree matches invalidation frame's modified state.
if (aBuilder->InInvalidSubtree()) {
MOZ_DIAGNOSTIC_ASSERT(
AnyContentAncestorModified(item->FrameForInvalidation()));
}
#endif
return item;
@ -2155,14 +2183,13 @@ class nsDisplayItem : public nsDisplayItemLink {
virtual void RestoreState() {
mClipChain = mState.mClipChain;
mClip = mState.mClip;
mItemFlags -= ItemFlag::DisableSubpixelAA;
mDisableSubpixelAA = false;
}
virtual void RemoveFrame(nsIFrame* aFrame) {
if (mFrame && aFrame == mFrame) {
MOZ_ASSERT(!mFrame->HasDisplayItem(this));
mFrame = nullptr;
SetDeletedFrame();
SetDisplayItemData(nullptr, nullptr);
}
}
@ -2188,7 +2215,6 @@ class nsDisplayItem : public nsDisplayItemLink {
*/
nsDisplayItem(nsDisplayListBuilder* aBuilder, const nsDisplayItem& aOther)
: mFrame(aOther.mFrame),
mItemFlags(),
mClipChain(aOther.mClipChain),
mClip(aOther.mClip),
mActiveScrolledRoot(aOther.mActiveScrolledRoot),
@ -2196,21 +2222,21 @@ class nsDisplayItem : public nsDisplayItemLink {
mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
mToReferenceFrame(aOther.mToReferenceFrame),
mBuildingRect(aOther.mBuildingRect),
mPaintRect(aOther.mPaintRect) {
mPaintRect(aOther.mPaintRect),
mForceNotVisible(aOther.mForceNotVisible),
mDisableSubpixelAA(aOther.mDisableSubpixelAA),
mReusedItem(false),
mBackfaceIsHidden(aOther.mBackfaceIsHidden),
mCombines3DTransformWithAncestors(
aOther.mCombines3DTransformWithAncestors),
mPaintRectValid(false),
mCanBeReused(true)
#ifdef MOZ_DUMP_PAINTING
,
mPainted(false)
#endif
{
MOZ_COUNT_CTOR(nsDisplayItem);
// TODO: It might be better to remove the flags that aren't copied.
if (aOther.ForceNotVisible()) {
mItemFlags += ItemFlag::ForceNotVisible;
}
if (aOther.IsSubpixelAADisabled()) {
mItemFlags += ItemFlag::DisableSubpixelAA;
}
if (mFrame->In3DContextAndBackfaceIsHidden()) {
mItemFlags += ItemFlag::BackfaceHidden;
}
if (aOther.Combines3DTransformWithAncestors()) {
mItemFlags += ItemFlag::Combines3DTransformWithAncestors;
}
}
struct HitTestState {
@ -2274,10 +2300,7 @@ class nsDisplayItem : public nsDisplayItemLink {
*/
virtual nsIFrame* FrameForInvalidation() const { return mFrame; }
bool HasModifiedFrame() const;
void SetModifiedFrame(bool aModified);
bool HasDeletedFrame() const;
virtual bool HasDeletedFrame() const { return !mFrame; }
virtual nsIFrame* StyleFrame() const { return mFrame; }
@ -2521,12 +2544,12 @@ class nsDisplayItem : public nsDisplayItemLink {
* Mark this display item as being painted via
* FrameLayerBuilder::DrawPaintedLayer.
*/
bool Painted() const { return mItemFlags.contains(ItemFlag::Painted); }
bool Painted() const { return mPainted; }
/**
* Check if this display item has been painted.
*/
void SetPainted() { mItemFlags += ItemFlag::Painted; }
void SetPainted() { mPainted = true; }
#endif
/**
@ -2709,16 +2732,14 @@ class nsDisplayItem : public nsDisplayItemLink {
return;
}
mPaintRect = mBuildingRect = aBuildingRect;
mItemFlags -= ItemFlag::PaintRectValid;
mPaintRectValid = false;
}
void SetPaintRect(const nsRect& aPaintRect) {
mPaintRect = aPaintRect;
mItemFlags += ItemFlag::PaintRectValid;
}
bool HasPaintRect() const {
return mItemFlags.contains(ItemFlag::PaintRectValid);
mPaintRectValid = true;
}
bool HasPaintRect() const { return mPaintRectValid; }
/**
* Returns the building rect for the children, relative to their
@ -2744,9 +2765,7 @@ class nsDisplayItem : public nsDisplayItemLink {
*/
virtual bool CanApplyOpacity() const { return false; }
bool ForceNotVisible() const {
return mItemFlags.contains(ItemFlag::ForceNotVisible);
}
bool ForceNotVisible() const { return mForceNotVisible; }
/**
* For debugging and stuff
@ -2812,11 +2831,9 @@ class nsDisplayItem : public nsDisplayItemLink {
* Disable usage of component alpha. Currently only relevant for items that
* have text.
*/
void DisableComponentAlpha() { mItemFlags += ItemFlag::DisableSubpixelAA; }
void DisableComponentAlpha() { mDisableSubpixelAA = true; }
bool IsSubpixelAADisabled() const {
return mItemFlags.contains(ItemFlag::DisableSubpixelAA);
}
bool IsSubpixelAADisabled() const { return mDisableSubpixelAA; }
/**
* Check if we can add async animations to the layer for this display item.
@ -2852,17 +2869,14 @@ class nsDisplayItem : public nsDisplayItemLink {
void FuseClipChainUpTo(nsDisplayListBuilder* aBuilder,
const ActiveScrolledRoot* aASR);
bool BackfaceIsHidden() const {
return mItemFlags.contains(ItemFlag::BackfaceHidden);
}
bool BackfaceIsHidden() const { return mBackfaceIsHidden; }
bool Combines3DTransformWithAncestors() const {
return mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
return mCombines3DTransformWithAncestors;
}
bool In3DContextAndBackfaceIsHidden() const {
return mItemFlags.contains(ItemFlag::BackfaceHidden) &&
mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
return mBackfaceIsHidden && mCombines3DTransformWithAncestors;
}
bool HasDifferentFrame(const nsDisplayItem* aOther) const {
@ -2878,22 +2892,14 @@ class nsDisplayItem : public nsDisplayItemLink {
return mFrame->GetContent() == aOther->Frame()->GetContent();
}
bool IsReused() const { return mItemFlags.contains(ItemFlag::ReusedItem); }
void SetReused(bool aReused) {
if (aReused) {
mItemFlags += ItemFlag::ReusedItem;
} else {
mItemFlags -= ItemFlag::ReusedItem;
}
}
bool IsReused() const { return mReusedItem; }
bool CanBeReused() const {
return !mItemFlags.contains(ItemFlag::CantBeReused);
}
void SetCantBeReused() { mItemFlags += ItemFlag::CantBeReused; }
void SetReused(bool aReused) { mReusedItem = aReused; }
bool CanBeReused() const { return mCanBeReused; }
void DiscardIfOldItem() {
if (mOldList) {
SetCantBeReused();
mCanBeReused = false;
}
}
virtual void NotifyUsed(nsDisplayListBuilder* aBuilder) {}
@ -2965,34 +2971,11 @@ class nsDisplayItem : public nsDisplayItemLink {
#endif
protected:
void SetDeletedFrame();
typedef bool (*PrefFunc)(void);
bool ShouldUseAdvancedLayer(LayerManager* aManager, PrefFunc aFunc) const;
bool CanUseAdvancedLayer(LayerManager* aManager) const;
enum class ItemFlag {
ModifiedFrame,
DeletedFrame,
ForceNotVisible,
DisableSubpixelAA,
CantBeReused,
ReusedItem,
BackfaceHidden,
Combines3DTransformWithAncestors,
PaintRectValid,
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
MergedItem,
PreProcessedItem,
#endif
#ifdef MOZ_DUMP_PAINTING
// True if this frame has been painted.
Painted,
#endif
};
nsIFrame* mFrame;
mozilla::EnumSet<ItemFlag, uint16_t> mItemFlags;
RefPtr<const DisplayItemClipChain> mClipChain;
const DisplayItemClip* mClip;
RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
@ -3026,31 +3009,26 @@ class nsDisplayItem : public nsDisplayItemLink {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
public:
bool IsMergedItem() const {
return mItemFlags.contains(ItemFlag::MergedItem);
}
bool IsPreProcessedItem() const {
return mItemFlags.contains(ItemFlag::PreProcessedItem);
}
void SetMergedPreProcessed(bool aMerged, bool aPreProcessed) {
if (aMerged) {
mItemFlags += ItemFlag::MergedItem;
} else {
mItemFlags -= ItemFlag::MergedItem;
}
if (aPreProcessed) {
mItemFlags += ItemFlag::PreProcessedItem;
} else {
mItemFlags -= ItemFlag::PreProcessedItem;
}
}
uint32_t mOldListKey = 0;
uint32_t mOldNestingDepth = 0;
bool mMergedItem = false;
bool mPreProcessedItem = false;
protected:
#endif
bool mForceNotVisible;
bool mDisableSubpixelAA;
bool mReusedItem;
bool mBackfaceIsHidden;
bool mCombines3DTransformWithAncestors;
bool mPaintRectValid;
bool mCanBeReused;
#ifdef MOZ_DUMP_PAINTING
// True if this frame has been painted.
bool mPainted;
#endif
};
/**
@ -4183,9 +4161,7 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase {
NS_ASSERTION(NS_GET_A(aColor) > 0,
"Don't create invisible nsDisplaySolidColors!");
MOZ_COUNT_CTOR(nsDisplaySolidColor);
if (!aCanBeReused) {
SetCantBeReused();
}
mCanBeReused = aCanBeReused;
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -4523,10 +4499,13 @@ class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
nsIFrame* FrameForInvalidation() const override { return mStyleFrame; }
bool HasDeletedFrame() const override {
return !mStyleFrame || nsDisplayBackgroundImage::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mStyleFrame) {
mStyleFrame = nullptr;
SetDeletedFrame();
}
nsDisplayBackgroundImage::RemoveFrame(aFrame);
}
@ -4651,10 +4630,13 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayThemedBackground::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr;
SetDeletedFrame();
}
nsDisplayThemedBackground::RemoveFrame(aFrame);
}
@ -4828,10 +4810,13 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBackgroundColor::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr;
SetDeletedFrame();
}
nsDisplayBackgroundColor::RemoveFrame(aFrame);
}
@ -5647,10 +5632,13 @@ class nsDisplayTableBlendMode : public nsDisplayBlendMode {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBlendMode::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr;
SetDeletedFrame();
}
nsDisplayBlendMode::RemoveFrame(aFrame);
}
@ -5751,10 +5739,13 @@ class nsDisplayTableBlendContainer : public nsDisplayBlendContainer {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBlendContainer::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr;
SetDeletedFrame();
}
nsDisplayBlendContainer::RemoveFrame(aFrame);
}
@ -5981,6 +5972,7 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
const ContainerLayerParameters& aContainerParameters);
nsIFrame* FrameForInvalidation() const override;
bool HasDeletedFrame() const override;
void RemoveFrame(nsIFrame* aFrame) override;
void Disown();
@ -6162,10 +6154,13 @@ class nsDisplayTableFixedPosition : public nsDisplayFixedPosition {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayFixedPosition::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr;
SetDeletedFrame();
}
nsDisplayFixedPosition::RemoveFrame(aFrame);
}

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

@ -2861,7 +2861,7 @@ void nsDisplaySVGText::HitTest(nsDisplayListBuilder* aBuilder,
void nsDisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
mDisableSubpixelAA);
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();

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

@ -278,7 +278,7 @@ static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,
void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) {
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
mDisableSubpixelAA);
// Paint the text shadow before doing any foreground stuff
nsRect drawRect =

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

@ -2498,7 +2498,7 @@ class nsDisplayTreeBody final : public nsDisplayItem {
gfxContext* aCtx) override {
MOZ_ASSERT(aBuilder);
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled());
mDisableSubpixelAA);
ImgDrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)->PaintTreeBody(
*aCtx, GetPaintRect(), ToReferenceFrame(), aBuilder);

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

@ -2,8 +2,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ["pref"]
TEST_DIRS += ["test"]
DIRS += [
"pref",
"test",
]
EXTRA_COMPONENTS += [
"command-line-handler.js",