Followup to bug 151407: use GetDir() on the root element. r=bz
authorSimon Montagu <smontagu@smontagu.org>
Tue, 23 Apr 2013 15:12:14 +0300
changeset 129610 7c44612d9ceacc08323b8345dc30d4894aaa26af
parent 129609 118b45dac29f0ca0e812911ba6166e5aaf48e5f2
child 129611 40a9300f1200628ef558bbf7a69cc91bd49e561c
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbz
bugs151407
milestone23.0a1
Followup to bug 151407: use GetDir() on the root element. r=bz
content/base/src/nsDocument.cpp
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -6234,18 +6234,16 @@ nsDocument::GetAnimationController()
   // because they don't get OnPageShow / OnPageHide calls).
   if (!mIsShowing && !mIsBeingUsedAsImage) {
     mAnimationController->OnPageHide();
   }
 
   return mAnimationController;
 }
 
-static const char* dirAttributes[] = { "ltr", "rtl", "auto", 0 };
-
 /**
  * Retrieve the "direction" property of the document.
  *
  * @lina 01/09/2001
  */
 NS_IMETHODIMP
 nsDocument::GetDir(nsAString& aDirection)
 {
@@ -6254,24 +6252,17 @@ nsDocument::GetDir(nsAString& aDirection
 }
 
 void
 nsIDocument::GetDir(nsAString& aDirection) const
 {
   aDirection.Truncate();
   Element* rootElement = GetHtmlElement();
   if (rootElement) {
-    nsAutoString dir;
-    rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::dir, dir);
-    for (uint32_t i = 0; dirAttributes[i]; ++i) {
-      if (dir.LowerCaseEqualsASCII(dirAttributes[i])) {
-        aDirection.AssignASCII(dirAttributes[i]);
-        return;
-      }
-    }
+    static_cast<nsGenericHTMLElement*>(rootElement)->GetDir(aDirection);
   }
 }
 
 /**
  * Set the "direction" property of the document.
  *
  * @lina 01/09/2001
  */