Bug 1554499 - Part 8: Remove index from nsDisplayMathMLCharForeground, nsDisplayMathMLBar, nsDisplayNotation r=mattwoodrow

Differential Revision: https://phabricator.services.mozilla.com/D74087
This commit is contained in:
Miko Mynttinen 2020-05-11 16:57:08 +00:00
Родитель 1965529d52
Коммит b376ee6512
3 изменённых файлов: 17 добавлений и 21 удалений

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

@ -1715,10 +1715,9 @@ class nsDisplayMathMLCharForeground final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsMathMLChar* aChar,
uint16_t aIndex, bool aIsSelected)
const bool aIsSelected)
: nsPaintedDisplayItem(aBuilder, aFrame),
mChar(aChar),
mIndex(aIndex),
mIsSelected(aIsSelected) {
MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
}
@ -1752,11 +1751,8 @@ class nsDisplayMathMLCharForeground final : public nsPaintedDisplayItem {
return GetBounds(aBuilder, &snap);
}
virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
private:
nsMathMLChar* mChar;
uint16_t mIndex;
bool mIsSelected;
};
@ -1813,13 +1809,17 @@ void nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
computedStyle = aForFrame->Style();
}
if (!computedStyle->StyleVisibility()->IsVisible()) return;
if (!computedStyle->StyleVisibility()->IsVisible()) {
return;
}
const bool isSelected = aSelectedRect && !aSelectedRect->IsEmpty();
// if the leaf computed style that we use for stretchy chars has a background
// color we use it -- this feature is mostly used for testing and debugging
// purposes. Normally, users will set the background on the container frame.
// paint the selection background -- beware MathML frames overlap a lot
if (aSelectedRect && !aSelectedRect->IsEmpty()) {
if (isSelected) {
aLists.BorderBackground()->AppendNewToTop<nsDisplayMathMLSelectionRect>(
aBuilder, aForFrame, *aSelectedRect);
} else if (mRect.width && mRect.height) {
@ -1840,9 +1840,8 @@ void nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsIFrame* aForFrame,
aBuilder, aForFrame, mRect);
#endif
}
aLists.Content()->AppendNewToTop<nsDisplayMathMLCharForeground>(
aBuilder, aForFrame, this, aIndex,
aSelectedRect && !aSelectedRect->IsEmpty());
aLists.Content()->AppendNewToTopWithIndex<nsDisplayMathMLCharForeground>(
aBuilder, aForFrame, aIndex, this, isSelected);
}
void nsMathMLChar::ApplyTransforms(gfxContext* aThebesContext,

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

@ -299,19 +299,17 @@ void nsMathMLFrame::DisplayBoundingMetrics(nsDisplayListBuilder* aBuilder,
class nsDisplayMathMLBar final : public nsPaintedDisplayItem {
public:
nsDisplayMathMLBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
const nsRect& aRect, uint16_t aIndex)
: nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect), mIndex(aIndex) {
const nsRect& aRect)
: nsPaintedDisplayItem(aBuilder, aFrame), mRect(aRect) {
MOZ_COUNT_CTOR(nsDisplayMathMLBar);
}
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayMathMLBar)
virtual uint16_t CalculatePerFrameKey() const override { return mIndex; }
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
NS_DISPLAY_DECL_NAME("MathMLBar", TYPE_MATHML_BAR)
private:
nsRect mRect;
uint16_t mIndex;
};
void nsDisplayMathMLBar::Paint(nsDisplayListBuilder* aBuilder,
@ -332,8 +330,8 @@ void nsMathMLFrame::DisplayBar(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
uint32_t aIndex) {
if (!aFrame->StyleVisibility()->IsVisible() || aRect.IsEmpty()) return;
aLists.Content()->AppendNewToTop<nsDisplayMathMLBar>(aBuilder, aFrame, aRect,
aIndex);
aLists.Content()->AppendNewToTopWithIndex<nsDisplayMathMLBar>(
aBuilder, aFrame, aIndex, aRect);
}
void nsMathMLFrame::GetRadicalParameters(nsFontMetrics* aFontMetrics,

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

@ -726,8 +726,6 @@ class nsDisplayNotation final : public nsPaintedDisplayItem {
}
MOZ_COUNTED_DTOR_OVERRIDE(nsDisplayNotation)
virtual uint16_t CalculatePerFrameKey() const override { return mType; }
virtual void Paint(nsDisplayListBuilder* aBuilder, gfxContext* aCtx) override;
NS_DISPLAY_DECL_NAME("MathMLMencloseNotation", TYPE_MATHML_MENCLOSE_NOTATION)
@ -838,6 +836,7 @@ void nsMathMLmencloseFrame::DisplayNotation(nsDisplayListBuilder* aBuilder,
aThickness <= 0)
return;
aLists.Content()->AppendNewToTop<nsDisplayNotation>(aBuilder, aFrame, aRect,
aThickness, aType);
const uint16_t index = aType;
aLists.Content()->AppendNewToTopWithIndex<nsDisplayNotation>(
aBuilder, aFrame, index, aRect, aThickness, aType);
}