Bug 764996 - Determine directionality. r=karlt
authorCosmin Clapon <cosmin.clapon@gmail.com>
Wed, 29 May 2013 19:26:40 -0400
changeset 133345 bff77936627216fc9281bc888b1570e9496af639
parent 133344 40be35413245fabae262becb97a556482decf772
child 133346 b9d77a2d12af72041bcb510b2655d87b3ddceedb
push id24751
push userryanvm@gmail.com
push dateThu, 30 May 2013 15:43:11 +0000
treeherdermozilla-central@75407626ba46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs764996
milestone24.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 764996 - Determine directionality. r=karlt
layout/mathml/nsIMathMLFrame.h
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLContainerFrame.h
layout/mathml/nsMathMLFrame.cpp
layout/mathml/nsMathMLFrame.h
layout/mathml/nsMathMLTokenFrame.cpp
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmfracFrame.cpp
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmrootFrame.cpp
layout/mathml/nsMathMLmrowFrame.cpp
layout/mathml/nsMathMLmstyleFrame.cpp
--- a/layout/mathml/nsIMathMLFrame.h
+++ b/layout/mathml/nsIMathMLFrame.h
@@ -291,19 +291,16 @@ struct nsPresentationData {
 // This bit is set if the frame has the explicit attribute
 // displaystyle="true" or "false". It is only relevant to <mstyle> and <mtable>
 // because they are the only tags where the attribute is allowed by the spec.
 #define NS_MATHML_EXPLICIT_DISPLAYSTYLE               0x00000020U
 
 // This bit is set if the frame is "space-like", as defined by the spec.
 #define NS_MATHML_SPACE_LIKE                          0x00000040U
 
-// This bit is set if the directionality of the frame is right-to-left
-#define NS_MATHML_RTL                                 0x00000080U
-
 // This bit is set when the frame cannot be formatted due to an
 // error (e.g., invalid markup such as a <msup> without an overscript).
 // When set, a visual feedback will be provided to the user.
 #define NS_MATHML_ERROR                               0x80000000U
 
 // a bit used for debug
 #define NS_MATHML_STRETCH_DONE                        0x20000000U
 
@@ -328,19 +325,16 @@ struct nsPresentationData {
   (NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY == ((_flags) & NS_MATHML_STRETCH_ALL_CHILDREN_HORIZONTALLY))
 
 #define NS_MATHML_HAS_EXPLICIT_DISPLAYSTYLE(_flags) \
   (NS_MATHML_EXPLICIT_DISPLAYSTYLE == ((_flags) & NS_MATHML_EXPLICIT_DISPLAYSTYLE))
 
 #define NS_MATHML_IS_SPACE_LIKE(_flags) \
   (NS_MATHML_SPACE_LIKE == ((_flags) & NS_MATHML_SPACE_LIKE))
 
-#define NS_MATHML_IS_RTL(_flags) \
-  (NS_MATHML_RTL == ((_flags) & NS_MATHML_RTL))
-
 #define NS_MATHML_HAS_ERROR(_flags) \
   (NS_MATHML_ERROR == ((_flags) & NS_MATHML_ERROR))
 
 #define NS_MATHML_STRETCH_WAS_DONE(_flags) \
   (NS_MATHML_STRETCH_DONE == ((_flags) & NS_MATHML_STRETCH_DONE))
 
 #define NS_MATHML_PAINT_BOUNDING_METRICS(_flags) \
   (NS_MATHML_SHOW_BOUNDING_METRICS == ((_flags) & NS_MATHML_SHOW_BOUNDING_METRICS))
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -411,17 +411,17 @@ nsMathMLContainerFrame::Stretch(nsRender
           nsEmbellishData coreData;
           GetEmbellishDataFrom(mEmbellishData.coreFrame, coreData);
 
           mBoundingMetrics.width +=
             coreData.leadingSpace + coreData.trailingSpace;
           aDesiredStretchSize.width = mBoundingMetrics.width;
           aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
 
-          nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
+          nscoord dx = (StyleVisibility()->mDirection ?
                         coreData.trailingSpace : coreData.leadingSpace);
           if (dx != 0) {
             mBoundingMetrics.leftBearing += dx;
             mBoundingMetrics.rightBearing += dx;
             aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
             aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
 
             nsIFrame* childFrame = mFrames.FirstChild();
@@ -1168,17 +1168,17 @@ static nscoord GetThinSpace(const nsStyl
 
 class nsMathMLContainerFrame::RowChildFrameIterator {
 public:
   explicit RowChildFrameIterator(nsMathMLContainerFrame* aParentFrame) :
     mParentFrame(aParentFrame),
     mX(0),
     mCarrySpace(0),
     mFromFrameType(eMathMLFrameType_UNKNOWN),
-    mRTL(NS_MATHML_IS_RTL(aParentFrame->mPresentationData.flags))
+    mRTL(aParentFrame->StyleVisibility()->mDirection)
   {
     if (!mRTL) {
       mChildFrame = aParentFrame->mFrames.FirstChild();
     } else {
       mChildFrame = aParentFrame->mFrames.LastChild();
     }
 
     if (!mChildFrame)
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -157,17 +157,17 @@ public:
   AttributeChanged(int32_t         aNameSpaceID,
                    nsIAtom*        aAttribute,
                    int32_t         aModType) MOZ_OVERRIDE;
 
   // helper function to apply mirroring to a horizontal coordinate, if needed.
   nscoord
   MirrorIfRTL(nscoord aParentWidth, nscoord aChildWidth, nscoord aChildLeading)
   {
-    return (NS_MATHML_IS_RTL(mPresentationData.flags) ?
+    return (StyleVisibility()->mDirection ?
             aParentWidth - aChildWidth - aChildLeading : aChildLeading);
   }
 
   // --------------------------------------------------------------------------
   // Additional methods 
 
 protected:
   /* Place :
--- a/layout/mathml/nsMathMLFrame.cpp
+++ b/layout/mathml/nsMathMLFrame.cpp
@@ -52,47 +52,16 @@ nsMathMLFrame::FindAttrDisplaystyle(nsIC
   case 1:
     aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
     aPresentationData.flags |= NS_MATHML_EXPLICIT_DISPLAYSTYLE;
     break;
   }
   // no reset if the attr isn't found. so be sure to call it on inherited flags
 }
 
-// snippet of code used by the tags where the dir attribute is allowed.
-/* static */ void
-nsMathMLFrame::FindAttrDirectionality(nsIContent*         aContent,
-                                      nsPresentationData& aPresentationData)
-{
-  NS_ASSERTION(aContent->Tag() == nsGkAtoms::math ||
-               aContent->Tag() == nsGkAtoms::mrow_ ||
-               aContent->Tag() == nsGkAtoms::mstyle_ ||
-               aContent->Tag() == nsGkAtoms::mi_ ||
-               aContent->Tag() == nsGkAtoms::mn_ ||
-               aContent->Tag() == nsGkAtoms::mo_ ||
-               aContent->Tag() == nsGkAtoms::mtext_ ||
-               aContent->Tag() == nsGkAtoms::ms_, "bad caller");
-
-  static nsIContent::AttrValuesArray strings[] =
-    {&nsGkAtoms::ltr, &nsGkAtoms::rtl, nullptr};
-
-  // see if the explicit dir attribute is there
-  switch (aContent->FindAttrValueIn(kNameSpaceID_None,
-                                    nsGkAtoms::dir, strings, eCaseMatters))
-    {
-    case 0:
-      aPresentationData.flags &= ~NS_MATHML_RTL;
-      break;
-    case 1:
-      aPresentationData.flags |= NS_MATHML_RTL;
-      break;
-    }
-  // no reset if the attr isn't found. so be sure to call it on inherited flags
-}
-
 NS_IMETHODIMP
 nsMathMLFrame::InheritAutomaticData(nsIFrame* aParent) 
 {
   mEmbellishData.flags = 0;
   mEmbellishData.coreFrame = nullptr;
   mEmbellishData.direction = NS_STRETCH_DIRECTION_UNSUPPORTED;
   mEmbellishData.leadingSpace = 0;
   mEmbellishData.trailingSpace = 0;
@@ -103,19 +72,16 @@ nsMathMLFrame::InheritAutomaticData(nsIF
 
   // by default, just inherit the display of our parent
   nsPresentationData parentData;
   GetPresentationDataFrom(aParent, parentData);
   mPresentationData.mstyle = parentData.mstyle;
   if (NS_MATHML_IS_DISPLAYSTYLE(parentData.flags)) {
     mPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
   }
-  if (NS_MATHML_IS_RTL(parentData.flags)) {
-    mPresentationData.flags |= NS_MATHML_RTL;
-  }
 
 #if defined(DEBUG) && defined(SHOW_BOUNDING_BOX)
   mPresentationData.flags |= NS_MATHML_SHOW_BOUNDING_METRICS;
 #endif
 
   return NS_OK;
 }
 
@@ -223,17 +189,16 @@ nsMathMLFrame::GetPresentationDataFrom(n
       break;
 
     if (content->Tag() == nsGkAtoms::math) {
       const nsStyleDisplay* display = frame->StyleDisplay();
       if (display->mDisplay == NS_STYLE_DISPLAY_BLOCK) {
         aPresentationData.flags |= NS_MATHML_DISPLAYSTYLE;
       }
       FindAttrDisplaystyle(content, aPresentationData);
-      FindAttrDirectionality(content, aPresentationData);
       aPresentationData.mstyle = frame->GetFirstContinuation();
       break;
     }
     frame = frame->GetParent();
   }
   NS_WARN_IF_FALSE(frame && frame->GetContent(),
                    "bad MathML markup - could not find the top <math> element");
 }
--- a/layout/mathml/nsMathMLFrame.h
+++ b/layout/mathml/nsMathMLFrame.h
@@ -131,21 +131,16 @@ public:
                           nsPresentationData& aPresentationData,
                           bool                aClimbTree = true);
 
   // helper used by <mstyle> and <mtable> to see if they have a displaystyle attribute 
   static void
   FindAttrDisplaystyle(nsIContent*         aContent,
                        nsPresentationData& aPresentationData);
 
-  // helper used to see if an element has a dir attribute 
-  static void
-  FindAttrDirectionality(nsIContent*         aContent,
-                         nsPresentationData& aPresentationData);
-
   // helper to check if a content has an attribute. If content is nullptr or if
   // the attribute is not there, check if the attribute is on the mstyle hierarchy
   // @return true     --if attribute exists
   //         false --if attribute doesn't exist
   static bool
   GetAttribute(nsIContent* aContent,
                nsIFrame*   aMathMLmstyleFrame,          
                nsIAtom*    aAttributeAtom,
--- a/layout/mathml/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/nsMathMLTokenFrame.cpp
@@ -27,22 +27,16 @@ nsMathMLTokenFrame::~nsMathMLTokenFrame(
 }
 
 NS_IMETHODIMP
 nsMathMLTokenFrame::InheritAutomaticData(nsIFrame* aParent)
 {
   // let the base class get the default from our parent
   nsMathMLContainerFrame::InheritAutomaticData(aParent);
 
-  if (mContent->Tag() != nsGkAtoms::mspace_ &&
-      mContent->Tag() != nsGkAtoms::annotation_) {
-    // see if the directionality attribute is there
-    nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
-  }
-
   ProcessTextData();
 
   return NS_OK;
 }
 
 eMathMLFrameType
 nsMathMLTokenFrame::GetMathMLFrameType()
 {
--- a/layout/mathml/nsMathMLmencloseFrame.cpp
+++ b/layout/mathml/nsMathMLmencloseFrame.cpp
@@ -195,18 +195,17 @@ nsMathMLmencloseFrame::BuildDisplayList(
   nsRect mencloseRect = nsIFrame::GetRect();
   mencloseRect.x = mencloseRect.y = 0;
 
   if (IsToDraw(NOTATION_RADICAL)) {
     mMathMLChar[mRadicalCharIndex].Display(aBuilder, this, aLists, 0);
 
     nsRect rect;
     mMathMLChar[mRadicalCharIndex].GetRect(rect);
-    rect.MoveBy(NS_MATHML_IS_RTL(mPresentationData.flags) ?
-                -mContentWidth : rect.width, 0);
+    rect.MoveBy(StyleVisibility()->mDirection ? -mContentWidth : rect.width, 0);
     rect.SizeTo(mContentWidth, mRuleThickness);
     DisplayBar(aBuilder, this, rect, aLists);
   }
 
   if (IsToDraw(NOTATION_LONGDIV)) {
     mMathMLChar[mLongDivCharIndex].Display(aBuilder, this, aLists, 1);
 
     nsRect rect;
@@ -459,18 +458,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsR
       mBoundingMetrics.descent = std::max(mBoundingMetrics.descent,
                                         longdivDescent);
     }
   }
 
   ///////////////
   // radical notation:
   if (IsToDraw(NOTATION_RADICAL)) {
-    nscoord *dx_leading =
-      NS_MATHML_IS_RTL(mPresentationData.flags) ? &dx_right : &dx_left;
+    nscoord *dx_leading = StyleVisibility()->mDirection ? &dx_right : &dx_left;
     
     if (aWidthOnly) {
       nscoord radical_width = mMathMLChar[mRadicalCharIndex].
         GetMaxWidth(PresContext(), aRenderingContext);
       
       // Update horizontal parameters
       *dx_leading = std::max(*dx_leading, radical_width);
     } else {
@@ -480,17 +478,17 @@ nsMathMLmencloseFrame::PlaceInternal(nsR
       contSize.ascent = mRuleThickness;
       contSize.descent = bmBase.ascent + bmBase.descent + psi;
 
       // height(radical) should be >= height(base) + psi + mRuleThickness
       mMathMLChar[mRadicalCharIndex].Stretch(PresContext(), aRenderingContext,
                                              NS_STRETCH_DIRECTION_VERTICAL,
                                              contSize, bmRadicalChar,
                                              NS_STRETCH_LARGER,
-                                             NS_MATHML_IS_RTL(mPresentationData.flags));
+                                             StyleVisibility()->mDirection);
       mMathMLChar[mRadicalCharIndex].GetBoundingMetrics(bmRadicalChar);
 
       // Update horizontal parameters
       *dx_leading = std::max(*dx_leading, bmRadicalChar.width);
 
       // Update vertical parameters
       radicalAscent = bmBase.ascent + psi + mRuleThickness;
       radicalDescent = std::max(bmBase.descent,
@@ -599,18 +597,18 @@ nsMathMLmencloseFrame::PlaceInternal(nsR
                                                     bmLongdivChar.width,
                                                     aDesiredSize.ascent -
                                                     longdivAscent,
                                                     bmLongdivChar.width,
                                                     bmLongdivChar.ascent +
                                                     bmLongdivChar.descent));
 
     if (IsToDraw(NOTATION_RADICAL)) {
-      nscoord dx = NS_MATHML_IS_RTL(mPresentationData.flags) ?
-        dx_left + bmBase.width : dx_left - bmRadicalChar.width;
+      nscoord dx = (StyleVisibility()->mDirection ?
+                    dx_left + bmBase.width : dx_left - bmRadicalChar.width);
 
       mMathMLChar[mRadicalCharIndex].SetRect(nsRect(dx,
                                                     aDesiredSize.ascent -
                                                     radicalAscent,
                                                     bmRadicalChar.width,
                                                     bmRadicalChar.ascent +
                                                     bmRadicalChar.descent));
     }
--- a/layout/mathml/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/nsMathMLmfencedFrame.cpp
@@ -312,17 +312,17 @@ nsMathMLmfencedFrame::Reflow(nsPresConte
   // adjust the origin of children.
 
   // we need to center around the axis
   nscoord delta = std::max(containerSize.ascent - axisHeight, 
                          containerSize.descent + axisHeight);
   containerSize.ascent = delta + axisHeight;
   containerSize.descent = delta - axisHeight;
 
-  bool isRTL = NS_MATHML_IS_RTL(mPresentationData.flags);
+  bool isRTL = StyleVisibility()->mDirection;
 
   /////////////////
   // opening fence ...
   ReflowChar(aPresContext, *aReflowState.rendContext, mOpenChar,
              NS_MATHML_OPERATOR_FORM_PREFIX, font->mScriptLevel, 
              axisHeight, leading, em, containerSize, ascent, descent, isRTL);
   /////////////////
   // separators ...
--- a/layout/mathml/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/nsMathMLmfracFrame.cpp
@@ -235,21 +235,19 @@ nsMathMLmfracFrame::PlaceInternal(nsRend
   if (!mIsBevelled) {
     mLineRect.height = mLineThickness;
     
     // by default, leave at least one-pixel padding at either end, or use
     // lspace & rspace that may come from <mo> if we are an embellished
     // container (we fetch values from the core since they may use units that
     // depend on style data, and style changes could have occurred in the
     // core since our last visit there)
-    nscoord leftSpace = std::max(onePixel,
-                               NS_MATHML_IS_RTL(mPresentationData.flags) ?
+    nscoord leftSpace = std::max(onePixel, StyleVisibility()->mDirection ?
                                coreData.trailingSpace : coreData.leadingSpace);
-    nscoord rightSpace = std::max(onePixel,
-                                NS_MATHML_IS_RTL(mPresentationData.flags) ?
+    nscoord rightSpace = std::max(onePixel, StyleVisibility()->mDirection ?
                                 coreData.leadingSpace : coreData.trailingSpace);
 
     //////////////////
     // Get shifts
     nscoord numShift = 0;
     nscoord denShift = 0;
 
     // Rule 15b, App. G, TeXbook
@@ -451,17 +449,17 @@ nsMathMLmfracFrame::PlaceInternal(nsRend
     } else {
       mLineRect.width = mLineThickness +
         std::min(slashMaxWidthConstant,
                (mBoundingMetrics.ascent + mBoundingMetrics.descent) /
                slashRatio);
     }
 
     // Set horizontal bounding metrics
-    if (NS_MATHML_IS_RTL(mPresentationData.flags)) {
+    if (StyleVisibility()->mDirection) {
       mBoundingMetrics.leftBearing = trailingSpace + bmDen.leftBearing;
       mBoundingMetrics.rightBearing = trailingSpace + bmDen.width + mLineRect.width + bmNum.rightBearing;
     } else {
       mBoundingMetrics.leftBearing = leadingSpace + bmNum.leftBearing;
       mBoundingMetrics.rightBearing = leadingSpace + bmNum.width + mLineRect.width + bmDen.rightBearing;
     }
     mBoundingMetrics.width =
       leadingSpace + bmNum.width + mLineRect.width + bmDen.width +
@@ -590,10 +588,10 @@ nsMathMLmfracFrame::DisplaySlash(nsDispl
                                  nsIFrame* aFrame, const nsRect& aRect,
                                  nscoord aThickness,
                                  const nsDisplayListSet& aLists) {
   if (!aFrame->StyleVisibility()->IsVisible() || aRect.IsEmpty())
     return;
 
   aLists.Content()->AppendNewToTop(new (aBuilder)
     nsDisplayMathMLSlash(aBuilder, aFrame, aRect, aThickness,
-                         NS_MATHML_IS_RTL(mPresentationData.flags)));
+                         StyleVisibility()->mDirection));
 }
--- a/layout/mathml/nsMathMLmoFrame.cpp
+++ b/layout/mathml/nsMathMLmoFrame.cpp
@@ -746,18 +746,17 @@ nsMathMLmoFrame::Stretch(nsRenderingCont
         }
       }
     }
 
     // let the MathMLChar stretch itself...
     nsresult res = mMathMLChar.Stretch(PresContext(), aRenderingContext,
                                        aStretchDirection, container, charSize,
                                        stretchHint,
-                                       NS_MATHML_IS_RTL(mPresentationData.
-                                                        flags));
+                                       StyleVisibility()->mDirection);
     if (NS_FAILED(res)) {
       // gracefully handle cases where stretching the char failed (i.e., GetBoundingMetrics failed)
       // clear our 'form' to behave as if the operator wasn't in the dictionary
       mFlags &= ~NS_MATHML_OPERATOR_FORM;
       useMathMLChar = false;
     }
   }
 
@@ -871,17 +870,17 @@ nsMathMLmoFrame::Stretch(nsRenderingCont
     if (isAccent && !NS_MATHML_OPERATOR_HAS_RSPACE_ATTR(mFlags)) {
       trailingSpace = 0;
     }
 
     mBoundingMetrics.width += leadingSpace + trailingSpace;
     aDesiredStretchSize.width = mBoundingMetrics.width;
     aDesiredStretchSize.mBoundingMetrics.width = mBoundingMetrics.width;
 
-    nscoord dx = (NS_MATHML_IS_RTL(mPresentationData.flags) ?
+    nscoord dx = (StyleVisibility()->mDirection ?
                   trailingSpace : leadingSpace);
     if (dx) {
       // adjust the offsets
       mBoundingMetrics.leftBearing += dx;
       mBoundingMetrics.rightBearing += dx;
       aDesiredStretchSize.mBoundingMetrics.leftBearing += dx;
       aDesiredStretchSize.mBoundingMetrics.rightBearing += dx;
 
--- a/layout/mathml/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/nsMathMLmpaddedFrame.cpp
@@ -412,34 +412,34 @@ nsMathMLmpaddedFrame::Place(nsRenderingC
                 mBoundingMetrics, voffset);
   }
   // do the padding now that we have everything
   // The idea here is to maintain the invariant that <mpadded>...</mpadded> (i.e.,
   // with no attributes) looks the same as <mrow>...</mrow>. But when there are
   // attributes, tweak our metrics and move children to achieve the desired visual
   // effects.
 
-  if ((NS_MATHML_IS_RTL(mPresentationData.flags) ?
+  if ((StyleVisibility()->mDirection ?
        mWidthSign : mLeadingSpaceSign) != NS_MATHML_SIGN_INVALID) {
     // there was padding on the left. dismiss the left italic correction now
     // (so that our parent won't correct us)
     mBoundingMetrics.leftBearing = 0;
   }
 
-  if ((NS_MATHML_IS_RTL(mPresentationData.flags) ?
+  if ((StyleVisibility()->mDirection ?
        mLeadingSpaceSign : mWidthSign) != NS_MATHML_SIGN_INVALID) {
     // there was padding on the right. dismiss the right italic correction now
     // (so that our parent won't correct us)
     mBoundingMetrics.width = width;
     mBoundingMetrics.rightBearing = mBoundingMetrics.width;
   }
 
   nscoord dy = height - mBoundingMetrics.ascent;
-  nscoord dx = NS_MATHML_IS_RTL(mPresentationData.flags) ?
-    width - initialWidth - lspace : lspace;
+  nscoord dx = (StyleVisibility()->mDirection ?
+                width - initialWidth - lspace : lspace);
     
   aDesiredSize.ascent += dy;
   aDesiredSize.width = mBoundingMetrics.width;
   aDesiredSize.height += dy + depth - mBoundingMetrics.descent;
   mBoundingMetrics.ascent = height;
   mBoundingMetrics.descent = depth;
   aDesiredSize.mBoundingMetrics = mBoundingMetrics;
 
--- a/layout/mathml/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/nsMathMLmrootFrame.cpp
@@ -266,17 +266,17 @@ nsMathMLmrootFrame::Reflow(nsPresContext
   contSize.ascent = ruleThickness;
 
   // height(radical) should be >= height(base) + psi + ruleThickness
   nsBoundingMetrics radicalSize;
   mSqrChar.Stretch(aPresContext, renderingContext,
                    NS_STRETCH_DIRECTION_VERTICAL, 
                    contSize, radicalSize,
                    NS_STRETCH_LARGER,
-                   NS_MATHML_IS_RTL(mPresentationData.flags));
+                   StyleVisibility()->mDirection);
   // radicalSize have changed at this point, and should match with
   // the bounding metrics of the char
   mSqrChar.GetBoundingMetrics(bmSqr);
 
   // Update the desired size for the container (like msqrt, index is not yet included)
   // the baseline will be that of the base.
   mBoundingMetrics.ascent = bmBase.ascent + psi + ruleThickness;
   mBoundingMetrics.descent = 
--- a/layout/mathml/nsMathMLmrowFrame.cpp
+++ b/layout/mathml/nsMathMLmrowFrame.cpp
@@ -30,21 +30,16 @@ nsMathMLmrowFrame::~nsMathMLmrowFrame()
 NS_IMETHODIMP
 nsMathMLmrowFrame::InheritAutomaticData(nsIFrame* aParent)
 {
   // let the base class get the default from our parent
   nsMathMLContainerFrame::InheritAutomaticData(aParent);
 
   mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
 
-  if (mContent->Tag() == nsGkAtoms::mrow_) {
-    // see if the directionality attribute is there
-    nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
-  }
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMathMLmrowFrame::AttributeChanged(int32_t  aNameSpaceID,
                                     nsIAtom* aAttribute,
                                     int32_t  aModType)
 {
--- a/layout/mathml/nsMathMLmstyleFrame.cpp
+++ b/layout/mathml/nsMathMLmstyleFrame.cpp
@@ -37,19 +37,16 @@ nsMathMLmstyleFrame::InheritAutomaticDat
 
   // sync with our current state
   mPresentationData.flags |= NS_MATHML_STRETCH_ALL_CHILDREN_VERTICALLY;
   mPresentationData.mstyle = this;
 
   // see if the displaystyle attribute is there
   nsMathMLFrame::FindAttrDisplaystyle(mContent, mPresentationData);
 
-  // see if the directionality attribute is there
-  nsMathMLFrame::FindAttrDirectionality(mContent, mPresentationData);
-
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsMathMLmstyleFrame::TransmitAutomaticData()
 {
   return TransmitAutomaticDataForMrowLikeElement();
 }