Bug 1549751 - Part 2: Add nsPaintedDisplayItem r=mattwoodrow

Move ApplyOpacity(), CanApplyOpacity(), Paint() and PaintWithClip() methods to nsPaintedDisplayItem

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Miko Mynttinen 2019-05-08 13:49:56 +00:00
parent d31f4467e4
commit 2c5cb1519c
31 changed files with 256 additions and 207 deletions

View File

@ -60,11 +60,11 @@ bool nsButtonFrameRenderer::isDisabled() {
NS_EVENT_STATE_DISABLED);
}
class nsDisplayButtonBoxShadowOuter : public nsDisplayItem {
class nsDisplayButtonBoxShadowOuter : public nsPaintedDisplayItem {
public:
nsDisplayButtonBoxShadowOuter(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayButtonBoxShadowOuter);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -184,11 +184,11 @@ bool nsDisplayButtonBoxShadowOuter::CreateWebRenderCommands(
return true;
}
class nsDisplayButtonBorder final : public nsDisplayItem {
class nsDisplayButtonBorder final : public nsPaintedDisplayItem {
public:
nsDisplayButtonBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsButtonFrameRenderer* aRenderer)
: nsDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
: nsPaintedDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
MOZ_COUNT_CTOR(nsDisplayButtonBorder);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -290,11 +290,11 @@ nsRect nsDisplayButtonBorder::GetBounds(nsDisplayListBuilder* aBuilder,
ToReferenceFrame();
}
class nsDisplayButtonForeground final : public nsDisplayItem {
class nsDisplayButtonForeground final : public nsPaintedDisplayItem {
public:
nsDisplayButtonForeground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsButtonFrameRenderer* aRenderer)
: nsDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
: nsPaintedDisplayItem(aBuilder, aFrame), mBFR(aRenderer) {
MOZ_COUNT_CTOR(nsDisplayButtonForeground);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -1421,11 +1421,11 @@ int32_t nsComboboxControlFrame::UpdateRecentIndex(int32_t aIndex) {
return index;
}
class nsDisplayComboboxFocus : public nsDisplayItem {
class nsDisplayComboboxFocus : public nsPaintedDisplayItem {
public:
nsDisplayComboboxFocus(nsDisplayListBuilder* aBuilder,
nsComboboxControlFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayComboboxFocus);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -90,11 +90,11 @@ nsIFrame* nsFieldSetFrame::GetLegend() const {
return mFrames.FirstChild();
}
class nsDisplayFieldSetBorder final : public nsDisplayItem {
class nsDisplayFieldSetBorder final : public nsPaintedDisplayItem {
public:
nsDisplayFieldSetBorder(nsDisplayListBuilder* aBuilder,
nsFieldSetFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayFieldSetBorder);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -148,10 +148,10 @@ void nsRangeFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
}
}
class nsDisplayRangeFocusRing final : public nsDisplayItem {
class nsDisplayRangeFocusRing final : public nsPaintedDisplayItem {
public:
nsDisplayRangeFocusRing(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayRangeFocusRing);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -100,10 +100,10 @@ static nsListControlFrame* GetEnclosingListFrame(nsIFrame* aSelectsAreaFrame) {
return nullptr;
}
class nsDisplayListFocus : public nsDisplayItem {
class nsDisplayListFocus : public nsPaintedDisplayItem {
public:
nsDisplayListFocus(nsDisplayListBuilder* aBuilder, nsSelectsAreaFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayListFocus);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -148,13 +148,13 @@ static bool IsFrameDescendantOfAny(
return false;
}
class nsDisplayTextOverflowMarker final : public nsDisplayItem {
class nsDisplayTextOverflowMarker final : public nsPaintedDisplayItem {
public:
nsDisplayTextOverflowMarker(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, nscoord aAscent,
const nsStyleTextOverflowSide* aStyle,
uint32_t aLineNumber, uint16_t aIndex)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mRect(aRect),
mStyle(*aStyle),
mAscent(aAscent),

View File

@ -543,10 +543,10 @@ bool BulletRenderer::CreateWebRenderCommandsForText(
return textDrawer->Finish();
}
class nsDisplayBullet final : public nsDisplayItem {
class nsDisplayBullet final : public nsPaintedDisplayItem {
public:
nsDisplayBullet(nsDisplayListBuilder* aBuilder, nsBulletFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayBullet);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -604,7 +604,7 @@ class nsDisplayBullet final : public nsDisplayItem {
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
}
return nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
return nsPaintedDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
aInvalidRegion);
}

View File

@ -438,10 +438,10 @@ void nsDisplayCanvasThemedBackground::Paint(nsDisplayListBuilder* aBuilder,
*
* The only reason this can't use nsDisplayGeneric is overriding GetBounds.
*/
class nsDisplayCanvasFocus : public nsDisplayItem {
class nsDisplayCanvasFocus : public nsPaintedDisplayItem {
public:
nsDisplayCanvasFocus(nsDisplayListBuilder* aBuilder, nsCanvasFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayCanvasFocus);
}
virtual ~nsDisplayCanvasFocus() { MOZ_COUNT_DTOR(nsDisplayCanvasFocus); }

View File

@ -21,10 +21,10 @@ static LazyLogModule sColumnSetLog("ColumnSet");
#define COLUMN_SET_LOG(msg, ...) \
MOZ_LOG(sColumnSetLog, LogLevel::Debug, (msg, ##__VA_ARGS__))
class nsDisplayColumnRule : public nsDisplayItem {
class nsDisplayColumnRule : public nsPaintedDisplayItem {
public:
nsDisplayColumnRule(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayColumnRule);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -2168,11 +2168,12 @@ int16_t nsFrame::DisplaySelection(nsPresContext* aPresContext,
return selType;
}
class nsDisplaySelectionOverlay : public nsDisplayItem {
class nsDisplaySelectionOverlay : public nsPaintedDisplayItem {
public:
nsDisplaySelectionOverlay(nsDisplayListBuilder* aBuilder, nsFrame* aFrame,
int16_t aSelectionValue)
: nsDisplayItem(aBuilder, aFrame), mSelectionValue(aSelectionValue) {
: nsPaintedDisplayItem(aBuilder, aFrame),
mSelectionValue(aSelectionValue) {
MOZ_COUNT_CTOR(nsDisplaySelectionOverlay);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -1328,11 +1328,11 @@ void nsHTMLFramesetBorderFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.SetOverflowAreasToDesiredBounds();
}
class nsDisplayFramesetBorder : public nsDisplayItem {
class nsDisplayFramesetBorder : public nsPaintedDisplayItem {
public:
nsDisplayFramesetBorder(nsDisplayListBuilder* aBuilder,
nsHTMLFramesetBorderFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayFramesetBorder);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -1516,10 +1516,10 @@ void nsHTMLFramesetBlankFrame::Reflow(nsPresContext* aPresContext,
aDesiredSize.SetOverflowAreasToDesiredBounds();
}
class nsDisplayFramesetBlank : public nsDisplayItem {
class nsDisplayFramesetBlank : public nsPaintedDisplayItem {
public:
nsDisplayFramesetBlank(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayFramesetBlank);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -1295,10 +1295,10 @@ struct nsRecessedBorder : public nsStyleBorder {
}
};
class nsDisplayAltFeedback final : public nsDisplayItem {
class nsDisplayAltFeedback final : public nsPaintedDisplayItem {
public:
nsDisplayAltFeedback(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
: nsPaintedDisplayItem(aBuilder, aFrame) {}
virtual nsDisplayItemGeometry* AllocateGeometry(
nsDisplayListBuilder* aBuilder) override {

View File

@ -440,10 +440,10 @@ static gfx::Matrix4x4 ComputePageTransform(nsIFrame* aFrame,
return gfx::Matrix4x4::Scaling(scale, scale, 1);
}
class nsDisplayHeaderFooter final : public nsDisplayItem {
class nsDisplayHeaderFooter final : public nsPaintedDisplayItem {
public:
nsDisplayHeaderFooter(nsDisplayListBuilder* aBuilder, nsPageFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayHeaderFooter);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -353,10 +353,10 @@ class nsDisplayPluginGeometry : public nsDisplayItemGenericGeometry {
virtual bool InvalidateForSyncDecodeImages() const override { return true; }
};
class nsDisplayPlugin final : public nsDisplayItem {
class nsDisplayPlugin final : public nsPaintedDisplayItem {
public:
nsDisplayPlugin(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayPlugin);
aBuilder->SetContainsPluginItem();
}

View File

@ -162,7 +162,7 @@ inline static bool IsTempLayerManager(mozilla::layers::LayerManager* aManager) {
nsDisplayRemote::nsDisplayRemote(nsDisplayListBuilder* aBuilder,
nsSubDocumentFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mTabId{0},
mEventRegionsOverride(EventRegionsOverride::NoOverride) {
bool frameIsPointerEventsNone = aFrame->StyleUI()->GetEffectivePointerEvents(

View File

@ -89,7 +89,7 @@ class RenderFrame final {
* A nsDisplayRemote will graft a remote frame's shadow layer tree (for a given
* nsFrameLoader) into its parent frame's layer tree.
*/
class nsDisplayRemote final : public nsDisplayItem {
class nsDisplayRemote final : public nsPaintedDisplayItem {
typedef mozilla::dom::TabId TabId;
typedef mozilla::gfx::Matrix4x4 Matrix4x4;
typedef mozilla::layers::EventRegionsOverride EventRegionsOverride;

View File

@ -1682,11 +1682,11 @@ nscoord nsMathMLChar::GetMaxWidth(nsIFrame* aForFrame, DrawTarget* aDrawTarget,
return std::max(bm.width, bm.rightBearing) - std::min(0, bm.leftBearing);
}
class nsDisplayMathMLSelectionRect final : public nsDisplayItem {
class nsDisplayMathMLSelectionRect final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLSelectionRect(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
: nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect) {
MOZ_COUNT_CTOR(nsDisplayMathMLSelectionRect);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -1713,12 +1713,12 @@ void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
drawTarget->FillRect(rect, ColorPattern(ToDeviceColor(bgColor)));
}
class nsDisplayMathMLCharForeground final : public nsDisplayItem {
class nsDisplayMathMLCharForeground final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsMathMLChar* aChar,
uint16_t aIndex, bool aIsSelected)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mChar(aChar),
mIndex(aIndex),
mIsSelected(aIsSelected) {
@ -1767,11 +1767,11 @@ class nsDisplayMathMLCharForeground final : public nsDisplayItem {
};
#ifdef DEBUG
class nsDisplayMathMLCharDebug final : public nsDisplayItem {
class nsDisplayMathMLCharDebug final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLCharDebug(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect) {
: nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect) {
MOZ_COUNT_CTOR(nsDisplayMathMLCharDebug);
}
# ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -68,10 +68,10 @@ nsresult nsMathMLContainerFrame::ReflowError(DrawTarget* aDrawTarget,
return NS_OK;
}
class nsDisplayMathMLError : public nsDisplayItem {
class nsDisplayMathMLError : public nsPaintedDisplayItem {
public:
nsDisplayMathMLError(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayMathMLError);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -300,11 +300,11 @@ void nsMathMLFrame::DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder,
}
#endif
class nsDisplayMathMLBar final : public nsDisplayItem {
class nsDisplayMathMLBar final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, uint16_t aIndex)
: nsDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) {
: nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) {
MOZ_COUNT_CTOR(nsDisplayMathMLBar);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -701,12 +701,12 @@ void nsMathMLmencloseFrame::SetAdditionalComputedStyle(
mMathMLChar[aIndex].SetComputedStyle(aComputedStyle);
}
class nsDisplayNotation final : public nsDisplayItem {
class nsDisplayNotation final : public nsPaintedDisplayItem {
public:
nsDisplayNotation(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, nscoord aThickness,
nsMencloseNotation aType)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mRect(aRect),
mThickness(aThickness),
mType(aType) {

View File

@ -569,11 +569,11 @@ nsresult nsMathMLmfracFrame::PlaceInternal(DrawTarget* aDrawTarget,
return NS_OK;
}
class nsDisplayMathMLSlash : public nsDisplayItem {
class nsDisplayMathMLSlash : public nsPaintedDisplayItem {
public:
nsDisplayMathMLSlash(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, nscoord aThickness, bool aRTL)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mRect(aRect),
mThickness(aThickness),
mRTL(aRTL) {

View File

@ -4192,7 +4192,7 @@ void nsDisplayBackgroundImage::HitTest(nsDisplayListBuilder* aBuilder,
bool nsDisplayBackgroundImage::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
if (!nsDisplayImageContainer::ComputeVisibility(aBuilder, aVisibleRegion)) {
return false;
}
@ -4429,7 +4429,7 @@ bool nsDisplayTableBackgroundImage::IsInvalid(nsRect& aRect) const {
nsDisplayThemedBackground::nsDisplayThemedBackground(
nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aBackgroundRect)
: nsDisplayItem(aBuilder, aFrame), mBackgroundRect(aBackgroundRect) {
: nsPaintedDisplayItem(aBuilder, aFrame), mBackgroundRect(aBackgroundRect) {
MOZ_COUNT_CTOR(nsDisplayThemedBackground);
}
@ -5129,7 +5129,8 @@ uint16_t nsDisplayCompositorHitTestInfo::CalculatePerFrameKey() const {
}
int32_t nsDisplayCompositorHitTestInfo::ZIndex() const {
return mOverrideZIndex ? *mOverrideZIndex : nsDisplayItem::ZIndex();
return mOverrideZIndex ? *mOverrideZIndex
: nsDisplayHitTestInfoItem::ZIndex();
}
void nsDisplayCompositorHitTestInfo::SetOverrideZIndex(int32_t aZIndex) {
@ -5138,7 +5139,7 @@ void nsDisplayCompositorHitTestInfo::SetOverrideZIndex(int32_t aZIndex) {
nsDisplayCaret::nsDisplayCaret(nsDisplayListBuilder* aBuilder,
nsIFrame* aCaretFrame)
: nsDisplayItem(aBuilder, aCaretFrame),
: nsPaintedDisplayItem(aBuilder, aCaretFrame),
mCaret(aBuilder->GetCaret()),
mBounds(aBuilder->GetCaretRect() + ToReferenceFrame()) {
MOZ_COUNT_CTOR(nsDisplayCaret);
@ -5201,7 +5202,7 @@ bool nsDisplayCaret::CreateWebRenderCommands(
nsDisplayBorder::nsDisplayBorder(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayBorder);
mBounds = CalculateBounds<nsRect>(*mFrame->StyleBorder());
@ -5370,7 +5371,7 @@ bool nsDisplayBoxShadowOuter::IsInvisibleInRect(const nsRect& aRect) const {
bool nsDisplayBoxShadowOuter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
if (!nsPaintedDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
return false;
}
@ -5637,7 +5638,7 @@ bool nsDisplayBoxShadowInner::CreateWebRenderCommands(
bool nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion) {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
if (!nsPaintedDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion)) {
return false;
}
@ -6058,7 +6059,7 @@ static const size_t kOpacityMaxListSize = kOpacityMaxChildCount * 2;
* Otherwise returns true.
*/
static bool CollectItemsWithOpacity(nsDisplayList* aList,
nsTArray<nsDisplayItem*>& aArray) {
nsTArray<nsPaintedDisplayItem*>& aArray) {
if (aList->Count() > kOpacityMaxListSize) {
// Exit early, since |aList| will likely contain more than
// |kOpacityMaxChildCount| items.
@ -6068,6 +6069,10 @@ static bool CollectItemsWithOpacity(nsDisplayList* aList,
for (nsDisplayItem* i : *aList) {
const DisplayItemType type = i->GetType();
if (type == DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO) {
continue;
}
// Descend only into wraplists.
if (type == DisplayItemType::TYPE_WRAP_LIST) {
// The current display item has children, process them first.
@ -6078,15 +6083,16 @@ static bool CollectItemsWithOpacity(nsDisplayList* aList,
continue;
}
if (type == DisplayItemType::TYPE_COMPOSITOR_HITTEST_INFO) {
continue;
}
if (!i->CanApplyOpacity() || aArray.Length() == kOpacityMaxChildCount) {
if (aArray.Length() == kOpacityMaxChildCount) {
return false;
}
aArray.AppendElement(i);
auto* item = i->AsPaintedDisplayItem();
if (!item || !item->CanApplyOpacity()) {
return false;
}
aArray.AppendElement(item);
}
return true;
@ -6099,20 +6105,20 @@ bool nsDisplayOpacity::ApplyOpacityToChildren(nsDisplayListBuilder* aBuilder) {
// Iterate through the child display list and copy at most
// |kOpacityMaxChildCount| child display item pointers to a temporary list.
AutoTArray<nsDisplayItem*, kOpacityMaxChildCount> items;
AutoTArray<nsPaintedDisplayItem*, kOpacityMaxChildCount> items;
if (!CollectItemsWithOpacity(&mList, items)) {
mChildOpacityState = ChildOpacityState::Deferred;
return false;
}
struct {
nsDisplayItem* item;
nsPaintedDisplayItem* item;
nsRect bounds;
} children[kOpacityMaxChildCount];
bool snap;
size_t childCount = 0;
for (nsDisplayItem* item : items) {
for (nsPaintedDisplayItem* item : items) {
children[childCount].item = item;
children[childCount].bounds = item->GetBounds(aBuilder, &snap);
childCount++;
@ -6726,7 +6732,7 @@ void nsDisplaySubDocument::RemoveFrame(nsIFrame* aFrame) {
mSubDocFrame = nullptr;
SetDeletedFrame();
}
nsDisplayItem::RemoveFrame(aFrame);
nsDisplayOwnLayer::RemoveFrame(aFrame);
}
void nsDisplaySubDocument::Disown() {
@ -8937,7 +8943,7 @@ bool nsDisplayPerspective::CreateWebRenderCommands(
nsDisplayText::nsDisplayText(nsDisplayListBuilder* aBuilder,
nsTextFrame* aFrame,
const Maybe<bool>& aIsSelected)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mOpacity(1.0f),
mVisIStartEdge(0),
mVisIEndEdge(0) {

View File

@ -1994,7 +1994,6 @@ class nsDisplayListBuilder {
class nsDisplayItem;
class nsDisplayItemBase;
class nsDisplayWrapList;
class nsDisplayList;
class RetainedDisplayList;
@ -2037,8 +2036,10 @@ void AssertUniqueItem(nsDisplayItem* aItem);
template <typename T, typename F, typename... Args>
MOZ_ALWAYS_INLINE T* MakeDisplayItem(nsDisplayListBuilder* aBuilder, F* aFrame,
Args&&... aArgs) {
static_assert(std::is_base_of<nsDisplayItem, T>::value,
"Display item should be derived from nsDisplayItem");
static_assert(std::is_base_of<nsIFrame, F>::value,
"Frame type is not derived from nsIFrame");
"Frame type should be derived from nsIFrame");
T* item = new (aBuilder) T(aBuilder, aFrame, std::forward<Args>(aArgs)...);
@ -2110,6 +2111,9 @@ class nsDisplayItemLink {
friend class nsDisplayList;
};
class nsPaintedDisplayItem;
class nsDisplayWrapList;
/*
* nsDisplayItemBase is a base-class for all display items. It is mainly
* responsible for handling the frame-display item 1:n relationship, as well as
@ -2127,6 +2131,27 @@ class nsDisplayItemBase : public nsDisplayItemLink {
public:
nsDisplayItemBase() = delete;
/**
* Downcasts this item to nsPaintedDisplayItem, if possible.
*/
virtual nsPaintedDisplayItem* AsPaintedDisplayItem() { return nullptr; }
virtual const nsPaintedDisplayItem* AsPaintedDisplayItem() const {
return nullptr;
}
/**
* Downcasts this item to nsDisplayWrapList, if possible.
*/
virtual nsDisplayWrapList* AsDisplayWrapList() { return nullptr; }
virtual const nsDisplayWrapList* AsDisplayWrapList() const { return nullptr; }
/**
* Create a clone of this item.
*/
virtual nsDisplayItem* Clone(nsDisplayListBuilder* aBuilder) const {
return nullptr;
}
/**
* Frees the memory allocated for this display item.
* The given display list builder must have allocated this display item.
@ -2405,30 +2430,6 @@ class nsDisplayItem : public nsDisplayItemBase {
SetDisplayItemData(nullptr, nullptr);
}
public:
nsDisplayItem() = delete;
virtual void RestoreState() {
mClipChain = mState.mClipChain;
mClip = mState.mClip;
mItemFlags -= ItemFlag::DisableSubpixelAA;
}
/**
* Downcasts this item to nsDisplayWrapList, if possible.
*/
virtual const nsDisplayWrapList* AsDisplayWrapList() const { return nullptr; }
virtual nsDisplayWrapList* AsDisplayWrapList() { return nullptr; }
/**
* Create a clone of this item.
*/
virtual nsDisplayItem* Clone(nsDisplayListBuilder* aBuilder) const {
MOZ_ASSERT_UNREACHABLE("Clone() called on an incorrect item type!");
return nullptr;
}
nsDisplayItem(const nsDisplayItem&) = delete;
/**
* The custom copy-constructor is implemented to prevent copying the saved
* state of the item.
@ -2460,6 +2461,16 @@ class nsDisplayItem : public nsDisplayItemBase {
}
}
public:
nsDisplayItem() = delete;
nsDisplayItem(const nsDisplayItem&) = delete;
virtual void RestoreState() {
mClipChain = mState.mClipChain;
mClip = mState.mClip;
mItemFlags -= ItemFlag::DisableSubpixelAA;
}
struct HitTestState {
explicit HitTestState() : mInPreserves3D(false) {}
@ -2709,27 +2720,6 @@ class nsDisplayItem : public nsDisplayItemBase {
return mozilla::LAYER_NONE;
}
/**
* Returns true if this item supports PaintWithClip, where the clipping
* is used directly as the primitive geometry instead of needing an explicit
* clip.
*/
virtual bool CanPaintWithClip(const DisplayItemClip& aClip) { return false; }
/**
* Actually paint this item to some rendering context.
* Content outside mVisibleRect need not be painted.
* aCtx must be set up as for nsDisplayList::Paint.
*/
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {}
/**
* Same as Paint, except provides a clip to use the geometry to draw with.
* Must not be called unless CanPaintWithClip returned true.
*/
virtual void PaintWithClip(nsDisplayListBuilder* aBuilder, gfxContext* aCtx,
const DisplayItemClip& aClip) {}
#ifdef MOZ_DUMP_PAINTING
/**
* Mark this display item as being painted via
@ -2928,24 +2918,6 @@ class nsDisplayItem : public nsDisplayItemBase {
return mBuildingRect;
}
/**
* Stores the given opacity value to be applied when drawing. It is an error
* to call this if CanApplyOpacity returned false.
*/
virtual void ApplyOpacity(nsDisplayListBuilder* aBuilder, float aOpacity,
const DisplayItemClipChain* aClip) {
NS_ASSERTION(CanApplyOpacity(), "ApplyOpacity not supported on this type");
}
/**
* Returns true if this display item would return true from ApplyOpacity
* without actually applying the opacity. Otherwise returns false.
*/
virtual bool CanApplyOpacity() const { return false; }
bool ForceNotVisible() const {
return mItemFlags.contains(ItemFlag::ForceNotVisible);
}
virtual void WriteDebugInfo(std::stringstream& aStream) {}
nsDisplayItem* GetAbove() { return mAbove; }
@ -3053,6 +3025,10 @@ class nsDisplayItem : public nsDisplayItemBase {
return mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
}
bool ForceNotVisible() const {
return mItemFlags.contains(ItemFlag::ForceNotVisible);
}
bool In3DContextAndBackfaceIsHidden() const {
return mItemFlags.contains(ItemFlag::BackfaceHidden) &&
mItemFlags.contains(ItemFlag::Combines3DTransformWithAncestors);
@ -3158,6 +3134,65 @@ class nsDisplayItem : public nsDisplayItemBase {
mozilla::EnumSet<ItemFlag, uint8_t> mItemFlags;
};
class nsPaintedDisplayItem : public nsDisplayItem {
public:
nsPaintedDisplayItem* AsPaintedDisplayItem() final { return this; }
const nsPaintedDisplayItem* AsPaintedDisplayItem() const final {
return this;
}
/**
* Stores the given opacity value to be applied when drawing. It is an error
* to call this if CanApplyOpacity returned false.
*/
virtual void ApplyOpacity(nsDisplayListBuilder* aBuilder, float aOpacity,
const DisplayItemClipChain* aClip) {
MOZ_ASSERT(CanApplyOpacity(), "ApplyOpacity is not supported on this type");
}
/**
* Returns true if this display item would return true from ApplyOpacity
* without actually applying the opacity. Otherwise returns false.
*/
virtual bool CanApplyOpacity() const { return false; }
/**
* Returns true if this item supports PaintWithClip, where the clipping
* is used directly as the primitive geometry instead of needing an explicit
* clip.
*/
virtual bool CanPaintWithClip(const DisplayItemClip& aClip) { return false; }
/**
* Same as |Paint()|, except provides a clip to use the geometry to draw with.
* Must not be called unless |CanPaintWithClip()| returned true.
*/
virtual void PaintWithClip(nsDisplayListBuilder* aBuilder, gfxContext* aCtx,
const DisplayItemClip& aClip) {
MOZ_ASSERT_UNREACHABLE("PaintWithClip() is not implemented!");
}
/**
* Paint this item to some rendering context.
*/
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) {
// TODO(miko): Make this a pure virtual function to force implementation.
MOZ_ASSERT_UNREACHABLE("Paint() is not implemented!");
}
protected:
nsPaintedDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
nsPaintedDisplayItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const ActiveScrolledRoot* aActiveScrolledRoot)
: nsDisplayItem(aBuilder, aFrame, aActiveScrolledRoot) {}
nsPaintedDisplayItem(nsDisplayListBuilder* aBuilder,
const nsPaintedDisplayItem& aOther)
: nsDisplayItem(aBuilder, aOther) {}
};
/**
* Manages a singly-linked list of display list items.
*
@ -3887,24 +3922,24 @@ struct HitTestInfo {
const mozilla::DisplayItemClip* mClip;
};
class nsDisplayHitTestInfoItem : public nsDisplayItem {
class nsDisplayHitTestInfoItem : public nsPaintedDisplayItem {
public:
nsDisplayHitTestInfoItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
: nsPaintedDisplayItem(aBuilder, aFrame) {}
nsDisplayHitTestInfoItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const ActiveScrolledRoot* aActiveScrolledRoot)
: nsDisplayItem(aBuilder, aFrame, aActiveScrolledRoot) {}
: nsPaintedDisplayItem(aBuilder, aFrame, aActiveScrolledRoot) {}
nsDisplayHitTestInfoItem(nsDisplayListBuilder* aBuilder,
const nsDisplayHitTestInfoItem& aOther)
: nsDisplayItem(aBuilder, aOther) {}
: nsPaintedDisplayItem(aBuilder, aOther) {}
const HitTestInfo& GetHitTestInfo() const { return *mHitTestInfo; }
void SetActiveScrolledRoot(
const ActiveScrolledRoot* aActiveScrolledRoot) override {
nsDisplayItem::SetActiveScrolledRoot(aActiveScrolledRoot);
nsPaintedDisplayItem::SetActiveScrolledRoot(aActiveScrolledRoot);
UpdateHitTestInfoActiveScrolledRoot(aActiveScrolledRoot);
}
@ -3956,7 +3991,7 @@ class nsDisplayHitTestInfoItem : public nsDisplayItem {
mozilla::UniquePtr<HitTestInfo> mHitTestInfo;
};
class nsDisplayImageContainer : public nsDisplayItem {
class nsDisplayImageContainer : public nsPaintedDisplayItem {
public:
typedef mozilla::LayerIntPoint LayerIntPoint;
typedef mozilla::LayoutDeviceRect LayoutDeviceRect;
@ -3964,7 +3999,7 @@ class nsDisplayImageContainer : public nsDisplayItem {
typedef mozilla::layers::ImageLayer ImageLayer;
nsDisplayImageContainer(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
: nsPaintedDisplayItem(aBuilder, aFrame) {}
/**
* @return true if this display item can be optimized into an image layer.
@ -3996,7 +4031,7 @@ class nsDisplayImageContainer : public nsDisplayItem {
* custom display item class could be, and fractionally slower. However it does
* save code size. We use this for infrequently-used item types.
*/
class nsDisplayGeneric : public nsDisplayItem {
class nsDisplayGeneric : public nsPaintedDisplayItem {
public:
typedef void (*PaintCallback)(nsIFrame* aFrame, DrawTarget* aDrawTarget,
const nsRect& aDirtyRect, nsPoint aFramePt);
@ -4008,7 +4043,7 @@ class nsDisplayGeneric : public nsDisplayItem {
nsDisplayGeneric(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
PaintCallback aPaint, const char* aName,
DisplayItemType aType)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mPaint(aPaint),
mOldPaint(nullptr),
mName(aName) {
@ -4020,7 +4055,7 @@ class nsDisplayGeneric : public nsDisplayItem {
nsDisplayGeneric(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
OldPaintCallback aOldPaint, const char* aName,
DisplayItemType aType)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mPaint(nullptr),
mOldPaint(aOldPaint),
mName(aName) {
@ -4080,11 +4115,11 @@ class nsDisplayGeneric : public nsDisplayItem {
* XXXbz the color thing is a bit of a mess, but 0 basically means "not set"
* here... I could switch it all to nscolor, but why bother?
*/
class nsDisplayReflowCount : public nsDisplayItem {
class nsDisplayReflowCount : public nsPaintedDisplayItem {
public:
nsDisplayReflowCount(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const char* aFrameName, uint32_t aColor = 0)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mFrameName(aFrameName),
mColor(aColor) {
MOZ_COUNT_CTOR(nsDisplayReflowCount);
@ -4143,7 +4178,7 @@ class nsDisplayReflowCount : public nsDisplayItem {
#endif // MOZ_REFLOW_PERF_DSP && MOZ_REFLOW_PERF
class nsDisplayCaret : public nsDisplayItem {
class nsDisplayCaret : public nsPaintedDisplayItem {
public:
nsDisplayCaret(nsDisplayListBuilder* aBuilder, nsIFrame* aCaretFrame);
@ -4170,7 +4205,7 @@ class nsDisplayCaret : public nsDisplayItem {
/**
* The standard display item to paint the CSS borders of a frame.
*/
class nsDisplayBorder : public nsDisplayItem {
class nsDisplayBorder : public nsPaintedDisplayItem {
public:
nsDisplayBorder(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame);
@ -4280,11 +4315,11 @@ class nsDisplayBorder : public nsDisplayItem {
* is not yet a frame tree to go in the frame/iframe so we use the subdoc
* frame of the parent document as a standin.
*/
class nsDisplaySolidColorBase : public nsDisplayItem {
class nsDisplaySolidColorBase : public nsPaintedDisplayItem {
public:
nsDisplaySolidColorBase(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nscolor aColor)
: nsDisplayItem(aBuilder, aFrame), mColor(aColor) {}
: nsPaintedDisplayItem(aBuilder, aFrame), mColor(aColor) {}
nsDisplayItemGeometry* AllocateGeometry(
nsDisplayListBuilder* aBuilder) override {
@ -4380,13 +4415,13 @@ class nsDisplaySolidColor : public nsDisplaySolidColorBase {
* exposed through CSS, its only purpose is efficient invalidation of
* the find bar highlighter dimmer.
*/
class nsDisplaySolidColorRegion : public nsDisplayItem {
class nsDisplaySolidColorRegion : public nsPaintedDisplayItem {
typedef mozilla::gfx::Color Color;
public:
nsDisplaySolidColorRegion(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRegion& aRegion, nscolor aColor)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mRegion(aRegion),
mColor(Color::FromABGR(aColor)) {
NS_ASSERTION(NS_GET_A(aColor) > 0,
@ -4576,7 +4611,7 @@ class nsDisplayBackgroundImage : public nsDisplayImageContainer {
if (aFrame == mDependentFrame) {
mDependentFrame = nullptr;
}
nsDisplayItem::RemoveFrame(aFrame);
nsDisplayImageContainer::RemoveFrame(aFrame);
}
protected:
@ -4692,7 +4727,7 @@ class nsDisplayTableBackgroundImage : public nsDisplayBackgroundImage {
/**
* A display item to paint the native theme background for a frame.
*/
class nsDisplayThemedBackground : public nsDisplayItem {
class nsDisplayThemedBackground : public nsPaintedDisplayItem {
public:
nsDisplayThemedBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aBackgroundRect);
@ -4711,7 +4746,7 @@ class nsDisplayThemedBackground : public nsDisplayItem {
void Destroy(nsDisplayListBuilder* aBuilder) override {
aBuilder->UnregisterThemeGeometry(this);
nsDisplayItem::Destroy(aBuilder);
nsPaintedDisplayItem::Destroy(aBuilder);
}
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
@ -4815,7 +4850,7 @@ class nsDisplayTableThemedBackground : public nsDisplayThemedBackground {
TableType mTableType;
};
class nsDisplayBackgroundColor : public nsDisplayItem {
class nsDisplayBackgroundColor : public nsPaintedDisplayItem {
typedef mozilla::gfx::Color Color;
public:
@ -4823,7 +4858,7 @@ class nsDisplayBackgroundColor : public nsDisplayItem {
const nsRect& aBackgroundRect,
const mozilla::ComputedStyle* aBackgroundStyle,
const nscolor& aColor)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mBackgroundRect(aBackgroundRect),
mHasStyle(aBackgroundStyle),
mDependentFrame(nullptr),
@ -4847,7 +4882,7 @@ class nsDisplayBackgroundColor : public nsDisplayItem {
NS_DISPLAY_DECL_NAME("BackgroundColor", TYPE_BACKGROUND_COLOR)
void RestoreState() override {
nsDisplayItem::RestoreState();
nsPaintedDisplayItem::RestoreState();
mColor = mState.mColor;
}
@ -4934,7 +4969,8 @@ class nsDisplayBackgroundColor : public nsDisplayItem {
if (aFrame == mDependentFrame) {
mDependentFrame = nullptr;
}
nsDisplayItem::RemoveFrame(aFrame);
nsPaintedDisplayItem::RemoveFrame(aFrame);
}
void WriteDebugInfo(std::stringstream& aStream) override;
@ -4999,10 +5035,10 @@ class nsDisplayTableBackgroundColor : public nsDisplayBackgroundColor {
TableType mTableType;
};
class nsDisplayClearBackground : public nsDisplayItem {
class nsDisplayClearBackground : public nsPaintedDisplayItem {
public:
nsDisplayClearBackground(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {}
: nsPaintedDisplayItem(aBuilder, aFrame) {}
NS_DISPLAY_DECL_NAME("ClearBackground", TYPE_CLEAR_BACKGROUND)
@ -5045,10 +5081,10 @@ class nsDisplayClearBackground : public nsDisplayItem {
/**
* The standard display item to paint the outer CSS box-shadows of a frame.
*/
class nsDisplayBoxShadowOuter final : public nsDisplayItem {
class nsDisplayBoxShadowOuter final : public nsPaintedDisplayItem {
public:
nsDisplayBoxShadowOuter(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame), mOpacity(1.0f) {
: nsPaintedDisplayItem(aBuilder, aFrame), mOpacity(1.0f) {
MOZ_COUNT_CTOR(nsDisplayBoxShadowOuter);
mBounds = GetBoundsInternal();
}
@ -5062,7 +5098,7 @@ class nsDisplayBoxShadowOuter final : public nsDisplayItem {
NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
void RestoreState() override {
nsDisplayItem::RestoreState();
nsPaintedDisplayItem::RestoreState();
mVisibleRegion.SetEmpty();
mOpacity = 1.0f;
}
@ -5108,10 +5144,10 @@ class nsDisplayBoxShadowOuter final : public nsDisplayItem {
/**
* The standard display item to paint the inner CSS box-shadows of a frame.
*/
class nsDisplayBoxShadowInner : public nsDisplayItem {
class nsDisplayBoxShadowInner : public nsPaintedDisplayItem {
public:
nsDisplayBoxShadowInner(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayBoxShadowInner);
}
@ -5124,7 +5160,7 @@ class nsDisplayBoxShadowInner : public nsDisplayItem {
NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
void RestoreState() override {
nsDisplayItem::RestoreState();
nsPaintedDisplayItem::RestoreState();
mVisibleRegion.SetEmpty();
}
@ -5171,10 +5207,10 @@ class nsDisplayBoxShadowInner : public nsDisplayItem {
/**
* The standard display item to paint the CSS outline of a frame.
*/
class nsDisplayOutline : public nsDisplayItem {
class nsDisplayOutline : public nsPaintedDisplayItem {
public:
nsDisplayOutline(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayOutline);
}
@ -5199,10 +5235,10 @@ class nsDisplayOutline : public nsDisplayItem {
* A class that lets you receive events within the frame bounds but never
* paints.
*/
class nsDisplayEventReceiver : public nsDisplayItem {
class nsDisplayEventReceiver : public nsPaintedDisplayItem {
public:
nsDisplayEventReceiver(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayEventReceiver);
}
@ -5350,13 +5386,12 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
NS_DISPLAY_DECL_NAME("WrapList", TYPE_WRAP_LIST)
const nsDisplayWrapList* AsDisplayWrapList() const override { return this; }
nsDisplayWrapList* AsDisplayWrapList() override { return this; }
const nsDisplayWrapList* AsDisplayWrapList() const final { return this; }
nsDisplayWrapList* AsDisplayWrapList() final { return this; }
void Destroy(nsDisplayListBuilder* aBuilder) override {
mList.DeleteAll(aBuilder);
nsDisplayItem::Destroy(aBuilder);
nsDisplayHitTestInfoItem::Destroy(aBuilder);
}
/**
@ -5401,7 +5436,7 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
// Skip unnecessary call to
// |nsDisplayHitTestInfoItem::UpdateHitTestInfoActiveScrolledRoot()|, since
// callers will manually call that with different ASR.
nsDisplayItem::SetActiveScrolledRoot(aActiveScrolledRoot);
nsDisplayHitTestInfoItem::SetActiveScrolledRoot(aActiveScrolledRoot);
}
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
@ -5465,7 +5500,8 @@ class nsDisplayWrapList : public nsDisplayHitTestInfoItem {
RetainedDisplayList* GetChildren() const override { return mListPtr; }
int32_t ZIndex() const override {
return (mHasZIndexOverride) ? mOverrideZIndex : nsDisplayItem::ZIndex();
return (mHasZIndexOverride) ? mOverrideZIndex
: nsDisplayHitTestInfoItem::ZIndex();
}
void SetOverrideZIndex(int32_t aZIndex) {
@ -5586,7 +5622,7 @@ class nsDisplayOpacity : public nsDisplayWrapList {
NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
void RestoreState() override {
nsDisplayItem::RestoreState();
nsDisplayWrapList::RestoreState();
mOpacity = mState.mOpacity;
}
@ -6490,7 +6526,10 @@ class nsDisplayEffectsBase : public nsDisplayWrapList {
void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*>* aOutFrames) override;
void RestoreState() override { mHandleOpacity = false; }
void RestoreState() override {
nsDisplayWrapList::RestoreState();
mHandleOpacity = false;
}
bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override {
return false;
@ -6759,7 +6798,10 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
NS_DISPLAY_DECL_NAME("nsDisplayTransform", TYPE_TRANSFORM)
void RestoreState() override { mShouldFlatten = false; }
void RestoreState() override {
nsDisplayHitTestInfoItem::RestoreState();
mShouldFlatten = false;
}
void UpdateBounds(nsDisplayListBuilder* aBuilder) override;
@ -6773,7 +6815,7 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
void Destroy(nsDisplayListBuilder* aBuilder) override {
GetChildren()->DeleteAll(aBuilder);
nsDisplayItem::Destroy(aBuilder);
nsDisplayHitTestInfoItem::Destroy(aBuilder);
}
nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) const override;
@ -6850,7 +6892,7 @@ class nsDisplayTransform : public nsDisplayHitTestInfoItem {
if (!mTransformGetter) {
return mFrame;
}
return nsDisplayItem::ReferenceFrameForChildren();
return nsDisplayHitTestInfoItem::ReferenceFrameForChildren();
}
AnimatedGeometryRoot* AnimatedGeometryRootForScrollMetadata() const override {
@ -7169,7 +7211,7 @@ class nsDisplayPerspective : public nsDisplayHitTestInfoItem {
* The values must be non-negative.
* The default value for both edges is zero, which means everything is painted.
*/
class nsDisplayText final : public nsDisplayItem {
class nsDisplayText final : public nsPaintedDisplayItem {
public:
nsDisplayText(nsDisplayListBuilder* aBuilder, nsTextFrame* aFrame,
const mozilla::Maybe<bool>& aIsSelected);
@ -7180,10 +7222,9 @@ class nsDisplayText final : public nsDisplayItem {
NS_DISPLAY_DECL_NAME("Text", TYPE_TEXT)
void RestoreState() final {
nsPaintedDisplayItem::RestoreState();
mIsFrameSelected.reset();
mOpacity = 1.0f;
nsDisplayItem::RestoreState();
}
nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) const final {

View File

@ -56,12 +56,12 @@ NS_QUERYFRAME_TAIL_INHERITING(nsFrame)
//----------------------------------------------------------------------
// Display list item:
class nsDisplaySVGGeometry final : public nsDisplayItem {
class nsDisplaySVGGeometry final : public nsPaintedDisplayItem {
typedef mozilla::image::imgDrawingParams imgDrawingParams;
public:
nsDisplaySVGGeometry(nsDisplayListBuilder* aBuilder, SVGGeometryFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplaySVGGeometry);
MOZ_ASSERT(aFrame, "Must have a frame!");
}
@ -134,7 +134,8 @@ void nsDisplaySVGGeometry::ComputeInvalidationRegion(
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
}
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry, aInvalidRegion);
nsPaintedDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
aInvalidRegion);
}
namespace mozilla {

View File

@ -2807,10 +2807,10 @@ void SVGTextDrawPathCallbacks::StrokeGeometry() {
// ----------------------------------------------------------------------------
// Display list item
class nsDisplaySVGText final : public nsDisplayItem {
class nsDisplaySVGText final : public nsPaintedDisplayItem {
public:
nsDisplaySVGText(nsDisplayListBuilder* aBuilder, SVGTextFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplaySVGText);
MOZ_ASSERT(aFrame, "Must have a frame!");
}

View File

@ -527,10 +527,10 @@ void nsSVGOuterSVGFrame::UnionChildOverflow(nsOverflowAreas& aOverflowAreas) {
/**
* Used to paint/hit-test SVG when SVG display lists are disabled.
*/
class nsDisplayOuterSVG final : public nsDisplayItem {
class nsDisplayOuterSVG final : public nsPaintedDisplayItem {
public:
nsDisplayOuterSVG(nsDisplayListBuilder* aBuilder, nsSVGOuterSVGFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayOuterSVG);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -38,10 +38,10 @@ using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::image;
class nsDisplayTableCellSelection final : public nsDisplayItem {
class nsDisplayTableCellSelection final : public nsPaintedDisplayItem {
public:
nsDisplayTableCellSelection(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayTableCellSelection);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -42,11 +42,11 @@ static inline bool IsTableCell(mozilla::LayoutFrameType frameType) {
frameType == mozilla::LayoutFrameType::BCTableCell;
}
class nsDisplayTableItem : public nsDisplayItem {
class nsDisplayTableItem : public nsPaintedDisplayItem {
public:
nsDisplayTableItem(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
bool aDrawsBackground = true)
: nsDisplayItem(aBuilder, aFrame),
: nsPaintedDisplayItem(aBuilder, aFrame),
mPartHasFixedBackground(false),
mDrawsBackground(aDrawsBackground) {}

View File

@ -93,11 +93,11 @@ nsIFrame* NS_NewGroupBoxFrame(PresShell* aPresShell, ComputedStyle* aStyle) {
NS_IMPL_FRAMEARENA_HELPERS(nsGroupBoxFrame)
class nsDisplayXULGroupBorder final : public nsDisplayItem {
class nsDisplayXULGroupBorder final : public nsPaintedDisplayItem {
public:
nsDisplayXULGroupBorder(nsDisplayListBuilder* aBuilder,
nsGroupBoxFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayXULGroupBorder);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -240,10 +240,10 @@ void nsTextBoxFrame::UpdateAttributes(nsAtom* aAttribute, bool& aResize,
}
}
class nsDisplayXULTextBox final : public nsDisplayItem {
class nsDisplayXULTextBox final : public nsPaintedDisplayItem {
public:
nsDisplayXULTextBox(nsDisplayListBuilder* aBuilder, nsTextBoxFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayXULTextBox);
}
#ifdef NS_BUILD_REFCNT_LOGGING

View File

@ -2463,10 +2463,10 @@ nsresult nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext,
return NS_OK;
}
class nsDisplayTreeBody final : public nsDisplayItem {
class nsDisplayTreeBody final : public nsPaintedDisplayItem {
public:
nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame)
: nsDisplayItem(aBuilder, aFrame) {
: nsPaintedDisplayItem(aBuilder, aFrame) {
MOZ_COUNT_CTOR(nsDisplayTreeBody);
}
#ifdef NS_BUILD_REFCNT_LOGGING
@ -2480,7 +2480,7 @@ class nsDisplayTreeBody final : public nsDisplayItem {
void Destroy(nsDisplayListBuilder* aBuilder) override {
aBuilder->UnregisterThemeGeometry(this);
nsDisplayItem::Destroy(aBuilder);
nsPaintedDisplayItem::Destroy(aBuilder);
}
void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
@ -2495,7 +2495,7 @@ class nsDisplayTreeBody final : public nsDisplayItem {
aInvalidRegion->Or(*aInvalidRegion, GetBounds(aBuilder, &snap));
}
nsDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
nsPaintedDisplayItem::ComputeInvalidationRegion(aBuilder, aGeometry,
aInvalidRegion);
}