Changeset 58108 in webkit
- Timestamp:
- Apr 22, 2010 12:39:50 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r58107 r58108 1 2010-04-22 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Gustavo Noronha. 4 5 [GTK] GObject DOM bindings 6 https://bugs.webkit.org/show_bug.cgi?id=33590 7 8 Extend the bindings to cover most of Document.idl 9 10 * GNUmakefile.am: 11 * bindings/gobject/WebKitDOMBinding.cpp: 12 (WebKit::createWrapper): 13 (WebKit::kit): 14 * bindings/gobject/WebKitDOMBinding.h: 15 * bindings/gobject/WebKitHTMLElementWrapperFactory.cpp: Added. 16 (WebKit::createAnchorWrapper): 17 (WebKit::createAppletWrapper): 18 (WebKit::createAreaWrapper): 19 (WebKit::createBaseWrapper): 20 (WebKit::createBaseFontWrapper): 21 (WebKit::createBlockquoteWrapper): 22 (WebKit::createBodyWrapper): 23 (WebKit::createBRWrapper): 24 (WebKit::createButtonWrapper): 25 (WebKit::createCanvasWrapper): 26 (WebKit::createTableCaptionWrapper): 27 (WebKit::createTableColWrapper): 28 (WebKit::createModWrapper): 29 (WebKit::createDirectoryWrapper): 30 (WebKit::createDivWrapper): 31 (WebKit::createDListWrapper): 32 (WebKit::createEmbedWrapper): 33 (WebKit::createFieldSetWrapper): 34 (WebKit::createFontWrapper): 35 (WebKit::createFormWrapper): 36 (WebKit::createFrameWrapper): 37 (WebKit::createFrameSetWrapper): 38 (WebKit::createHeadingWrapper): 39 (WebKit::createHeadWrapper): 40 (WebKit::createHRWrapper): 41 (WebKit::createHtmlWrapper): 42 (WebKit::createIFrameWrapper): 43 (WebKit::createImageWrapper): 44 (WebKit::createInputWrapper): 45 (WebKit::createIsIndexWrapper): 46 (WebKit::createLabelWrapper): 47 (WebKit::createLegendWrapper): 48 (WebKit::createLIWrapper): 49 (WebKit::createLinkWrapper): 50 (WebKit::createMapWrapper): 51 (WebKit::createMarqueeWrapper): 52 (WebKit::createMenuWrapper): 53 (WebKit::createMetaWrapper): 54 (WebKit::createObjectWrapper): 55 (WebKit::createOListWrapper): 56 (WebKit::createOptGroupWrapper): 57 (WebKit::createOptionWrapper): 58 (WebKit::createParagraphWrapper): 59 (WebKit::createParamWrapper): 60 (WebKit::createPreWrapper): 61 (WebKit::createQuoteWrapper): 62 (WebKit::createScriptWrapper): 63 (WebKit::createSelectWrapper): 64 (WebKit::createStyleWrapper): 65 (WebKit::createTableWrapper): 66 (WebKit::createTableSectionWrapper): 67 (WebKit::createTableCellWrapper): 68 (WebKit::createTextAreaWrapper): 69 (WebKit::createTitleWrapper): 70 (WebKit::createTableRowWrapper): 71 (WebKit::createUListWrapper): 72 (WebKit::createHTMLElementWrapper): 73 * bindings/gobject/WebKitHTMLElementWrapperFactory.h: Added. 74 * bindings/scripts/CodeGeneratorGObject.pm: 75 * dom/Node.idl: 76 1 77 2010-04-22 Eric Carlson <eric.carlson@apple.com> 2 78 -
trunk/WebCore/GNUmakefile.am
r58093 r58108 319 319 WebCore/bindings/gobject/WebKitDOMBinding.cpp \ 320 320 WebCore/bindings/gobject/WebKitDOMBinding.h \ 321 WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.cpp \ 322 WebCore/bindings/gobject/WebKitHTMLElementWrapperFactory.h \ 321 323 WebCore/bindings/gobject/WebKitDOMObject.cpp \ 322 324 WebCore/bindings/gobject/WebKitDOMObject.h … … 3795 3797 WebCore/css/CSSStyleSheet.idl \ 3796 3798 WebCore/css/CSSValue.idl \ 3799 WebCore/css/Media.idl \ 3797 3800 WebCore/css/MediaList.idl \ 3798 3801 WebCore/css/StyleSheet.idl \ 3802 WebCore/css/StyleSheetList.idl \ 3799 3803 WebCore/dom/Attr.idl \ 3804 WebCore/dom/CDATASection.idl \ 3805 WebCore/dom/CharacterData.idl \ 3806 WebCore/dom/Comment.idl \ 3807 WebCore/dom/Document.idl \ 3808 WebCore/dom/DocumentFragment.idl \ 3809 WebCore/dom/DocumentType.idl \ 3810 WebCore/dom/DOMImplementation.idl \ 3800 3811 WebCore/dom/Element.idl \ 3812 WebCore/dom/EntityReference.idl \ 3813 WebCore/dom/MessagePort.idl \ 3801 3814 WebCore/dom/NamedNodeMap.idl \ 3802 3815 WebCore/dom/Node.idl \ 3803 WebCore/dom/NodeList.idl 3816 WebCore/dom/NodeFilter.idl \ 3817 WebCore/dom/NodeIterator.idl \ 3818 WebCore/dom/NodeList.idl \ 3819 WebCore/dom/ProcessingInstruction.idl \ 3820 WebCore/dom/Range.idl \ 3821 WebCore/dom/Text.idl \ 3822 WebCore/dom/TreeWalker.idl \ 3823 WebCore/html/Blob.idl \ 3824 WebCore/html/File.idl \ 3825 WebCore/html/FileList.idl \ 3826 WebCore/html/HTMLAnchorElement.idl \ 3827 WebCore/html/HTMLAppletElement.idl \ 3828 WebCore/html/HTMLAreaElement.idl \ 3829 WebCore/html/HTMLBaseElement.idl \ 3830 WebCore/html/HTMLBaseFontElement.idl \ 3831 WebCore/html/HTMLBlockquoteElement.idl \ 3832 WebCore/html/HTMLBodyElement.idl \ 3833 WebCore/html/HTMLBRElement.idl \ 3834 WebCore/html/HTMLButtonElement.idl \ 3835 WebCore/html/HTMLCanvasElement.idl \ 3836 WebCore/html/HTMLCollection.idl \ 3837 WebCore/html/HTMLDirectoryElement.idl \ 3838 WebCore/html/HTMLDivElement.idl \ 3839 WebCore/html/HTMLDListElement.idl \ 3840 WebCore/html/HTMLDocument.idl \ 3841 WebCore/html/HTMLElement.idl \ 3842 WebCore/html/HTMLEmbedElement.idl \ 3843 WebCore/html/HTMLFieldSetElement.idl \ 3844 WebCore/html/HTMLFontElement.idl \ 3845 WebCore/html/HTMLFormElement.idl \ 3846 WebCore/html/HTMLFrameElement.idl \ 3847 WebCore/html/HTMLFrameSetElement.idl \ 3848 WebCore/html/HTMLHeadElement.idl \ 3849 WebCore/html/HTMLHeadingElement.idl \ 3850 WebCore/html/HTMLHRElement.idl \ 3851 WebCore/html/HTMLHtmlElement.idl \ 3852 WebCore/html/HTMLIFrameElement.idl \ 3853 WebCore/html/HTMLImageElement.idl \ 3854 WebCore/html/HTMLInputElement.idl \ 3855 WebCore/html/HTMLIsIndexElement.idl \ 3856 WebCore/html/HTMLLabelElement.idl \ 3857 WebCore/html/HTMLLegendElement.idl \ 3858 WebCore/html/HTMLLIElement.idl \ 3859 WebCore/html/HTMLLinkElement.idl \ 3860 WebCore/html/HTMLMapElement.idl \ 3861 WebCore/html/HTMLMarqueeElement.idl \ 3862 WebCore/html/HTMLMenuElement.idl \ 3863 WebCore/html/HTMLMetaElement.idl \ 3864 WebCore/html/HTMLModElement.idl \ 3865 WebCore/html/HTMLObjectElement.idl \ 3866 WebCore/html/HTMLOListElement.idl \ 3867 WebCore/html/HTMLOptGroupElement.idl \ 3868 WebCore/html/HTMLOptionElement.idl \ 3869 WebCore/html/HTMLOptionsCollection.idl \ 3870 WebCore/html/HTMLParagraphElement.idl \ 3871 WebCore/html/HTMLParamElement.idl \ 3872 WebCore/html/HTMLPreElement.idl \ 3873 WebCore/html/HTMLQuoteElement.idl \ 3874 WebCore/html/HTMLScriptElement.idl \ 3875 WebCore/html/HTMLSelectElement.idl \ 3876 WebCore/html/HTMLStyleElement.idl \ 3877 WebCore/html/HTMLTableElement.idl \ 3878 WebCore/html/HTMLTableCaptionElement.idl \ 3879 WebCore/html/HTMLTableColElement.idl \ 3880 WebCore/html/HTMLTableSectionElement.idl \ 3881 WebCore/html/HTMLTableCellElement.idl \ 3882 WebCore/html/HTMLTextAreaElement.idl \ 3883 WebCore/html/HTMLTitleElement.idl \ 3884 WebCore/html/HTMLTableRowElement.idl \ 3885 WebCore/html/HTMLUListElement.idl \ 3886 WebCore/html/ValidityState.idl \ 3887 WebCore/loader/appcache/DOMApplicationCache.idl \ 3888 WebCore/page/BarInfo.idl \ 3889 WebCore/page/Console.idl \ 3890 WebCore/page/DOMWindow.idl \ 3891 WebCore/page/DOMSelection.idl \ 3892 WebCore/page/Geolocation.idl \ 3893 WebCore/page/History.idl \ 3894 WebCore/page/Location.idl \ 3895 WebCore/page/Navigator.idl \ 3896 WebCore/page/Screen.idl \ 3897 WebCore/page/WebKitPoint.idl \ 3898 WebCore/plugins/MimeType.idl \ 3899 WebCore/plugins/MimeTypeArray.idl \ 3900 WebCore/plugins/Plugin.idl \ 3901 WebCore/plugins/PluginArray.idl \ 3902 WebCore/storage/Database.idl \ 3903 WebCore/storage/Storage.idl \ 3904 WebCore/xml/XPathExpression.idl \ 3905 WebCore/xml/XPathNSResolver.idl \ 3906 WebCore/xml/XPathResult.idl 3804 3907 3805 3908 # All classes autogenerated in the GObject DOM bindings -
trunk/WebCore/bindings/gobject/WebKitDOMBinding.cpp
r57987 r58108 28 28 #include "EventException.h" 29 29 #include "HTMLNames.h" 30 #include "WebKitDOMElementPrivate.h" 30 31 #include "WebKitDOMNode.h" 31 32 #include "WebKitDOMNodePrivate.h" 33 #include "WebKitHTMLElementWrapperFactory.h" 32 34 33 35 namespace WebKit { … … 67 69 { 68 70 ASSERT(node); 71 ASSERT(node->nodeType()); 69 72 70 73 gpointer wrappedNode = 0; 71 74 72 if (node->nodeType()) 75 switch (node->nodeType()) { 76 case Node::ELEMENT_NODE: 77 if (node->isHTMLElement()) 78 wrappedNode = createHTMLElementWrapper(static_cast<HTMLElement*>(node)); 79 else 80 wrappedNode = wrapNode(node); 81 break; 82 default: 73 83 wrappedNode = wrapNode(node); 84 break; 85 } 74 86 75 87 return DOMObjectCache::put(node, wrappedNode); … … 88 100 } 89 101 102 gpointer kit(Element* element) 103 { 104 if (!element) 105 return 0; 106 107 gpointer kitElement = DOMObjectCache::get(element); 108 if (kitElement) 109 return kitElement; 110 111 gpointer wrappedElement; 112 113 if (element->isHTMLElement()) 114 wrappedElement = createHTMLElementWrapper(static_cast<HTMLElement*>(element)); 115 else 116 wrappedElement = wrapElement(element); 117 118 return DOMObjectCache::put(element, wrappedElement); 119 } 120 90 121 } // namespace WebKit -
trunk/WebCore/bindings/gobject/WebKitDOMBinding.h
r57985 r58108 29 29 namespace WebCore { 30 30 class Node; 31 class Element; 31 32 } // namespace WebCore 32 33 33 34 namespace WebKit { 34 35 gpointer kit(WebCore::Node* node); 36 gpointer kit(WebCore::Element* element); 35 37 36 38 class DOMObjectCache { -
trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r57985 r58108 96 96 } 97 97 98 sub FixUpDecamelizedName { 99 my $classname = shift; 100 101 # FIXME: try to merge this somehow with the fixes in ClassNameToGobjectType 102 $classname =~ s/x_path/xpath/; 103 $classname =~ s/web_kit/webkit/; 104 105 return $classname; 106 } 107 98 108 sub ClassNameToGObjectType { 99 109 my $className = shift; … … 103 113 # might be more like this in the future) 104 114 $CLASS_NAME =~ s/DOMCSS/DOM_CSS/; 115 $CLASS_NAME =~ s/DOMHTML/DOM_HTML/; 116 $CLASS_NAME =~ s/DOMDOM/DOM_DOM/; 117 $CLASS_NAME =~ s/DOMCDATA/DOM_CDATA/; 118 $CLASS_NAME =~ s/DOMX_PATH/DOM_XPATH/; 119 $CLASS_NAME =~ s/DOM_WEB_KIT/DOM_WEBKIT/; 105 120 return $CLASS_NAME; 106 121 } … … 129 144 130 145 if ($attribute->signature->extendedAttributes->{"CustomGetter"} || 131 $attribute->signature->extendedAttributes->{"CustomSetter"}) { 146 $attribute->signature->extendedAttributes->{"CustomSetter"} || 147 $attribute->signature->extendedAttributes->{"Replaceable"}) { 132 148 return 1; 133 149 } … … 139 155 140 156 if ($propType =~ /Constructor$/) { 157 return 1; 158 } 159 160 # This is for DOMWindow.idl location attribute 161 if ($attribute->signature->name eq "location") { 162 return 1; 163 } 164 165 # This is for HTMLInput.idl valueAsDate 166 if ($attribute->signature->name eq "valueAsDate") { 167 return 1; 168 } 169 170 # This is for DOMWindow.idl Crypto attribute 171 if ($attribute->signature->type eq "Crypto") { 172 return 1; 173 } 174 175 return 0; 176 } 177 178 sub SkipFunction { 179 my $function = shift; 180 181 # FIXME: skip all custom methods; is this ok? 182 if ($function->signature->extendedAttributes->{"Custom"}) { 183 return 1; 184 } 185 186 if ($function->signature->type eq "Event") { 187 return 1; 188 } 189 190 if ($function->signature->name eq "getSVGDocument") { 191 return 1; 192 } 193 194 if ($function->signature->name eq "getCSSCanvasContext") { 141 195 return 1; 142 196 } … … 173 227 174 228 my %types = ("DOMString", "gchar* ", 229 "CompareHow", "gushort", 175 230 "float", "gfloat", 176 231 "double", "gdouble", … … 195 250 196 251 return 0 if $type eq "DOMString"; 252 return 0 if $type eq "CompareHow"; 197 253 return 0 if $type eq "float"; 198 254 return 0 if $type eq "double"; … … 217 273 218 274 my $clsCaps = substr(ClassNameToGObjectType($className), 12); 219 my $lowerCaseIfaceName = "webkit_dom_" . ( decamelize($interfaceName));275 my $lowerCaseIfaceName = "webkit_dom_" . (FixUpDecamelizedName(decamelize($interfaceName))); 220 276 221 277 # Properties … … 298 354 299 355 my $convertFunction = ""; 356 if ($gtype eq "string") { 357 $convertFunction = "WebCore::String::fromUTF8"; 358 } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { 359 $convertFunction = "WebCore::String::number"; 360 } 361 362 my $setterContentHead; 363 my $getterContentHead; 364 my $reflect = $attribute->signature->extendedAttributes->{"Reflect"}; 365 my $reflectURL = $attribute->signature->extendedAttributes->{"ReflectURL"}; 366 if ($reflect || $reflectURL) { 367 my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $camelPropName : ($reflect || $reflectURL); 368 my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); 369 $implIncludes{"${namespace}.h"} = 1; 370 my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; 371 $setterContentHead = "coreSelf->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${convertFunction}(g_value_get_$gtype(value))"; 372 $getterContentHead = "coreSelf->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr"; 373 } else { 374 $setterContentHead = "coreSelf->set${setPropNameFunction}(${convertFunction}(g_value_get_$gtype(value))"; 375 $getterContentHead = "coreSelf->${getPropNameFunction}("; 376 } 300 377 301 378 if ($writeable && ($gtype eq "boolean" || $gtype eq "float" || $gtype eq "double" || … … 306 383 push(@txtSetProps, " case ${propEnum}:\n {\n"); 307 384 push(@txtSetProps, " WebCore::ExceptionCode ec = 0;\n") if @{$attribute->setterExceptions}; 308 309 if ($gtype eq "string") { 310 $convertFunction = "WebCore::String::fromUTF8"; 311 } elsif ($attribute->signature->extendedAttributes->{"ConvertFromString"}) { 312 $convertFunction = "WebCore::String::number"; 313 } 314 315 push(@txtSetProps, " coreSelf->set${setPropNameFunction}(${convertFunction}(g_value_get_$gtype(value))"); 385 push(@txtSetProps, " ${setterContentHead}"); 316 386 push(@txtSetProps, ", ec") if @{$attribute->setterExceptions}; 317 387 push(@txtSetProps, ");\n"); 318 319 388 push(@txtSetProps, " break;\n }\n"); 320 389 } … … 331 400 my $done = 0; 332 401 if ($gtype eq "string") { 333 push(@txtGetProps, " g_value_take_string(value, convertToUTF8String( coreSelf->${getPropNameFunction}(${exception})));\n");402 push(@txtGetProps, " g_value_take_string(value, convertToUTF8String(${getterContentHead}${exception})));\n"); 334 403 $done = 1; 335 404 } elsif ($gtype eq "object") { 336 337 405 $txtGetProp = << "EOF"; 338 406 RefPtr<WebCore::${propType}> ptr = coreSelf->${getPropNameFunction}(${exception}); … … 340 408 EOF 341 409 push(@txtGetProps, $txtGetProp); 342 343 410 $done = 1; 344 411 } … … 484 551 push(@hBodyPre, $implContent); 485 552 486 my $clsCaps = uc(decamelize($interfaceName)); 487 my $lowerCaseIfaceName = "webkit_dom_" . (decamelize($interfaceName)); 553 my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); 554 my $clsCaps = uc($decamelize); 555 my $lowerCaseIfaceName = "webkit_dom_" . ($decamelize); 488 556 489 557 $implContent = << "EOF"; 490 491 558 #define WEBKIT_TYPE_DOM_${clsCaps} (${lowerCaseIfaceName}_get_type()) 492 559 #define WEBKIT_DOM_${clsCaps}(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), WEBKIT_TYPE_DOM_${clsCaps}, ${className})) … … 534 601 return "" if $type eq "boolean"; 535 602 return "" if $type eq "void"; 603 return "" if $type eq "CompareHow"; 536 604 537 605 return "$name.h"; … … 540 608 sub addIncludeInBody { 541 609 my $type = shift; 610 611 if ($type eq "DOMObject") { 612 return; 613 } 542 614 543 615 my $header = getIncludeHeader($type); … … 556 628 my ($object, $interfaceName, $function, $prefix) = @_; 557 629 630 if (SkipFunction($function)) { 631 return; 632 } 633 558 634 my $functionSigName = $function->signature->name; 559 635 my $functionSigType = $function->signature->type; 560 my $functionName = "webkit_dom_" . decamelize($interfaceName) . "_" . $prefix . decamelize($functionSigName); 636 my $decamelize = FixUpDecamelizedName(decamelize($interfaceName)); 637 my $functionName = "webkit_dom_" . $decamelize . "_" . $prefix . decamelize($functionSigName); 561 638 my $returnType = GetGlibTypeName($functionSigType); 562 639 my $returnValueIsGDOMType = IsGDOMClassType($functionSigType); … … 572 649 foreach my $param (@{$function->parameters}) { 573 650 my $paramIDLType = $param->type; 574 if ($paramIDLType eq "Event" ) {651 if ($paramIDLType eq "Event" || $paramIDLType eq "EventListener") { 575 652 push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); 576 653 push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); … … 589 666 } 590 667 } 591 if ($paramIsGDOMType || ($paramIDLType eq "DOMString") ) {668 if ($paramIsGDOMType || ($paramIDLType eq "DOMString") || ($paramIDLType eq "CompareHow")) { 592 669 $paramName = "_g_" . $paramName; 593 670 } … … 599 676 } 600 677 601 if ($functionSigType eq "Event") { 602 push(@hBody, "\n/* TODO: event function ${functionName} */\n\n"); 603 push(@cBody, "\n/* TODO: event function ${functionName} */\n\n"); 604 return; 605 } 606 607 if ($returnType ne "void" && $returnValueIsGDOMType) { 678 if ($returnType ne "void" && $returnValueIsGDOMType && $functionSigType ne "DOMObject") { 608 679 if ($functionSigType ne "EventTarget") { 609 680 $implIncludes{"webkit/WebKitDOM${functionSigType}Private.h"} = 1; … … 668 739 if ($paramIDLType eq "DOMString") { 669 740 push(@cBody, " WebCore::String _g_${paramName} = WebCore::String::fromUTF8($paramName);\n"); 670 } 671 if ($paramIsGDOMType) { 741 } elsif ($paramIDLType eq "CompareHow") { 742 push(@cBody, " WebCore::Range::CompareHow _g_${paramName} = static_cast<WebCore::Range::CompareHow>($paramName);\n"); 743 } elsif ($paramIsGDOMType) { 672 744 push(@cBody, " WebCore::${paramIDLType} * _g_${paramName} = WebKit::core($paramName);\n"); 673 745 if ($returnType ne "void") { … … 733 805 return; 734 806 } elsif ($functionSigType eq "DOMString") { 735 push(@cBody, " ${assign}convertToUTF8String(item->${functionSigName}(${callImplParams}${exceptions}));\n" ); 807 my $getterContentHead; 808 my $reflect = $function->signature->extendedAttributes->{"Reflect"}; 809 my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; 810 if ($reflect || $reflectURL) { 811 my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); 812 my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); 813 $implIncludes{"${namespace}.h"} = 1; 814 my $getAttributeFunctionName = $reflectURL ? "getURLAttribute" : "getAttribute"; 815 $getterContentHead = "${assign}convertToUTF8String(item->${getAttributeFunctionName}(WebCore::${namespace}::${contentAttributeName}Attr));\n"; 816 } else { 817 $getterContentHead = "${assign}convertToUTF8String(item->${functionSigName}(${callImplParams}${exceptions}));\n"; 818 } 819 820 push(@cBody, " ${getterContentHead}"); 736 821 } else { 737 push(@cBody, " ${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n" ); 822 my $setterContentHead; 823 my $reflect = $function->signature->extendedAttributes->{"Reflect"}; 824 my $reflectURL = $function->signature->extendedAttributes->{"ReflectURL"}; 825 if ($reflect || $reflectURL) { 826 my $contentAttributeName = (($reflect || $reflectURL) eq "1") ? $functionSigName : ($reflect || $reflectURL); 827 $contentAttributeName =~ s/set//; 828 $contentAttributeName = $codeGenerator->WK_lcfirst($contentAttributeName); 829 my $namespace = $codeGenerator->NamespaceForAttributeName($interfaceName, $contentAttributeName); 830 $implIncludes{"${namespace}.h"} = 1; 831 $setterContentHead = "${assign}${assignPre}item->setAttribute(WebCore::${namespace}::${contentAttributeName}Attr, ${callImplParams}${exceptions}${assignPost});\n"; 832 } else { 833 $setterContentHead = "${assign}${assignPre}item->${functionSigName}(${callImplParams}${exceptions}${assignPost});\n"; 834 } 835 836 push(@cBody, " ${setterContentHead}"); 738 837 739 838 if(@{$function->raisesExceptions}) { 740 839 my $exceptionHandling = << "EOF"; 741 if (ec) {840 if (ec) { 742 841 WebCore::ExceptionCodeDescription ecdesc; 743 842 WebCore::getExceptionCodeDescription(ec, ecdesc); … … 814 913 $object->GenerateFunction($interfaceName, $function, "get_"); 815 914 816 if ($attribute->type =~ /^readonly/ || 817 $attribute->signature->extendedAttributes->{"Replaceable"} # can't handle this yet 818 ) { 915 if ($attribute->type =~ /^readonly/) { 819 916 next TOP; 820 917 } … … 847 944 my $implContent = ""; 848 945 849 my $clsCaps = uc( decamelize($interfaceName));850 my $lowerCaseIfaceName = "webkit_dom_" . decamelize($interfaceName);946 my $clsCaps = uc(FixUpDecamelizedName(decamelize($interfaceName))); 947 my $lowerCaseIfaceName = "webkit_dom_" . FixUpDecamelizedName(decamelize($interfaceName)); 851 948 852 949 $implContent = << "EOF"; … … 963 1060 } 964 1061 965 sub UsesManual ToJSImplementation {1062 sub UsesManualKitImplementation { 966 1063 my $type = shift; 967 1064 968 return 1 if $type eq "Node" or $type eq "Document" or $type eq "HTMLCollection" or 969 $type eq "SVGPathSeg" or $type eq "StyleSheet" or $type eq "CSSRule" or $type eq "CSSValue" or 970 $type eq "Event" or $type eq "Element" or $type eq "Text"; 1065 return 1 if $type eq "Node" or $type eq "Element"; 971 1066 return 0; 972 1067 } … … 997 1092 $hdrIncludes{"webkit/${parentClassName}.h"} = 1; 998 1093 999 if ( $className ne "WebKitDOMNode") {1094 if (!UsesManualKitImplementation($interfaceName)) { 1000 1095 my $converter = << "EOF"; 1001 1096 namespace WebKit { -
trunk/WebCore/dom/Node.idl
r57985 r58108 63 63 readonly attribute Node nextSibling; 64 64 readonly attribute NamedNodeMap attributes; 65 #if !defined(LANGUAGE_GOBJECT) || !LANGUAGE_GOBJECT66 65 readonly attribute Document ownerDocument; 67 #endif68 66 69 67 [OldStyleObjC, Custom] Node insertBefore(in [Return] Node newChild, -
trunk/WebKit/gtk/ChangeLog
r58098 r58108 1 2010-04-22 Xan Lopez <xlopez@igalia.com> 2 3 Reviewed by Gustavo Noronha. 4 5 [GTK] GObject DOM bindings 6 https://bugs.webkit.org/show_bug.cgi?id=33590 7 8 Add webkit_web_view_get_document to retrieve the WebKitDOMDocument 9 from a WebKitWebView, and a very simple test for it. 10 11 * tests/testwebview.c: 12 * webkit/webkitwebview.cpp: 13 (webkit_web_view_get_document): 14 * webkit/webkitwebview.h: 15 1 16 2010-04-22 Diego Escalante Urrelo <descalante@igalia.com> 2 17 -
trunk/WebKit/gtk/tests/testwebview.c
r56217 r58108 337 337 } 338 338 339 static void test_webkit_web_view_document() 340 { 341 GtkWidget* window; 342 GtkWidget* web_view; 343 gchar* title; 344 WebKitDOMDocument* document; 345 346 window = gtk_window_new(GTK_WINDOW_TOPLEVEL); 347 web_view = webkit_web_view_new(); 348 349 gtk_container_add(GTK_CONTAINER(window), web_view); 350 gtk_widget_show_all(window); 351 352 loop = g_main_loop_new(NULL, TRUE); 353 354 g_signal_connect(window, "map-event", 355 G_CALLBACK(map_event_cb), loop); 356 g_main_loop_run(loop); 357 358 document = webkit_web_view_get_dom_document(WEBKIT_WEB_VIEW(web_view)); 359 g_assert(document); 360 webkit_dom_document_set_title(document, (gchar*)"First title"); 361 title = webkit_dom_document_get_title(document); 362 g_assert(title); 363 g_assert_cmpstr(title, ==, "First title"); 364 g_free(title); 365 webkit_dom_document_set_title(document, (gchar*)"Title changed by DOM bindings"); 366 title = webkit_dom_document_get_title(document); 367 g_assert(title); 368 g_assert_cmpstr(title, ==, "Title changed by DOM bindings"); 369 g_free(title); 370 371 gtk_widget_destroy(window); 372 } 373 339 374 int main(int argc, char** argv) 340 375 { … … 365 400 g_test_add_func("/webkit/webview/grab_focus", test_webkit_web_view_grab_focus); 366 401 g_test_add_func("/webkit/webview/window-features", test_webkit_web_view_window_features); 402 g_test_add_func("/webkit/webview/document", test_webkit_web_view_document); 367 403 368 404 return g_test_run (); -
trunk/WebKit/gtk/webkit/webkitwebview.cpp
r58072 r58108 82 82 #include "ScriptValue.h" 83 83 #include "Scrollbar.h" 84 #include "webkit/WebKitDOMDocumentPrivate.h" 84 85 #include <wtf/text/CString.h> 85 86 … … 4432 4433 return cacheModel; 4433 4434 } 4435 4436 /** 4437 * webkit_web_view_get_dom_document: 4438 * @webView: a #WebKitWebView 4439 * 4440 * Returns: the #WebKitDOMDocument currently loaded in the @webView 4441 * 4442 * Since: 1.3.0 4443 **/ 4444 WebKitDOMDocument* 4445 webkit_web_view_get_dom_document(WebKitWebView* webView) 4446 { 4447 g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); 4448 4449 Frame* coreFrame = core(webView)->mainFrame(); 4450 if (!coreFrame) 4451 return 0; 4452 4453 Document* doc = coreFrame->document(); 4454 if (!doc) 4455 return 0; 4456 4457 return static_cast<WebKitDOMDocument*>(kit(doc)); 4458 } -
trunk/WebKit/gtk/webkit/webkitwebview.h
r52418 r58108 28 28 29 29 #include <webkit/webkitdefines.h> 30 #include <webkit/webkitdom.h> 30 31 #include <webkit/webkitwebbackforwardlist.h> 31 32 #include <webkit/webkitwebframe.h> … … 382 383 webkit_get_cache_model (void); 383 384 385 WEBKIT_API WebKitDOMDocument * 386 webkit_web_view_get_dom_document (WebKitWebView *webView); 387 384 388 G_END_DECLS 385 389
Note: See TracChangeset
for help on using the changeset viewer.