зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1688832: part 2) Add `AccessibleCaretManager::Carets::HasLogicallyVisibleCaret`. r=smaug
Depends on D103308 Differential Revision: https://phabricator.services.mozilla.com/D103309
This commit is contained in:
Родитель
2ca0daf525
Коммит
8585eb61e5
|
@ -121,9 +121,7 @@ nsresult AccessibleCaretManager::OnSelectionChanged(Document* aDoc,
|
|||
auto mode = static_cast<ScriptUpdateMode>(
|
||||
StaticPrefs::layout_accessiblecaret_script_change_update_mode());
|
||||
if (mode == kScriptAlwaysShow ||
|
||||
(mode == kScriptUpdateVisible &&
|
||||
(mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible()))) {
|
||||
(mode == kScriptUpdateVisible && mCarets.HasLogicallyVisibleCaret())) {
|
||||
UpdateCarets();
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -173,8 +171,7 @@ nsresult AccessibleCaretManager::OnSelectionChanged(Document* aDoc,
|
|||
}
|
||||
|
||||
void AccessibleCaretManager::HideCaretsAndDispatchCaretStateChangedEvent() {
|
||||
if (mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible()) {
|
||||
if (mCarets.HasLogicallyVisibleCaret()) {
|
||||
AC_LOG("%s", __FUNCTION__);
|
||||
mCarets.mFirst->SetAppearance(Appearance::None);
|
||||
mCarets.mSecond->SetAppearance(Appearance::None);
|
||||
|
@ -698,8 +695,7 @@ void AccessibleCaretManager::OnScrollStart() {
|
|||
|
||||
mIsScrollStarted = true;
|
||||
|
||||
if (mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible()) {
|
||||
if (mCarets.HasLogicallyVisibleCaret()) {
|
||||
// Dispatch the event only if one of the carets is logically visible like in
|
||||
// HideCaretsAndDispatchCaretStateChangedEvent().
|
||||
DispatchCaretStateChangedEvent(CaretChangedReason::Scroll);
|
||||
|
@ -746,8 +742,7 @@ void AccessibleCaretManager::OnScrollPositionChanged() {
|
|||
assert.emplace(*mPresShell);
|
||||
}
|
||||
|
||||
if (mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible()) {
|
||||
if (mCarets.HasLogicallyVisibleCaret()) {
|
||||
if (mIsScrollStarted) {
|
||||
// We don't want extra CaretStateChangedEvents dispatched when user is
|
||||
// scrolling the page.
|
||||
|
@ -771,8 +766,7 @@ void AccessibleCaretManager::OnReflow() {
|
|||
assert.emplace(*mPresShell);
|
||||
}
|
||||
|
||||
if (mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible()) {
|
||||
if (mCarets.HasLogicallyVisibleCaret()) {
|
||||
AC_LOG("%s: UpdateCarets(RespectOldAppearance)", __FUNCTION__);
|
||||
UpdateCarets(UpdateCaretsHint::RespectOldAppearance);
|
||||
}
|
||||
|
@ -1479,8 +1473,7 @@ void AccessibleCaretManager::DispatchCaretStateChangedEvent(
|
|||
init.mBoundingClientRect = domRect;
|
||||
init.mReason = aReason;
|
||||
init.mCollapsed = sel->IsCollapsed();
|
||||
init.mCaretVisible = mCarets.mFirst->IsLogicallyVisible() ||
|
||||
mCarets.mSecond->IsLogicallyVisible();
|
||||
init.mCaretVisible = mCarets.HasLogicallyVisibleCaret();
|
||||
init.mCaretVisuallyVisible = mCarets.mFirst->IsVisuallyVisible() ||
|
||||
mCarets.mSecond->IsVisuallyVisible();
|
||||
init.mSelectedTextContent = StringifiedSelection();
|
||||
|
|
|
@ -315,6 +315,10 @@ class AccessibleCaretManager {
|
|||
PresShell* MOZ_NON_OWNING_REF mPresShell = nullptr;
|
||||
|
||||
struct Carets {
|
||||
bool HasLogicallyVisibleCaret() const {
|
||||
return mFirst->IsLogicallyVisible() || mSecond->IsLogicallyVisible();
|
||||
}
|
||||
|
||||
// First caret is attached to nsCaret in cursor mode, and is attached to
|
||||
// selection highlight as the left caret in selection mode.
|
||||
UniquePtr<AccessibleCaret> mFirst;
|
||||
|
|
Загрузка…
Ссылка в новой задаче