WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 97335
DOM4: Add support for rest parameters to DOMTokenList
https://bugs.webkit.org/show_bug.cgi?id=97335
Summary
DOM4: Add support for rest parameters to DOMTokenList
Erik Arvidsson
Reported
2012-09-21 06:44:48 PDT
DOM4 allows passing multiple arguments to DOMTokenList add and remove.
Attachments
WIP
(45.22 KB, patch)
2012-09-26 07:55 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(65.41 KB, patch)
2012-09-26 13:27 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(65.99 KB, patch)
2012-09-26 13:40 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(66.02 KB, patch)
2012-09-26 14:28 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(66.55 KB, patch)
2012-09-27 07:52 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Patch
(64.78 KB, patch)
2012-09-27 09:20 PDT
,
Erik Arvidsson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Erik Arvidsson
Comment 1
2012-09-21 10:11:12 PDT
***
Bug 97343
has been marked as a duplicate of this bug. ***
Erik Arvidsson
Comment 2
2012-09-21 10:11:25 PDT
Discussion:
https://www.w3.org/Bugs/Public/show_bug.cgi?id=13999
Erik Arvidsson
Comment 3
2012-09-26 07:55:45 PDT
Created
attachment 165803
[details]
WIP
Erik Arvidsson
Comment 4
2012-09-26 07:57:50 PDT
The DOMTokenList.* files are not really done at this point. At this point I want feedback on the generated code. Does this approach look reasonable for variadic arguments?
Adam Barth
Comment 5
2012-09-26 09:12:16 PDT
> At this point I want feedback on the generated code. Does this approach look reasonable for variadic arguments?
It looks plausible to me, but this is really a question for haraken.
Ojan Vafai
Comment 6
2012-09-26 09:32:05 PDT
Comment on
attachment 165803
[details]
WIP View in context:
https://bugs.webkit.org/attachment.cgi?id=165803&action=review
> Source/WebCore/html/DOMTokenList.h:53 > virtual void add(const AtomicString&, ExceptionCode&) = 0; > virtual void remove(const AtomicString&, ExceptionCode&) = 0;
Just curious, with the new code, do these ever get called or do we always call the Vector versions? It's hard to tell since I'm unfamiliar with the bindings code. If the latter, can we delete these two methods or are they called internal to WebCore?
Erik Arvidsson
Comment 7
2012-09-26 09:41:26 PDT
(In reply to
comment #6
)
> (From update of
attachment 165803
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=165803&action=review
> > > Source/WebCore/html/DOMTokenList.h:53 > > virtual void add(const AtomicString&, ExceptionCode&) = 0; > > virtual void remove(const AtomicString&, ExceptionCode&) = 0; > > Just curious, with the new code, do these ever get called or do we always call the Vector versions? It's hard to tell since I'm unfamiliar with the bindings code. If the latter, can we delete these two methods or are they called internal to WebCore?
I'm working on these now. The DOM bindings will never call these but there is other WebCore code that calls them. I might just update the call sites.
Erik Arvidsson
Comment 8
2012-09-26 13:27:34 PDT
Created
attachment 165863
[details]
Patch
Erik Arvidsson
Comment 9
2012-09-26 13:40:36 PDT
Created
attachment 165868
[details]
Patch
Early Warning System Bot
Comment 10
2012-09-26 14:01:21 PDT
Comment on
attachment 165868
[details]
Patch
Attachment 165868
[details]
did not pass qt-ews (qt): Output:
http://queues.webkit.org/results/14021630
Early Warning System Bot
Comment 11
2012-09-26 14:06:20 PDT
Comment on
attachment 165868
[details]
Patch
Attachment 165868
[details]
did not pass qt-wk2-ews (qt): Output:
http://queues.webkit.org/results/14043260
Erik Arvidsson
Comment 12
2012-09-26 14:28:34 PDT
Created
attachment 165876
[details]
Patch
Kentaro Hara
Comment 13
2012-09-26 17:27:52 PDT
Comment on
attachment 165876
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=165876&action=review
The binding part and test cases LGTM with some comments. ojan: would you take a look at the WebCore/html part?
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2720 > + if ($argType eq "DOMString") { > + $nativeElementType = "String";
Why can't you use GetNativeType() for DOMString?
> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2724 > + $nativeElementType = $nativeElementType . " ";
Nit: $nativeElementType .= " ";
> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:1423 > + my $hasVariadic = 0; > my $numMandatoryParams = @{$function->parameters}; > foreach my $parameter (@{$function->parameters}) { > if ($parameter->extendedAttributes->{"Optional"}) { > push(@orExpression, GenerateParametersCheckExpression($numParameters, $function)); > $numMandatoryParams--; > } > + if ($parameter->isVariadic) { > + $hasVariadic = 1; > + last; > + } > $numParameters++; > } > - push(@orExpression, GenerateParametersCheckExpression($numParameters, $function)); > + if (!$hasVariadic) { > + push(@orExpression, GenerateParametersCheckExpression($numParameters, $function)); > + }
This looks correct, but shall we make the logic the same as the CodeGeneratorJS.pm one?
> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:1773 > + $nativeElementType = $nativeElementType . " ";
Nit: $nativeElementType .= " ";
> Source/WebCore/bindings/scripts/IDLParser.pm:251 > + my $isVariadic = $paramTypeSuffix eq "...";
tasak@ is about to land the new IDLParser.pm in a day (
https://bugs.webkit.org/show_bug.cgi?id=26398
). I'd be happy if you could modify the new IDLParser.
Erik Arvidsson
Comment 14
2012-09-27 07:06:52 PDT
Comment on
attachment 165876
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=165876&action=review
>> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:2720 >> + $nativeElementType = "String"; > > Why can't you use GetNativeType() for DOMString?
GetNativeType returns "const String&"
>> Source/WebCore/bindings/scripts/CodeGeneratorV8.pm:1423 >> + } > > This looks correct, but shall we make the logic the same as the CodeGeneratorJS.pm one?
Done.
>> Source/WebCore/bindings/scripts/IDLParser.pm:251 >> + my $isVariadic = $paramTypeSuffix eq "..."; > > tasak@ is about to land the new IDLParser.pm in a day (
https://bugs.webkit.org/show_bug.cgi?id=26398
). I'd be happy if you could modify the new IDLParser.
I see that it landed overnight. I'll rebase.
Erik Arvidsson
Comment 15
2012-09-27 07:52:29 PDT
Created
attachment 166000
[details]
Patch
Kentaro Hara
Comment 16
2012-09-27 08:03:31 PDT
Comment on
attachment 166000
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=166000&action=review
r+ for the V8 binding part and test cases. Please r+ it if the WebCore/html part is OK.
> Source/WebCore/bindings/scripts/IDLParser.pm:1249 > - $self->parseEllipsis(); > + $paramDataNode->isVariadic($self->parseEllipsis());
Great! The new IDL parser is much much easier to modify:)
> Source/WebCore/bindings/scripts/IDLStructure.pm:115 > our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; > > -our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|?]*)'; > -our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>?]*)'; > +our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|?.]*)'; > +our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>?.]*)'; > our $interfaceParameterSelector = '(in|out)\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . $supportedTypeSuffix . '\s*(' . $idlIdNs . '*)'; > > our $interfaceAttributeSelector = '\s*(static\s+)?(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)';
I think that these variables are no longer used by the IDL parser. I'll remove them in a follow-up patch.
Erik Arvidsson
Comment 17
2012-09-27 08:23:06 PDT
(In reply to
comment #16
)
> > Source/WebCore/bindings/scripts/IDLStructure.pm:115 > > our $typeNamespaceSelector = '((?:' . $idlId . '*::)*)\s*(' . $idlDataType . '*)'; > > > > -our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|?]*)'; > > -our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>?]*)'; > > +our $interfaceSelector = '(interface|exception)\s*((?:' . $extendedAttributeSyntax . ' )?)(' . $idlIdNs . '*)\s*(?::(\s*[^{]*))?{([-a-zA-Z0-9_"=\s(),;:\[\]<>&\|?.]*)'; > > +our $interfaceMethodSelector = '\s*((?:' . $extendedAttributeSyntax . ' )?)(static\s+)?' . $supportedTypes . '\s*(' . $idlIdNs . '*)\s*\(\s*([a-zA-Z0-9:\s,=\[\]<>?.]*)'; > > our $interfaceParameterSelector = '(in|out)\s*((?:' . $extendedAttributeSyntax . ' )?)' . $supportedTypes . $supportedTypeSuffix . '\s*(' . $idlIdNs . '*)'; > > > > our $interfaceAttributeSelector = '\s*(static\s+)?(readonly attribute|attribute)\s*(' . $extendedAttributeSyntax . ' )?' . $supportedTypes . '\s*(' . $idlType . '*)'; > > I think that these variables are no longer used by the IDL parser. I'll remove them in a follow-up patch.
Yeah, my patch works when I remove all of these
Erik Arvidsson
Comment 18
2012-09-27 09:20:13 PDT
Created
attachment 166017
[details]
Patch
WebKit Review Bot
Comment 19
2012-09-27 11:05:14 PDT
Comment on
attachment 166017
[details]
Patch Clearing flags on attachment: 166017 Committed
r129779
: <
http://trac.webkit.org/changeset/129779
>
WebKit Review Bot
Comment 20
2012-09-27 11:05:19 PDT
All reviewed patches have been landed. Closing bug.
Darin Adler
Comment 21
2012-09-27 16:33:52 PDT
I think we should investigate having the variadic string support use Vector<AtomicString> for the same reason that the single-argument functions use AtomicString.
Erik Arvidsson
Comment 22
2012-09-28 07:20:11 PDT
(In reply to
comment #21
)
> I think we should investigate having the variadic string support use Vector<AtomicString> for the same reason that the single-argument functions use AtomicString.
Agreed. I filed
bug 97911
Alexey Shvayka
Comment 23
2020-04-05 09:59:32 PDT
***
Bug 122528
has been marked as a duplicate of this bug. ***
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug