Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5c150f7a3b5880d65eb13e92222e2d177846693d
      
https://github.com/WebKit/WebKit/commit/5c150f7a3b5880d65eb13e92222e2d177846693d
  Author: Rahim Abdi <[email protected]>
  Date:   2025-08-02 (Sat, 02 Aug 2025)

  Changed paths:
    M Source/WebCore/bindings/scripts/CodeGenerator.pm
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/bindings/scripts/IDLAttributes.json
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
    M Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
    M Source/WebCore/bindings/scripts/test/TestObj.idl
    M Source/WebCore/html/HTMLIFrameElement.cpp
    M Source/WebCore/html/HTMLIFrameElement.h
    M Source/WebCore/html/HTMLIFrameElement.idl
    M Source/WebCore/html/HTMLImageElement.cpp
    M Source/WebCore/html/HTMLImageElement.h
    M Source/WebCore/html/HTMLImageElement.idl

  Log Message:
  -----------
  [WebIDL] Add WebIDL support for [Enumerated] extended attribute and related 
attributes [MissingValueDefault],[InvalidValueDefault]
https://bugs.webkit.org/show_bug.cgi?id=295854
rdar://problem/156249490

Reviewed by Darin Adler.

To simplify .idl definitions of DOMString/DOMString? reflected enumerated 
attributes (https://html.spec.whatwg.org/#keywords-and-enumerated-attributes),
and reduce manual generation of bindings code, this PR adds 3 new WebKitIDL 
extended attributes:
- [Enumerated]
- [MissingValueDefault]
- [InvalidValueDefault]

These attributes provide bindings codegen for C++ getters/setters using the 
specified enum. For example,
given a nullable enumerated attr that is limited to known values, its IDL 
definition would look like:

enum AttrEnum { "value1", "value2",..."valueN" }

[Reflect, Enumerated=AttrEnum] attribute DOMString? attr;

Optionally, a missing and/or invalid value default can be supplied to the enum 
definition, e.g.,:

[MissingValueDefault="value1", InvalidValueDefault="value2"] enum AttrEnum { 
"value1", "value2"..."valueN" }

In addition to adding TestObj.idl tests, the loading attribute for 
HTMLImageElement and HTMLIFrameElement now use these new extended attributes.

* Source/WebCore/bindings/scripts/IDLAttributes.json
* Source/WebCore/bindings/scripts/CodeGenerator.pm
* Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
* Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
* Source/WebCore/bindings/scripts/test/JS/JSTestObj.h
* Source/WebCore/bindings/scripts/test/TestObj.idl
* Source/WebCore/html/HTMLImageElement.cpp
* Source/WebCore/html/HTMLImageElement.h
* Source/WebCore/html/HTMLImageElement.idl
* Source/WebCore/html/HTMLIFrameElement.cpp
* Source/WebCore/html/HTMLIFrameElement.h
* Source/WebCore/html/HTMLIFrameElement.idl

Canonical link: https://commits.webkit.org/298172@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to