<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>295854</bug_id>
          
          <creation_ts>2025-07-13 01:45:08 -0700</creation_ts>
          <short_desc>[WebIDL] Add WebIDL support for [Enumerated] extended attribute, and related attributes: [MissingValueDefault], [InvalidValueDefault]</short_desc>
          <delta_ts>2025-08-02 15:00:12 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Bindings</component>
          <version>Other</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Rahim Abdi">rahim_abdi</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>cdumez</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2129673</commentid>
    <comment_count>0</comment_count>
    <who name="Rahim Abdi">rahim_abdi</who>
    <bug_when>2025-07-13 01:45:08 -0700</bug_when>
    <thetext>In .idl files, it would be helpful to simplify defining enumerated attributes to streamline getter/setter code generation (and not have to code these manually). This is particularly useful for enumerated attributes since they are limited to known values, and have two optional, special states: missing value default and invalid value default; all of these could be specified as part of an attribute&apos;s .idl declaration.

For example (ignoring that these may not be truly valid values):

CURRENT:

[CEReactions=Needed, Reflect=aria_orientation]      attribute DOMString? ariaOrientation;

PROPOSED:

[CEReactions=Needed, Reflect=aria_orientation, ReflectOnly=(&quot;horizontal&quot;, &quot;vertical&quot;, &quot;undefined&quot;), ReflectMissing=(&quot;vertical&quot;), ReflectInvalid=(&quot;horizontal&quot;)]      attribute DOMString? ariaOrientation;

Per HTML spec, DOMString and nullable DOMString (DOMString?) do not require that the attribute be enumerated however, where a content attribute is enumerated, it must be limited to known values; see DOMString and DOMString reflection algorithm: https://html.spec.whatwg.org/#reflecting-content-attributes-in-idl-attributes.

Note: These new extended attributes are not defined in WebIDL, although they are described in WebIDL spec prose. Also, Chrome already supports them: https://chromium.googlesource.com/chromium/src/+/HEAD/third_party/blink/renderer/bindings/IDLExtendedAttributes.md#reflectonly.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2129674</commentid>
    <comment_count>1</comment_count>
    <who name="Rahim Abdi">rahim_abdi</who>
    <bug_when>2025-07-13 01:57:25 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/47953</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2131456</commentid>
    <comment_count>2</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-07-20 01:46:12 -0700</bug_when>
    <thetext>&lt;rdar://problem/156249490&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2131511</commentid>
    <comment_count>3</comment_count>
    <who name="Rahim Abdi">rahim_abdi</who>
    <bug_when>2025-07-20 19:20:57 -0700</bug_when>
    <thetext>New approach from PR comment on improving syntax of enumerated attributes using &apos;enum&apos; IDL type: https://github.com/WebKit/WebKit/pull/47953#pullrequestreview-3014249574.

To better support .idl definition of reflected DOMString/DOMString? attributes, the following should be added:
- [Enumerated] = allowed on attributes that use [Reflect] and used to specify two or more known values for the attribute
- [MissingValueDefault] = the value of the IDL attribute when the content attribute is missing: https://html.spec.whatwg.org/#missing-value-default
- [InvalidValueDefault] = the value of the IDL attribute when the content attribute has a non-permitted value: https://html.spec.whatwg.org/#invalid-value-default
- [EmptyValueDefault] = the value of the IDL attribute when the content attribute is present without a value, e.g., &lt;div someAttr&gt; (as opposed to &lt;div someAttr=&quot;foo&quot;&gt;

For example:

[
    MissingValueDefault=“Value1”,
    InvalidValueDefault=“Value3”,
] enum attrnameAttribute {
    &quot;Value1&quot;, 
    &quot;Value2&quot;, 
    &quot;Value3&quot;
}

…

[Reflect=myattr, Enumerated=attrnameAttribute] attribute DOMString? myattr;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2134051</commentid>
    <comment_count>4</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-08-02 15:00:09 -0700</bug_when>
    <thetext>Committed 298172@main (5c150f7a3b58): &lt;https://commits.webkit.org/298172@main&gt;

Reviewed commits have been landed. Closing PR #47953 and removing active labels.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>