From 97ae5fe39d9a453e7c5d6b85e4d4d19759668186 Mon Sep 17 00:00:00 2001 From: Ting-Yu Lin Date: Wed, 27 May 2015 16:37:28 +0800 Subject: [PATCH] Bug 1161392 - Enlarge touch area for AccessibleCaret. r=roc Porting the patch for Touch/SelectionCarets in bug 1021499 to AccessibleCaret. --- layout/base/AccessibleCaret.cpp | 5 +++-- layout/base/AccessibleCaret.h | 4 ++-- layout/style/ua.css | 6 ++++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/layout/base/AccessibleCaret.cpp b/layout/base/AccessibleCaret.cpp index ad2cccf4c2a..8433b509b3e 100644 --- a/layout/base/AccessibleCaret.cpp +++ b/layout/base/AccessibleCaret.cpp @@ -254,9 +254,10 @@ AccessibleCaret::SetCaretElementStyle(const nsRect& aRect) { nsPoint position = CaretElementPosition(aRect); nsAutoString styleStr; - styleStr.AppendPrintf("left: %dpx; top: %dpx;", + styleStr.AppendPrintf("left: %dpx; top: %dpx; padding-top: %dpx;", nsPresContext::AppUnitsToIntCSSPixels(position.x), - nsPresContext::AppUnitsToIntCSSPixels(position.y)); + nsPresContext::AppUnitsToIntCSSPixels(position.y), + nsPresContext::AppUnitsToIntCSSPixels(aRect.height)); float zoomLevel = GetZoomLevel(); styleStr.AppendPrintf(" width: %.2fpx; height: %.2fpx; margin-left: %.2fpx", diff --git a/layout/base/AccessibleCaret.h b/layout/base/AccessibleCaret.h index 47caabf158c..0733d2e7ae3 100644 --- a/layout/base/AccessibleCaret.h +++ b/layout/base/AccessibleCaret.h @@ -165,11 +165,11 @@ private: // Remove caret element from custom content container. void RemoveCaretElement(nsIDocument* aDocument); - // The bottom-center of the imaginary caret to which this AccessibleCaret is + // The top-center of the imaginary caret to which this AccessibleCaret is // attached. static nsPoint CaretElementPosition(const nsRect& aRect) { - return aRect.TopLeft() + nsPoint(aRect.width / 2, aRect.height); + return aRect.TopLeft() + nsPoint(aRect.width / 2, 0); } class DummyTouchListener final : public nsIDOMEventListener diff --git a/layout/style/ua.css b/layout/style/ua.css index a85797f2ec1..2cf91d68f3a 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -322,8 +322,10 @@ div:-moz-native-anonymous.moz-accessiblecaret > div.bar { } div:-moz-native-anonymous.moz-accessiblecaret > div.image { - background-position: center center; - background-size: 100% 100%; + background-position: center bottom; + background-size: 100%; + background-repeat: no-repeat; + bottom: 0; width: 100%; height: 100%;