Issue #2340 - Return an array (actually frozen sequence) for {border|content}BoxSize

Resolves #2340
This commit is contained in:
Moonchild 2023-10-14 14:16:26 +02:00 committed by roytam1
commit 9cd7fd3bf4
3 changed files with 33 additions and 9 deletions

View file

@ -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();