mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-25 00:27:29 +09:00
Issue #2340 - Return an array (actually frozen sequence) for {border|content}BoxSize
Resolves #2340
This commit is contained in:
parent
348f761a9b
commit
9cd7fd3bf4
3 changed files with 33 additions and 9 deletions
|
|
@ -303,6 +303,30 @@ ResizeObserverEntry::Constructor(const GlobalObject& aGlobal,
|
||||||
return observerEntry.forget();
|
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
|
void
|
||||||
ResizeObserverEntry::SetBorderBoxSize(const nsSize& aSize) {
|
ResizeObserverEntry::SetBorderBoxSize(const nsSize& aSize) {
|
||||||
nsIFrame* frame = mTarget->GetPrimaryFrame();
|
nsIFrame* frame = mTarget->GetPrimaryFrame();
|
||||||
|
|
|
||||||
|
|
@ -163,14 +163,10 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns target's logical border-box size and content-box size as
|
* Returns target's logical border-box size and content-box size as
|
||||||
* ResizeObserverSize.
|
* a ResizeObserverSize array.
|
||||||
*/
|
*/
|
||||||
ResizeObserverSize* BorderBoxSize() const {
|
void GetBorderBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
|
||||||
return mBorderBoxSize;
|
void GetContentBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
|
||||||
}
|
|
||||||
ResizeObserverSize* ContentBoxSize() const {
|
|
||||||
return mContentBoxSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set borderBoxSize.
|
// Set borderBoxSize.
|
||||||
void SetBorderBoxSize(const nsSize& aSize);
|
void SetBorderBoxSize(const nsSize& aSize);
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,12 @@ callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, R
|
||||||
interface ResizeObserverEntry {
|
interface ResizeObserverEntry {
|
||||||
readonly attribute Element target;
|
readonly attribute Element target;
|
||||||
readonly attribute DOMRectReadOnly? contentRect;
|
readonly attribute DOMRectReadOnly? contentRect;
|
||||||
readonly attribute ResizeObserverSize borderBoxSize;
|
// We are using a [Pure, Cached, Frozen] sequence since `FrozenArray` is not implemented in webidl.
|
||||||
readonly attribute ResizeObserverSize contentBoxSize;
|
// This is functionally similar enough. As of #2340 Mozilla has not implemented this yet, either.
|
||||||
|
[Frozen, Cached, Pure]
|
||||||
|
readonly attribute sequence<ResizeObserverSize> borderBoxSize;
|
||||||
|
[Frozen, Cached, Pure]
|
||||||
|
readonly attribute sequence<ResizeObserverSize> contentBoxSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
[Pref="layout.css.resizeobserver.enabled"]
|
[Pref="layout.css.resizeobserver.enabled"]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue