Bug 1685303: part 25) Hide AccessibleCaretManager::LayoutFlusher::mFlushing. r=TYLin

Depends on D102414

Differential Revision: https://phabricator.services.mozilla.com/D102415
This commit is contained in:
Mirko Brodesser 2021-01-20 23:31:44 +00:00
parent f7d4eee8e5
commit 8dab90eba1
2 changed files with 10 additions and 7 deletions

View File

@ -86,9 +86,9 @@ AccessibleCaretManager::AccessibleCaretManager(PresShell* aPresShell)
mSecondCaret = MakeUnique<AccessibleCaret>(mPresShell);
}
AccessibleCaretManager::~AccessibleCaretManager() {
MOZ_RELEASE_ASSERT(!mLayoutFlusher.mFlushing,
"Going away in mLayoutFlusher.MaybeFlush? Bad!");
AccessibleCaretManager::LayoutFlusher::~LayoutFlusher() {
MOZ_RELEASE_ASSERT(!mFlushing,
"Going away in MaybeFlush? Bad!");
}
void AccessibleCaretManager::Terminate() {

View File

@ -49,7 +49,7 @@ class Selection;
class AccessibleCaretManager {
public:
explicit AccessibleCaretManager(PresShell* aPresShell);
virtual ~AccessibleCaretManager();
virtual ~AccessibleCaretManager() = default;
// Called by AccessibleCaretEventHub to inform us that PresShell is destroyed.
void Terminate();
@ -329,6 +329,8 @@ class AccessibleCaretManager {
class LayoutFlusher final {
public:
~LayoutFlusher();
// This method could kill the shell, so callers to methods that call
// MaybeFlush should ensure the event hub that owns us is still alive.
//
@ -338,13 +340,14 @@ class AccessibleCaretManager {
[[nodiscard]] MOZ_CAN_RUN_SCRIPT Terminated
MaybeFlush(const AccessibleCaretManager& aAccessibleCaretManager);
// Whether we're flushing layout, used for sanity-checking.
bool mFlushing = false;
// Set to false to disallow flushing layout in some callbacks such as
// OnReflow(), OnScrollStart(), OnScrollStart(), or
// OnScrollPositionChanged().
bool mAllowFlushing = true;
private:
// Whether we're flushing layout, used for sanity-checking.
bool mFlushing = false;
};
LayoutFlusher mLayoutFlusher;