Bug 1339797 - Fix select-all events fired by touch incorrectly hide the carets. r=mtseng a=gchang
authorTing-Yu Lin <tlin@mozilla.com>
Fri, 17 Feb 2017 14:08:48 +0800
changeset 376314 86de27eb78e3045843eefd47f07735663001c130
parent 376313 834d02e98a7446e487bf78bc43210b9dfa4f27bd
child 376315 c0053a0cf40f389068d7fdf443d721df8259cdaf
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmtseng, gchang
bugs1339797
milestone53.0a2
Bug 1339797 - Fix select-all events fired by touch incorrectly hide the carets. r=mtseng a=gchang sHideCaretsForMouseInput is default to true on all platforms. When clicking "SELECT ALL" on Fennec toolbar in <input>, AccessibleCaretManager will receive SELECTALL_REASON with MOZ_SOURCE_TOUCH. We should hide the carets only if the select-all reason is fired by keyboard, not by touch. MozReview-Commit-ID: D7FYIH5ZGS0
layout/base/AccessibleCaretManager.cpp
--- a/layout/base/AccessibleCaretManager.cpp
+++ b/layout/base/AccessibleCaretManager.cpp
@@ -191,19 +191,20 @@ AccessibleCaretManager::OnSelectionChang
 
   // For mouse input we don't want to show the carets.
   if (sHideCaretsForMouseInput &&
       mLastInputSource == nsIDOMMouseEvent::MOZ_SOURCE_MOUSE) {
     HideCarets();
     return NS_OK;
   }
 
-  // No need to show the carets for select all action when we want to hide
-  // the carets for mouse input.
+  // When we want to hide the carets for mouse input, hide them for select
+  // all action fired by keyboard as well.
   if (sHideCaretsForMouseInput &&
+      mLastInputSource == nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD &&
       (aReason & nsISelectionListener::SELECTALL_REASON)) {
     HideCarets();
     return NS_OK;
   }
 
   UpdateCarets();
   return NS_OK;
 }