Extend the WritingModes API. Bug 735577, r=jfkthame
authorSimon Montagu <smontagu@smontagu.org>
Wed, 12 Feb 2014 23:55:08 -0800
changeset 168443 e41e1fd3c90042505001445cb72e4933fdf8ced2
parent 168442 a63da21ad30b244c6488a4068cbf5136d564d8bc
child 168444 f2430a5e43794cfbcb521f653270214f87422b3e
push id39723
push usersmontagu@mozilla.com
push dateThu, 13 Feb 2014 07:55:59 +0000
treeherdermozilla-inbound@e41e1fd3c900 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs735577
milestone30.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
Extend the WritingModes API. Bug 735577, r=jfkthame
layout/generic/WritingModes.h
--- a/layout/generic/WritingModes.h
+++ b/layout/generic/WritingModes.h
@@ -187,16 +187,31 @@ public:
 #endif
 
     if (NS_STYLE_DIRECTION_RTL == aStyleVisibility->mDirection) {
       mWritingMode |= eInlineFlowMask | //XXX needs update when text-orientation added
                       eBidiMask;
     }
   }
 
+  // For unicode-bidi: plaintext, reset the direction of the writing mode from
+  // the bidi paragraph level of the content
+
+  //XXX change uint8_t to UBiDiLevel after bug 924851
+  void SetDirectionFromBidiLevel(uint8_t level)
+  {
+    if (level & 1) {
+      // odd level, set RTL
+      mWritingMode |= eBidiMask;
+    } else {
+      // even level, set LTR
+      mWritingMode &= ~eBidiMask;
+    }
+  }
+
   /**
    * Compare two WritingModes for equality.
    */
   bool operator==(const WritingMode& aOther) const
   {
     return mWritingMode == aOther.mWritingMode;
   }