Bug 1067243 - Refine the selection reason matching logic to toggle the visibility of selection carets. r=roc
--- a/layout/base/SelectionCarets.cpp
+++ b/layout/base/SelectionCarets.cpp
@@ -851,17 +851,19 @@ SelectionCarets::NotifySelectionChanged(
int16_t aReason)
{
bool isCollapsed;
aSel->GetIsCollapsed(&isCollapsed);
if (isCollapsed) {
SetVisibility(false);
return NS_OK;
}
- if (aReason & nsISelectionListener::KEYPRESS_REASON) {
+ if (!aReason || (aReason & (nsISelectionListener::DRAG_REASON |
+ nsISelectionListener::KEYPRESS_REASON |
+ nsISelectionListener::MOUSEDOWN_REASON))) {
SetVisibility(false);
} else {
UpdateSelectionCarets();
}
return NS_OK;
}
static void
@@ -900,17 +902,17 @@ SelectionCarets::AsyncPanZoomStopped(con
{
UpdateSelectionCarets();
DispatchScrollViewChangeEvent(mPresShell, dom::ScrollState::Stopped, aScrollPos);
}
void
SelectionCarets::ScrollPositionChanged()
{
- if (!mAPZenabled) {
+ if (!mAPZenabled && mVisible) {
SetVisibility(false);
//TODO: handling scrolling for selection bubble when APZ is off
LaunchScrollEndDetector();
}
}
void
SelectionCarets::LaunchLongTapDetector()