diff options
author | Linus Groh <mail@linusgroh.de> | 2023-03-05 21:55:22 +0000 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2023-03-05 21:59:16 +0000 |
commit | 725a758c66f411a7142da574bcb60764f165e0ae (patch) | |
tree | 75b5ec96fa7717a2b927cc09718369ce499835b5 | |
parent | cc1e8a4e9fa9629604c8478bd29deb4fc6ccc277 (diff) | |
download | serenity-725a758c66f411a7142da574bcb60764f165e0ae.zip |
LibIDL: Also parse extended attributes after 'optional'
From the WebIDL grammar:
(https://webidl.spec.whatwg.org/#prod-Argument)
Argument ::
ExtendedAttributeList ArgumentRest
ArgumentRest ::
optional TypeWithExtendedAttributes ArgumentName Default
TypeWithExtendedAttributes ::
ExtendedAttributeList Type
One IDL file has been updated to match the spec literally, as it can now
be parsed properly.
-rw-r--r-- | Userland/Libraries/LibIDL/IDLParser.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl | 2 |
2 files changed, 7 insertions, 1 deletions
diff --git a/Userland/Libraries/LibIDL/IDLParser.cpp b/Userland/Libraries/LibIDL/IDLParser.cpp index 7f12d0b313..87adc465bc 100644 --- a/Userland/Libraries/LibIDL/IDLParser.cpp +++ b/Userland/Libraries/LibIDL/IDLParser.cpp @@ -298,6 +298,12 @@ Vector<Parameter> Parser::parse_parameters() bool optional = lexer.consume_specific("optional"); if (optional) consume_whitespace(); + if (lexer.consume_specific('[')) { + // Not explicitly forbidden by the grammar but unlikely to happen in practice - if it does, + // we'll have to teach the parser how to merge two sets of extended attributes. + VERIFY(extended_attributes.is_empty()); + extended_attributes = parse_extended_attributes(); + } auto type = parse_type(); bool variadic = lexer.consume_specific("..."sv); consume_whitespace(); diff --git a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl index 02dbc94f5e..725ca646bc 100644 --- a/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl +++ b/Userland/Libraries/LibWeb/CSS/CSSStyleDeclaration.idl @@ -10,7 +10,7 @@ interface CSSStyleDeclaration { CSSOMString getPropertyValue(CSSOMString property); CSSOMString getPropertyPriority(CSSOMString property); - [CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, [LegacyNullToEmptyString] optional CSSOMString priority = ""); + [CEReactions] undefined setProperty(CSSOMString property, [LegacyNullToEmptyString] CSSOMString value, optional [LegacyNullToEmptyString] CSSOMString priority = ""); [CEReactions] CSSOMString removeProperty(CSSOMString property); }; |