Bug 1077139 - Use the vertical-text I-beam cursor when the writing mode is vertical. r=dbaron
authorJonathan Kew <jkew@mozilla.com>
Fri, 03 Oct 2014 13:47:26 +0100
changeset 208691 795d9067f6c6157f694f7da55ac8bb93bdd86be3
parent 208690 93909a51e5edeed38968cc6c06c3af178b8d4742
child 208692 e36bdb0150b920a4c23249abcdb955dca7efd3d0
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersdbaron
bugs1077139
milestone35.0a1
Bug 1077139 - Use the vertical-text I-beam cursor when the writing mode is vertical. r=dbaron
layout/generic/nsFrame.cpp
layout/generic/nsTextFrame.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3783,20 +3783,21 @@ nsIFrame::AssociateImage(const nsStyleIm
 nsresult
 nsFrame::GetCursor(const nsPoint& aPoint,
                    nsIFrame::Cursor& aCursor)
 {
   FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
   if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
     // If this is editable, I-beam cursor is better for most elements.
     aCursor.mCursor =
-      (mContent && mContent->IsEditable()) ? NS_STYLE_CURSOR_TEXT :
-                                             NS_STYLE_CURSOR_DEFAULT;
-  }
-
+      (mContent && mContent->IsEditable())
+      ? GetWritingMode().IsVertical()
+        ? NS_STYLE_CURSOR_VERTICAL_TEXT : NS_STYLE_CURSOR_TEXT
+      : NS_STYLE_CURSOR_DEFAULT;
+  }
 
   return NS_OK;
 }
 
 // Resize and incremental reflow
 
 /* virtual */ void
 nsFrame::MarkIntrinsicISizesDirty()
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -4212,19 +4212,20 @@ NS_IMPL_FRAMEARENA_HELPERS(nsContinuingT
 nsTextFrame::~nsTextFrame()
 {
 }
 
 nsresult
 nsTextFrame::GetCursor(const nsPoint& aPoint,
                        nsIFrame::Cursor& aCursor)
 {
-  FillCursorInformationFromStyle(StyleUserInterface(), aCursor);  
+  FillCursorInformationFromStyle(StyleUserInterface(), aCursor);
   if (NS_STYLE_CURSOR_AUTO == aCursor.mCursor) {
-    aCursor.mCursor = NS_STYLE_CURSOR_TEXT;
+    aCursor.mCursor = GetWritingMode().IsVertical()
+                      ? NS_STYLE_CURSOR_VERTICAL_TEXT : NS_STYLE_CURSOR_TEXT;
     // If this is editable, we should ignore tabindex value.
     if (mContent->IsEditable()) {
       return NS_OK;
     }
 
     // If tabindex >= 0, use default cursor to indicate it's not selectable
     nsIFrame *ancestorFrame = this;
     while ((ancestorFrame = ancestorFrame->GetParent()) != nullptr) {