Bug 1339797 - Fix select-all events fired by touch incorrectly hide the carets. r?mtseng
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
--- 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;
}