Bug 1404181 - Part 10: Track theme geometry contributions per-frame so that can remove contributions from invalidated frames. r=mstange

MozReview-Commit-ID: JjTOGiaeWAn

--HG--
extra : rebase_source : 0e2dc01cb97d4f50373dcfcb3da24ce3c10d4abc
This commit is contained in:
Matt Woodrow ext:(%2C%20Miko%20Mynttinen%20%3Cmikokm%40gmail.com%3E%2C%20Timothy%20Nikkel%20%3Ctnikkel%40gmail.com%3E) 2017-09-28 08:41:47 +13:00
Родитель db37a82e0b
Коммит 740537f943
3 изменённых файлов: 42 добавлений и 7 удалений

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

@ -3101,7 +3101,7 @@ RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsPoint offset = aBuilder->IsInSubdocument() ? aBuilder->ToReferenceFrame(aFrame) nsPoint offset = aBuilder->IsInSubdocument() ? aBuilder->ToReferenceFrame(aFrame)
: aFrame->GetOffsetTo(displayRoot); : aFrame->GetOffsetTo(displayRoot);
nsRect borderBox = nsRect(offset, aFrame->GetSize()); nsRect borderBox = nsRect(offset, aFrame->GetSize());
aBuilder->RegisterThemeGeometry(aType, aBuilder->RegisterThemeGeometry(aType, aFrame,
LayoutDeviceIntRect::FromUnknownRect( LayoutDeviceIntRect::FromUnknownRect(
borderBox.ToNearestPixels( borderBox.ToNearestPixels(
aFrame->PresContext()->AppUnitsPerDevPixel()))); aFrame->PresContext()->AppUnitsPerDevPixel())));

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

@ -817,8 +817,6 @@ public:
*/ */
void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame); void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame);
const nsTArray<ThemeGeometry>& GetThemeGeometries() { return mThemeGeometries; }
/** /**
* Returns true if we need to descend into this frame when building * Returns true if we need to descend into this frame when building
* the display list, even though it doesn't intersect the dirty * the display list, even though it doesn't intersect the dirty
@ -831,6 +829,20 @@ public:
GetIncludeAllOutOfFlows(); GetIncludeAllOutOfFlows();
} }
/**
* Returns the list of registered theme geometries.
*/
nsTArray<ThemeGeometry> GetThemeGeometries() const
{
nsTArray<ThemeGeometry> geometries;
for (auto iter = mThemeGeometries.ConstIter(); !iter.Done(); iter.Next()) {
geometries.AppendElements(*iter.Data());
}
return geometries;
}
/** /**
* Notifies the builder that a particular themed widget exists * Notifies the builder that a particular themed widget exists
* at the given rectangle within the currently built display list. * at the given rectangle within the currently built display list.
@ -844,13 +856,24 @@ public:
* @param aRect the device-pixel rect relative to the widget's displayRoot * @param aRect the device-pixel rect relative to the widget's displayRoot
* for the themed widget * for the themed widget
*/ */
void RegisterThemeGeometry(uint8_t aWidgetType, void RegisterThemeGeometry(uint8_t aWidgetType, nsIFrame* aFrame,
const mozilla::LayoutDeviceIntRect& aRect) { const mozilla::LayoutDeviceIntRect& aRect) {
if (mIsPaintingToWindow) { if (mIsPaintingToWindow) {
mThemeGeometries.AppendElement(ThemeGeometry(aWidgetType, aRect)); nsTArray<ThemeGeometry>* geometries =
mThemeGeometries.LookupOrAdd(aFrame);
geometries->AppendElement(ThemeGeometry(aWidgetType, aRect));
} }
} }
/**
* Removes theme geometries associated with the given frame.
*/
void UnregisterThemeGeometry(nsIFrame* aFrame)
{
mThemeGeometries.Remove(aFrame);
}
/** /**
* Adjusts mWindowDraggingRegion to take into account aFrame. If aFrame's * Adjusts mWindowDraggingRegion to take into account aFrame. If aFrame's
* -moz-window-dragging value is |drag|, its border box is added to the * -moz-window-dragging value is |drag|, its border box is added to the
@ -1625,7 +1648,7 @@ private:
nsCOMPtr<nsISelection> mBoundingSelection; nsCOMPtr<nsISelection> mBoundingSelection;
AutoTArray<PresShellState,8> mPresShellStates; AutoTArray<PresShellState,8> mPresShellStates;
AutoTArray<nsIFrame*,400> mFramesMarkedForDisplay; AutoTArray<nsIFrame*,400> mFramesMarkedForDisplay;
AutoTArray<ThemeGeometry,2> mThemeGeometries; nsClassHashtable<nsPtrHashKey<nsIFrame>, nsTArray<ThemeGeometry>> mThemeGeometries;
nsDisplayTableItem* mCurrentTableItem; nsDisplayTableItem* mCurrentTableItem;
DisplayListClipState mClipState; DisplayListClipState mClipState;
const ActiveScrolledRoot* mCurrentActiveScrolledRoot; const ActiveScrolledRoot* mCurrentActiveScrolledRoot;
@ -3697,6 +3720,12 @@ public:
const nsRect& aBackgroundRect); const nsRect& aBackgroundRect);
virtual ~nsDisplayThemedBackground(); virtual ~nsDisplayThemedBackground();
void Destroy(nsDisplayListBuilder* aBuilder) override
{
aBuilder->UnregisterThemeGeometry(mFrame);
nsDisplayItem::Destroy(aBuilder);
}
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override; HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) override;
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder, virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,

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

@ -2788,6 +2788,12 @@ public:
return new nsDisplayItemGenericImageGeometry(this, aBuilder); return new nsDisplayItemGenericImageGeometry(this, aBuilder);
} }
void Destroy(nsDisplayListBuilder* aBuilder) override
{
aBuilder->UnregisterThemeGeometry(mFrame);
nsDisplayItem::Destroy(aBuilder);
}
void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder, void ComputeInvalidationRegion(nsDisplayListBuilder* aBuilder,
const nsDisplayItemGeometry* aGeometry, const nsDisplayItemGeometry* aGeometry,
nsRegion *aInvalidRegion) const override nsRegion *aInvalidRegion) const override
@ -2878,7 +2884,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight * nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight *
(i - FirstVisibleRow()), mInnerBox.width, (i - FirstVisibleRow()), mInnerBox.width,
mRowHeight); mRowHeight);
aBuilder->RegisterThemeGeometry(type, aBuilder->RegisterThemeGeometry(type, this,
LayoutDeviceIntRect::FromUnknownRect( LayoutDeviceIntRect::FromUnknownRect(
(rowRect + aBuilder->ToReferenceFrame(this)).ToNearestPixels( (rowRect + aBuilder->ToReferenceFrame(this)).ToNearestPixels(
PresContext()->AppUnitsPerDevPixel()))); PresContext()->AppUnitsPerDevPixel())));