Bug 749055 - Add index parameter to nsDisplayMathMLCharForeground. r=roc
authorMatt Woodrow <mwoodrow@mozilla.com>
Fri, 27 Apr 2012 12:24:54 +1200
changeset 92564 e8bf76219f364346ef1b0e0b93636e819e1c9935
parent 92563 35dfe0d44d83ba99c977e43ebc4d10f8fae45513
child 92565 ef7803bad0b1f468850b50f3c4c009c848d3db6b
push id8753
push usermwoodrow@mozilla.com
push dateFri, 27 Apr 2012 00:25:03 +0000
treeherdermozilla-inbound@e8bf76219f36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs749055
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 749055 - Add index parameter to nsDisplayMathMLCharForeground. r=roc
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLChar.h
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmrootFrame.cpp
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -1894,18 +1894,19 @@ void nsDisplayMathMLCharBackground::Pain
                                         mStyleContext, *border,
                                         aBuilder->GetBackgroundPaintFlags());
 }
 
 class nsDisplayMathMLCharForeground : public nsDisplayItem {
 public:
   nsDisplayMathMLCharForeground(nsDisplayListBuilder* aBuilder,
                                 nsIFrame* aFrame, nsMathMLChar* aChar,
-				                        bool aIsSelected)
-    : nsDisplayItem(aBuilder, aFrame), mChar(aChar), mIsSelected(aIsSelected) {
+				                PRUint32 aIndex, bool aIsSelected)
+    : nsDisplayItem(aBuilder, aFrame), mChar(aChar), 
+      mIndex(aIndex), mIsSelected(aIsSelected) {
     MOZ_COUNT_CTOR(nsDisplayMathMLCharForeground);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLCharForeground() {
     MOZ_COUNT_DTOR(nsDisplayMathMLCharForeground);
   }
 #endif
 
@@ -1929,19 +1930,22 @@ public:
 
   NS_DISPLAY_DECL_NAME("MathMLCharForeground", TYPE_MATHML_CHAR_FOREGROUND)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
   {
     bool snap;
     return GetBounds(aBuilder, &snap);
   }
+  
+  virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
 
 private:
   nsMathMLChar* mChar;
+  PRUint32      mIndex;
   bool          mIsSelected;
 };
 
 #ifdef NS_DEBUG
 class nsDisplayMathMLCharDebug : public nsDisplayItem {
 public:
   nsDisplayMathMLCharDebug(nsDisplayListBuilder* aBuilder,
                            nsIFrame* aFrame, const nsRect& aRect)
@@ -1977,16 +1981,17 @@ void nsDisplayMathMLCharDebug::Paint(nsD
 }
 #endif
 
 
 nsresult
 nsMathMLChar::Display(nsDisplayListBuilder*   aBuilder,
                       nsIFrame*               aForFrame,
                       const nsDisplayListSet& aLists,
+                      PRUint32                aIndex,
                       const nsRect*           aSelectedRect)
 {
   nsresult rv = NS_OK;
   nsStyleContext* parentContext = mStyleContext->GetParent();
   nsStyleContext* styleContext = mStyleContext;
 
   if (mDrawNormal) {
     // normal drawing if there is nothing special about this char
@@ -2021,16 +2026,17 @@ nsMathMLChar::Display(nsDisplayListBuild
     // for visual debug
     rv = aLists.BorderBackground()->AppendToTop(new (aBuilder)
         nsDisplayMathMLCharDebug(aBuilder, aForFrame, mRect));
     NS_ENSURE_SUCCESS(rv, rv);
 #endif
   }
   return aLists.Content()->AppendNewToTop(new (aBuilder)
         nsDisplayMathMLCharForeground(aBuilder, aForFrame, this,
+                                      aIndex,
                                       aSelectedRect && !aSelectedRect->IsEmpty()));
 }
 
 void
 nsMathMLChar::ApplyTransforms(nsRenderingContext& aRenderingContext, nsRect &r)
 {
   // apply the transforms
   if (mMirrored) {
--- a/layout/mathml/nsMathMLChar.h
+++ b/layout/mathml/nsMathMLChar.h
@@ -126,16 +126,17 @@ public:
       delete mSibling;
     }
   }
 
   nsresult
   Display(nsDisplayListBuilder*   aBuilder,
           nsIFrame*               aForFrame,
           const nsDisplayListSet& aLists,
+          PRUint32                aIndex,
           const nsRect*           aSelectedRect = nsnull);
           
   void PaintForeground(nsPresContext* aPresContext,
                        nsRenderingContext& aRenderingContext,
                        nsPoint aPt,
                        bool aIsSelected);
 
   // This is the method called to ask the char to stretch itself.
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -231,30 +231,30 @@ nsMathMLmencloseFrame::BuildDisplayList(
 
   if (NS_MATHML_HAS_ERROR(mPresentationData.flags))
     return rv;
 
   nsRect mencloseRect = nsIFrame::GetRect();
   mencloseRect.x = mencloseRect.y = 0;
 
   if (IsToDraw(NOTATION_RADICAL)) {
-    rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists);
+    rv = mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists, 0);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsRect rect;
     mMathMLChar[mRadicalCharIndex].GetRect(rect);
     rect.MoveBy(NS_MATHML_IS_RTL(mPresentationData.flags) ?
                 -mContentWidth : rect.width, 0);
     rect.SizeTo(mContentWidth, mRuleThickness);
     rv = DisplayBar(aBuilder, this, rect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (IsToDraw(NOTATION_LONGDIV)) {
-    rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists);
+    rv = mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists, 1);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsRect rect;
     mMathMLChar[mLongDivCharIndex].GetRect(rect);
     rect.SizeTo(rect.width + mContentWidth, mRuleThickness);
     rv = DisplayBar(aBuilder, this, rect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
   }
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -215,28 +215,29 @@ nsMathMLmfencedFrame::BuildDisplayList(n
 {
   /////////////
   // display the content
   nsresult rv = nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
   
   ////////////
   // display fences and separators
+  PRUint32 count = 0;
   if (mOpenChar) {
-    rv = mOpenChar->Display(aBuilder, this, aLists);
+    rv = mOpenChar->Display(aBuilder, this, aLists, count++);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   
   if (mCloseChar) {
-    rv = mCloseChar->Display(aBuilder, this, aLists);
+    rv = mCloseChar->Display(aBuilder, this, aLists, count++);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   
   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);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMathMLmfencedFrame::Reflow(nsPresContext*          aPresContext,
                              nsHTMLReflowMetrics&     aDesiredSize,
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -135,17 +135,17 @@ nsMathMLmoFrame::BuildDisplayList(nsDisp
     // make our char selected if our inner child text frame is selected
     bool isSelected = false;
     nsRect selectedRect;
     nsIFrame* firstChild = mFrames.FirstChild();
     if (IsFrameInSelection(firstChild)) {
       selectedRect = firstChild->GetRect();
       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);
   
 #if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     rv = DisplayBoundingMetrics(aBuilder, this, mReference, mBoundingMetrics, aLists);
 #endif
   }
   return rv;
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -129,17 +129,17 @@ nsMathMLmrootFrame::BuildDisplayList(nsD
   /////////////
   // paint the content we are square-rooting
   nsresult rv = nsMathMLContainerFrame::BuildDisplayList(aBuilder, aDirtyRect, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
   
   /////////////
   // paint the sqrt symbol
   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);
 
     rv = DisplayBar(aBuilder, this, mBarRect, aLists);
     NS_ENSURE_SUCCESS(rv, rv);
 
 #if defined(NS_DEBUG) && defined(SHOW_BOUNDING_BOX)
     // for visual debug
     nsRect rect;