зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1155493 - Part 3: Dispatch event when carets are updated, pressed, released, tap, longpressonemptycontent, hidden. r=roc
--HG-- extra : source : ca51748d62b232c8312ff9d8decaf1a16aebf0a2
This commit is contained in:
Родитель
a11d4a5f6e
Коммит
b538815b50
|
@ -90,6 +90,7 @@ AccessibleCaretManager::HideCarets()
|
|||
AC_LOG("%s", __FUNCTION__);
|
||||
mFirstCaret->SetAppearance(Appearance::None);
|
||||
mSecondCaret->SetAppearance(Appearance::None);
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Visibilitychange);
|
||||
CancelCaretTimeoutTimer();
|
||||
}
|
||||
}
|
||||
|
@ -154,7 +155,8 @@ AccessibleCaretManager::UpdateCaretsForCursorMode()
|
|||
// No need to consider whether the caret's position is out of scrollport.
|
||||
// According to the spec, we need to explicitly hide it after the scrolling is
|
||||
// ended.
|
||||
mFirstCaret->SetPosition(frame, offset);
|
||||
bool oldSecondCaretVisible = mSecondCaret->IsLogicallyVisible();
|
||||
PositionChangedResult caretResult = mFirstCaret->SetPosition(frame, offset);
|
||||
mFirstCaret->SetSelectionBarEnabled(false);
|
||||
if (nsContentUtils::HasNonEmptyTextContent(
|
||||
editingHost, nsContentUtils::eRecurseIntoChildren)) {
|
||||
|
@ -164,6 +166,11 @@ AccessibleCaretManager::UpdateCaretsForCursorMode()
|
|||
mFirstCaret->SetAppearance(Appearance::NormalNotShown);
|
||||
}
|
||||
mSecondCaret->SetAppearance(Appearance::None);
|
||||
|
||||
if ((caretResult == PositionChangedResult::Changed ||
|
||||
oldSecondCaretVisible) && !mActiveCaret) {
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Updateposition);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -214,6 +221,14 @@ AccessibleCaretManager::UpdateCaretsForSelectionMode()
|
|||
}
|
||||
|
||||
UpdateCaretsForTilt();
|
||||
|
||||
if ((firstCaretResult == PositionChangedResult::Changed ||
|
||||
secondCaretResult == PositionChangedResult::Changed ||
|
||||
firstCaretResult == PositionChangedResult::Invisible ||
|
||||
secondCaretResult == PositionChangedResult::Invisible) &&
|
||||
!mActiveCaret) {
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Updateposition);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -253,6 +268,7 @@ AccessibleCaretManager::PressCaret(const nsPoint& aPoint)
|
|||
mOffsetYToCaretLogicalPosition =
|
||||
mActiveCaret->LogicalPosition().y - aPoint.y;
|
||||
SetSelectionDragState(true);
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Presscaret);
|
||||
CancelCaretTimeoutTimer();
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
@ -279,6 +295,7 @@ AccessibleCaretManager::ReleaseCaret()
|
|||
|
||||
mActiveCaret = nullptr;
|
||||
SetSelectionDragState(false);
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Releasecaret);
|
||||
LaunchCaretTimeoutTimer();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -291,6 +308,7 @@ AccessibleCaretManager::TapCaret(const nsPoint& aPoint)
|
|||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (GetCaretMode() == CaretMode::Cursor) {
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Taponcaret);
|
||||
rv = NS_OK;
|
||||
}
|
||||
|
||||
|
@ -331,6 +349,7 @@ AccessibleCaretManager::SelectWordOrShortcut(const nsPoint& aPoint)
|
|||
editingHost, nsContentUtils::eRecurseIntoChildren))) {
|
||||
// Content is empty. No need to select word.
|
||||
AC_LOG("%s, Cannot select word bacause content is empty", __FUNCTION__);
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Longpressonemptycontent);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче