Bug 1097499 part 6 - Inherit move direction from parent for horizontal-in-vertical text. r=jfkthame
MozReview-Commit-ID: 28mBKQnYydp
--- 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];