ResizeObserver.webidl (1707B)
1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://drafts.csswg.org/resize-observer/ 8 */ 9 10 enum ResizeObserverBoxOptions { 11 "border-box", 12 "content-box", 13 "device-pixel-content-box" 14 }; 15 16 dictionary ResizeObserverOptions { 17 ResizeObserverBoxOptions box = "content-box"; 18 }; 19 20 [Exposed=Window] 21 interface ResizeObserver { 22 [Throws] 23 constructor(ResizeObserverCallback callback); 24 25 undefined observe(Element target, optional ResizeObserverOptions options = {}); 26 undefined unobserve(Element target); 27 undefined disconnect(); 28 }; 29 30 callback ResizeObserverCallback = undefined (sequence<ResizeObserverEntry> entries, ResizeObserver observer); 31 32 [Exposed=Window] 33 interface ResizeObserverEntry { 34 readonly attribute Element target; 35 readonly attribute DOMRectReadOnly contentRect; 36 // We are using [Pure, Cached, Frozen] sequence until `FrozenArray` is implemented. 37 // See https://bugzilla.mozilla.org/show_bug.cgi?id=1236777 for more details. 38 [Frozen, Cached, Pure] 39 readonly attribute sequence<ResizeObserverSize> borderBoxSize; 40 [Frozen, Cached, Pure] 41 readonly attribute sequence<ResizeObserverSize> contentBoxSize; 42 [Frozen, Cached, Pure] 43 readonly attribute sequence<ResizeObserverSize> devicePixelContentBoxSize; 44 }; 45 46 [Exposed=Window] 47 interface ResizeObserverSize { 48 readonly attribute unrestricted double inlineSize; 49 readonly attribute unrestricted double blockSize; 50 };