Changeset 73564 in webkit
- Timestamp:
- Dec 8, 2010 4:37:34 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73562 r73564 1 2010-12-08 Andy Estes <aestes@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Reflected unsigned attributes should be in the range [0, 2^31). 6 https://bugs.webkit.org/show_bug.cgi?id=50472 7 8 * fast/html/marquee-element.html: Give hspace and vspace negative values 9 and test what their corresponding IDL attributes reflect. 10 * fast/html/marquee-element-expected.txt: 11 1 12 2010-12-08 Ryosuke Niwa <rniwa@webkit.org> 2 13 -
trunk/LayoutTests/fast/html/marquee-element-expected.txt
r73189 r73564 24 24 "hspace" IDL attribute can be modified: 25 25 PASS marquee.hspace is 20 26 "hspace" IDL attribute is 0 when content attribute is negative: 27 PASS marquee.hspace is 0 28 "hspace" IDL attribute is 0 when content attribute is too large: 29 PASS marquee.hspace is 0 26 30 "loop" IDL attribute reflects content attribute: 27 31 PASS marquee.loop is 3 … … 44 48 "vspace" IDL attribute can be modified: 45 49 PASS marquee.vspace is 20 50 "vspace" IDL attribute is 0 when content attribute is negative: 51 PASS marquee.vspace is 0 52 "vspace" IDL attribute is 0 when content attribute is too large: 53 PASS marquee.vspace is 0 46 54 Default "scrollAmount" value is 6: 47 55 PASS marquee.scrollAmount is 6 -
trunk/LayoutTests/fast/html/marquee-element.html
r73189 r73564 70 70 shouldBe('marquee.hspace', '20'); 71 71 72 debug('"hspace" IDL attribute is 0 when content attribute is negative:'); 73 testParent.innerHTML = '<marquee id="marquee" hspace="-1">test</marquee>'; 74 marquee = document.getElementById('marquee'); 75 shouldBe('marquee.hspace', '0'); 76 77 debug('"hspace" IDL attribute is 0 when content attribute is too large:'); 78 testParent.innerHTML = '<marquee id="marquee" hspace="2147483648">test</marquee>'; 79 marquee = document.getElementById('marquee'); 80 shouldBe('marquee.hspace', '0'); 81 72 82 debug('"loop" IDL attribute reflects content attribute:'); 73 83 testParent.innerHTML = '<marquee id="marquee" loop="3">test</marquee>'; … … 124 134 marquee.vspace=20; 125 135 shouldBe('marquee.vspace', '20'); 136 137 debug('"vspace" IDL attribute is 0 when content attribute is negative:'); 138 testParent.innerHTML = '<marquee id="marquee" vspace="-1">test</marquee>'; 139 marquee = document.getElementById('marquee'); 140 shouldBe('marquee.vspace', '0'); 141 142 debug('"vspace" IDL attribute is 0 when content attribute is too large:'); 143 testParent.innerHTML = '<marquee id="marquee" vspace="2147483648">test</marquee>'; 144 marquee = document.getElementById('marquee'); 145 shouldBe('marquee.vspace', '0'); 126 146 127 147 debug('Default "scrollAmount" value is 6:'); -
trunk/WebCore/ChangeLog
r73561 r73564 1 2010-12-08 Andy Estes <aestes@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Reflected unsigned attributes should be in the range [0, 2^31). 6 https://bugs.webkit.org/show_bug.cgi?id=50472 7 8 HTML5 says that unsigned reflected attributes should be in the range 9 [0, 2^31). When a value isn't in this range, a default value (or 0) 10 should be returned instead. Update the JS bindings code generator to 11 ensure 0 is returned when a content attribute value falls outside of 12 this range. 13 14 Tests: bindings/scripts/test/TestObj.idl 15 fast/html/marquee-element.html 16 17 * bindings/scripts/CodeGeneratorJS.pm: Return the maximum of 0 and the 18 content attribute as a 32-bit signed int when converting a native value 19 to an unsigned JS value. 20 * bindings/scripts/test/TestObj.idl: Add a reflected unsigned attribute 21 to test code generation. 22 * bindings/scripts/test/CPP/WebDOMTestObj.cpp: Update test results. 23 * bindings/scripts/test/CPP/WebDOMTestObj.h: Ditto. 24 * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. 25 * bindings/scripts/test/GObject/WebKitDOMTestObj.h: Ditto. 26 * bindings/scripts/test/JS/JSTestObj.cpp: Ditto. 27 * bindings/scripts/test/JS/JSTestObj.h: Ditto. 28 * bindings/scripts/test/ObjC/DOMTestObj.h: Ditto. 29 * bindings/scripts/test/ObjC/DOMTestObj.mm: Ditto. 30 * bindings/scripts/test/V8/V8TestObj.cpp: Ditto. 31 1 32 2010-12-08 Carlos Garcia Campos <cgarcia@igalia.com> 2 33 -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r72941 r73564 2498 2498 return "jsDateOrNull(exec, $value)"; 2499 2499 } 2500 2501 if ($signature->extendedAttributes->{"Reflect"} and ($type eq "unsigned long" or $type eq "unsigned short")) { 2502 $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g; 2503 return "jsNumber(std::max(0, " . $value . "))"; 2504 } 2505 2500 2506 if ($codeGenerator->IsPrimitiveType($type) or $type eq "SVGPaintType" or $type eq "DOMTimeStamp") { 2501 2507 $implIncludes{"<runtime/JSNumberCell.h>"} = 1; -
trunk/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.cpp
r72728 r73564 282 282 } 283 283 284 unsigned WebDOMTestObj::reflectedUnsignedIntegralAttr() const 285 { 286 if (!impl()) 287 return unsigned(); 288 289 return impl()->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr); 290 } 291 292 void WebDOMTestObj::setReflectedUnsignedIntegralAttr(unsigned newReflectedUnsignedIntegralAttr) 293 { 294 if (!impl()) 295 return; 296 297 impl()->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, newReflectedUnsignedIntegralAttr); 298 } 299 284 300 bool WebDOMTestObj::reflectedBooleanAttr() const 285 301 { -
trunk/WebCore/bindings/scripts/test/CPP/WebDOMTestObj.h
r72728 r73564 84 84 int reflectedIntegralAttr() const; 85 85 void setReflectedIntegralAttr(int); 86 unsigned reflectedUnsignedIntegralAttr() const; 87 void setReflectedUnsignedIntegralAttr(unsigned); 86 88 bool reflectedBooleanAttr() const; 87 89 void setReflectedBooleanAttr(bool); -
trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r73238 r73564 666 666 } 667 667 668 gulong 669 webkit_dom_test_obj_get_reflected_unsigned_integral_attr(WebKitDOMTestObj* self) 670 { 671 g_return_val_if_fail(self, 0); 672 WebCore::JSMainThreadNullState state; 673 WebCore::TestObj * item = WebKit::core(self); 674 gulong res = item->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr); 675 return res; 676 } 677 678 void 679 webkit_dom_test_obj_set_reflected_unsigned_integral_attr(WebKitDOMTestObj* self, gulong value) 680 { 681 g_return_if_fail(self); 682 WebCore::JSMainThreadNullState state; 683 WebCore::TestObj * item = WebKit::core(self); 684 item->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, value); 685 } 686 668 687 gboolean 669 688 webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self) … … 1095 1114 PROP_REFLECTED_STRING_ATTR, 1096 1115 PROP_REFLECTED_INTEGRAL_ATTR, 1116 PROP_REFLECTED_UNSIGNED_INTEGRAL_ATTR, 1097 1117 PROP_REFLECTED_BOOLEAN_ATTR, 1098 1118 PROP_REFLECTED_URL_ATTR, … … 1181 1201 break; 1182 1202 } 1203 case PROP_REFLECTED_UNSIGNED_INTEGRAL_ATTR: 1204 { 1205 coreSelf->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, (g_value_get_ulong(value))); 1206 break; 1207 } 1183 1208 case PROP_REFLECTED_BOOLEAN_ATTR: 1184 1209 { … … 1355 1380 { 1356 1381 g_value_set_long(value, coreSelf->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); 1382 break; 1383 } 1384 case PROP_REFLECTED_UNSIGNED_INTEGRAL_ATTR: 1385 { 1386 g_value_set_ulong(value, coreSelf->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)); 1357 1387 break; 1358 1388 } … … 1595 1625 WEBKIT_PARAM_READWRITE)); 1596 1626 g_object_class_install_property(gobjectClass, 1627 PROP_REFLECTED_UNSIGNED_INTEGRAL_ATTR, 1628 g_param_spec_ulong("reflected-unsigned-integral-attr", /* name */ 1629 "test_obj_reflected-unsigned-integral-attr", /* short description */ 1630 "read-write gulong TestObj.reflected-unsigned-integral-attr", /* longer - could do with some extra doc stuff here */ 1631 0, /* min */ 1632 G_MAXULONG, /* max */ 1633 0, /* default */ 1634 WEBKIT_PARAM_READWRITE)); 1635 g_object_class_install_property(gobjectClass, 1597 1636 PROP_REFLECTED_BOOLEAN_ATTR, 1598 1637 g_param_spec_boolean("reflected-boolean-attr", /* name */ -
trunk/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
r72728 r73564 209 209 webkit_dom_test_obj_set_reflected_integral_attr(WebKitDOMTestObj* self, glong value); 210 210 211 WEBKIT_API gulong 212 webkit_dom_test_obj_get_reflected_unsigned_integral_attr(WebKitDOMTestObj* self); 213 214 WEBKIT_API void 215 webkit_dom_test_obj_set_reflected_unsigned_integral_attr(WebKitDOMTestObj* self, gulong value); 216 211 217 WEBKIT_API gboolean 212 218 webkit_dom_test_obj_get_reflected_boolean_attr(WebKitDOMTestObj* self); -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r72895 r73564 56 56 #endif 57 57 58 static const HashTableValue JSTestObjTableValues[3 6] =58 static const HashTableValue JSTestObjTableValues[37] = 59 59 { 60 60 { "readOnlyIntAttr", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReadOnlyIntAttr), (intptr_t)0 THUNK_GENERATOR(0) }, … … 72 72 { "reflectedStringAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedStringAttr), (intptr_t)setJSTestObjReflectedStringAttr THUNK_GENERATOR(0) }, 73 73 { "reflectedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedIntegralAttr), (intptr_t)setJSTestObjReflectedIntegralAttr THUNK_GENERATOR(0) }, 74 { "reflectedUnsignedIntegralAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedUnsignedIntegralAttr), (intptr_t)setJSTestObjReflectedUnsignedIntegralAttr THUNK_GENERATOR(0) }, 74 75 { "reflectedBooleanAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedBooleanAttr), (intptr_t)setJSTestObjReflectedBooleanAttr THUNK_GENERATOR(0) }, 75 76 { "reflectedURLAttr", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsTestObjReflectedURLAttr), (intptr_t)setJSTestObjReflectedURLAttr THUNK_GENERATOR(0) }, … … 408 409 } 409 410 411 JSValue jsTestObjReflectedUnsignedIntegralAttr(ExecState* exec, JSValue slotBase, const Identifier&) 412 { 413 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(slotBase)); 414 UNUSED_PARAM(exec); 415 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 416 JSValue result = jsNumber(std::max(0, imp->getIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr))); 417 return result; 418 } 419 410 420 JSValue jsTestObjReflectedBooleanAttr(ExecState* exec, JSValue slotBase, const Identifier&) 411 421 { … … 678 688 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 679 689 imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, value.toInt32(exec)); 690 } 691 692 void setJSTestObjReflectedUnsignedIntegralAttr(ExecState* exec, JSObject* thisObject, JSValue value) 693 { 694 JSTestObj* castedThis = static_cast<JSTestObj*>(thisObject); 695 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 696 imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, value.toUInt32(exec)); 680 697 } 681 698 -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.h
r72728 r73564 150 150 JSC::JSValue jsTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); 151 151 void setJSTestObjReflectedIntegralAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); 152 JSC::JSValue jsTestObjReflectedUnsignedIntegralAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); 153 void setJSTestObjReflectedUnsignedIntegralAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); 152 154 JSC::JSValue jsTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSValue, const JSC::Identifier&); 153 155 void setJSTestObjReflectedBooleanAttr(JSC::ExecState*, JSC::JSObject*, JSC::JSValue); -
trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
r72728 r73564 76 76 - (int)reflectedIntegralAttr; 77 77 - (void)setReflectedIntegralAttr:(int)newReflectedIntegralAttr; 78 - (unsigned)reflectedUnsignedIntegralAttr; 79 - (void)setReflectedUnsignedIntegralAttr:(unsigned)newReflectedUnsignedIntegralAttr; 78 80 - (BOOL)reflectedBooleanAttr; 79 81 - (void)setReflectedBooleanAttr:(BOOL)newReflectedBooleanAttr; -
trunk/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
r72728 r73564 231 231 } 232 232 233 - (unsigned)reflectedUnsignedIntegralAttr 234 { 235 WebCore::JSMainThreadNullState state; 236 return IMPL->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr); 237 } 238 239 - (void)setReflectedUnsignedIntegralAttr:(unsigned)newReflectedUnsignedIntegralAttr 240 { 241 WebCore::JSMainThreadNullState state; 242 IMPL->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, newReflectedUnsignedIntegralAttr); 243 } 244 233 245 - (BOOL)reflectedBooleanAttr 234 246 { -
trunk/WebCore/bindings/scripts/test/TestObj.idl
r72728 r73564 52 52 attribute [Reflect] DOMString reflectedStringAttr; 53 53 attribute [Reflect] long reflectedIntegralAttr; 54 attribute [Reflect] unsigned long reflectedUnsignedIntegralAttr; 54 55 attribute [Reflect] boolean reflectedBooleanAttr; 55 56 attribute [Reflect, URL] DOMString reflectedURLAttr; -
trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r72895 r73564 254 254 int v = toInt32(value); 255 255 imp->setIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr, v); 256 return; 257 } 258 259 static v8::Handle<v8::Value> reflectedUnsignedIntegralAttrAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info) 260 { 261 INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._get"); 262 TestObj* imp = V8TestObj::toNative(info.Holder()); 263 return v8::Integer::NewFromUnsigned(imp->getUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr)); 264 } 265 266 static void reflectedUnsignedIntegralAttrAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info) 267 { 268 INC_STATS("DOM.TestObj.reflectedUnsignedIntegralAttr._set"); 269 TestObj* imp = V8TestObj::toNative(info.Holder()); 270 unsigned v = toUInt32(value); 271 imp->setUnsignedIntegralAttribute(WebCore::HTMLNames::reflectedunsignedintegralattrAttr, v); 256 272 return; 257 273 } … … 1164 1180 // Attribute 'reflectedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') 1165 1181 {"reflectedIntegralAttr", TestObjInternal::reflectedIntegralAttrAttrGetter, TestObjInternal::reflectedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 1182 // Attribute 'reflectedUnsignedIntegralAttr' (Type: 'attribute' ExtAttr: 'Reflect') 1183 {"reflectedUnsignedIntegralAttr", TestObjInternal::reflectedUnsignedIntegralAttrAttrGetter, TestObjInternal::reflectedUnsignedIntegralAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */}, 1166 1184 // Attribute 'reflectedBooleanAttr' (Type: 'attribute' ExtAttr: 'Reflect') 1167 1185 {"reflectedBooleanAttr", TestObjInternal::reflectedBooleanAttrAttrGetter, TestObjInternal::reflectedBooleanAttrAttrSetter, 0 /* no data */, static_cast<v8::AccessControl>(v8::DEFAULT), static_cast<v8::PropertyAttribute>(v8::None), 0 /* on instance */},
Note: See TracChangeset
for help on using the changeset viewer.