Bug 749055 - Add index parameter to nsDisplayMathMLCharForeground. r=roc

This commit is contained in:
Matt Woodrow 2012-04-27 12:24:54 +12:00
Родитель 3d94253d33
Коммит c676a2d954
6 изменённых файлов: 17 добавлений и 9 удалений

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

@ -1899,8 +1899,9 @@ class nsDisplayMathMLCharForeground : public nsDisplayItem {
public: public:
nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder, nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame, nsMathMLChar* aChar, nsIFrame* aFrame, nsMathMLChar* aChar,
bool aIsSelected) PRUint32 aIndex, bool aIsSelected)
: nsDisplayItem(aBuilder, aFrame), mChar(aChar), mIsSelected(aIsSelected) { : nsDisplayItem(aBuilder, aFrame), mChar(aChar),
mIndex(aIndex), mIsSelected(aIsSelected) {
MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground); MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
} }
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
@ -1934,9 +1935,12 @@ public:
bool snap; bool snap;
return GetBounds(aBuilder, &snap); return GetBounds(aBuilder, &snap);
} }
virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
private: private:
nsMathMLChar* mChar; nsMathMLChar* mChar;
PRUint32 mIndex;
bool mIsSelected; bool mIsSelected;
}; };
@ -1982,6 +1986,7 @@ nsresult
nsMathMLChar::Display(nsDisplayListBuilder* aBuilder, nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsDisplayListSet& aLists, const nsDisplayListSet& aLists,
PRUint32 aIndex,
const nsRect* aSelectedRect) const nsRect* aSelectedRect)
{ {
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -2026,6 +2031,7 @@ nsMathMLChar::Display(nsDisplayListBuilder* aBuilder,
} }
return aLists.Content()->AppendNewToTop(new (aBuilder) return aLists.Content()->AppendNewToTop(new (aBuilder)
nsDisplayMathMLCharForeground(aBuilder, aForFrame, this, nsDisplayMathMLCharForeground(aBuilder, aForFrame, this,
aIndex,
aSelectedRect && !aSelectedRect->IsEmpty())); aSelectedRect && !aSelectedRect->IsEmpty()));
} }

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

@ -131,6 +131,7 @@ public:
Display(nsDisplayListBuilder* aBuilder, Display(nsDisplayListBuilder* aBuilder,
nsIFrame* aForFrame, nsIFrame* aForFrame,
const nsDisplayListSet& aLists, const nsDisplayListSet& aLists,
PRUint32 aIndex,
const nsRect* aSelectedRect = nsnull); const nsRect* aSelectedRect = nsnull);
void PaintForeground(nsPresContext* aPresContext, void PaintForeground(nsPresContext* aPresContext,

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

@ -236,7 +236,7 @@ nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
mencloseRect.x = mencloseRect.y = 0; mencloseRect.x = mencloseRect.y = 0;
if (IsToDraw(NOTATION_RADICAL)) { if (IsToDraw(NOTATION_RADICAL)) {
rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists); rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists, 0);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsRect rect; nsRect rect;
@ -249,7 +249,7 @@ nsMathMLmencloseFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
} }
if (IsToDraw(NOTATION_LONGDIV)) { if (IsToDraw(NOTATION_LONGDIV)) {
rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists); rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists, 1);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
nsRect rect; nsRect rect;

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

@ -220,18 +220,19 @@ nsMathMLmfencedFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
//////////// ////////////
// display fences and separators // display fences and separators
PRUint32 count = 0;
if (mOpenChar) { if (mOpenChar) {
rv = mOpenChar->Display(aBuilder, this, aLists); rv = mOpenChar->Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
if (mCloseChar) { if (mCloseChar) {
rv = mCloseChar->Display(aBuilder, this, aLists); rv = mCloseChar->Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
for (PRInt32 i = 0; i < mSeparatorsCount; i++) { for (PRInt32 i = 0; i < mSeparatorsCount; i++) {
rv = mSeparatorsChar[i].Display(aBuilder, this, aLists); rv = mSeparatorsChar[i].Display(aBuilder, this, aLists, count++);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
} }
return NS_OK; return NS_OK;

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

@ -140,7 +140,7 @@ nsMathMLmoFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
selectedRect = firstChild->GetRect(); selectedRect = firstChild->GetRect();
isSelected = true; isSelected = true;
} }
rv = mMathMLChar.Display(aBuilder, this, aLists, isSelected ? &selectedRect : nsnull); rv = mMathMLChar.Display(aBuilder, this, aLists, 0, isSelected ? &selectedRect : nsnull);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
#if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX) #if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)

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

@ -134,7 +134,7 @@ nsMathMLmrootFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
///////////// /////////////
// paint the sqrt symbol // paint the sqrt symbol
if (!NS_MATHML_HAS_ERROR(mPresentationData.flags)) { if (!NS_MATHML_HAS_ERROR(mPresentationData.flags)) {
rv = mSqrChar.Display(aBuilder, this, aLists); rv = mSqrChar.Display(aBuilder, this, aLists, 0);
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
rv = DisplayBar(aBuilder, this, mBarRect, aLists); rv = DisplayBar(aBuilder, this, mBarRect, aLists);