Title: [200110] trunk/Source/WebCore
Revision
200110
Author
[email protected]
Date
2016-04-26 15:53:54 -0700 (Tue, 26 Apr 2016)

Log Message

[Web IDL] Specify default values for optional parameters of type 'unsigned long'
https://bugs.webkit.org/show_bug.cgi?id=157043

Reviewed by Alex Christensen.

Specify default values for optional parameters of type 'unsigned long' and let
the bindings generator use WTF::Optional<> for the parameters that do not have
such default value.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::createScriptProcessor): Deleted.
(WebCore::AudioContext::createChannelSplitter): Deleted.
(WebCore::AudioContext::createChannelMerger): Deleted.
* Modules/webaudio/AudioContext.h:
* Modules/webaudio/AudioContext.idl:
* bindings/scripts/CodeGeneratorJS.pm:
(CanUseWTFOptionalForParameter): Deleted.
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::addRule):
* css/CSSStyleSheet.h:
* inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::addRule):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200109 => 200110)


--- trunk/Source/WebCore/ChangeLog	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/ChangeLog	2016-04-26 22:53:54 UTC (rev 200110)
@@ -1,3 +1,28 @@
+2016-04-26  Chris Dumez  <[email protected]>
+
+        [Web IDL] Specify default values for optional parameters of type 'unsigned long'
+        https://bugs.webkit.org/show_bug.cgi?id=157043
+
+        Reviewed by Alex Christensen.
+
+        Specify default values for optional parameters of type 'unsigned long' and let
+        the bindings generator use WTF::Optional<> for the parameters that do not have
+        such default value.
+
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::createScriptProcessor): Deleted.
+        (WebCore::AudioContext::createChannelSplitter): Deleted.
+        (WebCore::AudioContext::createChannelMerger): Deleted.
+        * Modules/webaudio/AudioContext.h:
+        * Modules/webaudio/AudioContext.idl:
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (CanUseWTFOptionalForParameter): Deleted.
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::addRule):
+        * css/CSSStyleSheet.h:
+        * inspector/InspectorStyleSheet.cpp:
+        (WebCore::InspectorStyleSheet::addRule):
+
 2016-04-26  Ryosuke Niwa  <[email protected]>
 
         ASSERTION FAILED: m_templateInsertionModes.isEmpty() in WebCore::HTMLTreeBuilder::finished

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp (200109 => 200110)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.cpp	2016-04-26 22:53:54 UTC (rev 200110)
@@ -481,18 +481,6 @@
 
 #endif
 
-RefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, ExceptionCode& ec)
-{
-    // Set number of input/output channels to stereo by default.
-    return createScriptProcessor(bufferSize, 2, 2, ec);
-}
-
-RefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode& ec)
-{
-    // Set number of output channels to stereo by default.
-    return createScriptProcessor(bufferSize, numberOfInputChannels, 2, ec);
-}
-
 RefPtr<ScriptProcessorNode> AudioContext::createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode& ec)
 {
     ASSERT(isMainThread());
@@ -567,12 +555,6 @@
     return WTFMove(node);
 }
 
-RefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(ExceptionCode& ec)
-{
-    const unsigned ChannelSplitterDefaultNumberOfOutputs = 6;
-    return createChannelSplitter(ChannelSplitterDefaultNumberOfOutputs, ec);
-}
-
 RefPtr<ChannelSplitterNode> AudioContext::createChannelSplitter(size_t numberOfOutputs, ExceptionCode& ec)
 {
     ASSERT(isMainThread());
@@ -588,12 +570,6 @@
     return node;
 }
 
-RefPtr<ChannelMergerNode> AudioContext::createChannelMerger(ExceptionCode& ec)
-{
-    const unsigned ChannelMergerDefaultNumberOfInputs = 6;
-    return createChannelMerger(ChannelMergerDefaultNumberOfInputs, ec);
-}
-
 RefPtr<ChannelMergerNode> AudioContext::createChannelMerger(size_t numberOfInputs, ExceptionCode& ec)
 {
     ASSERT(isMainThread());

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.h (200109 => 200110)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.h	2016-04-26 22:53:54 UTC (rev 200110)
@@ -137,12 +137,8 @@
     Ref<ConvolverNode> createConvolver();
     Ref<DynamicsCompressorNode> createDynamicsCompressor();
     Ref<AnalyserNode> createAnalyser();
-    RefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, ExceptionCode&);
-    RefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, ExceptionCode&);
     RefPtr<ScriptProcessorNode> createScriptProcessor(size_t bufferSize, size_t numberOfInputChannels, size_t numberOfOutputChannels, ExceptionCode&);
-    RefPtr<ChannelSplitterNode> createChannelSplitter(ExceptionCode&);
     RefPtr<ChannelSplitterNode> createChannelSplitter(size_t numberOfOutputs, ExceptionCode&);
-    RefPtr<ChannelMergerNode> createChannelMerger(ExceptionCode&);
     RefPtr<ChannelMergerNode> createChannelMerger(size_t numberOfInputs, ExceptionCode&);
     Ref<OscillatorNode> createOscillator();
     RefPtr<PeriodicWave> createPeriodicWave(Float32Array* real, Float32Array* imag, ExceptionCode&);

Modified: trunk/Source/WebCore/Modules/webaudio/AudioContext.idl (200109 => 200110)


--- trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/Modules/webaudio/AudioContext.idl	2016-04-26 22:53:54 UTC (rev 200110)
@@ -84,13 +84,13 @@
     ConvolverNode createConvolver();
     DynamicsCompressorNode createDynamicsCompressor();
     AnalyserNode createAnalyser();
-    [RaisesException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
+    [RaisesException] ScriptProcessorNode createScriptProcessor(unsigned long bufferSize, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2);
     OscillatorNode createOscillator();
     [RaisesException] PeriodicWave createPeriodicWave(Float32Array real, Float32Array imag);
 
     // Channel splitting and merging
-    [RaisesException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs);
-    [RaisesException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs);
+    [RaisesException] ChannelSplitterNode createChannelSplitter(optional unsigned long numberOfOutputs = 6);
+    [RaisesException] ChannelMergerNode createChannelMerger(optional unsigned long numberOfInputs = 6);
 
     // Offline rendering
     // void prepareOfflineBufferRendering(unsigned long numberOfChannels, unsigned long numberOfFrames, unrestricted float sampleRate);
@@ -100,6 +100,6 @@
     [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createGain] GainNode createGainNode();
     [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createDelay, RaisesException] DelayNode createDelayNode(optional unrestricted double maxDelayTime = 1);
 
-    [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createScriptProcessor, RaisesException] ScriptProcessorNode createJavaScriptNode(unsigned long bufferSize, optional unsigned long numberOfInputChannels, optional unsigned long numberOfOutputChannels);
+    [Conditional=LEGACY_WEB_AUDIO, ImplementedAs=createScriptProcessor, RaisesException] ScriptProcessorNode createJavaScriptNode(unsigned long bufferSize, optional unsigned long numberOfInputChannels = 2, optional unsigned long numberOfOutputChannels = 2);
 
 };

Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200109 => 200110)


--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm	2016-04-26 22:53:54 UTC (rev 200110)
@@ -3384,7 +3384,6 @@
     return 0 if $codeGenerator->IsWrapperType($type);
     return 0 if $type eq "DOMString";
     return 0 if $type eq "any";
-    return 0 if $type eq "unsigned long";
 
     return 1;
 }

Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (200109 => 200110)


--- trunk/Source/WebCore/css/CSSStyleSheet.cpp	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp	2016-04-26 22:53:54 UTC (rev 200110)
@@ -340,7 +340,7 @@
     }
 }
 
-int CSSStyleSheet::addRule(const String& selector, const String& style, int index, ExceptionCode& ec)
+int CSSStyleSheet::addRule(const String& selector, const String& style, Optional<unsigned> index, ExceptionCode& ec)
 {
     StringBuilder text;
     text.append(selector);
@@ -349,18 +349,12 @@
     if (!style.isEmpty())
         text.append(' ');
     text.append('}');
-    insertRule(text.toString(), index, ec);
+    insertRule(text.toString(), index.valueOr(length()), ec);
     
     // As per Microsoft documentation, always return -1.
     return -1;
 }
 
-int CSSStyleSheet::addRule(const String& selector, const String& style, ExceptionCode& ec)
-{
-    return addRule(selector, style, length(), ec);
-}
-
-
 RefPtr<CSSRuleList> CSSStyleSheet::cssRules()
 {
     if (!canAccessRules())

Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (200109 => 200110)


--- trunk/Source/WebCore/css/CSSStyleSheet.h	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h	2016-04-26 22:53:54 UTC (rev 200110)
@@ -70,8 +70,7 @@
     
     // IE Extensions
     RefPtr<CSSRuleList> rules();
-    int addRule(const String& selector, const String& style, int index, ExceptionCode&);
-    int addRule(const String& selector, const String& style, ExceptionCode&);
+    int addRule(const String& selector, const String& style, Optional<unsigned> index, ExceptionCode&);
     void removeRule(unsigned index, ExceptionCode& ec) { deleteRule(index, ec); }
     
     // For CSSRuleList.

Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (200109 => 200110)


--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2016-04-26 22:16:00 UTC (rev 200109)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp	2016-04-26 22:53:54 UTC (rev 200110)
@@ -708,7 +708,7 @@
     StringBuilder styleSheetText;
     styleSheetText.append(text);
 
-    m_pageStyleSheet->addRule(selector, "", ec);
+    m_pageStyleSheet->addRule(selector, emptyString(), Nullopt, ec);
     if (ec)
         return nullptr;
     ASSERT(m_pageStyleSheet->length());
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to