зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1728232 - Remove RestoreState. r=miko
Differential Revision: https://phabricator.services.mozilla.com/D124006
This commit is contained in:
Родитель
7e0f7ff766
Коммит
3f9d3853cd
|
@ -76,7 +76,7 @@ class TextDrawTarget : public DrawTarget {
|
|||
mHasUnsupportedFeatures = false;
|
||||
mHasShadows = false;
|
||||
|
||||
SetPermitSubpixelAA(!aItem->IsSubpixelAADisabled());
|
||||
SetPermitSubpixelAA(true);
|
||||
|
||||
// Compute clip/bounds
|
||||
auto appUnitsPerDevPixel =
|
||||
|
|
|
@ -209,9 +209,6 @@ static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,
|
|||
|
||||
void nsDisplayTextOverflowMarker::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
|
||||
nscolor foregroundColor =
|
||||
nsLayoutUtils::GetColor(mFrame, &nsStyleText::mWebkitTextFillColor);
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ class nsDisplayHeaderFooter final : public nsPaintedDisplayItem {
|
|||
MOZ_ASSERT(pageFrame, "We should have an nsPageFrame");
|
||||
#endif
|
||||
static_cast<nsPageFrame*>(mFrame)->PaintHeaderFooter(
|
||||
*aCtx, ToReferenceFrame(), IsSubpixelAADisabled());
|
||||
*aCtx, ToReferenceFrame(), false);
|
||||
}
|
||||
NS_DISPLAY_DECL_NAME("HeaderFooter", TYPE_HEADER_FOOTER)
|
||||
|
||||
|
|
|
@ -280,13 +280,6 @@ bool RetainedDisplayListBuilder::PreProcessDisplayList(
|
|||
mBuilder.MarkFrameForDisplayIfVisible(f, mBuilder.RootReferenceFrame());
|
||||
}
|
||||
|
||||
// TODO: This is here because we sometimes reuse the previous display list
|
||||
// completely. For optimization, we could only restore the state for reused
|
||||
// display items.
|
||||
if (item->RestoreState()) {
|
||||
item->InvalidateItemCacheEntry();
|
||||
}
|
||||
|
||||
// If we're going to keep this linked list and not merge it, then mark the
|
||||
// item as used and put it back into the list.
|
||||
if (aKeepLinked) {
|
||||
|
|
|
@ -2830,11 +2830,6 @@ void nsDisplayItem::SetClipChain(const DisplayItemClipChain* aClipChain,
|
|||
bool aStore) {
|
||||
mClipChain = aClipChain;
|
||||
mClip = DisplayItemClipChain::ClipForASR(aClipChain, mActiveScrolledRoot);
|
||||
|
||||
if (aStore) {
|
||||
mState.mClipChain = mClipChain;
|
||||
mState.mClip = mClip;
|
||||
}
|
||||
}
|
||||
|
||||
Maybe<nsRect> nsDisplayItem::GetClipWithRespectToASR(
|
||||
|
@ -4782,6 +4777,7 @@ nsDisplayWrapList::nsDisplayWrapList(
|
|||
|
||||
mListPtr = &mList;
|
||||
mListPtr->AppendToTop(aList);
|
||||
mOriginalClipChain = mClipChain;
|
||||
nsDisplayWrapList::UpdateBounds(aBuilder);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
@ -4810,6 +4806,7 @@ nsDisplayWrapList::nsDisplayWrapList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
mListPtr = &mList;
|
||||
mListPtr->AppendToTop(aItem);
|
||||
mOriginalClipChain = mClipChain;
|
||||
nsDisplayWrapList::UpdateBounds(aBuilder);
|
||||
|
||||
if (!aFrame || !aFrame->IsTransformed()) {
|
||||
|
@ -5863,8 +5860,7 @@ void nsDisplayStickyPosition::SetClipChain(
|
|||
"with it.");
|
||||
|
||||
if (aStore) {
|
||||
mState.mClipChain = aClipChain;
|
||||
mState.mClip = mClip;
|
||||
mOriginalClipChain = aClipChain;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6404,7 +6400,6 @@ void nsDisplayTransform::SetReferenceFrameToAncestor(
|
|||
|
||||
void nsDisplayTransform::Init(nsDisplayListBuilder* aBuilder,
|
||||
nsDisplayList* aChildren) {
|
||||
mShouldFlatten = false;
|
||||
mChildren.AppendToTop(aChildren);
|
||||
UpdateBounds(aBuilder);
|
||||
}
|
||||
|
@ -7818,9 +7813,6 @@ bool nsDisplayText::CanApplyOpacity(WebRenderLayerManager* aManager,
|
|||
|
||||
void nsDisplayText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
AUTO_PROFILER_LABEL("nsDisplayText::Paint", GRAPHICS);
|
||||
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
RenderToContext(aCtx, aBuilder);
|
||||
}
|
||||
|
||||
|
|
|
@ -2402,9 +2402,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
if (aOther.ForceNotVisible()) {
|
||||
mItemFlags += ItemFlag::ForceNotVisible;
|
||||
}
|
||||
if (aOther.IsSubpixelAADisabled()) {
|
||||
mItemFlags += ItemFlag::DisableSubpixelAA;
|
||||
}
|
||||
if (mFrame->In3DContextAndBackfaceIsHidden()) {
|
||||
mItemFlags += ItemFlag::BackfaceHidden;
|
||||
}
|
||||
|
@ -2439,24 +2436,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
nsDisplayItem() = delete;
|
||||
nsDisplayItem(const nsDisplayItem&) = delete;
|
||||
|
||||
/**
|
||||
* Roll back side effects carried out by processing the display list.
|
||||
*
|
||||
* @return true if the rollback actually modified anything, to help the caller
|
||||
* decide whether to invalidate cached information about this node.
|
||||
*/
|
||||
virtual bool RestoreState() {
|
||||
if (mClipChain == mState.mClipChain && mClip == mState.mClip &&
|
||||
!mItemFlags.contains(ItemFlag::DisableSubpixelAA)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mClipChain = mState.mClipChain;
|
||||
mClip = mState.mClip;
|
||||
mItemFlags -= ItemFlag::DisableSubpixelAA;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidate cached information that depends on this node's contents, after
|
||||
* a mutation of those contents.
|
||||
|
@ -2861,16 +2840,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
return nsRect();
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable usage of component alpha. Currently only relevant for items that
|
||||
* have text.
|
||||
*/
|
||||
void DisableComponentAlpha() { mItemFlags += ItemFlag::DisableSubpixelAA; }
|
||||
|
||||
bool IsSubpixelAADisabled() const {
|
||||
return mItemFlags.contains(ItemFlag::DisableSubpixelAA);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if we can add async animations to the layer for this display item.
|
||||
*/
|
||||
|
@ -2969,7 +2938,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
#endif
|
||||
BackfaceHidden,
|
||||
Combines3DTransformWithAncestors,
|
||||
DisableSubpixelAA,
|
||||
ForceNotVisible,
|
||||
HasHitTestInfo,
|
||||
IsGlassItem,
|
||||
|
@ -3011,11 +2979,6 @@ class nsDisplayItem : public nsDisplayItemLink {
|
|||
RefPtr<const DisplayItemClipChain> mClipChain;
|
||||
const DisplayItemClip* mClip = nullptr;
|
||||
|
||||
struct {
|
||||
RefPtr<const DisplayItemClipChain> mClipChain;
|
||||
const DisplayItemClip* mClip;
|
||||
} mState;
|
||||
|
||||
#ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
|
||||
public:
|
||||
bool IsMergedItem() const {
|
||||
|
@ -4898,6 +4861,7 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
MOZ_COUNT_CTOR(nsDisplayWrapList);
|
||||
mBaseBuildingRect = GetBuildingRect();
|
||||
mListPtr = &mList;
|
||||
mOriginalClipChain = mClipChain;
|
||||
}
|
||||
|
||||
nsDisplayWrapList() = delete;
|
||||
|
@ -4915,6 +4879,7 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
mMergedFrames(aOther.mMergedFrames.Clone()),
|
||||
mBounds(aOther.mBounds),
|
||||
mBaseBuildingRect(aOther.mBaseBuildingRect),
|
||||
mOriginalClipChain(aOther.mClipChain),
|
||||
mOverrideZIndex(aOther.mOverrideZIndex),
|
||||
mHasZIndexOverride(aOther.mHasZIndexOverride),
|
||||
mClearingClipChain(aOther.mClearingClipChain) {
|
||||
|
@ -4946,7 +4911,7 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
// Clear the clip chain up to the asr, but don't store it, so that we'll
|
||||
// recover it when we reuse the item.
|
||||
if (mClearingClipChain) {
|
||||
const DisplayItemClipChain* clip = mState.mClipChain;
|
||||
const DisplayItemClipChain* clip = mOriginalClipChain;
|
||||
while (clip && ActiveScrolledRoot::IsAncestor(GetActiveScrolledRoot(),
|
||||
clip->mASR)) {
|
||||
clip = clip->mParent;
|
||||
|
@ -4968,6 +4933,15 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
SetBuildingRect(buildingRect);
|
||||
}
|
||||
|
||||
void SetClipChain(const DisplayItemClipChain* aClipChain,
|
||||
bool aStore) override {
|
||||
nsDisplayItem::SetClipChain(aClipChain, aStore);
|
||||
|
||||
if (aStore) {
|
||||
mOriginalClipChain = mClipChain;
|
||||
}
|
||||
}
|
||||
|
||||
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
|
||||
HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
|
||||
nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const override;
|
||||
|
@ -5091,6 +5065,7 @@ class nsDisplayWrapList : public nsPaintedDisplayItem {
|
|||
// Displaylist building rect contributed by this display item itself.
|
||||
// Our mBuildingRect may include the visible areas of children.
|
||||
nsRect mBaseBuildingRect;
|
||||
RefPtr<const DisplayItemClipChain> mOriginalClipChain;
|
||||
int32_t mOverrideZIndex;
|
||||
bool mHasZIndexOverride;
|
||||
bool mClearingClipChain = false;
|
||||
|
@ -6238,15 +6213,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem {
|
|||
|
||||
NS_DISPLAY_DECL_NAME("nsDisplayTransform", TYPE_TRANSFORM)
|
||||
|
||||
bool RestoreState() override {
|
||||
if (!nsPaintedDisplayItem::RestoreState() && !mShouldFlatten) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mShouldFlatten = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void UpdateBounds(nsDisplayListBuilder* aBuilder) override;
|
||||
|
||||
/**
|
||||
|
@ -6316,8 +6282,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem {
|
|||
}
|
||||
}
|
||||
|
||||
bool NeedsGeometryUpdates() const override { return mShouldFlatten; }
|
||||
|
||||
const nsIFrame* ReferenceFrameForChildren() const override {
|
||||
// If we were created using a transform-getter, then we don't
|
||||
// belong to a transformed frame, and aren't a reference frame
|
||||
|
@ -6583,8 +6547,6 @@ class nsDisplayTransform : public nsPaintedDisplayItem {
|
|||
// parent context unintendedly if the root of the child preserves3d context
|
||||
// doesn't create a transform item.
|
||||
bool mIsTransformSeparator : 1;
|
||||
// True if this nsDisplayTransform should get flattened
|
||||
bool mShouldFlatten : 1;
|
||||
// True if we have a transform getter.
|
||||
bool mHasTransformGetter : 1;
|
||||
};
|
||||
|
|
|
@ -2714,9 +2714,6 @@ void DisplaySVGText::HitTest(nsDisplayListBuilder* aBuilder,
|
|||
}
|
||||
|
||||
void DisplaySVGText::Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
|
||||
uint32_t appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
|
||||
|
||||
// ToReferenceFrame includes our mRect offset, but painting takes
|
||||
|
|
|
@ -263,9 +263,6 @@ static void PaintTextShadowCallback(gfxContext* aCtx, nsPoint aShadowOffset,
|
|||
|
||||
void nsDisplayXULTextBox::Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) {
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
|
||||
// Paint the text shadow before doing any foreground stuff
|
||||
nsRect drawRect =
|
||||
static_cast<nsTextBoxFrame*>(mFrame)->mTextDrawRect + ToReferenceFrame();
|
||||
|
|
|
@ -2525,9 +2525,6 @@ class nsDisplayTreeBody final : public nsPaintedDisplayItem {
|
|||
virtual void Paint(nsDisplayListBuilder* aBuilder,
|
||||
gfxContext* aCtx) override {
|
||||
MOZ_ASSERT(aBuilder);
|
||||
DrawTargetAutoDisableSubpixelAntialiasing disable(aCtx->GetDrawTarget(),
|
||||
IsSubpixelAADisabled());
|
||||
|
||||
ImgDrawResult result = static_cast<nsTreeBodyFrame*>(mFrame)->PaintTreeBody(
|
||||
*aCtx, GetPaintRect(aBuilder, aCtx), ToReferenceFrame(), aBuilder);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче