<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200131] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200131">200131</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2016-04-27 10:05:40 -0700 (Wed, 27 Apr 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Web IDL] Clean up support for [Clamp] IDL extended attribute
https://bugs.webkit.org/show_bug.cgi?id=157060
Reviewed by Darin Adler.
Clean up support for [Clamp] IDL extended attribute:
1. Move [Clamp] handling in the bindings generator from the parameter
conversion to JSValueToNative(). This has the benefit of
simplifying the parameter conversion code, adding support for [Clamp]
on non-readonly attributes, and improving consistency by handling
this in the same place as [EnforceRange].
2. Add 'Clamp' to the IntegerConversionConfiguration enumeration in
JSDOMbindings.h and add support for it to the various toInt*() /
toUInt*() functions, similary to [EnforceRange]. Call these from
the generated bindings.
* bindings/js/JSDOMBinding.cpp:
(WebCore::toSmallerInt):
(WebCore::toSmallerUInt):
(WebCore::toInt32EnforceRange):
(WebCore::toInt32Clamp):
(WebCore::toUInt32Clamp):
(WebCore::toUInt32EnforceRange):
(WebCore::toInt64):
(WebCore::toUInt64):
(WebCore::toUInt8): Deleted.
(WebCore::toUInt16): Deleted.
* bindings/js/JSDOMBinding.h:
(WebCore::toInt32):
(WebCore::toUInt32):
* bindings/scripts/CodeGeneratorJS.pm:
(JSValueToNative):
(GenerateParametersCheck): Deleted.
* bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
(webkit_dom_test_obj_set_property):
(webkit_dom_test_obj_get_property):
(webkit_dom_test_obj_class_init):
(webkit_dom_test_obj_class_method_with_enforce_range):
(webkit_dom_test_obj_get_clamped_short_attr):
(webkit_dom_test_obj_set_clamped_short_attr):
(webkit_dom_test_obj_get_enforce_range_short_attr):
(webkit_dom_test_obj_set_enforce_range_short_attr):
* bindings/scripts/test/GObject/WebKitDOMTestObj.h:
* bindings/scripts/test/JS/JSTestObj.cpp:
(WebCore::jsTestObjClampedShortAttr):
(WebCore::jsTestObjEnforceRangeShortAttr):
(WebCore::setJSTestObjClampedShortAttr):
(WebCore::setJSTestObjEnforceRangeShortAttr):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
(WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
(WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): Deleted.
(WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
* bindings/scripts/test/JS/JSTestTypedefs.cpp:
(WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
(WebCore::jsTestTypedefsPrototypeFunctionImmutablePointFunction): Deleted.
* bindings/scripts/test/ObjC/DOMTestObj.h:
* bindings/scripts/test/ObjC/DOMTestObj.mm:
(-[DOMTestObj clampedShortAttr]):
(-[DOMTestObj setClampedShortAttr:]):
(-[DOMTestObj enforceRangeShortAttr]):
(-[DOMTestObj setEnforceRangeShortAttr:]):
(-[DOMTestObj classMethodWithEnforceRange:objArgsLong:]):
* bindings/scripts/test/TestObj.idl:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingcpp">trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSDOMBindingh">trunk/Source/WebCore/bindings/js/JSDOMBinding.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm">trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/ChangeLog        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -1,3 +1,69 @@
</span><ins>+2016-04-27 Chris Dumez <cdumez@apple.com>
+
+ [Web IDL] Clean up support for [Clamp] IDL extended attribute
+ https://bugs.webkit.org/show_bug.cgi?id=157060
+
+ Reviewed by Darin Adler.
+
+ Clean up support for [Clamp] IDL extended attribute:
+ 1. Move [Clamp] handling in the bindings generator from the parameter
+ conversion to JSValueToNative(). This has the benefit of
+ simplifying the parameter conversion code, adding support for [Clamp]
+ on non-readonly attributes, and improving consistency by handling
+ this in the same place as [EnforceRange].
+ 2. Add 'Clamp' to the IntegerConversionConfiguration enumeration in
+ JSDOMbindings.h and add support for it to the various toInt*() /
+ toUInt*() functions, similary to [EnforceRange]. Call these from
+ the generated bindings.
+
+ * bindings/js/JSDOMBinding.cpp:
+ (WebCore::toSmallerInt):
+ (WebCore::toSmallerUInt):
+ (WebCore::toInt32EnforceRange):
+ (WebCore::toInt32Clamp):
+ (WebCore::toUInt32Clamp):
+ (WebCore::toUInt32EnforceRange):
+ (WebCore::toInt64):
+ (WebCore::toUInt64):
+ (WebCore::toUInt8): Deleted.
+ (WebCore::toUInt16): Deleted.
+ * bindings/js/JSDOMBinding.h:
+ (WebCore::toInt32):
+ (WebCore::toUInt32):
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (JSValueToNative):
+ (GenerateParametersCheck): Deleted.
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp:
+ (webkit_dom_test_obj_set_property):
+ (webkit_dom_test_obj_get_property):
+ (webkit_dom_test_obj_class_init):
+ (webkit_dom_test_obj_class_method_with_enforce_range):
+ (webkit_dom_test_obj_get_clamped_short_attr):
+ (webkit_dom_test_obj_set_clamped_short_attr):
+ (webkit_dom_test_obj_get_enforce_range_short_attr):
+ (webkit_dom_test_obj_set_enforce_range_short_attr):
+ * bindings/scripts/test/GObject/WebKitDOMTestObj.h:
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjClampedShortAttr):
+ (WebCore::jsTestObjEnforceRangeShortAttr):
+ (WebCore::setJSTestObjClampedShortAttr):
+ (WebCore::setJSTestObjEnforceRangeShortAttr):
+ (WebCore::jsTestObjPrototypeFunctionClassMethodWithClamp):
+ (WebCore::jsTestObjPrototypeFunctionClassMethodWithEnforceRange):
+ (WebCore::jsTestObjConstructorFunctionClassMethodWithOptional): Deleted.
+ (WebCore::jsTestObjConstructorFunctionClassMethod2): Deleted.
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::jsTestTypedefsPrototypeFunctionFuncWithClamp):
+ (WebCore::jsTestTypedefsPrototypeFunctionImmutablePointFunction): Deleted.
+ * bindings/scripts/test/ObjC/DOMTestObj.h:
+ * bindings/scripts/test/ObjC/DOMTestObj.mm:
+ (-[DOMTestObj clampedShortAttr]):
+ (-[DOMTestObj setClampedShortAttr:]):
+ (-[DOMTestObj enforceRangeShortAttr]):
+ (-[DOMTestObj setEnforceRangeShortAttr:]):
+ (-[DOMTestObj classMethodWithEnforceRange:objArgsLong:]):
+ * bindings/scripts/test/TestObj.idl:
+
</ins><span class="cx"> 2016-04-27 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> CSP: Add app-specific workaround for Ecobee and Quora
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.cpp        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -418,20 +418,31 @@
</span><span class="cx"> int32_t d = value.asInt32();
</span><span class="cx"> if (d >= LimitsTrait::minValue && d <= LimitsTrait::maxValue)
</span><span class="cx"> return static_cast<T>(d);
</span><del>- if (configuration == EnforceRange) {
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> throwTypeError(exec);
</span><span class="cx"> return 0;
</span><ins>+ case Clamp:
+ return d < LimitsTrait::minValue ? LimitsTrait::minValue : LimitsTrait::maxValue;
</ins><span class="cx"> }
</span><span class="cx"> d %= LimitsTrait::numberOfValues;
</span><span class="cx"> return static_cast<T>(d > LimitsTrait::maxValue ? d - LimitsTrait::numberOfValues : d);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return enforceRange(exec, x, LimitsTrait::minValue, LimitsTrait::maxValue);
</span><ins>+ case Clamp:
+ return std::isnan(x) ? 0 : clampTo<T>(x);
+ }
</ins><span class="cx">
</span><span class="cx"> if (std::isnan(x) || std::isinf(x) || !x)
</span><span class="cx"> return 0;
</span><span class="lines">@@ -451,19 +462,29 @@
</span><span class="cx"> uint32_t d = value.asUInt32();
</span><span class="cx"> if (d <= LimitsTrait::maxValue)
</span><span class="cx"> return static_cast<T>(d);
</span><del>- if (configuration == EnforceRange) {
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ return static_cast<T>(d);
+ case EnforceRange:
</ins><span class="cx"> throwTypeError(exec);
</span><span class="cx"> return 0;
</span><ins>+ case Clamp:
+ return LimitsTrait::maxValue;
</ins><span class="cx"> }
</span><del>- return static_cast<T>(d);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return enforceRange(exec, x, 0, LimitsTrait::maxValue);
</span><ins>+ case Clamp:
+ return std::isnan(x) ? 0 : clampTo<T>(x);
+ }
</ins><span class="cx">
</span><span class="cx"> if (std::isnan(x) || std::isinf(x) || !x)
</span><span class="cx"> return 0;
</span><span class="lines">@@ -503,11 +524,33 @@
</span><span class="cx"> return value.asInt32();
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx"> return enforceRange(exec, x, kMinInt32, kMaxInt32);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+int32_t toInt32Clamp(ExecState* exec, JSValue value)
+{
+ if (value.isInt32())
+ return value.asInt32();
+
+ double x = value.toNumber(exec);
+ if (UNLIKELY(exec->hadException()))
+ return 0;
+ return std::isnan(x) ? 0 : clampTo<int32_t>(x);
+}
+
+uint32_t toUInt32Clamp(ExecState* exec, JSValue value)
+{
+ if (value.isUInt32())
+ return value.asUInt32();
+
+ double x = value.toNumber(exec);
+ if (UNLIKELY(exec->hadException()))
+ return 0;
+ return std::isnan(x) ? 0 : clampTo<uint32_t>(x);
+}
+
</ins><span class="cx"> // http://www.w3.org/TR/WebIDL/#es-unsigned-long
</span><span class="cx"> uint32_t toUInt32EnforceRange(ExecState* exec, JSValue value)
</span><span class="cx"> {
</span><span class="lines">@@ -515,7 +558,7 @@
</span><span class="cx"> return value.asUInt32();
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx"> return enforceRange(exec, x, 0, kMaxUInt32);
</span><span class="cx"> }
</span><span class="lines">@@ -527,11 +570,17 @@
</span><span class="cx"> return value.asInt32();
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return enforceRange(exec, x, -kJSMaxInteger, kJSMaxInteger);
</span><ins>+ case Clamp:
+ return std::isnan(x) ? 0 : static_cast<int64_t>(std::min<double>(std::max<double>(x, -kJSMaxInteger), kJSMaxInteger));
+ }
</ins><span class="cx">
</span><span class="cx"> // Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
</span><span class="cx"> unsigned long long n;
</span><span class="lines">@@ -546,11 +595,17 @@
</span><span class="cx"> return value.asUInt32();
</span><span class="cx">
</span><span class="cx"> double x = value.toNumber(exec);
</span><del>- if (exec->hadException())
</del><ins>+ if (UNLIKELY(exec->hadException()))
</ins><span class="cx"> return 0;
</span><span class="cx">
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return enforceRange(exec, x, 0, kJSMaxInteger);
</span><ins>+ case Clamp:
+ return std::isnan(x) ? 0 : static_cast<uint64_t>(std::min<double>(std::max<double>(x, 0), kJSMaxInteger));
+ }
</ins><span class="cx">
</span><span class="cx"> // Map NaNs and +/-Infinity to 0; convert finite values modulo 2^64.
</span><span class="cx"> unsigned long long n;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSDOMBindingh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSDOMBinding.h (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/js/JSDOMBinding.h        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -337,12 +337,15 @@
</span><span class="cx"> enum IntegerConversionConfiguration {
</span><span class="cx"> NormalConversion,
</span><span class="cx"> EnforceRange,
</span><del>- // FIXME: Implement Clamp
</del><ins>+ Clamp
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> WEBCORE_EXPORT int32_t toInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
</span><span class="cx"> WEBCORE_EXPORT uint32_t toUInt32EnforceRange(JSC::ExecState*, JSC::JSValue);
</span><span class="cx">
</span><ins>+WEBCORE_EXPORT int32_t toInt32Clamp(JSC::ExecState*, JSC::JSValue);
+WEBCORE_EXPORT uint32_t toUInt32Clamp(JSC::ExecState*, JSC::JSValue);
+
</ins><span class="cx"> WEBCORE_EXPORT int8_t toInt8(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="cx"> WEBCORE_EXPORT uint8_t toUInt8(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration);
</span><span class="cx">
</span><span class="lines">@@ -357,15 +360,27 @@
</span><span class="cx"> */
</span><span class="cx"> inline int32_t toInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
</span><span class="cx"> {
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return toInt32EnforceRange(exec, value);
</span><ins>+ case Clamp:
+ return toInt32Clamp(exec, value);
+ }
</ins><span class="cx"> return value.toInt32(exec);
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> inline uint32_t toUInt32(JSC::ExecState* exec, JSC::JSValue value, IntegerConversionConfiguration configuration)
</span><span class="cx"> {
</span><del>- if (configuration == EnforceRange)
</del><ins>+ switch (configuration) {
+ case NormalConversion:
+ break;
+ case EnforceRange:
</ins><span class="cx"> return toUInt32EnforceRange(exec, value);
</span><ins>+ case Clamp:
+ return toUInt32Clamp(exec, value);
+ }
</ins><span class="cx"> return value.toUInt32(exec);
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -3535,14 +3535,6 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx"> $value = "WTFMove($name)";
</span><del>- } elsif ($parameter->extendedAttributes->{"Clamp"}) {
- my $nativeValue = "${name}NativeValue";
- push(@$outputArray, " $argType $name = 0;\n");
- push(@$outputArray, " double $nativeValue = state->argument($argsIndex).toNumber(state);\n");
- push(@$outputArray, " if (UNLIKELY(state->hadException()))\n");
- push(@$outputArray, " return JSValue::encode(jsUndefined());\n\n");
- push(@$outputArray, " if (!std::isnan($nativeValue))\n");
- push(@$outputArray, " $name = clampTo<$argType>($nativeValue);\n\n");
</del><span class="cx"> } elsif ($parameter->isVariadic) {
</span><span class="cx"> my $nativeElementType;
</span><span class="cx"> if ($argType eq "DOMString") {
</span><span class="lines">@@ -4267,7 +4259,9 @@
</span><span class="cx"> return "$value.toNumber(state)" if $type eq "double" or $type eq "unrestricted double" ;
</span><span class="cx"> return "$value.toFloat(state)" if $type eq "float" or $type eq "unrestricted float" ;
</span><span class="cx">
</span><del>- my $intConversion = $signature->extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
</del><ins>+ my $intConversion = "NormalConversion";
+ $intConversion = "EnforceRange" if $signature->extendedAttributes->{"EnforceRange"};
+ $intConversion = "Clamp" if $signature->extendedAttributes->{"Clamp"};
</ins><span class="cx"> return "toInt8(state, $value, $intConversion)" if $type eq "byte";
</span><span class="cx"> return "toUInt8(state, $value, $intConversion)" if $type eq "octet";
</span><span class="cx"> return "toInt16(state, $value, $intConversion)" if $type eq "short";
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -84,6 +84,8 @@
</span><span class="cx"> PROP_BYTE_ATTR,
</span><span class="cx"> PROP_OCTET_ATTR,
</span><span class="cx"> PROP_SHORT_ATTR,
</span><ins>+ PROP_CLAMPED_SHORT_ATTR,
+ PROP_ENFORCE_RANGE_SHORT_ATTR,
</ins><span class="cx"> PROP_UNSIGNED_SHORT_ATTR,
</span><span class="cx"> PROP_LONG_ATTR,
</span><span class="cx"> PROP_LONG_LONG_ATTR,
</span><span class="lines">@@ -170,6 +172,12 @@
</span><span class="cx"> case PROP_SHORT_ATTR:
</span><span class="cx"> webkit_dom_test_obj_set_short_attr(self, g_value_get_int(value));
</span><span class="cx"> break;
</span><ins>+ case PROP_CLAMPED_SHORT_ATTR:
+ webkit_dom_test_obj_set_clamped_short_attr(self, g_value_get_int(value));
+ break;
+ case PROP_ENFORCE_RANGE_SHORT_ATTR:
+ webkit_dom_test_obj_set_enforce_range_short_attr(self, g_value_get_int(value));
+ break;
</ins><span class="cx"> case PROP_UNSIGNED_SHORT_ATTR:
</span><span class="cx"> webkit_dom_test_obj_set_unsigned_short_attr(self, g_value_get_uint(value));
</span><span class="cx"> break;
</span><span class="lines">@@ -295,6 +303,12 @@
</span><span class="cx"> case PROP_SHORT_ATTR:
</span><span class="cx"> g_value_set_int(value, webkit_dom_test_obj_get_short_attr(self));
</span><span class="cx"> break;
</span><ins>+ case PROP_CLAMPED_SHORT_ATTR:
+ g_value_set_int(value, webkit_dom_test_obj_get_clamped_short_attr(self));
+ break;
+ case PROP_ENFORCE_RANGE_SHORT_ATTR:
+ g_value_set_int(value, webkit_dom_test_obj_get_enforce_range_short_attr(self));
+ break;
</ins><span class="cx"> case PROP_UNSIGNED_SHORT_ATTR:
</span><span class="cx"> g_value_set_uint(value, webkit_dom_test_obj_get_unsigned_short_attr(self));
</span><span class="cx"> break;
</span><span class="lines">@@ -563,6 +577,26 @@
</span><span class="cx">
</span><span class="cx"> g_object_class_install_property(
</span><span class="cx"> gobjectClass,
</span><ins>+ PROP_CLAMPED_SHORT_ATTR,
+ g_param_spec_int(
+ "clamped-short-attr",
+ "TestObj:clamped-short-attr",
+ "read-write gshort TestObj:clamped-short-attr",
+ G_MININT, G_MAXINT, 0,
+ WEBKIT_PARAM_READWRITE));
+
+ g_object_class_install_property(
+ gobjectClass,
+ PROP_ENFORCE_RANGE_SHORT_ATTR,
+ g_param_spec_int(
+ "enforce-range-short-attr",
+ "TestObj:enforce-range-short-attr",
+ "read-write gshort TestObj:enforce-range-short-attr",
+ G_MININT, G_MAXINT, 0,
+ WEBKIT_PARAM_READWRITE));
+
+ g_object_class_install_property(
+ gobjectClass,
</ins><span class="cx"> PROP_UNSIGNED_SHORT_ATTR,
</span><span class="cx"> g_param_spec_uint(
</span><span class="cx"> "unsigned-short-attr",
</span><span class="lines">@@ -1763,6 +1797,14 @@
</span><span class="cx"> #endif /* ENABLE(Condition1) || ENABLE(Condition2) */
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void webkit_dom_test_obj_class_method_with_enforce_range(WebKitDOMTestObj* self, gushort objArgsShort, gulong objArgsLong)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->classMethodWithEnforceRange(objArgsShort, objArgsLong);
+}
+
</ins><span class="cx"> void webkit_dom_test_obj_convert1(WebKitDOMTestObj* self, WebKitDOMTestNode* value)
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1983,6 +2025,40 @@
</span><span class="cx"> item->setShortAttr(value);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+gshort webkit_dom_test_obj_get_clamped_short_attr(WebKitDOMTestObj* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
+ WebCore::TestObj* item = WebKit::core(self);
+ gshort result = item->clampedShortAttr();
+ return result;
+}
+
+void webkit_dom_test_obj_set_clamped_short_attr(WebKitDOMTestObj* self, gshort value)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->setClampedShortAttr(value);
+}
+
+gshort webkit_dom_test_obj_get_enforce_range_short_attr(WebKitDOMTestObj* self)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0);
+ WebCore::TestObj* item = WebKit::core(self);
+ gshort result = item->enforceRangeShortAttr();
+ return result;
+}
+
+void webkit_dom_test_obj_set_enforce_range_short_attr(WebKitDOMTestObj* self, gshort value)
+{
+ WebCore::JSMainThreadNullState state;
+ g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self));
+ WebCore::TestObj* item = WebKit::core(self);
+ item->setEnforceRangeShortAttr(value);
+}
+
</ins><span class="cx"> gushort webkit_dom_test_obj_get_unsigned_short_attr(WebKitDOMTestObj* self)
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestGObjectWebKitDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -718,6 +718,17 @@
</span><span class="cx"> webkit_dom_test_obj_conditional_method3(WebKitDOMTestObj* self);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_class_method_with_enforce_range:
+ * @self: A #WebKitDOMTestObj
+ * @objArgsShort: A #gushort
+ * @objArgsLong: A #gulong
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_class_method_with_enforce_range(WebKitDOMTestObj* self, gushort objArgsShort, gulong objArgsLong);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_convert1:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> * @value: A #WebKitDOMTestNode
</span><span class="lines">@@ -958,6 +969,48 @@
</span><span class="cx"> webkit_dom_test_obj_set_short_attr(WebKitDOMTestObj* self, gshort value);
</span><span class="cx">
</span><span class="cx"> /**
</span><ins>+ * webkit_dom_test_obj_get_clamped_short_attr:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: A #gshort
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gshort
+webkit_dom_test_obj_get_clamped_short_attr(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_set_clamped_short_attr:
+ * @self: A #WebKitDOMTestObj
+ * @value: A #gshort
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_set_clamped_short_attr(WebKitDOMTestObj* self, gshort value);
+
+/**
+ * webkit_dom_test_obj_get_enforce_range_short_attr:
+ * @self: A #WebKitDOMTestObj
+ *
+ * Returns: A #gshort
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API gshort
+webkit_dom_test_obj_get_enforce_range_short_attr(WebKitDOMTestObj* self);
+
+/**
+ * webkit_dom_test_obj_set_enforce_range_short_attr:
+ * @self: A #WebKitDOMTestObj
+ * @value: A #gshort
+ *
+ * Stability: Unstable
+**/
+WEBKIT_API void
+webkit_dom_test_obj_set_enforce_range_short_attr(WebKitDOMTestObj* self, gshort value);
+
+/**
</ins><span class="cx"> * webkit_dom_test_obj_get_unsigned_short_attr:
</span><span class="cx"> * @self: A #WebKitDOMTestObj
</span><span class="cx"> *
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -182,6 +182,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionOverloadedMethod1(JSC::ExecState*);
</span><span class="cx"> #endif
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithClamp(JSC::ExecState*);
</span><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithEnforceRange(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionStringArrayFunction(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionDomStringListFunction(JSC::ExecState*);
</span><span class="lines">@@ -235,6 +236,10 @@
</span><span class="cx"> bool setJSTestObjOctetAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><ins>+JSC::EncodedJSValue jsTestObjClampedShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjClampedShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
+JSC::EncodedJSValue jsTestObjEnforceRangeShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
+bool setJSTestObjEnforceRangeShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</ins><span class="cx"> JSC::EncodedJSValue jsTestObjUnsignedShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="cx"> bool setJSTestObjUnsignedShortAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::EncodedJSValue);
</span><span class="cx"> JSC::EncodedJSValue jsTestObjLongAttr(JSC::ExecState*, JSC::EncodedJSValue, JSC::PropertyName);
</span><span class="lines">@@ -556,6 +561,8 @@
</span><span class="cx"> { "byteAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjByteAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjByteAttr) } },
</span><span class="cx"> { "octetAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjOctetAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjOctetAttr) } },
</span><span class="cx"> { "shortAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjShortAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjShortAttr) } },
</span><ins>+ { "clampedShortAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjClampedShortAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjClampedShortAttr) } },
+ { "enforceRangeShortAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjEnforceRangeShortAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjEnforceRangeShortAttr) } },
</ins><span class="cx"> { "unsignedShortAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjUnsignedShortAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjUnsignedShortAttr) } },
</span><span class="cx"> { "longAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjLongAttr) } },
</span><span class="cx"> { "longLongAttr", CustomAccessor, NoIntrinsic, { (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjLongLongAttr), (intptr_t) static_cast<PutPropertySlot::PutValueFunc>(setJSTestObjLongLongAttr) } },
</span><span class="lines">@@ -747,6 +754,7 @@
</span><span class="cx"> { "overloadedMethod", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethod), (intptr_t) (2) } },
</span><span class="cx"> { "overloadedMethodWithOptionalParameter", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionOverloadedMethodWithOptionalParameter), (intptr_t) (1) } },
</span><span class="cx"> { "classMethodWithClamp", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithClamp), (intptr_t) (2) } },
</span><ins>+ { "classMethodWithEnforceRange", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionClassMethodWithEnforceRange), (intptr_t) (2) } },
</ins><span class="cx"> { "methodWithUnsignedLongSequence", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence), (intptr_t) (1) } },
</span><span class="cx"> { "stringArrayFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionStringArrayFunction), (intptr_t) (1) } },
</span><span class="cx"> { "domStringListFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionDomStringListFunction), (intptr_t) (1) } },
</span><span class="lines">@@ -1024,6 +1032,36 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+EncodedJSValue jsTestObjClampedShortAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(thisValue);
+ JSValue decodedThisValue = JSValue::decode(thisValue);
+ auto* castedThis = jsDynamicCast<JSTestObj*>(decodedThisValue);
+ if (UNLIKELY(!castedThis)) {
+ return throwGetterTypeError(*state, "TestObj", "clampedShortAttr");
+ }
+ auto& impl = castedThis->wrapped();
+ JSValue result = jsNumber(impl.clampedShortAttr());
+ return JSValue::encode(result);
+}
+
+
+EncodedJSValue jsTestObjEnforceRangeShortAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
+{
+ UNUSED_PARAM(state);
+ UNUSED_PARAM(thisValue);
+ JSValue decodedThisValue = JSValue::decode(thisValue);
+ auto* castedThis = jsDynamicCast<JSTestObj*>(decodedThisValue);
+ if (UNLIKELY(!castedThis)) {
+ return throwGetterTypeError(*state, "TestObj", "enforceRangeShortAttr");
+ }
+ auto& impl = castedThis->wrapped();
+ JSValue result = jsNumber(impl.enforceRangeShortAttr());
+ return JSValue::encode(result);
+}
+
+
</ins><span class="cx"> EncodedJSValue jsTestObjUnsignedShortAttr(ExecState* state, EncodedJSValue thisValue, PropertyName)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(state);
</span><span class="lines">@@ -2250,6 +2288,40 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx">
</span><ins>+bool setJSTestObjClampedShortAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ JSValue value = JSValue::decode(encodedValue);
+ UNUSED_PARAM(thisValue);
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!castedThis)) {
+ return throwSetterTypeError(*state, "TestObj", "clampedShortAttr");
+ }
+ auto& impl = castedThis->wrapped();
+ int16_t nativeValue = toInt16(state, value, Clamp);
+ if (UNLIKELY(state->hadException()))
+ return false;
+ impl.setClampedShortAttr(nativeValue);
+ return true;
+}
+
+
+bool setJSTestObjEnforceRangeShortAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
+{
+ JSValue value = JSValue::decode(encodedValue);
+ UNUSED_PARAM(thisValue);
+ JSTestObj* castedThis = jsDynamicCast<JSTestObj*>(JSValue::decode(thisValue));
+ if (UNLIKELY(!castedThis)) {
+ return throwSetterTypeError(*state, "TestObj", "enforceRangeShortAttr");
+ }
+ auto& impl = castedThis->wrapped();
+ int16_t nativeValue = toInt16(state, value, EnforceRange);
+ if (UNLIKELY(state->hadException()))
+ return false;
+ impl.setEnforceRangeShortAttr(nativeValue);
+ return true;
+}
+
+
</ins><span class="cx"> bool setJSTestObjUnsignedShortAttr(ExecState* state, EncodedJSValue thisValue, EncodedJSValue encodedValue)
</span><span class="cx"> {
</span><span class="cx"> JSValue value = JSValue::decode(encodedValue);
</span><span class="lines">@@ -4916,26 +4988,36 @@
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 2))
</span><span class="cx"> return throwVMError(state, createNotEnoughArgumentsError(state));
</span><del>- unsigned short objArgsShort = 0;
- double objArgsShortNativeValue = state->argument(0).toNumber(state);
</del><ins>+ uint16_t objArgsShort = toUInt16(state, state->argument(0), Clamp);
</ins><span class="cx"> if (UNLIKELY(state->hadException()))
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><del>-
- if (!std::isnan(objArgsShortNativeValue))
- objArgsShort = clampTo<unsigned short>(objArgsShortNativeValue);
-
- unsigned long objArgsLong = 0;
- double objArgsLongNativeValue = state->argument(1).toNumber(state);
</del><ins>+ unsigned objArgsLong = toUInt32(state, state->argument(1), Clamp);
</ins><span class="cx"> if (UNLIKELY(state->hadException()))
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><del>-
- if (!std::isnan(objArgsLongNativeValue))
- objArgsLong = clampTo<unsigned long>(objArgsLongNativeValue);
-
</del><span class="cx"> impl.classMethodWithClamp(objArgsShort, objArgsLong);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionClassMethodWithEnforceRange(ExecState* state)
+{
+ JSValue thisValue = state->thisValue();
+ auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
+ if (UNLIKELY(!castedThis))
+ return throwThisTypeError(*state, "TestObj", "classMethodWithEnforceRange");
+ ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
+ auto& impl = castedThis->wrapped();
+ if (UNLIKELY(state->argumentCount() < 2))
+ return throwVMError(state, createNotEnoughArgumentsError(state));
+ uint16_t objArgsShort = toUInt16(state, state->argument(0), EnforceRange);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ unsigned objArgsLong = toUInt32(state, state->argument(1), EnforceRange);
+ if (UNLIKELY(state->hadException()))
+ return JSValue::encode(jsUndefined());
+ impl.classMethodWithEnforceRange(objArgsShort, objArgsLong);
+ return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithUnsignedLongSequence(ExecState* state)
</span><span class="cx"> {
</span><span class="cx"> JSValue thisValue = state->thisValue();
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestTypedefscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -550,29 +550,19 @@
</span><span class="cx"> auto& impl = castedThis->wrapped();
</span><span class="cx"> if (UNLIKELY(state->argumentCount() < 1))
</span><span class="cx"> return throwVMError(state, createNotEnoughArgumentsError(state));
</span><del>- unsigned long long arg1 = 0;
- double arg1NativeValue = state->argument(0).toNumber(state);
</del><ins>+ unsigned long long arg1 = toUInt64(state, state->argument(0), Clamp);
</ins><span class="cx"> if (UNLIKELY(state->hadException()))
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx">
</span><del>- if (!std::isnan(arg1NativeValue))
- arg1 = clampTo<unsigned long long>(arg1NativeValue);
-
-
</del><span class="cx"> size_t argsCount = state->argumentCount();
</span><span class="cx"> if (argsCount <= 1) {
</span><span class="cx"> impl.funcWithClamp(arg1);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx">
</span><del>- unsigned long long arg2 = 0;
- double arg2NativeValue = state->argument(1).toNumber(state);
</del><ins>+ unsigned long long arg2 = toUInt64(state, state->argument(1), Clamp);
</ins><span class="cx"> if (UNLIKELY(state->hadException()))
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><del>-
- if (!std::isnan(arg2NativeValue))
- arg2 = clampTo<unsigned long long>(arg2NativeValue);
-
</del><span class="cx"> impl.funcWithClamp(arg1, arg2);
</span><span class="cx"> return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -67,6 +67,8 @@
</span><span class="cx"> @property char byteAttr;
</span><span class="cx"> @property unsigned char octetAttr;
</span><span class="cx"> @property short shortAttr;
</span><ins>+@property short clampedShortAttr;
+@property short enforceRangeShortAttr;
</ins><span class="cx"> @property unsigned short unsignedShortAttr;
</span><span class="cx"> @property int longAttr;
</span><span class="cx"> @property long long longLongAttr;
</span><span class="lines">@@ -193,6 +195,7 @@
</span><span class="cx"> - (void)classMethod;
</span><span class="cx"> - (int)classMethodWithOptional:(int)arg;
</span><span class="cx"> - (void)classMethod2:(int)arg;
</span><ins>+- (void)classMethodWithEnforceRange:(unsigned short)objArgsShort objArgsLong:(unsigned)objArgsLong;
</ins><span class="cx"> - (DOMSVGDocument *)getSVGDocument;
</span><span class="cx"> - (void)convert1:(DOMTestNode *)value;
</span><span class="cx"> - (void)convert2:(DOMTestNode *)value;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestObjCDOMTestObjmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -151,6 +151,30 @@
</span><span class="cx"> IMPL->setShortAttr(newShortAttr);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+- (short)clampedShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->clampedShortAttr();
+}
+
+- (void)setClampedShortAttr:(short)newClampedShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setClampedShortAttr(newClampedShortAttr);
+}
+
+- (short)enforceRangeShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ return IMPL->enforceRangeShortAttr();
+}
+
+- (void)setEnforceRangeShortAttr:(short)newEnforceRangeShortAttr
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->setEnforceRangeShortAttr(newEnforceRangeShortAttr);
+}
+
</ins><span class="cx"> - (unsigned short)unsignedShortAttr
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span><span class="lines">@@ -1420,6 +1444,12 @@
</span><span class="cx">
</span><span class="cx"> #endif
</span><span class="cx">
</span><ins>+- (void)classMethodWithEnforceRange:(unsigned short)objArgsShort objArgsLong:(unsigned)objArgsLong
+{
+ WebCore::JSMainThreadNullState state;
+ IMPL->classMethodWithEnforceRange(objArgsShort, objArgsLong);
+}
+
</ins><span class="cx"> - (DOMSVGDocument *)getSVGDocument
</span><span class="cx"> {
</span><span class="cx"> WebCore::JSMainThreadNullState state;
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (200130 => 200131)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-04-27 16:48:59 UTC (rev 200130)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-04-27 17:05:40 UTC (rev 200131)
</span><span class="lines">@@ -51,6 +51,8 @@
</span><span class="cx"> attribute byte byteAttr;
</span><span class="cx"> attribute octet octetAttr;
</span><span class="cx"> attribute short shortAttr;
</span><ins>+ [Clamp] attribute short clampedShortAttr;
+ [EnforceRange] attribute short enforceRangeShortAttr;
</ins><span class="cx"> attribute unsigned short unsignedShortAttr;
</span><span class="cx"> attribute long longAttr;
</span><span class="cx"> attribute long long longLongAttr;
</span><span class="lines">@@ -268,6 +270,7 @@
</span><span class="cx"> [Conditional=Condition1] static void overloadedMethod1([StrictTypeChecking] DOMString type);
</span><span class="cx">
</span><span class="cx"> void classMethodWithClamp([Clamp] unsigned short objArgsShort, [Clamp] unsigned long objArgsLong);
</span><ins>+ void classMethodWithEnforceRange([EnforceRange] unsigned short objArgsShort, [EnforceRange] unsigned long objArgsLong);
</ins><span class="cx">
</span><span class="cx"> #if defined(TESTING_JS)
</span><span class="cx"> void methodWithUnsignedLongSequence(sequence<unsigned long> unsignedLongSequence);
</span></span></pre>
</div>
</div>
</body>
</html>