Bug 1410906 - Store ThemeGeometry for display item instead of frame r=mattwoodrow

MozReview-Commit-ID: 6x7GRRTEVja

--HG--
extra : rebase_source : 3dc139938317e00b4f96498f1c1f84826fc64755
This commit is contained in:
Miko Mynttinen 2017-10-23 18:07:36 +02:00
Родитель 952fef1951
Коммит 27b7485c40
3 изменённых файлов: 23 добавлений и 21 удалений

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

@ -3220,15 +3220,15 @@ nsDisplaySolidColorRegion::CreateWebRenderCommands(mozilla::wr::DisplayListBuild
}
static void
RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsITheme::ThemeGeometryType aType)
RegisterThemeGeometry(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem,
nsIFrame* aFrame, nsITheme::ThemeGeometryType aType)
{
if (aBuilder->IsInChromeDocumentOrPopup() && !aBuilder->IsInTransform()) {
nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(aFrame);
nsPoint offset = aBuilder->IsInSubdocument() ? aBuilder->ToReferenceFrame(aFrame)
: aFrame->GetOffsetTo(displayRoot);
nsRect borderBox = nsRect(offset, aFrame->GetSize());
aBuilder->RegisterThemeGeometry(aType, aFrame,
aBuilder->RegisterThemeGeometry(aType, aItem,
LayoutDeviceIntRect::FromUnknownRect(
borderBox.ToNearestPixels(
aFrame->PresContext()->AppUnitsPerDevPixel())));
@ -4184,7 +4184,7 @@ nsDisplayThemedBackground::nsDisplayThemedBackground(nsDisplayListBuilder* aBuil
nsITheme::ThemeGeometryType type =
theme->ThemeGeometryTypeForWidget(mFrame, disp->mAppearance);
if (type != nsITheme::eThemeGeometryTypeUnknown) {
RegisterThemeGeometry(aBuilder, aFrame, type);
RegisterThemeGeometry(aBuilder, this, aFrame, type);
}
if (disp->mAppearance == NS_THEME_WIN_BORDERLESS_GLASS ||

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

@ -874,25 +874,27 @@ public:
* effects applied to them (e.g. CSS opacity or filters).
*
* @param aWidgetType the -moz-appearance value for the themed widget
* @param aItem the item associated with the theme geometry
* @param aRect the device-pixel rect relative to the widget's displayRoot
* for the themed widget
*/
void RegisterThemeGeometry(uint8_t aWidgetType, nsIFrame* aFrame,
const mozilla::LayoutDeviceIntRect& aRect) {
if (mIsPaintingToWindow) {
nsTArray<ThemeGeometry>* geometries =
mThemeGeometries.LookupOrAdd(aFrame);
geometries->AppendElement(ThemeGeometry(aWidgetType, aRect));
void RegisterThemeGeometry(uint8_t aWidgetType, nsDisplayItem* aItem,
const mozilla::LayoutDeviceIntRect& aRect)
{
if (!mIsPaintingToWindow) {
return;
}
nsTArray<ThemeGeometry>* geometries = mThemeGeometries.LookupOrAdd(aItem);
geometries->AppendElement(ThemeGeometry(aWidgetType, aRect));
}
/**
* Removes theme geometries associated with the given frame.
* Removes theme geometries associated with the given display item |aItem|.
*/
void UnregisterThemeGeometry(nsIFrame* aFrame)
void UnregisterThemeGeometry(nsDisplayItem* aItem)
{
mThemeGeometries.Remove(aFrame);
mThemeGeometries.Remove(aItem);
}
/**
@ -1703,7 +1705,7 @@ private:
nsCOMPtr<nsISelection> mBoundingSelection;
AutoTArray<PresShellState,8> mPresShellStates;
AutoTArray<nsIFrame*,400> mFramesMarkedForDisplay;
nsClassHashtable<nsPtrHashKey<nsIFrame>, nsTArray<ThemeGeometry>> mThemeGeometries;
nsClassHashtable<nsPtrHashKey<nsDisplayItem>, nsTArray<ThemeGeometry>> mThemeGeometries;
nsDisplayTableItem* mCurrentTableItem;
DisplayListClipState mClipState;
const ActiveScrolledRoot* mCurrentActiveScrolledRoot;
@ -3858,7 +3860,7 @@ public:
void Destroy(nsDisplayListBuilder* aBuilder) override
{
aBuilder->UnregisterThemeGeometry(mFrame);
aBuilder->UnregisterThemeGeometry(this);
nsDisplayItem::Destroy(aBuilder);
}

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

@ -2790,7 +2790,7 @@ public:
void Destroy(nsDisplayListBuilder* aBuilder) override
{
aBuilder->UnregisterThemeGeometry(mFrame);
aBuilder->UnregisterThemeGeometry(this);
nsDisplayItem::Destroy(aBuilder);
}
@ -2849,6 +2849,9 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
if (!mView || !GetContent ()->GetComposedDoc()->GetWindow())
return;
nsDisplayItem* item = new (aBuilder) nsDisplayTreeBody(aBuilder, this);
aLists.Content()->AppendToTop(item);
#ifdef XP_MACOSX
nsIContent* baseElement = GetBaseElement();
nsIFrame* treeFrame =
@ -2884,7 +2887,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
nsRect rowRect(mInnerBox.x, mInnerBox.y + mRowHeight *
(i - FirstVisibleRow()), mInnerBox.width,
mRowHeight);
aBuilder->RegisterThemeGeometry(type, this,
aBuilder->RegisterThemeGeometry(type, item,
LayoutDeviceIntRect::FromUnknownRect(
(rowRect + aBuilder->ToReferenceFrame(this)).ToNearestPixels(
PresContext()->AppUnitsPerDevPixel())));
@ -2895,9 +2898,6 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
}
#endif
aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayTreeBody(aBuilder, this));
}
DrawResult