зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1599176 - Use sequence for borderBoxSize and contentBoxSize in ResizeObserverEntry. r=smaug,dholbert
Based on the spec, we should use FrozenArray for these two attributes. However, we don't support FrozenArray in Gecko now, so use sequence. spec: https://drafts.csswg.org/resize-observer/#resize-observer-entry-interface Differential Revision: https://phabricator.services.mozilla.com/D120276
This commit is contained in:
Родитель
06e47baa0c
Коммит
e1c99a968b
|
@ -342,6 +342,30 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserverEntry)
|
|||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
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 for now.
|
||||
//
|
||||
// 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(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 for now.
|
||||
//
|
||||
// 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();
|
||||
const WritingMode wm = frame ? frame->GetWritingMode() : WritingMode();
|
||||
|
|
|
@ -38,8 +38,8 @@ class ResizeObservation final : public LinkedListElement<ResizeObservation> {
|
|||
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(ResizeObservation)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ResizeObservation)
|
||||
|
||||
ResizeObservation(Element&, ResizeObserver&,
|
||||
ResizeObserverBoxOptions, WritingMode);
|
||||
ResizeObservation(Element&, ResizeObserver&, ResizeObserverBoxOptions,
|
||||
WritingMode);
|
||||
|
||||
Element* Target() const { return mTarget; }
|
||||
|
||||
|
@ -207,8 +207,8 @@ class ResizeObserverEntry final : public nsISupports, public nsWrapperCache {
|
|||
* Returns target's logical border-box size and content-box size as
|
||||
* ResizeObserverSize.
|
||||
*/
|
||||
ResizeObserverSize* BorderBoxSize() const { return mBorderBoxSize; }
|
||||
ResizeObserverSize* ContentBoxSize() const { return mContentBoxSize; }
|
||||
void GetBorderBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
|
||||
void GetContentBoxSize(nsTArray<RefPtr<ResizeObserverSize>>& aRetVal) const;
|
||||
|
||||
private:
|
||||
~ResizeObserverEntry() = default;
|
||||
|
|
|
@ -36,8 +36,12 @@ callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, R
|
|||
interface ResizeObserverEntry {
|
||||
readonly attribute Element target;
|
||||
readonly attribute DOMRectReadOnly contentRect;
|
||||
readonly attribute ResizeObserverSize borderBoxSize;
|
||||
readonly attribute ResizeObserverSize contentBoxSize;
|
||||
// We are using [Pure, Cached, Frozen] sequence until `FrozenArray` is implemented.
|
||||
// See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 for more details.
|
||||
[Frozen, Cached, Pure]
|
||||
readonly attribute sequence<ResizeObserverSize> borderBoxSize;
|
||||
[Frozen, Cached, Pure]
|
||||
readonly attribute sequence<ResizeObserverSize> contentBoxSize;
|
||||
};
|
||||
|
||||
[Pref="layout.css.resizeobserver.enabled",
|
||||
|
|
|
@ -5,12 +5,6 @@
|
|||
[ResizeObserverEntry interface: attribute devicePixelContentBoxSize]
|
||||
expected: FAIL
|
||||
|
||||
[ResizeObserverEntry interface: entry must inherit property "contentBoxSize" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[ResizeObserverEntry interface: entry must inherit property "borderBoxSize" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[ResizeObserverEntry must be primary interface of entry]
|
||||
expected:
|
||||
if (os == "linux") and debug and webrender and not fission: [PASS, FAIL]
|
||||
|
|
|
@ -8,33 +8,6 @@ bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1587973
|
|||
[test6: iframe notifications]
|
||||
expected: [PASS, FAIL]
|
||||
|
||||
[test14: observe the same target but using a different box should override the previous one]
|
||||
expected: FAIL
|
||||
|
||||
[test15: an observation is fired with box dimensions 0 when element's display property is set to inline]
|
||||
expected: FAIL
|
||||
|
||||
[test11: simple observation with vertical writing mode]
|
||||
expected: FAIL
|
||||
|
||||
[test10: simple border-box observation]
|
||||
expected: FAIL
|
||||
|
||||
[test13: an observation is fired after the change of writing mode when box's specified size comes from physical size properties.]
|
||||
expected: FAIL
|
||||
|
||||
[test12: no observation is fired after the change of writing mode when box's specified size comes from logical size properties.]
|
||||
expected: FAIL
|
||||
|
||||
[test9: simple content-box observation but keep border-box size unchanged]
|
||||
expected: FAIL
|
||||
|
||||
[test8: simple content-box observation]
|
||||
expected: FAIL
|
||||
|
||||
[test18: an observation is fired when device-pixel-content-box is being observed]
|
||||
expected: FAIL
|
||||
|
||||
[test17: Box sizing snd Resize Observer notifications]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -5,24 +5,9 @@ bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1587973
|
|||
[test15: observe svg:text content and border box]
|
||||
expected: FAIL
|
||||
|
||||
[test12: observe svg:rect content box]
|
||||
expected: FAIL
|
||||
|
||||
[guard]
|
||||
expected: NOTRUN
|
||||
|
||||
[test14: observe g:rect content and border box]
|
||||
expected: FAIL
|
||||
|
||||
[test16: observe g:rect content, border and device-pixel-content boxes]
|
||||
expected: FAIL
|
||||
|
||||
[guard]
|
||||
expected: NOTRUN
|
||||
|
||||
[test16: observe g:rect content, border and device-pixel-content boxes]
|
||||
expected: FAIL
|
||||
|
||||
[test13: observe svg:rect border box]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче