gecko-dev/layout/base/gtest
Ting-Yu Lin 1e4e187165 Bug 1649191 - Remove the guarding statement about mismatching carets mode from AccessibleCaretManager APIs. r=botond
Steps to reproduce:
1. Open https://bugzilla.mozilla.org/home
   (Note the cursor is already blinking in the <input>
   "Enter a bug number or some search terms")
2. Pinch-zoom in.
3. Tap on the <input> "Enter a bug number or some search terms."
4. Pan/scroll the page, and the scrolling is very laggy.

Without this patch, AccessibleCaret disables APZ incorrectly via the
above operations. Here's an analysis.

In step 2, `OnScrollEnd()` called at the end of the pinch-zoom operation
is supposed to reset `mIsScrollStarted` to `false`, but `GetCaretMode()`
returns `CaretMode::Cursor` because the page already has a focus on
<input>. We are early-returned from `OnScrollEnd()` because
`mLastUpdateCaretMode` is still the default value `CaretMode::None`.

In step 3, tapping the <input> will call `UpdateCaretsForCursorMode()`,
setting `mIsCaretPositionChanged` to `true`. Then
`UpdateShouldDisableApz()` incorrectly sets `mShouldDisableApz` to
`true` because we still have `mIsScrollStarted=true`.

In step 4, the operation is laggy because APZ is disabled.

This patch fixed this bug by removing the guarding statement
`mLastUpdateCaretMode != GetCaretMode()` from three callback methods.

The statements were added in the very first patch introducing
`AccessibleCaretManager`. I don't recall why we needed them. (Perhaps to
avoid unnecessary updates notified from other PresShell?). Anyway, since
then, these callbacks have evolved to update carets only if any caret is
logically visible, so I don't see why we need these guards nowadays. By
doing so, `mIsScrollStarted` can be reset to `false` in `OnScrollEnd()`
in step 2.

Differential Revision: https://phabricator.services.mozilla.com/D99284
2020-12-09 23:02:34 +00:00
..
TestAccessibleCaretEventHub.cpp Bug 1643464 - Part 1: Rename eLeft/eRight to ePrimary/eSecondary r=masayuki 2020-06-19 18:02:41 +00:00
TestAccessibleCaretManager.cpp Bug 1649191 - Remove the guarding statement about mismatching carets mode from AccessibleCaretManager APIs. r=botond 2020-12-09 23:02:34 +00:00
moz.build Bug 1654103: Standardize on Black for Python code in `mozilla-central`. 2020-10-26 18:34:53 +00:00