From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- dom/base/ResizeObserver.h | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'dom/base/ResizeObserver.h') diff --git a/dom/base/ResizeObserver.h b/dom/base/ResizeObserver.h index 6f1fc5b6cd..eaa0e1726d 100644 --- a/dom/base/ResizeObserver.h +++ b/dom/base/ResizeObserver.h @@ -121,9 +121,6 @@ class ResizeObservation final : public LinkedListElement { * https://drafts.csswg.org/resize-observer/#api */ class ResizeObserver final : public nsISupports, public nsWrapperCache { - using NativeCallback = void (*)( - const Sequence>&, ResizeObserver&); - ResizeObserver(Document& aDocument, NativeCallback aCallback); public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -131,9 +128,7 @@ class ResizeObserver final : public nsISupports, public nsWrapperCache { ResizeObserver(nsCOMPtr&& aOwner, Document* aDocument, ResizeObserverCallback& aCb) - : mOwner(std::move(aOwner)), - mDocument(aDocument), - mCallback(RefPtr(&aCb)) { + : mOwner(std::move(aOwner)), mDocument(aDocument), mCallback(&aCb) { MOZ_ASSERT(mOwner, "Need a non-null owner window"); MOZ_ASSERT(mDocument, "Need a non-null doc"); MOZ_ASSERT(mDocument == mOwner->GetExtantDoc()); @@ -176,11 +171,6 @@ class ResizeObserver final : public nsISupports, public nsWrapperCache { */ bool HasSkippedObservations() const { return mHasSkippedTargets; } - /** - * Returns whether this is an internal ResizeObserver with a native callback. - */ - bool HasNativeCallback() const { return mCallback.is(); } - /** * Invoke the callback function in JavaScript for all active observations * and pass the sequence of ResizeObserverEntry so JavaScript can access them. @@ -191,8 +181,21 @@ class ResizeObserver final : public nsISupports, public nsWrapperCache { */ MOZ_CAN_RUN_SCRIPT uint32_t BroadcastActiveObservations(); - static already_AddRefed CreateLastRememberedSizeObserver( - Document&); + /** + * Returns |aTarget|'s size in the form of gfx::Size (in pixels). + * If the target is an SVG that does not participate in CSS layout, + * its width and height are determined from bounding box. Otherwise, the + * relevant box is determined according to the |aBox| parameter. + * + * If dom.resize_observer.support_fragments is enabled, or if + * |aForceFragmentHandling| is true then the function reports the size of all + * fragments, and not just the first one. + * + * https://www.w3.org/TR/resize-observer-1/#calculate-box-size + */ + static AutoTArray CalculateBoxSize( + Element* aTarget, ResizeObserverBoxOptions aBox, + bool aForceFragmentHandling = false); protected: ~ResizeObserver() { Disconnect(); } @@ -200,7 +203,7 @@ class ResizeObserver final : public nsISupports, public nsWrapperCache { nsCOMPtr mOwner; // The window's document at the time of ResizeObserver creation. RefPtr mDocument; - Variant, NativeCallback> mCallback; + RefPtr mCallback; nsTArray> mActiveTargets; // The spec uses a list to store the skipped targets. However, it seems what // we want is to check if there are any skipped targets (i.e. existence). -- cgit v1.2.3