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 231906 795d9067f6c6157f694f7da55ac8bb93bdd86be3
parent 231905 93909a51e5edeed38968cc6c06c3af178b8d4742
child 231907 e36bdb0150b920a4c23249abcdb955dca7efd3d0
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs1077139
milestone35.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 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) {