Bug 781494 - Remove dead code from nsMathMLChar. r=karlt
authorFrédéric Wang <fred.wang@free.fr>
Fri, 10 Aug 2012 11:29:59 -0400
changeset 102088 8a43488f1543c91e1f2d886087436b5e0e58d6b8
parent 102087 115bed385a7759eeaf04399df1b2dbe893f13f96
child 102089 54568120778aabb3757c2425a4e1134165df092b
push id13307
push userryanvm@gmail.com
push dateFri, 10 Aug 2012 15:30:07 +0000
treeherdermozilla-inbound@343e745e4016 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs781494
milestone17.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 781494 - Remove dead code from nsMathMLChar. r=karlt
layout/mathml/nsMathMLChar.cpp
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -28,17 +28,16 @@
 
 #include "nsDisplayList.h"
 
 #include "nsMathMLOperators.h"
 #include "nsMathMLChar.h"
 
 using namespace mozilla;
 
-//#define SHOW_BORDERS 1
 //#define NOISY_SEARCH 1
 
 // -----------------------------------------------------------------------------------
 static const PRUnichar   kSpaceCh   = PRUnichar(' ');
 static const nsGlyphCode kNullGlyph = {{0, 0}, 0};
 typedef enum {eExtension_base, eExtension_variants, eExtension_parts}
   nsMathfontPrefExtension;
 
@@ -2052,31 +2051,26 @@ nsMathMLChar::PaintForeground(nsPresCont
   aRenderingContext.PushState();
   nsRect r = mRect + aPt;
   ApplyTransforms(aRenderingContext, r);
 
   if (mDrawNormal) {
     // normal drawing if there is nothing special about this char ...
     // Grab some metrics to adjust the placements ...
     PRUint32 len = PRUint32(mData.Length());
-//printf("Painting %04X like a normal char\n", mData[0]);
-//aRenderingContext.SetColor(NS_RGB(255,0,0));
     aRenderingContext.DrawString(mData.get(), len, 0, mUnscaledAscent);
   }
   else {
     // Grab some metrics to adjust the placements ...
     // if there is a glyph of appropriate size, paint that glyph
     if (mGlyph.Exists()) {
-//printf("Painting %04X with a glyph of appropriate size\n", mData[0]);
-//aRenderingContext.SetColor(NS_RGB(0,0,255));
       aRenderingContext.DrawString(mGlyph.code, mGlyph.Length(),
                                    0, mUnscaledAscent);
     }
     else { // paint by parts
-//aRenderingContext.SetColor(NS_RGB(0,255,0));
       if (NS_STRETCH_DIRECTION_VERTICAL == mDirection)
         PaintVertically(aPresContext, aRenderingContext, theFont, styleContext,
                         mGlyphTable, r);
       else if (NS_STRETCH_DIRECTION_HORIZONTAL == mDirection)
         PaintHorizontally(aPresContext, aRenderingContext, theFont, styleContext,
                           mGlyphTable, r);
     }
   }
@@ -2207,21 +2201,16 @@ nsMathMLChar::PaintVertically(nsPresCont
   unionRect.Inflate(oneDevPixel, oneDevPixel);
 
   /////////////////////////////////////
   // draw top, middle, bottom
   for (i = 0; i <= bottom; ++i) {
     ch = chdata[i];
     // glue can be null, and other parts could have been set to glue
     if (ch.Exists()) {
-#ifdef SHOW_BORDERS
-      // bounding box of the part
-      aRenderingContext.SetColor(NS_RGB(0,0,0));
-      aRenderingContext.DrawRect(nsRect(dx,start[i],aRect.width+30*(i+1),end[i]-start[i]));
-#endif
       nscoord dy = offset[i];
       // Draw a glyph in a clipped area so that we don't have hairy chars
       // pending outside
       nsRect clipRect = unionRect;
       // Clip at the join to get a solid edge (without overlap or gap), when
       // this won't change the glyph too much.  If the glyph is too small to
       // clip then we'll overlap rather than have a gap.
       nscoord height = bmdata[i].ascent + bmdata[i].descent;
@@ -2301,39 +2290,24 @@ nsMathMLChar::PaintVertically(nsPresCont
     SetFontFamily(aStyleContext, aRenderingContext,
                   aFont, aGlyphTable, chGlue, mFamily);
     nsRect clipRect = unionRect;
 
     for (i = 0; i < bottom; ++i) {
       // Make sure not to draw outside the character
       nscoord dy = NS_MAX(end[i], aRect.y);
       nscoord fillEnd = NS_MIN(start[i+1], aRect.YMost());
-#ifdef SHOW_BORDERS
-      // exact area to fill
-      aRenderingContext.SetColor(NS_RGB(255,0,0));
-      clipRect.y = dy;
-      clipRect.height = fillEnd - dy;
-      aRenderingContext.DrawRect(clipRect);
-      {
-#endif
       while (dy < fillEnd) {
         clipRect.y = dy;
         clipRect.height = NS_MIN(bm.ascent + bm.descent, fillEnd - dy);
         AutoPushClipRect clip(aRenderingContext, clipRect);
         dy += bm.ascent;
         aRenderingContext.DrawString(chGlue.code, chGlue.Length(), dx, dy);
         dy += bm.descent;
       }
-#ifdef SHOW_BORDERS
-      }
-      // last glyph that may cross past its boundary and collide with the next
-      nscoord height = bm.ascent + bm.descent;
-      aRenderingContext.SetColor(NS_RGB(0,255,0));
-      aRenderingContext.DrawRect(nsRect(dx, dy-bm.ascent, aRect.width, height));
-#endif
     }
   }
 #ifdef DEBUG
   else {
     for (i = 0; i < bottom; ++i) {
       NS_ASSERTION(end[i] >= start[i+1],
                    "gap between parts with missing glue glyph");
     }
@@ -2432,21 +2406,16 @@ nsMathMLChar::PaintHorizontally(nsPresCo
   unionRect.Inflate(oneDevPixel, oneDevPixel);
 
   ///////////////////////////
   // draw left, middle, right
   for (i = 0; i <= right; ++i) {
     ch = chdata[i];
     // glue can be null, and other parts could have been set to glue
     if (ch.Exists()) {
-#ifdef SHOW_BORDERS
-      aRenderingContext.SetColor(NS_RGB(255,0,0));
-      aRenderingContext.DrawRect(nsRect(start[i], dy - bmdata[i].ascent,
-                                 end[i] - start[i], bmdata[i].ascent + bmdata[i].descent));
-#endif
       nscoord dx = offset[i];
       nsRect clipRect = unionRect;
       // Clip at the join to get a solid edge (without overlap or gap), when
       // this won't change the glyph too much.  If the glyph is too small to
       // clip then we'll overlap rather than have a gap.
       nscoord width = bmdata[i].rightBearing - bmdata[i].leftBearing;
       if (ch == chGlue ||
           width * (1.0 - NS_MATHML_DELIMITER_FACTOR) > oneDevPixel) {
@@ -2523,39 +2492,24 @@ nsMathMLChar::PaintHorizontally(nsPresCo
     SetFontFamily(aStyleContext, aRenderingContext,
                   aFont, aGlyphTable, chGlue, mFamily);
     nsRect clipRect = unionRect;
 
     for (i = 0; i < right; ++i) {
       // Make sure not to draw outside the character
       nscoord dx = NS_MAX(end[i], aRect.x);
       nscoord fillEnd = NS_MIN(start[i+1], aRect.XMost());
-#ifdef SHOW_BORDERS
-      // rectangles in-between that are to be filled
-      aRenderingContext.SetColor(NS_RGB(255,0,0));
-      clipRect.x = dx;
-      clipRect.width = fillEnd - dx;
-      aRenderingContext.DrawRect(clipRect);
-      {
-#endif
       while (dx < fillEnd) {
         clipRect.x = dx;
         clipRect.width = NS_MIN(bm.rightBearing - bm.leftBearing, fillEnd - dx);
         AutoPushClipRect clip(aRenderingContext, clipRect);
         dx -= bm.leftBearing;
         aRenderingContext.DrawString(chGlue.code, chGlue.Length(), dx, dy);
         dx += bm.rightBearing;
       }
-#ifdef SHOW_BORDERS
-      }
-      // last glyph that may cross past its boundary and collide with the next
-      nscoord width = bm.rightBearing - bm.leftBearing;
-      aRenderingContext.SetColor(NS_RGB(0,255,0));
-      aRenderingContext.DrawRect(nsRect(dx + bm.leftBearing, aRect.y, width, aRect.height));
-#endif
     }
   }
 #ifdef DEBUG
   else { // no glue
     for (i = 0; i < right; ++i) {
       NS_ASSERTION(end[i] >= start[i+1],
                    "gap between parts with missing glue glyph");
     }