Changeset 115442 in webkit
- Timestamp:
- Apr 27, 2012 9:35:38 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r115438 r115442 1 2012-04-27 Zan Dobersek <zandobersek@gmail.com> 2 3 [Gtk][DOM Bindings] Feature-protected properties are put under condition guards 4 https://bugs.webkit.org/show_bug.cgi?id=85068 5 6 Reviewed by Martin Robinson. 7 8 Generated feature-dependent properties are now present regardless of that 9 feature being enabled. On getting or setting that property's value a warning 10 is thrown if the feature is not enabled. Additionally, if the generated 11 interface is feature-dependant, when getting or setting any property's value 12 a warning is thrown if the feature is not enabled. 13 14 No new tests - covered by existing bindings tests. 15 16 * bindings/scripts/CodeGeneratorGObject.pm: 17 (GenerateProperty): 18 (GenerateProperties): 19 * bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp: Rebaseline. 20 (webkit_dom_test_interface_set_property): 21 (webkit_dom_test_interface_get_property): 22 (webkit_dom_test_interface_class_init): 23 * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Ditto. 24 (webkit_dom_test_obj_set_property): 25 (webkit_dom_test_obj_get_property): 26 (webkit_dom_test_obj_class_init): 27 * bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp: Ditto. 28 (webkit_dom_test_serialized_script_value_interface_get_property): 29 1 30 2012-04-27 Zan Dobersek <zandobersek@gmail.com> 2 31 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r115438 r115442 347 347 { 348 348 my $node = shift; 349 my $indentSize = shift; 350 if (!$indentSize) { 351 $indentSize = 4; 352 } 353 349 354 my $conditional = $node->extendedAttributes->{"Conditional"}; 350 355 my @warn; … … 355 360 foreach $condition (@splitConditionals) { 356 361 push(@warn, "#if !ENABLE($condition)\n"); 357 push(@warn, "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($condition) . "\")\n");362 push(@warn, ' ' x $indentSize . "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($condition) . "\")\n"); 358 363 push(@warn, "#endif\n"); 359 364 } 360 365 } elsif ($conditional =~ /\|/) { 361 366 foreach $condition (split(/\|/, $conditional)) { 362 push(@warn, "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($condition) . "\")\n");367 push(@warn, ' ' x $indentSize . "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($condition) . "\")\n"); 363 368 } 364 369 } else { 365 push(@warn, "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($conditional) . "\")\n");370 push(@warn, ' ' x $indentSize . "WEBKIT_WARN_FEATURE_NOT_PRESENT(\"" . HumanReadableConditional($conditional) . "\")\n"); 366 371 } 367 372 } … … 374 379 my $interfaceName = shift; 375 380 my @writeableProperties = @{shift @_}; 381 my $parentNode = shift; 376 382 377 383 my $conditionalString = $codeGenerator->GenerateConditionalString($attribute->signature); 384 my @conditionalWarn = GenerateConditionalWarning($attribute->signature, 8); 385 my $parentConditionalString = $codeGenerator->GenerateConditionalString($parentNode); 386 my @parentConditionalWarn = GenerateConditionalWarning($parentNode, 8); 378 387 my $camelPropName = $attribute->signature->name; 379 388 my $setPropNameFunction = $codeGenerator->WK_ucfirst($camelPropName); … … 384 393 $propName =~ s/_/-/g; 385 394 my ${propEnum} = "PROP_${propNameCaps}"; 386 push(@cBodyProperties, "#if ${conditionalString}\n") if $conditionalString;387 395 push(@cBodyProperties, " ${propEnum},\n"); 388 push(@cBodyProperties, "#endif /* ${conditionalString} */\n") if $conditionalString;389 396 390 397 my $propType = $attribute->signature->type; … … 435 442 436 443 if (grep {$_ eq $attribute} @writeableProperties) { 444 push(@txtSetProps, " case ${propEnum}: {\n"); 445 push(@txtSetProps, "#if ${parentConditionalString}\n") if $parentConditionalString; 437 446 push(@txtSetProps, "#if ${conditionalString}\n") if $conditionalString; 438 push(@txtSetProps, " case ${propEnum}: {\n");439 447 push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; 440 448 push(@txtSetProps, " ${setterFunctionName}(" . join(", ", @setterArguments) . ");\n"); 449 push(@txtSetProps, "#else\n") if $conditionalString; 450 push(@txtSetProps, @conditionalWarn) if scalar(@conditionalWarn); 451 push(@txtSetProps, "#endif /* ${conditionalString} */\n") if $conditionalString; 452 push(@txtSetProps, "#else\n") if $parentConditionalString; 453 push(@txtSetProps, @parentConditionalWarn) if scalar(@parentConditionalWarn); 454 push(@txtSetProps, "#endif /* ${parentConditionalString} */\n") if $parentConditionalString; 441 455 push(@txtSetProps, " break;\n }\n"); 442 push(@txtSetProps, "#endif /* ${conditionalString} */\n") if $conditionalString; 443 } 444 456 } 457 458 push(@txtGetProps, " case ${propEnum}: {\n"); 459 push(@txtGetProps, "#if ${parentConditionalString}\n") if $parentConditionalString; 445 460 push(@txtGetProps, "#if ${conditionalString}\n") if $conditionalString; 446 push(@txtGetProps, " case ${propEnum}: {\n");447 461 push(@txtGetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->getterExceptions}; 448 462 … … 474 488 } 475 489 490 push(@txtGetProps, "#else\n") if $conditionalString; 491 push(@txtGetProps, @conditionalWarn) if scalar(@conditionalWarn); 492 push(@txtGetProps, "#endif /* ${conditionalString} */\n") if $conditionalString; 493 push(@txtGetProps, "#else\n") if $parentConditionalString; 494 push(@txtGetProps, @parentConditionalWarn) if scalar(@parentConditionalWarn); 495 push(@txtGetProps, "#endif /* ${parentConditionalString} */\n") if $parentConditionalString; 476 496 push(@txtGetProps, " break;\n }\n"); 477 push(@txtGetProps, "#endif /* ${conditionalString} */\n") if $conditionalString;478 497 479 498 my %param_spec_options = ("int", "G_MININT, /* min */\nG_MAXINT, /* max */\n0, /* default */", … … 501 520 ${gparamflag})); 502 521 EOF 503 push(@txtInstallProps, "#if ${conditionalString}\n") if $conditionalString;504 522 push(@txtInstallProps, $txtInstallProp); 505 push(@txtInstallProps, "#endif /* ${conditionalString} */\n") if $conditionalString;506 523 } 507 524 … … 578 595 if ($attribute->signature->type ne "EventListener" && 579 596 $attribute->signature->type ne "MediaQueryListListener") { 580 GenerateProperty($attribute, $interfaceName, \@writeableProperties );597 GenerateProperty($attribute, $interfaceName, \@writeableProperties, $dataNode); 581 598 } 582 599 } -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestInterface.cpp
r115438 r115442 86 86 enum { 87 87 PROP_0, 88 #if ENABLE(Condition11) || ENABLE(Condition12)89 88 PROP_SUPPLEMENTAL_STR1, 90 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */91 #if ENABLE(Condition11) || ENABLE(Condition12)92 89 PROP_SUPPLEMENTAL_STR2, 93 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */94 #if ENABLE(Condition11) || ENABLE(Condition12)95 90 PROP_SUPPLEMENTAL_NODE, 96 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */97 91 }; 98 92 … … 121 115 WebCore::TestInterface* coreSelf = WebKit::core(self); 122 116 switch (propertyId) { 123 #if ENABLE(Condition11) || ENABLE(Condition12)124 117 case PROP_SUPPLEMENTAL_STR2: { 118 #if ENABLE(Condition1) || ENABLE(Condition2) 119 #if ENABLE(Condition11) || ENABLE(Condition12) 125 120 WebCore::TestSupplemental::setSupplementalStr2(coreSelf, WTF::String::fromUTF8(g_value_get_string(value))); 126 break; 127 } 128 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 121 #else 122 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11") 123 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12") 124 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 125 #else 126 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 127 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 128 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 129 break; 130 } 129 131 default: 130 132 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); … … 140 142 WebCore::TestInterface* coreSelf = WebKit::core(self); 141 143 switch (propertyId) { 142 #if ENABLE(Condition11) || ENABLE(Condition12)143 144 case PROP_SUPPLEMENTAL_STR1: { 145 #if ENABLE(Condition1) || ENABLE(Condition2) 146 #if ENABLE(Condition11) || ENABLE(Condition12) 144 147 g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr1(coreSelf))); 145 break; 146 } 147 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 148 #if ENABLE(Condition11) || ENABLE(Condition12) 148 #else 149 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11") 150 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12") 151 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 152 #else 153 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 154 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 155 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 156 break; 157 } 149 158 case PROP_SUPPLEMENTAL_STR2: { 159 #if ENABLE(Condition1) || ENABLE(Condition2) 160 #if ENABLE(Condition11) || ENABLE(Condition12) 150 161 g_value_take_string(value, convertToUTF8String(WebCore::TestSupplemental::supplementalStr2(coreSelf))); 151 break; 152 } 153 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 154 #if ENABLE(Condition11) || ENABLE(Condition12) 162 #else 163 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11") 164 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12") 165 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 166 #else 167 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 168 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 169 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 170 break; 171 } 155 172 case PROP_SUPPLEMENTAL_NODE: { 173 #if ENABLE(Condition1) || ENABLE(Condition2) 174 #if ENABLE(Condition11) || ENABLE(Condition12) 156 175 RefPtr<WebCore::Node> ptr = WebCore::TestSupplemental::supplementalNode(coreSelf); 157 176 g_value_set_object(value, WebKit::kit(ptr.get())); 158 break; 159 } 160 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 177 #else 178 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition11") 179 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition12") 180 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */ 181 #else 182 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 183 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 184 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 185 break; 186 } 161 187 default: 162 188 G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propertyId, pspec); … … 181 207 gobjectClass->constructed = webkit_dom_test_interface_constructed; 182 208 183 #if ENABLE(Condition11) || ENABLE(Condition12)184 209 g_object_class_install_property(gobjectClass, 185 210 PROP_SUPPLEMENTAL_STR1, … … 189 214 "", /* default */ 190 215 WEBKIT_PARAM_READABLE)); 191 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */192 #if ENABLE(Condition11) || ENABLE(Condition12)193 216 g_object_class_install_property(gobjectClass, 194 217 PROP_SUPPLEMENTAL_STR2, … … 198 221 "", /* default */ 199 222 WEBKIT_PARAM_READWRITE)); 200 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */201 #if ENABLE(Condition11) || ENABLE(Condition12)202 223 g_object_class_install_property(gobjectClass, 203 224 PROP_SUPPLEMENTAL_NODE, … … 207 228 WEBKIT_TYPE_DOM_NODE, /* gobject type */ 208 229 WEBKIT_PARAM_READWRITE)); 209 #endif /* ENABLE(Condition11) || ENABLE(Condition12) */210 230 211 231 -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r113450 r115442 134 134 PROP_WITH_SCRIPT_EXECUTION_CONTEXT_AND_SCRIPT_STATE_WITH_SPACES_ATTRIBUTE, 135 135 PROP_WITH_SCRIPT_ARGUMENTS_AND_CALL_STACK_ATTRIBUTE, 136 #if ENABLE(Condition1)137 136 PROP_CONDITIONAL_ATTR1, 138 #endif /* ENABLE(Condition1) */139 #if ENABLE(Condition1) && ENABLE(Condition2)140 137 PROP_CONDITIONAL_ATTR2, 141 #endif /* ENABLE(Condition1) && ENABLE(Condition2) */142 #if ENABLE(Condition1) || ENABLE(Condition2)143 138 PROP_CONDITIONAL_ATTR3, 144 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */145 139 PROP_CONTENT_DOCUMENT, 146 140 PROP_MUTABLE_POINT, … … 257 251 break; 258 252 } 253 case PROP_CONDITIONAL_ATTR1: { 259 254 #if ENABLE(Condition1) 260 case PROP_CONDITIONAL_ATTR1: {261 255 coreSelf->setConditionalAttr1((g_value_get_long(value))); 262 break; 263 }256 #else 257 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 264 258 #endif /* ENABLE(Condition1) */ 259 break; 260 } 261 case PROP_CONDITIONAL_ATTR2: { 265 262 #if ENABLE(Condition1) && ENABLE(Condition2) 266 case PROP_CONDITIONAL_ATTR2: {267 263 coreSelf->setConditionalAttr2((g_value_get_long(value))); 268 break; 269 } 264 #else 265 #if !ENABLE(Condition1) 266 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 267 #endif 268 #if !ENABLE(Condition2) 269 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 270 #endif 270 271 #endif /* ENABLE(Condition1) && ENABLE(Condition2) */ 272 break; 273 } 274 case PROP_CONDITIONAL_ATTR3: { 271 275 #if ENABLE(Condition1) || ENABLE(Condition2) 272 case PROP_CONDITIONAL_ATTR3: {273 276 coreSelf->setConditionalAttr3((g_value_get_long(value))); 274 break; 275 } 277 #else 278 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 279 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 276 280 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 281 break; 282 } 277 283 case PROP_STRICT_FLOAT: { 278 284 coreSelf->setStrictFloat((g_value_get_float(value))); … … 443 449 break; 444 450 } 451 case PROP_CONDITIONAL_ATTR1: { 445 452 #if ENABLE(Condition1) 446 case PROP_CONDITIONAL_ATTR1: {447 453 g_value_set_long(value, coreSelf->conditionalAttr1()); 448 break; 449 }454 #else 455 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 450 456 #endif /* ENABLE(Condition1) */ 457 break; 458 } 459 case PROP_CONDITIONAL_ATTR2: { 451 460 #if ENABLE(Condition1) && ENABLE(Condition2) 452 case PROP_CONDITIONAL_ATTR2: {453 461 g_value_set_long(value, coreSelf->conditionalAttr2()); 454 break; 455 } 462 #else 463 #if !ENABLE(Condition1) 464 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 465 #endif 466 #if !ENABLE(Condition2) 467 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 468 #endif 456 469 #endif /* ENABLE(Condition1) && ENABLE(Condition2) */ 470 break; 471 } 472 case PROP_CONDITIONAL_ATTR3: { 457 473 #if ENABLE(Condition1) || ENABLE(Condition2) 458 case PROP_CONDITIONAL_ATTR3: {459 474 g_value_set_long(value, coreSelf->conditionalAttr3()); 460 break; 461 } 475 #else 476 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 477 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 462 478 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 479 break; 480 } 463 481 case PROP_CONTENT_DOCUMENT: { 464 482 RefPtr<WebCore::Document> ptr = coreSelf->contentDocument(); … … 773 791 WEBKIT_TYPE_DOM_TEST_OBJ, /* gobject type */ 774 792 WEBKIT_PARAM_READWRITE)); 775 #if ENABLE(Condition1)776 793 g_object_class_install_property(gobjectClass, 777 794 PROP_CONDITIONAL_ATTR1, … … 783 800 0, /* default */ 784 801 WEBKIT_PARAM_READWRITE)); 785 #endif /* ENABLE(Condition1) */786 #if ENABLE(Condition1) && ENABLE(Condition2)787 802 g_object_class_install_property(gobjectClass, 788 803 PROP_CONDITIONAL_ATTR2, … … 794 809 0, /* default */ 795 810 WEBKIT_PARAM_READWRITE)); 796 #endif /* ENABLE(Condition1) && ENABLE(Condition2) */797 #if ENABLE(Condition1) || ENABLE(Condition2)798 811 g_object_class_install_property(gobjectClass, 799 812 PROP_CONDITIONAL_ATTR3, … … 805 818 0, /* default */ 806 819 WEBKIT_PARAM_READWRITE)); 807 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */808 820 g_object_class_install_property(gobjectClass, 809 821 PROP_CONTENT_DOCUMENT, -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestSerializedScriptValueInterface.cpp
r115438 r115442 130 130 switch (propertyId) { 131 131 case PROP_VALUE: { 132 #if ENABLE(Condition1) || ENABLE(Condition2) 132 133 RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->value(); 133 134 g_value_set_object(value, WebKit::kit(ptr.get())); 135 #else 136 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 137 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 138 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 134 139 break; 135 140 } 136 141 case PROP_READONLY_VALUE: { 142 #if ENABLE(Condition1) || ENABLE(Condition2) 137 143 RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->readonlyValue(); 138 144 g_value_set_object(value, WebKit::kit(ptr.get())); 145 #else 146 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 147 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 148 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 139 149 break; 140 150 } 141 151 case PROP_CACHED_VALUE: { 152 #if ENABLE(Condition1) || ENABLE(Condition2) 142 153 RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->cachedValue(); 143 154 g_value_set_object(value, WebKit::kit(ptr.get())); 155 #else 156 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 157 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 158 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 144 159 break; 145 160 } 146 161 case PROP_PORTS: { 162 #if ENABLE(Condition1) || ENABLE(Condition2) 147 163 RefPtr<WebCore::MessagePortArray> ptr = coreSelf->ports(); 148 164 g_value_set_object(value, WebKit::kit(ptr.get())); 165 #else 166 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 167 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 168 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 149 169 break; 150 170 } 151 171 case PROP_CACHED_READONLY_VALUE: { 172 #if ENABLE(Condition1) || ENABLE(Condition2) 152 173 RefPtr<WebCore::SerializedScriptValue> ptr = coreSelf->cachedReadonlyValue(); 153 174 g_value_set_object(value, WebKit::kit(ptr.get())); 175 #else 176 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition1") 177 WEBKIT_WARN_FEATURE_NOT_PRESENT("Condition2") 178 #endif /* ENABLE(Condition1) || ENABLE(Condition2) */ 154 179 break; 155 180 }
Note: See TracChangeset
for help on using the changeset viewer.