Title: [267953] trunk/Source/WebCore
Revision
267953
Author
wei...@apple.com
Date
2020-10-04 21:00:13 -0700 (Sun, 04 Oct 2020)

Log Message

[WebIDL] Address consistency around [SameObject] extended attributes
https://bugs.webkit.org/show_bug.cgi?id=217303

Reviewed by Darin Adler.

There isn't any real value in keeping comments around in the IDLs saying:

    // FIXME: Add [SameObject] once it is supported

It's unclear what we would want the bindings generator to do with [SameObject],
perhaps for wrapper types, assert if the implementation doesn't return the same
object each time in a debug build, perhaps error out if a non-wrapper type doesn't
also have CachedAttribute or maybe just have SameObject imply it. Regardless,
in the mean time, there is no harm in just annotating the types with the attribute
and letting the generator do nothing while we think.

* Modules/fetch/FetchRequest.idl:
* Modules/fetch/FetchResponse.idl:
* Modules/mediastream/MediaStreamTrackEvent.idl:
* css/DocumentOrShadowRoot+CSSOM.idl:
* css/ElementCSSInlineStyle.idl:
* dom/DOMQuad.idl:
* dom/DataTransfer.idl:
* dom/Document+HTML.idl:
* dom/Document+HTMLObsolete.idl:
* dom/Document.idl:
* dom/Element.idl:
* dom/MutationRecord.idl:
* dom/Node.idl:
* dom/NodeIterator.idl:
* dom/ParentNode.idl:
* dom/TreeWalker.idl:
* html/HTMLOrForeignElement.idl:
* html/HTMLSelectElement.idl:
* page/Location.idl:
* svg/SVGFitToViewBox.idl:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (267952 => 267953)


--- trunk/Source/WebCore/ChangeLog	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/ChangeLog	2020-10-05 04:00:13 UTC (rev 267953)
@@ -1,3 +1,42 @@
+2020-10-04  Sam Weinig  <wei...@apple.com>
+
+        [WebIDL] Address consistency around [SameObject] extended attributes
+        https://bugs.webkit.org/show_bug.cgi?id=217303
+
+        Reviewed by Darin Adler.
+
+        There isn't any real value in keeping comments around in the IDLs saying:
+        
+            // FIXME: Add [SameObject] once it is supported
+        
+        It's unclear what we would want the bindings generator to do with [SameObject],
+        perhaps for wrapper types, assert if the implementation doesn't return the same
+        object each time in a debug build, perhaps error out if a non-wrapper type doesn't
+        also have CachedAttribute or maybe just have SameObject imply it. Regardless,
+        in the mean time, there is no harm in just annotating the types with the attribute
+        and letting the generator do nothing while we think.
+
+        * Modules/fetch/FetchRequest.idl:
+        * Modules/fetch/FetchResponse.idl:
+        * Modules/mediastream/MediaStreamTrackEvent.idl:
+        * css/DocumentOrShadowRoot+CSSOM.idl:
+        * css/ElementCSSInlineStyle.idl:
+        * dom/DOMQuad.idl:
+        * dom/DataTransfer.idl:
+        * dom/Document+HTML.idl:
+        * dom/Document+HTMLObsolete.idl:
+        * dom/Document.idl:
+        * dom/Element.idl:
+        * dom/MutationRecord.idl:
+        * dom/Node.idl:
+        * dom/NodeIterator.idl:
+        * dom/ParentNode.idl:
+        * dom/TreeWalker.idl:
+        * html/HTMLOrForeignElement.idl:
+        * html/HTMLSelectElement.idl:
+        * page/Location.idl:
+        * svg/SVGFitToViewBox.idl:
+
 2020-10-04  Tyler Wilcock  <twilc...@protonmail.com>
 
         Presence of CSS variable causes a background url() to get resolved with a different base

Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (267952 => 267953)


--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -40,7 +40,7 @@
 
     readonly attribute ByteString method;
     [ImplementedAs=urlString] readonly attribute USVString url;
-    readonly attribute FetchHeaders headers; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute FetchHeaders headers;
 
     readonly attribute FetchRequestDestination destination;
     readonly attribute USVString referrer;

Modified: trunk/Source/WebCore/Modules/fetch/FetchResponse.idl (267952 => 267953)


--- trunk/Source/WebCore/Modules/fetch/FetchResponse.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/Modules/fetch/FetchResponse.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -55,7 +55,7 @@
     readonly attribute unsigned short status;
     readonly attribute boolean ok;
     readonly attribute ByteString statusText;
-    readonly attribute FetchHeaders headers; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute FetchHeaders headers;
 
     [CallWith=ScriptExecutionContext, MayThrowException, NewObject] FetchResponse clone();
 };

Modified: trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackEvent.idl (267952 => 267953)


--- trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackEvent.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/Modules/mediastream/MediaStreamTrackEvent.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -28,8 +28,7 @@
 ] interface MediaStreamTrackEvent : Event {
     constructor(DOMString type, MediaStreamTrackEventInit eventInitDict);
 
-    // FIXME: missing [SameObject]
-    readonly attribute MediaStreamTrack track;
+    [SameObject] readonly attribute MediaStreamTrack track;
 };
 
 dictionary MediaStreamTrackEventInit : EventInit {

Modified: trunk/Source/WebCore/css/DocumentOrShadowRoot+CSSOM.idl (267952 => 267953)


--- trunk/Source/WebCore/css/DocumentOrShadowRoot+CSSOM.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/css/DocumentOrShadowRoot+CSSOM.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -25,6 +25,6 @@
 
 // https://drafts.csswg.org/cssom/#extensions-to-the-document-or-shadow-root-interface
 partial interface mixin DocumentOrShadowRoot {
-    readonly attribute StyleSheetList styleSheets; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute StyleSheetList styleSheets;
 };
 

Modified: trunk/Source/WebCore/css/ElementCSSInlineStyle.idl (267952 => 267953)


--- trunk/Source/WebCore/css/ElementCSSInlineStyle.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/css/ElementCSSInlineStyle.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -26,6 +26,6 @@
 // CSSOM extensions to HTMLElement / SVGElement:
 // https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-interface
 interface mixin ElementCSSInlineStyle {
-    [ImplementedAs=cssomStyle, PutForwards=cssText] readonly attribute CSSStyleDeclaration style; // FIXME: Should be [SameObject].
-    [ImplementedAs=ensureAttributeStyleMap, CachedAttribute, EnabledAtRuntime=CSSTypedOM, Conditional=CSS_TYPED_OM] readonly attribute StylePropertyMap attributeStyleMap; // FIXME: Should be [SameObject].
+    [ImplementedAs=cssomStyle, SameObject, PutForwards=cssText] readonly attribute CSSStyleDeclaration style;
+    [ImplementedAs=ensureAttributeStyleMap, SameObject, CachedAttribute, EnabledAtRuntime=CSSTypedOM, Conditional=CSS_TYPED_OM] readonly attribute StylePropertyMap attributeStyleMap;
 };

Modified: trunk/Source/WebCore/dom/DOMQuad.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/DOMQuad.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/DOMQuad.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -35,10 +35,10 @@
     [NewObject] static DOMQuad fromRect(optional DOMRectInit other);
     [NewObject] static DOMQuad fromQuad(optional DOMQuadInit other);
 
-    readonly attribute DOMPoint p1; // FIXME: Should be [SameObject].
-    readonly attribute DOMPoint p2; // FIXME: Should be [SameObject].
-    readonly attribute DOMPoint p3; // FIXME: Should be [SameObject].
-    readonly attribute DOMPoint p4; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute DOMPoint p1;
+    [SameObject] readonly attribute DOMPoint p2;
+    [SameObject] readonly attribute DOMPoint p3;
+    [SameObject] readonly attribute DOMPoint p4;
     [NewObject] DOMRect getBounds();
 
     [Default] object toJSON();

Modified: trunk/Source/WebCore/dom/DataTransfer.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/DataTransfer.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/DataTransfer.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -35,8 +35,7 @@
     attribute DOMString dropEffect;
     attribute DOMString effectAllowed;
 
-    // FIXME: items should use [SameObject] once that is supported.
-    [EnabledBySetting=DataTransferItems, CallWith=Document] readonly attribute DataTransferItemList items;
+    [SameObject, EnabledBySetting=DataTransferItems, CallWith=Document] readonly attribute DataTransferItemList items;
 
     undefined setDragImage(Element? image, long x, long y); // FIXME: Element argument is not nullable in the HTML standard.
 
@@ -44,6 +43,5 @@
     [CallWith=Document] DOMString getData(DOMString format);
     undefined setData(DOMString format, DOMString data);
     undefined clearData(optional DOMString format);
-    // FIXME: files should use [SameObject] once that is supported.
-    [CallWith=Document] readonly attribute FileList files;
+    [SameObject, CallWith=Document] readonly attribute FileList files;
 };

Modified: trunk/Source/WebCore/dom/Document+HTML.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/Document+HTML.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/Document+HTML.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -43,12 +43,12 @@
     [CEReactions] attribute DOMString dir;
     [CEReactions, DOMJIT=Getter, ImplementedAs=bodyOrFrameset] attribute HTMLElement? body;
     readonly attribute HTMLHeadElement? head;
-    readonly attribute HTMLCollection images; // Should be [SameObject].
-    readonly attribute HTMLCollection embeds; // Should be [SameObject].
-    readonly attribute HTMLCollection plugins; // Should be [SameObject].
-    readonly attribute HTMLCollection links; // Should be [SameObject].
-    readonly attribute HTMLCollection forms; // Should be [SameObject].
-    readonly attribute HTMLCollection scripts; // Should be [SameObject].
+    [SameObject] readonly attribute HTMLCollection images;
+    [SameObject] readonly attribute HTMLCollection embeds;
+    [SameObject] readonly attribute HTMLCollection plugins;
+    [SameObject] readonly attribute HTMLCollection links;
+    [SameObject] readonly attribute HTMLCollection forms;
+    [SameObject] readonly attribute HTMLCollection scripts;
     NodeList getElementsByName([AtomString] DOMString elementName);
     // currentScript is specified to use type HTMLOrSVGScriptElement?, but implemented using
     // shared base type Element? to optimize implementation without an observable difference.

Modified: trunk/Source/WebCore/dom/Document+HTMLObsolete.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/Document+HTMLObsolete.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/Document+HTMLObsolete.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -31,8 +31,8 @@
     [CEReactions] attribute [LegacyNullToEmptyString] DOMString alinkColor;
     [CEReactions] attribute [LegacyNullToEmptyString] DOMString bgColor;
 
-    readonly attribute HTMLCollection anchors; // Should be [SameObject].
-    readonly attribute HTMLCollection applets; // Should be [SameObject].
+    [SameObject] readonly attribute HTMLCollection anchors;
+    [SameObject] readonly attribute HTMLCollection applets;
 
     undefined clear();
     undefined captureEvents();
@@ -39,5 +39,5 @@
     undefined releaseEvents();
 
     // FIXME: 'all' is not specified to be [Replaceable].
-    [Replaceable] readonly attribute HTMLAllCollection all; // Should be [SameObject].
+    [Replaceable, SameObject] readonly attribute HTMLAllCollection all;
 };

Modified: trunk/Source/WebCore/dom/Document.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/Document.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/Document.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -45,7 +45,7 @@
 ] interface Document : Node {
     [CallWith=Document] constructor();
 
-    readonly attribute DOMImplementation implementation; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute DOMImplementation implementation;
     [ImplementedAs=urlForBindings] readonly attribute USVString URL;
     [ImplementedAs=urlForBindings] readonly attribute USVString documentURI;
     readonly attribute DOMString compatMode;

Modified: trunk/Source/WebCore/dom/Element.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/Element.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/Element.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -33,12 +33,12 @@
 
     [CEReactions, Reflect] attribute DOMString id;
     [CEReactions, Reflect=class] attribute DOMString className;
-    [PutForwards=value] readonly attribute DOMTokenList classList; // FIXME: Should be [SameObject].
+    [SameObject, PutForwards=value] readonly attribute DOMTokenList classList;
     [CEReactions, Reflect, Unscopable] attribute DOMString slot;
     [SameObject, PutForwards=value] readonly attribute DOMTokenList part;
 
     [DOMJIT=ReadDOM] boolean hasAttributes();
-    readonly attribute NamedNodeMap attributes; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute NamedNodeMap attributes;
     sequence<DOMString> getAttributeNames();
     [DOMJIT=ReadDOM] DOMString? getAttribute(DOMString qualifiedName);
     DOMString? getAttributeNS(DOMString? namespaceURI, DOMString localName);

Modified: trunk/Source/WebCore/dom/MutationRecord.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/MutationRecord.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/MutationRecord.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -28,6 +28,7 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// https://dom.spec.whatwg.org/#interface-mutationrecord
 [    
     SkipVTableValidation,
     JSCustomMarkFunction,
@@ -34,17 +35,12 @@
     Exposed=Window
 ] interface MutationRecord {
     readonly attribute DOMString type;
-
-    // FIXME: The following attributes should be [SameObject] once we support it.
-    readonly attribute Node target;
-    readonly attribute NodeList addedNodes;
-    readonly attribute NodeList removedNodes;
-
+    [SameObject] readonly attribute Node target;
+    [SameObject] readonly attribute NodeList addedNodes;
+    [SameObject] readonly attribute NodeList removedNodes;
     readonly attribute Node? previousSibling;
     readonly attribute Node? nextSibling;
-
     readonly attribute DOMString? attributeName;
     readonly attribute DOMString? attributeNamespace;
-
     readonly attribute DOMString? oldValue;
 };

Modified: trunk/Source/WebCore/dom/Node.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/Node.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/Node.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -51,7 +51,7 @@
     [DOMJIT=Getter] readonly attribute Node? parentNode;
     readonly attribute Element? parentElement;
     boolean hasChildNodes();
-    readonly attribute NodeList childNodes; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute NodeList childNodes;
     [DOMJIT=Getter] readonly attribute Node? firstChild;
     [DOMJIT=Getter] readonly attribute Node? lastChild;
     [DOMJIT=Getter] readonly attribute Node? previousSibling;

Modified: trunk/Source/WebCore/dom/NodeIterator.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/NodeIterator.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/NodeIterator.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -18,6 +18,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// https://dom.spec.whatwg.org/#interface-nodeiterator
 [
     ExportToWrappedFunction,
     ImplementationLacksVTable,
@@ -24,7 +25,7 @@
     JSCustomMarkFunction,
     Exposed=Window
 ] interface NodeIterator {
-    readonly attribute Node root; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute Node root;
     readonly attribute Node referenceNode;
     readonly attribute boolean pointerBeforeReferenceNode;
     readonly attribute unsigned long whatToShow;

Modified: trunk/Source/WebCore/dom/ParentNode.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/ParentNode.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/ParentNode.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -26,7 +26,7 @@
 
 // https://dom.spec.whatwg.org/#interface-parentnode
 interface mixin ParentNode {
-    readonly attribute HTMLCollection children; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute HTMLCollection children;
     readonly attribute Element? firstElementChild;
     readonly attribute Element? lastElementChild;
     readonly attribute unsigned long childElementCount;

Modified: trunk/Source/WebCore/dom/TreeWalker.idl (267952 => 267953)


--- trunk/Source/WebCore/dom/TreeWalker.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/dom/TreeWalker.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -18,6 +18,7 @@
  * Boston, MA 02110-1301, USA.
  */
 
+// https://dom.spec.whatwg.org/#interface-treewalker
 [
     ExportToWrappedFunction,
     ImplementationLacksVTable,
@@ -24,7 +25,7 @@
     JSCustomMarkFunction,
     Exposed=Window
 ] interface TreeWalker {
-    readonly attribute Node root; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute Node root;
     readonly attribute unsigned long whatToShow;
     readonly attribute NodeFilter? filter;
     attribute Node currentNode;

Modified: trunk/Source/WebCore/html/HTMLOrForeignElement.idl (267952 => 267953)


--- trunk/Source/WebCore/html/HTMLOrForeignElement.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/html/HTMLOrForeignElement.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -27,7 +27,7 @@
 // FIXME: update above link when this change has been implemented:
 // https://github.com/whatwg/html/issues/4702
 interface mixin HTMLOrForeignElement {
-    readonly attribute DOMStringMap dataset; // FIXME: Should be [SameObject].
+    [SameObject] readonly attribute DOMStringMap dataset;
     // FIXME: Implement 'nonce'.
     // attribute DOMString nonce; // intentionally no [CEReactions]
 

Modified: trunk/Source/WebCore/html/HTMLSelectElement.idl (267952 => 267953)


--- trunk/Source/WebCore/html/HTMLSelectElement.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/html/HTMLSelectElement.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -34,7 +34,7 @@
 
     readonly attribute DOMString type;
 
-    /* [SameObject] */ readonly attribute HTMLOptionsCollection options;
+    [SameObject] readonly attribute HTMLOptionsCollection options;
     [CEReactions] attribute unsigned long length;
     getter HTMLOptionElement? item(unsigned long index); // FIXME: The spec has this returning Element?.
     HTMLOptionElement? namedItem([RequiresExistingAtomString] DOMString name);
@@ -43,7 +43,7 @@
     [CEReactions] undefined remove(long index);
     [CEReactions] setter undefined (unsigned long index, HTMLOptionElement? option);
 
-    /* [SameObject] */ readonly attribute HTMLCollection selectedOptions;
+    [SameObject] readonly attribute HTMLCollection selectedOptions;
     attribute long selectedIndex;
     attribute DOMString value;
 

Modified: trunk/Source/WebCore/page/Location.idl (267952 => 267953)


--- trunk/Source/WebCore/page/Location.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/page/Location.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -26,6 +26,7 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+// https://html.spec.whatwg.org/multipage/history.html#location
 [
     CheckSecurity,
     CustomDefineOwnProperty,
@@ -62,6 +63,5 @@
 
     readonly attribute USVString origin;
 
-    // FIXME: Add support for SameObject.
-    [LegacyUnforgeable, CachedAttribute] readonly attribute DOMStringList ancestorOrigins;
+    [LegacyUnforgeable, SameObject, CachedAttribute] readonly attribute DOMStringList ancestorOrigins;
 };

Modified: trunk/Source/WebCore/svg/SVGFitToViewBox.idl (267952 => 267953)


--- trunk/Source/WebCore/svg/SVGFitToViewBox.idl	2020-10-05 03:25:52 UTC (rev 267952)
+++ trunk/Source/WebCore/svg/SVGFitToViewBox.idl	2020-10-05 04:00:13 UTC (rev 267953)
@@ -26,8 +26,6 @@
 
 // https://svgwg.org/svg2-draft/types.html#InterfaceSVGFitToViewBox
 interface mixin SVGFitToViewBox {
-    // FIXME: 'viewBox' should be annotated with [SameObject].
-    readonly attribute SVGAnimatedRect viewBox;
-    // FIXME: 'preserveAspectRatio' should be annotated with [SameObject].
-    readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
+    [SameObject] readonly attribute SVGAnimatedRect viewBox;
+    [SameObject] readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio;
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to