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, void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
gfxContext* aCtx) { gfxContext* aCtx) {
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(), DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled()); mDisableSubpixelAA);
nscolor foregroundColor = nscolor foregroundColor =
nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor); nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);

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

@ -106,11 +106,8 @@ static void BuildDisplayListForTopLayerFrame(nsDisplayListBuilder* aBuilder,
asrSetter.SetCurrentActiveScrolledRoot( asrSetter.SetCurrentActiveScrolledRoot(
savedOutOfFlowData->mContainingBlockActiveScrolledRoot); 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( nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, aFrame, visible, dirty, nsDisplayListBuilder::RIIS_YES); aBuilder, aFrame, visible, dirty);
nsDisplayList list; nsDisplayList list;
aFrame->BuildDisplayListForStackingContext(aBuilder, &list); aFrame->BuildDisplayListForStackingContext(aBuilder, &list);
@ -156,10 +153,8 @@ void ViewportFrame::BuildDisplayListForTopLayer(nsDisplayListBuilder* aBuilder,
nsIFrame* backdropFrame = nsIFrame* backdropFrame =
static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame(); static_cast<nsPlaceholderFrame*>(backdropPh)->GetOutOfFlowFrame();
MOZ_ASSERT(backdropFrame); MOZ_ASSERT(backdropFrame);
BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList); BuildDisplayListForTopLayerFrame(aBuilder, backdropFrame, aList);
} }
BuildDisplayListForTopLayerFrame(aBuilder, frame, aList); BuildDisplayListForTopLayerFrame(aBuilder, frame, aList);
} }
} }

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

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

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

@ -3807,15 +3807,8 @@ void nsIFrame::BuildDisplayListForChild(nsDisplayListBuilder* aBuilder,
NS_ASSERTION(!isStackingContext || pseudoStackingContext, NS_ASSERTION(!isStackingContext || pseudoStackingContext,
"Stacking contexts must also be pseudo-stacking-contexts"); "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( nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, child, visible, dirty, recalcInInvalidSubtree); aBuilder, child, visible, dirty);
DisplayListClipState::AutoClipMultiple clipState(aBuilder); DisplayListClipState::AutoClipMultiple clipState(aBuilder);
nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(aBuilder); nsDisplayListBuilder::AutoCurrentActiveScrolledRootSetter asrSetter(aBuilder);
CheckForApzAwareEventHandlers(aBuilder, child); CheckForApzAwareEventHandlers(aBuilder, child);

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

@ -3764,12 +3764,6 @@ void ScrollFrameHelper::MaybeAddTopLayerItems(nsDisplayListBuilder* aBuilder,
nsDisplayList topLayerList; nsDisplayList topLayerList;
viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList); viewportFrame->BuildDisplayListForTopLayer(aBuilder, &topLayerList);
if (!topLayerList.IsEmpty()) { 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, // 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. // and append it at the very end, so that it stays at the topmost.
nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>( nsDisplayWrapList* wrapList = MakeDisplayItem<nsDisplayWrapList>(

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

@ -457,7 +457,7 @@ class nsDisplayHeaderFooter final : public nsDisplayItem {
MOZ_ASSERT(pageFrame, "We should have an nsPageFrame"); MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
#endif #endif
static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter( static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter(
*aCtx, ToReferenceFrame(), IsSubpixelAADisabled()); *aCtx, ToReferenceFrame(), mDisableSubpixelAA);
} }
NS_DISPLAY_DECL_NAME("HeaderFooter", TYPE_HEADER_FOOTER) NS_DISPLAY_DECL_NAME("HeaderFooter", TYPE_HEADER_FOOTER)
@ -524,12 +524,8 @@ void nsPageFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
while ((page = GetNextPage(page)) != nullptr) { while ((page = GetNextPage(page)) != nullptr) {
nsRect childVisible = visibleRect + child->GetOffsetTo(page); 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( nsDisplayListBuilder::AutoBuildingDisplayList buildingForChild(
aBuilder, page, childVisible, childVisible, aBuilder, page, childVisible, childVisible);
nsDisplayListBuilder::RIIS_YES);
BuildDisplayListForExtraPage(aBuilder, this, page, &content); BuildDisplayListForExtraPage(aBuilder, this, page, &content);
} }

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

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

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

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

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

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

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

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

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

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

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

@ -101,7 +101,6 @@
#include "mozilla/layers/WebRenderLayerManager.h" #include "mozilla/layers/WebRenderLayerManager.h"
#include "mozilla/layers/WebRenderMessages.h" #include "mozilla/layers/WebRenderMessages.h"
#include "mozilla/layers/WebRenderScrollData.h" #include "mozilla/layers/WebRenderScrollData.h"
#include "mozilla/layout/RenderFrame.h"
using namespace mozilla; using namespace mozilla;
using namespace mozilla::layers; using namespace mozilla::layers;
@ -136,7 +135,7 @@ void AssertUniqueItem(nsDisplayItem* aItem) {
for (nsDisplayItem* i : *items) { for (nsDisplayItem* i : *items) {
if (i != aItem && !i->HasDeletedFrame() && i->Frame() == aItem->Frame() && if (i != aItem && !i->HasDeletedFrame() && i->Frame() == aItem->Frame() &&
i->GetPerFrameKey() == aItem->GetPerFrameKey()) { i->GetPerFrameKey() == aItem->GetPerFrameKey()) {
if (i->IsPreProcessedItem()) { if (i->mPreProcessedItem) {
continue; continue;
} }
MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!"); MOZ_DIAGNOSTIC_ASSERT(false, "Duplicate display item!");
@ -3172,9 +3171,18 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const ActiveScrolledRoot* aActiveScrolledRoot) const ActiveScrolledRoot* aActiveScrolledRoot)
: mFrame(aFrame), : mFrame(aFrame),
mItemFlags(),
mActiveScrolledRoot(aActiveScrolledRoot), 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); MOZ_COUNT_CTOR(nsDisplayItem);
if (aBuilder->IsRetainingDisplayList()) { if (aBuilder->IsRetainingDisplayList()) {
mFrame->AddDisplayItem(this); mFrame->AddDisplayItem(this);
@ -3200,12 +3208,9 @@ nsDisplayItem::nsDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
SetBuildingRect(visible); SetBuildingRect(visible);
const nsStyleDisplay* disp = mFrame->StyleDisplay(); const nsStyleDisplay* disp = mFrame->StyleDisplay();
if (mFrame->BackfaceIsHidden(disp)) { mBackfaceIsHidden = mFrame->BackfaceIsHidden(disp);
mItemFlags += ItemFlag::BackfaceHidden; mCombines3DTransformWithAncestors =
} mFrame->Combines3DTransformWithAncestors(disp);
if (mFrame->Combines3DTransformWithAncestors(disp)) {
mItemFlags += ItemFlag::Combines3DTransformWithAncestors;
}
} }
/* static */ /* static */
@ -3221,24 +3226,6 @@ bool nsDisplayItem::ForceActiveLayers() {
return sForce; 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(); } int32_t nsDisplayItem::ZIndex() const { return mFrame->ZIndex(); }
bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder, bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
@ -3249,7 +3236,7 @@ bool nsDisplayItem::ComputeVisibility(nsDisplayListBuilder* aBuilder,
bool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder, bool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) { nsRegion* aVisibleRegion) {
if (ForceNotVisible() && !GetSameCoordinateSystemChildren()) { if (mForceNotVisible && !GetSameCoordinateSystemChildren()) {
// mForceNotVisible wants to ensure that this display item doesn't render // mForceNotVisible wants to ensure that this display item doesn't render
// anything itself. If this item has contents, then we obviously want to // anything itself. If this item has contents, then we obviously want to
// render those, so we don't need this check in that case. // 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, bool nsDisplayItem::ShouldUseAdvancedLayer(LayerManager* aManager,
PrefFunc aFunc) const { PrefFunc aFunc) const {
return CanUseAdvancedLayer(aManager) ? aFunc() : false; return CanUseAdvancedLayer(aManager) ? aFunc() : false;
@ -6713,10 +6698,13 @@ nsIFrame* nsDisplaySubDocument::FrameForInvalidation() const {
return mSubDocFrame ? mSubDocFrame : mFrame; return mSubDocFrame ? mSubDocFrame : mFrame;
} }
bool nsDisplaySubDocument::HasDeletedFrame() const {
return !mSubDocFrame || nsDisplayItem::HasDeletedFrame();
}
void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) { void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) {
if (aFrame == mSubDocFrame) { if (aFrame == mSubDocFrame) {
mSubDocFrame = nullptr; mSubDocFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayItem::RemoveFrame(aFrame); nsDisplayItem::RemoveFrame(aFrame);
} }
@ -8956,7 +8944,7 @@ void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS); AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS);
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(), DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
IsSubpixelAADisabled()); mDisableSubpixelAA);
RenderToContext(aCtx, aBuilder); RenderToContext(aCtx, aBuilder);
} }
@ -10284,86 +10272,3 @@ PaintTelemetry::AutoRecord::~AutoRecord() {
} }
} // namespace mozilla } // 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::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::Maybe<mozilla::layers::ScrollDirection> MaybeScrollDirection; 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 * @param aReferenceFrame the frame at the root of the subtree; its origin
* is the origin of the reference coordinate system for this display list * is the origin of the reference coordinate system for this display list
@ -1137,25 +1132,59 @@ class nsDisplayListBuilder {
class AutoBuildingDisplayList { class AutoBuildingDisplayList {
public: public:
AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
RecalcInInvalidSubtree aRecalcInvalidSubtree) const nsRect& aVisibleRect,
: AutoBuildingDisplayList( const nsRect& aDirtyRect)
aBuilder, aForChild, aBuilder->GetVisibleRect(),
aBuilder->GetDirtyRect(), aForChild->IsTransformed(),
aRecalcInvalidSubtree) {}
AutoBuildingDisplayList(
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
const nsRect& aVisibleRect, const nsRect& aDirtyRect,
RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO)
: AutoBuildingDisplayList(aBuilder, aForChild, aVisibleRect, aDirtyRect, : AutoBuildingDisplayList(aBuilder, aForChild, aVisibleRect, aDirtyRect,
aForChild->IsTransformed(), aForChild->IsTransformed()) {}
aRecalcInvalidSubtree) {}
AutoBuildingDisplayList( AutoBuildingDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aForChild,
nsDisplayListBuilder* aBuilder, nsIFrame* aForChild, const nsRect& aVisibleRect,
const nsRect& aVisibleRect, const nsRect& aDirtyRect, const nsRect& aDirtyRect, const bool aIsTransformed)
const bool aIsTransformed, : mBuilder(aBuilder),
RecalcInInvalidSubtree aRecalcInvalidSubtree = RIIS_NO); 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, void SetReferenceFrameAndCurrentOffset(const nsIFrame* aFrame,
const nsPoint& aOffset) { const nsPoint& aOffset) {
@ -1731,7 +1760,17 @@ class nsDisplayListBuilder {
return false; return false;
} }
bool MarkCurrentFrameModifiedDuringBuilding() {
if (MarkFrameModifiedDuringBuilding(const_cast<nsIFrame*>(mCurrentFrame))) {
mInInvalidSubtree = true;
mDirtyRect = mVisibleRect;
return true;
}
return false;
}
void RebuildAllItemsInCurrentSubtree() { void RebuildAllItemsInCurrentSubtree() {
mInInvalidSubtree = true;
mDirtyRect = mVisibleRect; 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 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
if (aBuilder->IsRetainingDisplayList() && !aBuilder->IsInPageSequence() && if (aBuilder->IsRetainingDisplayList() && !aBuilder->IsInPageSequence() &&
aBuilder->IsBuilding()) { aBuilder->IsBuilding()) {
AssertUniqueItem(item); AssertUniqueItem(item);
} }
// Verify that InInvalidSubtree matches invalidation frame's modified state.
if (aBuilder->InInvalidSubtree()) {
MOZ_DIAGNOSTIC_ASSERT(
AnyContentAncestorModified(item->FrameForInvalidation()));
}
#endif #endif
return item; return item;
@ -2155,14 +2183,13 @@ class nsDisplayItem : public nsDisplayItemLink {
virtual void RestoreState() { virtual void RestoreState() {
mClipChain = mState.mClipChain; mClipChain = mState.mClipChain;
mClip = mState.mClip; mClip = mState.mClip;
mItemFlags -= ItemFlag::DisableSubpixelAA; mDisableSubpixelAA = false;
} }
virtual void RemoveFrame(nsIFrame* aFrame) { virtual void RemoveFrame(nsIFrame* aFrame) {
if (mFrame && aFrame == mFrame) { if (mFrame && aFrame == mFrame) {
MOZ_ASSERT(!mFrame->HasDisplayItem(this)); MOZ_ASSERT(!mFrame->HasDisplayItem(this));
mFrame = nullptr; mFrame = nullptr;
SetDeletedFrame();
SetDisplayItemData(nullptr, nullptr); SetDisplayItemData(nullptr, nullptr);
} }
} }
@ -2188,7 +2215,6 @@ class nsDisplayItem : public nsDisplayItemLink {
*/ */
nsDisplayItem(nsDisplayListBuilder* aBuilder, const nsDisplayItem& aOther) nsDisplayItem(nsDisplayListBuilder* aBuilder, const nsDisplayItem& aOther)
: mFrame(aOther.mFrame), : mFrame(aOther.mFrame),
mItemFlags(),
mClipChain(aOther.mClipChain), mClipChain(aOther.mClipChain),
mClip(aOther.mClip), mClip(aOther.mClip),
mActiveScrolledRoot(aOther.mActiveScrolledRoot), mActiveScrolledRoot(aOther.mActiveScrolledRoot),
@ -2196,21 +2222,21 @@ class nsDisplayItem : public nsDisplayItemLink {
mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot), mAnimatedGeometryRoot(aOther.mAnimatedGeometryRoot),
mToReferenceFrame(aOther.mToReferenceFrame), mToReferenceFrame(aOther.mToReferenceFrame),
mBuildingRect(aOther.mBuildingRect), 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); 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 { struct HitTestState {
@ -2274,10 +2300,7 @@ class nsDisplayItem : public nsDisplayItemLink {
*/ */
virtual nsIFrame* FrameForInvalidation() const { return mFrame; } virtual nsIFrame* FrameForInvalidation() const { return mFrame; }
bool HasModifiedFrame() const; virtual bool HasDeletedFrame() const { return !mFrame; }
void SetModifiedFrame(bool aModified);
bool HasDeletedFrame() const;
virtual nsIFrame* StyleFrame() 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 * Mark this display item as being painted via
* FrameLayerBuilder::DrawPaintedLayer. * FrameLayerBuilder::DrawPaintedLayer.
*/ */
bool Painted() const { return mItemFlags.contains(ItemFlag::Painted); } bool Painted() const { return mPainted; }
/** /**
* Check if this display item has been painted. * Check if this display item has been painted.
*/ */
void SetPainted() { mItemFlags += ItemFlag::Painted; } void SetPainted() { mPainted = true; }
#endif #endif
/** /**
@ -2709,16 +2732,14 @@ class nsDisplayItem : public nsDisplayItemLink {
return; return;
} }
mPaintRect = mBuildingRect = aBuildingRect; mPaintRect = mBuildingRect = aBuildingRect;
mItemFlags -= ItemFlag::PaintRectValid; mPaintRectValid = false;
} }
void SetPaintRect(const nsRect& aPaintRect) { void SetPaintRect(const nsRect& aPaintRect) {
mPaintRect = aPaintRect; mPaintRect = aPaintRect;
mItemFlags += ItemFlag::PaintRectValid; mPaintRectValid = true;
}
bool HasPaintRect() const {
return mItemFlags.contains(ItemFlag::PaintRectValid);
} }
bool HasPaintRect() const { return mPaintRectValid; }
/** /**
* Returns the building rect for the children, relative to their * Returns the building rect for the children, relative to their
@ -2744,9 +2765,7 @@ class nsDisplayItem : public nsDisplayItemLink {
*/ */
virtual bool CanApplyOpacity() const { return false; } virtual bool CanApplyOpacity() const { return false; }
bool ForceNotVisible() const { bool ForceNotVisible() const { return mForceNotVisible; }
return mItemFlags.contains(ItemFlag::ForceNotVisible);
}
/** /**
* For debugging and stuff * For debugging and stuff
@ -2812,11 +2831,9 @@ class nsDisplayItem : public nsDisplayItemLink {
* Disable usage of component alpha. Currently only relevant for items that * Disable usage of component alpha. Currently only relevant for items that
* have text. * have text.
*/ */
void DisableComponentAlpha() { mItemFlags += ItemFlag::DisableSubpixelAA; } void DisableComponentAlpha() { mDisableSubpixelAA = true; }
bool IsSubpixelAADisabled() const { bool IsSubpixelAADisabled() const { return mDisableSubpixelAA; }
return mItemFlags.contains(ItemFlag::DisableSubpixelAA);
}
/** /**
* Check if we can add async animations to the layer for this display item. * 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, void FuseClipChainUpTo(nsDisplayListBuilder* aBuilder,
const ActiveScrolledRoot* aASR); const ActiveScrolledRoot* aASR);
bool BackfaceIsHidden() const { bool BackfaceIsHidden() const { return mBackfaceIsHidden; }
return mItemFlags.contains(ItemFlag::BackfaceHidden);
}
bool Combines3DTransformWithAncestors() const { bool Combines3DTransformWithAncestors() const {
return mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors); return mCombines3DTransformWithAncestors;
} }
bool In3DContextAndBackfaceIsHidden() const { bool In3DContextAndBackfaceIsHidden() const {
return mItemFlags.contains(ItemFlag::BackfaceHidden) && return mBackfaceIsHidden && mCombines3DTransformWithAncestors;
mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
} }
bool HasDifferentFrame(const nsDisplayItem* aOther) const { bool HasDifferentFrame(const nsDisplayItem* aOther) const {
@ -2878,22 +2892,14 @@ class nsDisplayItem : public nsDisplayItemLink {
return mFrame->GetContent() == aOther->Frame()->GetContent(); return mFrame->GetContent() == aOther->Frame()->GetContent();
} }
bool IsReused() const { return mItemFlags.contains(ItemFlag::ReusedItem); } bool IsReused() const { return mReusedItem; }
void SetReused(bool aReused) {
if (aReused) {
mItemFlags += ItemFlag::ReusedItem;
} else {
mItemFlags -= ItemFlag::ReusedItem;
}
}
bool CanBeReused() const { void SetReused(bool aReused) { mReusedItem = aReused; }
return !mItemFlags.contains(ItemFlag::CantBeReused);
} bool CanBeReused() const { return mCanBeReused; }
void SetCantBeReused() { mItemFlags += ItemFlag::CantBeReused; }
void DiscardIfOldItem() { void DiscardIfOldItem() {
if (mOldList) { if (mOldList) {
SetCantBeReused(); mCanBeReused = false;
} }
} }
virtual void NotifyUsed(nsDisplayListBuilder* aBuilder) {} virtual void NotifyUsed(nsDisplayListBuilder* aBuilder) {}
@ -2965,34 +2971,11 @@ class nsDisplayItem : public nsDisplayItemLink {
#endif #endif
protected: protected:
void SetDeletedFrame();
typedef bool (*PrefFunc)(void); typedef bool (*PrefFunc)(void);
bool ShouldUseAdvancedLayer(LayerManager* aManager, PrefFunc aFunc) const; bool ShouldUseAdvancedLayer(LayerManager* aManager, PrefFunc aFunc) const;
bool CanUseAdvancedLayer(LayerManager* aManager) 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; nsIFrame* mFrame;
mozilla::EnumSet<ItemFlag, uint16_t> mItemFlags;
RefPtr<const DisplayItemClipChain> mClipChain; RefPtr<const DisplayItemClipChain> mClipChain;
const DisplayItemClip* mClip; const DisplayItemClip* mClip;
RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot; RefPtr<const ActiveScrolledRoot> mActiveScrolledRoot;
@ -3026,31 +3009,26 @@ class nsDisplayItem : public nsDisplayItemLink {
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
public: 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 mOldListKey = 0;
uint32_t mOldNestingDepth = 0; uint32_t mOldNestingDepth = 0;
bool mMergedItem = false;
bool mPreProcessedItem = false;
protected: protected:
#endif #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, NS_ASSERTION(NS_GET_A(aColor) > 0,
"Don't create invisible nsDisplaySolidColors!"); "Don't create invisible nsDisplaySolidColors!");
MOZ_COUNT_CTOR(nsDisplaySolidColor); MOZ_COUNT_CTOR(nsDisplaySolidColor);
if (!aCanBeReused) { mCanBeReused = aCanBeReused;
SetCantBeReused();
}
} }
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
@ -4523,10 +4499,13 @@ class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
nsIFrame* FrameForInvalidation() const override { return mStyleFrame; } nsIFrame* FrameForInvalidation() const override { return mStyleFrame; }
bool HasDeletedFrame() const override {
return !mStyleFrame || nsDisplayBackgroundImage::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mStyleFrame) { if (aFrame == mStyleFrame) {
mStyleFrame = nullptr; mStyleFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayBackgroundImage::RemoveFrame(aFrame); nsDisplayBackgroundImage::RemoveFrame(aFrame);
} }
@ -4651,10 +4630,13 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayThemedBackground::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) { if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr; mAncestorFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayThemedBackground::RemoveFrame(aFrame); nsDisplayThemedBackground::RemoveFrame(aFrame);
} }
@ -4828,10 +4810,13 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBackgroundColor::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) { if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr; mAncestorFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayBackgroundColor::RemoveFrame(aFrame); nsDisplayBackgroundColor::RemoveFrame(aFrame);
} }
@ -5647,10 +5632,13 @@ class nsDisplayTableBlendMode : public nsDisplayBlendMode {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBlendMode::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) { if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr; mAncestorFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayBlendMode::RemoveFrame(aFrame); nsDisplayBlendMode::RemoveFrame(aFrame);
} }
@ -5751,10 +5739,13 @@ class nsDisplayTableBlendContainer : public nsDisplayBlendContainer {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayBlendContainer::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) { if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr; mAncestorFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayBlendContainer::RemoveFrame(aFrame); nsDisplayBlendContainer::RemoveFrame(aFrame);
} }
@ -5981,6 +5972,7 @@ class nsDisplaySubDocument : public nsDisplayOwnLayer {
const ContainerLayerParameters& aContainerParameters); const ContainerLayerParameters& aContainerParameters);
nsIFrame* FrameForInvalidation() const override; nsIFrame* FrameForInvalidation() const override;
bool HasDeletedFrame() const override;
void RemoveFrame(nsIFrame* aFrame) override; void RemoveFrame(nsIFrame* aFrame) override;
void Disown(); void Disown();
@ -6162,10 +6154,13 @@ class nsDisplayTableFixedPosition : public nsDisplayFixedPosition {
nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; } nsIFrame* FrameForInvalidation() const override { return mAncestorFrame; }
bool HasDeletedFrame() const override {
return !mAncestorFrame || nsDisplayFixedPosition::HasDeletedFrame();
}
void RemoveFrame(nsIFrame* aFrame) override { void RemoveFrame(nsIFrame* aFrame) override {
if (aFrame == mAncestorFrame) { if (aFrame == mAncestorFrame) {
mAncestorFrame = nullptr; mAncestorFrame = nullptr;
SetDeletedFrame();
} }
nsDisplayFixedPosition::RemoveFrame(aFrame); nsDisplayFixedPosition::RemoveFrame(aFrame);
} }

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

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

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

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

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

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

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

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