Bug 1097499 part 6 - Inherit move direction from parent for horizontal-in-vertical text. r=jfkthame
authorXidorn Quan <quanxunzhen@gmail.com>
Fri, 22 Apr 2016 09:18:41 +1000
changeset 332273 c582f2934be9efa80e5e0ec8b7ff482277fdf97d
parent 332272 6373a28c2d743636969afe25a215ad66b1e1751c
child 332274 555af8b37aace3843df75a4f04cfa75f2e34e14c
push id6048
push userkmoir@mozilla.com
push dateMon, 06 Jun 2016 19:02:08 +0000
treeherdermozilla-beta@46d72a56c57d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1097499
milestone48.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 1097499 part 6 - Inherit move direction from parent for horizontal-in-vertical text. r=jfkthame MozReview-Commit-ID: 28mBKQnYydp
layout/generic/nsSelection.cpp
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -2121,17 +2121,27 @@ nsFrameSelection::PhysicalMove(int16_t a
   };
 
   WritingMode wm;
   nsIFrame *frame = nullptr;
   int32_t offsetused = 0;
   if (NS_SUCCEEDED(sel->GetPrimaryFrameForFocusNode(&frame, &offsetused,
                                                     true))) {
     if (frame) {
-      wm = frame->GetWritingMode();
+      if (!frame->StyleContext()->IsTextCombined()) {
+        wm = frame->GetWritingMode();
+      } else {
+        // Using different direction for horizontal-in-vertical would
+        // make it hard to navigate via keyboard. Inherit the moving
+        // direction from its parent.
+        MOZ_ASSERT(frame->GetType() == nsGkAtoms::textFrame);
+        wm = frame->GetParent()->GetWritingMode();
+        MOZ_ASSERT(wm.IsVertical(), "Text combined "
+                   "can only appear in vertical text");
+      }
     }
   }
 
   const PhysicalToLogicalMapping& mapping =
     wm.IsVertical()
       ? wm.IsVerticalLR() ? verticalLR[aDirection] : verticalRL[aDirection]
       : horizontal[aDirection];