summaryrefslogtreecommitdiff
path: root/dom/base
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2023-10-14 14:16:26 +0200
committerMoonchild <moonchild@palemoon.org>2023-10-14 14:16:26 +0200
commit4df8e7664af00cc7d12edbd1b75be95f1a10cc8a (patch)
treea30a7c88822effa6f85ec110a910e6992d333a52 /dom/base
parentcdfd243b5ab6848fe169e6aef426d953b296ffbd (diff)
downloaduxp-4df8e7664af00cc7d12edbd1b75be95f1a10cc8a.tar.gz
Issue #2340 - Return an array (actually frozen sequence) for {border|content}BoxSize
Resolves #2340
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/ResizeObserver.cpp24
-rw-r--r--dom/base/ResizeObserver.h10
2 files changed, 27 insertions, 7 deletions
diff --git a/dom/base/ResizeObserver.cpp b/dom/base/ResizeObserver.cpp
index 51fd603217..ca25c06e43 100644
--- a/dom/base/ResizeObserver.cpp
+++ b/dom/base/ResizeObserver.cpp
@@ -303,6 +303,30 @@ ResizeObserverEntry::Constructor(const GlobalObject& aGlobal,
return observerEntry.forget();
}
+void ResizeObserverEntry::GetBorderBoxSize(
+ nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const {
+ // In the resize-observer-1 spec, there will only be a single
+ // ResizeObserverSize returned in the FrozenArray.
+ //
+ // Note: the usage of FrozenArray is to support elements that have multiple
+ // fragments, which occur in multi-column scenarios. See:
+ // https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface
+ aRetVal.Clear();
+ aRetVal.AppendElement(mBorderBoxSize);
+}
+
+void ResizeObserverEntry::GetContentBoxSize(
+ nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const {
+ // In the resize-observer-1 spec, there will only be a single
+ // ResizeObserverSize returned in the FrozenArray.
+ //
+ // Note: the usage of FrozenArray is to support elements that have multiple
+ // fragments, which occur in multi-column scenarios.
+ // https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface
+ aRetVal.Clear();
+ aRetVal.AppendElement(mContentBoxSize);
+}
+
void
ResizeObserverEntry::SetBorderBoxSize(const nsSize& aSize) {
nsIFrame* frame = mTarget->GetPrimaryFrame();
diff --git a/dom/base/ResizeObserver.h b/dom/base/ResizeObserver.h
index 56675693ce..ca87a080b4 100644
--- a/dom/base/ResizeObserver.h
+++ b/dom/base/ResizeObserver.h
@@ -163,14 +163,10 @@ public:
/**
* Returns target's logical border-box size and content-box size as
- * ResizeObserverSize.
+ * a ResizeObserverSize array.
*/
- ResizeObserverSize* BorderBoxSize() const {
- return mBorderBoxSize;
- }
- ResizeObserverSize* ContentBoxSize() const {
- return mContentBoxSize;
- }
+ void GetBorderBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
+ void GetContentBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
// Set borderBoxSize.
void SetBorderBoxSize(const nsSize& aSize);