commit 32d80d7cb1efb62547f39f47decbb85dcadb663f
parent eda45505a425ddf1969bb6561e689f9a497e70fb
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date: Sun, 2 Nov 2025 10:35:30 +0000
Bug 1997765 - Make CapturedContentInfo not require runtime initialization. r=layout-reviewers,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D270953
Diffstat:
2 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/layout/base/PresShell.cpp b/layout/base/PresShell.cpp
@@ -234,7 +234,7 @@ using namespace mozilla::layout;
using PaintFrameFlags = nsLayoutUtils::PaintFrameFlags;
typedef ScrollableLayerGuid::ViewID ViewID;
-MOZ_RUNINIT PresShell::CapturingContentInfo PresShell::sCapturingContentInfo;
+MOZ_CONSTINIT PresShell::CapturingContentInfo PresShell::sCapturingContentInfo;
// RangePaintInfo is used to paint ranges to offscreen buffers
struct RangePaintInfo {
diff --git a/layout/base/PresShell.h b/layout/base/PresShell.h
@@ -3506,20 +3506,15 @@ class PresShell final : public nsStubDocumentObserver,
dom::SelectionNodeCache* mSelectionNodeCache{nullptr};
struct CapturingContentInfo final {
- CapturingContentInfo()
- : mRemoteTarget(nullptr),
- mAllowed(false),
- mPointerLock(false),
- mRetargetToElement(false),
- mPreventDrag(false) {}
+ constexpr CapturingContentInfo() = default;
// capture should only be allowed during a mousedown event
StaticRefPtr<nsIContent> mContent;
- dom::BrowserParent* mRemoteTarget;
- bool mAllowed;
- bool mPointerLock;
- bool mRetargetToElement;
- bool mPreventDrag;
+ dom::BrowserParent* mRemoteTarget = nullptr;
+ bool mAllowed = false;
+ bool mPointerLock = false;
+ bool mRetargetToElement = false;
+ bool mPreventDrag = false;
};
static CapturingContentInfo sCapturingContentInfo;