Issue #2388 - Part 2: move focus at every selection change when it's called by JS

This commit is contained in:
Moonchild 2024-01-16 21:28:04 +01:00 committed by roytam1
commit 681193a256
4 changed files with 202 additions and 16 deletions

View file

@ -413,7 +413,7 @@ protected:
// Assume that this is guaranteed that this is held by the caller when
// this is used. (Note that we cannot use AutoRestore for mCalledByJS
// due to a bit field.)
class MOZ_RAII AutoCalledByJSSetter final
class MOZ_RAII AutoCalledByJSRestore final
{
private:
nsRange& mRange;
@ -421,18 +421,18 @@ protected:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public:
explicit AutoCalledByJSSetter(nsRange& aRange
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
explicit AutoCalledByJSRestore(nsRange& aRange
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mRange(aRange)
, mOldValue(aRange.mCalledByJS)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mRange.mCalledByJS = true;
}
~AutoCalledByJSSetter()
~AutoCalledByJSRestore()
{
mRange.mCalledByJS = mOldValue;
}
bool SavedValue() const { return mOldValue; }
};
struct MOZ_STACK_CLASS AutoInvalidateSelection