Remove unnecessary argument from SetBidiEnabled. Bug 435856, r+sr=roc
authorSimon Montagu <smontagu@smontagu.org>
Mon, 16 Jun 2008 02:28:17 -0700
changeset 15376 33cf44ea0fc8e5835dc1b00fd2f9c4e1b2b9ade0
parent 15375 be010ac940e07c36dd7a986f2e03c2e13538e1a3
child 15377 7d293ee240a923c8359ca219bdb8932c2b61b978
push id173
push usersmontagu@mozilla.com
push dateMon, 16 Jun 2008 09:29:48 +0000
treeherdermozilla-central@33cf44ea0fc8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs435856
milestone1.9.1a1pre
Remove unnecessary argument from SetBidiEnabled. Bug 435856, r+sr=roc
content/base/public/nsIDocument.h
content/base/src/nsGenericDOMDataNode.cpp
layout/base/nsCaret.cpp
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/generic/nsPageFrame.cpp
layout/style/nsRuleNode.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -293,19 +293,19 @@ public:
   }
 
   /**
    * Indicate the document contains bidi data.
    * Currently, we cannot disable bidi, because once bidi is enabled,
    * it affects a frame model irreversibly, and plays even though
    * the document no longer contains bidi data.
    */
-  void SetBidiEnabled(PRBool aBidiEnabled)
+  void SetBidiEnabled()
   {
-    mBidiEnabled = aBidiEnabled;
+    mBidiEnabled = PR_TRUE;
   }
   
   /**
    * Check if the document contains (or has contained) any MathML elements.
    */
   PRBool GetMathMLEnabled() const
   {
     return mMathMLEnabled;
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -627,17 +627,17 @@ nsGenericDOMDataNode::BindToTree(nsIDocu
 
   // XXXbz sXBL/XBL2 issue!
 
   // Set document
   if (aDocument) {
     // XXX See the comment in nsGenericElement::BindToTree
     mParentPtrBits |= PARENT_BIT_INDOCUMENT;
     if (mText.IsBidi()) {
-      aDocument->SetBidiEnabled(PR_TRUE);
+      aDocument->SetBidiEnabled();
     }
   }
 
   nsNodeUtils::ParentChainChanged(this);
 
   UpdateEditableState();
 
   NS_POSTCONDITION(aDocument == GetCurrentDoc(), "Bound to wrong document");
@@ -1162,17 +1162,17 @@ void nsGenericDOMDataNode::SetBidiStatus
   if (document && document->GetBidiEnabled()) {
     // OK, we already know it's Bidi, so we won't test again
     return;
   }
 
   mText.SetBidiFlag();
 
   if (document && mText.IsBidi()) {
-    document->SetBidiEnabled(PR_TRUE);
+    document->SetBidiEnabled();
   }
 }
 
 already_AddRefed<nsIAtom>
 nsGenericDOMDataNode::GetCurrentValueAtom()
 {
   nsAutoString val;
   GetData(val);
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -1228,17 +1228,17 @@ nsresult nsCaret::UpdateHookRect(nsPresC
   if (!bidiKeyboard || NS_FAILED(bidiKeyboard->IsLangRTL(&isCaretRTL)))
     // if bidiKeyboard->IsLangRTL() failed, there is no way to tell the
     // keyboard direction, or the user has no right-to-left keyboard
     // installed, so we  never draw the hook.
     return NS_OK;
   if (isCaretRTL)
   {
     bidiEnabled = PR_TRUE;
-    aPresContext->SetBidiEnabled(bidiEnabled);
+    aPresContext->SetBidiEnabled();
   }
   else
     bidiEnabled = aPresContext->BidiEnabled();
   if (bidiEnabled)
   {
     if (isCaretRTL != mKeyboardRTL)
     {
       /* if the caret bidi level and the keyboard language direction are not in
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1248,22 +1248,22 @@ nsPresContext::BidiEnabledInternal() con
 
 PRBool
 nsPresContext::BidiEnabledExternal() const
 {
   return BidiEnabledInternal();
 }
 
 void
-nsPresContext::SetBidiEnabled(PRBool aBidiEnabled) const
+nsPresContext::SetBidiEnabled() const
 {
   if (mShell) {
     nsIDocument *doc = mShell->GetDocument();
     if (doc) {
-      doc->SetBidiEnabled(aBidiEnabled);
+      doc->SetBidiEnabled();
     }
   }
 }
 
 nsBidiPresUtils*
 nsPresContext::GetBidiUtils()
 {
   if (!mBidiUtils)
@@ -1281,17 +1281,17 @@ nsPresContext::SetBidi(PRUint32 aSource,
   }
 
   NS_ASSERTION(!(aForceRestyle && (GetBidi() == 0)), 
                "ForceReflow on new prescontext");
 
   Document()->SetBidiOptions(aSource);
   if (IBMBIDI_TEXTDIRECTION_RTL == GET_BIDI_OPTION_DIRECTION(aSource)
       || IBMBIDI_NUMERAL_HINDI == GET_BIDI_OPTION_NUMERAL(aSource)) {
-    SetBidiEnabled(PR_TRUE);
+    SetBidiEnabled();
   }
   if (IBMBIDI_TEXTTYPE_VISUAL == GET_BIDI_OPTION_TEXTTYPE(aSource)) {
     SetVisualMode(PR_TRUE);
   }
   else if (IBMBIDI_TEXTTYPE_LOGICAL == GET_BIDI_OPTION_TEXTTYPE(aSource)) {
     SetVisualMode(PR_FALSE);
   }
   else {
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -608,17 +608,17 @@ public:
   PRBool BidiEnabled() const { return BidiEnabledExternal(); }
 #endif
 
   /**
    *  Set bidi enabled. This means we should apply the Unicode Bidi Algorithm
    *
    *  @lina 07/12/2000
    */
-  NS_HIDDEN_(void) SetBidiEnabled(PRBool aBidiEnabled) const;
+  NS_HIDDEN_(void) SetBidiEnabled() const;
 
   /**
    *  Set visual or implicit mode into the pres context.
    *
    *  Visual directionality is a presentation method that displays text
    *  as if it were a uni-directional, according to the primary display
    *  direction only. 
    *
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -366,21 +366,18 @@ nsPageFrame::DrawHeaderFooter(nsIRenderi
           // We can only fit 3 or fewer chars.  Just show nothing
           str.Truncate();
         }
       }
     } else { 
       return; // bail if couldn't find the correct length
     }
     
-    // Use this form rather than SetBidiEnabled(HasRTLChars(str)) so as not to 
-    // turn off bidi processing when printing a page with bidi content in the
-    // page but not in the print headers.
     if (HasRTLChars(str)) {
-      PresContext()->SetBidiEnabled(PR_TRUE);
+      PresContext()->SetBidiEnabled();
     }
 
     // cacl the x and y positions of the text
     nscoord x = GetXPosition(aRenderingContext, aRect, aJust, str);
     nscoord y;
     if (aHeaderFooter == eHeader) {
       y = aRect.y + mPD->mExtraMargin.top + mPD->mEdgePaperMargin.top;
     } else {
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -3375,17 +3375,17 @@ nsRuleNode::ComputeVisibilityData(void* 
   COMPUTE_START_INHERITED(Visibility, (mPresContext),
                           visibility, parentVisibility,
                           Display, displayData)
 
   // direction: enum, inherit
   if (eCSSUnit_Enumerated == displayData.mDirection.GetUnit()) {
     visibility->mDirection = displayData.mDirection.GetIntValue();
     if (NS_STYLE_DIRECTION_RTL == visibility->mDirection)
-      mPresContext->SetBidiEnabled(PR_TRUE);
+      mPresContext->SetBidiEnabled();
   }
   else if (eCSSUnit_Inherit == displayData.mDirection.GetUnit()) {
     inherited = PR_TRUE;
     visibility->mDirection = parentVisibility->mDirection;
   }
   else if (eCSSUnit_Initial == displayData.mDirection.GetUnit()) {
     PRUint32 bidiOptions = mPresContext->GetBidi();
     if (GET_BIDI_OPTION_DIRECTION(bidiOptions) == IBMBIDI_TEXTDIRECTION_RTL)
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -490,17 +490,17 @@ nsTextBoxFrame::PaintTitle(nsIRenderingC
     CalculateUnderline(aRenderingContext);
 
     aRenderingContext.SetColor(GetStyleColor()->mColor);
 
 #ifdef IBMBIDI
     nsresult rv = NS_ERROR_FAILURE;
 
     if (mState & NS_FRAME_IS_BIDI) {
-      presContext->SetBidiEnabled(PR_TRUE);
+      presContext->SetBidiEnabled();
       nsBidiPresUtils* bidiUtils = presContext->GetBidiUtils();
 
       if (bidiUtils) {
         const nsStyleVisibility* vis = GetStyleVisibility();
         nsBidiDirection direction = (NS_STYLE_DIRECTION_RTL == vis->mDirection) ? NSBIDI_RTL : NSBIDI_LTR;
         if (mAccessKeyInfo && mAccessKeyInfo->mAccesskeyIndex != kNotFound) {
            // We let the RenderText function calculate the mnemonic's
            // underline position for us.
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -1310,31 +1310,26 @@ void
 nsTreeBodyFrame::CheckTextForBidi(nsAutoString& aText)
 {
   // We could check to see whether the prescontext already has bidi enabled,
   // but usually it won't, so it's probably faster to avoid the call to
   // GetPresContext() when it's not needed.
   const PRUnichar* text = aText.get();
   PRUint32 length = aText.Length();
   PRUint32 i;
-  PRBool maybeRTL = PR_FALSE;
   for (i = 0; i < length; ++i) {
     PRUnichar ch = text[i];
     // To simplify things, anything that could be a surrogate or RTL
     // presentation form is covered just by testing >= 0xD800). It's fine to
     // enable bidi in rare cases where it actually isn't needed.
     if (ch >= 0xD800 || IS_IN_BMP_RTL_BLOCK(ch)) {
-      maybeRTL = PR_TRUE;
+      PresContext()->SetBidiEnabled();
       break;
     }
   }
-  if (!maybeRTL)
-    return;
-
-  PresContext()->SetBidiEnabled(PR_TRUE);
 }
 
 void
 nsTreeBodyFrame::AdjustForCellText(nsAutoString& aText,
                                    PRInt32 aRowIndex,  nsTreeColumn* aColumn,
                                    nsIRenderingContext& aRenderingContext,
                                    nsRect& aTextRect)
 {