Changeset 151267 in webkit
- Timestamp:
- Jun 6, 2013 6:39:27 AM (11 years ago)
- Location:
- trunk/Source
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r151265 r151267 1 2013-06-06 Diego Pino Garcia <dpino@igalia.com> 2 3 [GTK] Parameters 'inResult' and 'resolver' from function 'webkit_dom_document_evaluate' should be allowed to be NULL 4 https://bugs.webkit.org/show_bug.cgi?id=117129 5 6 Reviewed by Xan Lopez. 7 8 At this moment there was a temporary fix that allowed parameter 9 'inResult' to be NULL (see: webk.it/42115). However, there was no fix 10 for parameter 'resolver'. 11 12 This patch refactors the code of the previous fix, moving the code for 13 determine whether a parameter can be NULL or not to GetGReturnMacro. 14 The solution is quite general and will alow to add other parameters in 15 the future if needed. 16 17 * bindings/scripts/CodeGeneratorGObject.pm: 18 (GetGReturnMacro): Pass functionName, as in some cases the code 19 generated depends on the paramName and the functionName 20 (ParamCanBeNull): Checks if a parameter is allowed to be NULL 21 (GenerateFunction): 22 1 23 2013-06-06 Zalan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r149679 r151267 46 46 "HTMLCollection" => 1); 47 47 48 # List of function parameters that are allowed to be NULL 49 my $canBeNullParams = { 50 'webkit_dom_document_evaluate' => ['inResult', 'resolver'] 51 }; 52 48 53 # Default constructor 49 54 sub new { … … 846 851 847 852 sub GetGReturnMacro { 848 my ($paramName, $paramIDLType, $returnType ) = @_;853 my ($paramName, $paramIDLType, $returnType, $functionName) = @_; 849 854 850 855 my $condition; … … 854 859 my $paramTypeCaps = uc(FixUpDecamelizedName(decamelize($paramIDLType))); 855 860 $condition = "WEBKIT_DOM_IS_${paramTypeCaps}($paramName)"; 861 if (ParamCanBeNull($functionName, $paramName)) { 862 $condition = "!$paramName || $condition"; 863 } 856 864 } else { 857 865 $condition = "$paramName"; … … 869 877 } 870 878 879 sub ParamCanBeNull { 880 my($functionName, $paramName) = @_; 881 882 if (defined($functionName)) { 883 return scalar(grep(/$paramName/, @{$canBeNullParams->{$functionName}})); 884 } 885 return 0; 886 } 887 871 888 sub GenerateFunction { 872 889 my ($object, $interfaceName, $function, $prefix, $parentNode) = @_; … … 974 991 my $paramIsGDOMType = IsGDOMClassType($paramIDLType); 975 992 if (!$paramTypeIsPrimitive) { 976 # FIXME: Temporary hack for generating a proper implementation 977 # of the webkit_dom_document_evaluate function (Bug-ID: 42115) 978 if (!(($functionName eq "webkit_dom_document_evaluate") && ($paramIDLType eq "XPathResult"))) { 979 $gReturnMacro = GetGReturnMacro($paramName, $paramIDLType, $returnType); 980 push(@cBody, $gReturnMacro); 981 } 993 $gReturnMacro = GetGReturnMacro($paramName, $paramIDLType, $returnType, $functionName); 994 push(@cBody, $gReturnMacro); 982 995 } 983 996 } -
trunk/Source/WebKit/gtk/ChangeLog
r151245 r151267 1 2013-06-06 Diego Pino Garcia <dpino@igalia.com> 2 3 [GTK] Parameters 'inResult' and 'resolver' from function 'webkit_dom_document_evaluate' should be allowed to be NULL 4 https://bugs.webkit.org/show_bug.cgi?id=117129 5 6 Reviewed by Xan Lopez. 7 8 Add test for function 'webkit_dom_document_evaluate'. 9 10 * tests/testdomdocument.c: 11 (test_dom_document_evaluate): Checks function dom_document_evaluate, 12 executes an XPath expression on a HTML document. 13 (main): 14 1 15 2013-06-05 Alberto Garcia <agarcia@igalia.com> 2 16 -
trunk/Source/WebKit/gtk/tests/testdomdocument.c
r149952 r151267 33 33 #define HTML_DOCUMENT_IFRAME "<html><head><title>IFrame</title></head><body><iframe id='iframe'></iframe><div id='test'></div></body></html>" 34 34 #define HTML_DOCUMENT_TABLE "<html><body><table id=\"table\"></table></body></html>" 35 #define HTML_DOCUMENT_EVALUATE "<html><head><title></title></head><body><div>First div</div><div>Second div</div></body></html>" 35 36 36 37 typedef struct { … … 207 208 g_assert(WEBKIT_DOM_IS_HTML_COLLECTION(rows)); 208 209 g_assert_cmpint(webkit_dom_html_collection_get_length(rows), ==, 1); 210 } 211 212 static void test_dom_document_evaluate(DomDocumentFixture* fixture, gconstpointer data) 213 { 214 g_assert(fixture); 215 WebKitWebView* view = (WebKitWebView*)fixture->webView; 216 g_assert(view); 217 WebKitDOMDocument* document = webkit_web_view_get_dom_document(view); 218 g_assert(WEBKIT_DOM_IS_DOCUMENT(document)); 219 WebKitDOMNodeList* list = webkit_dom_document_get_elements_by_tag_name(document, "html"); 220 g_assert(list); 221 gulong length = webkit_dom_node_list_get_length(list); 222 g_assert_cmpint(length, ==, 1); 223 WebKitDOMNode* html = webkit_dom_node_list_item(list, 0); 224 g_assert(WEBKIT_DOM_IS_NODE(html)); 225 226 WebKitDOMXPathResult* result = webkit_dom_document_evaluate(document, "//div", html, NULL, 0, NULL, NULL); 227 g_assert(WEBKIT_DOM_IS_XPATH_RESULT(result)); 228 229 int i = 0; 230 WebKitDOMNode* node; 231 while ( (node = webkit_dom_xpath_result_iterate_next(result, NULL)) != NULL) { 232 g_assert(node); 233 WebKitDOMElement* element = (WebKitDOMElement*)node; 234 g_assert_cmpstr(webkit_dom_element_get_tag_name(element), ==, "DIV"); 235 i++; 236 } 237 g_assert_cmpint(i, ==, 2); 238 239 g_object_unref(list); 209 240 } 210 241 … … 381 412 dom_document_fixture_teardown); 382 413 414 g_test_add("/webkit/domdocument/test_document_evaluate", 415 DomDocumentFixture, HTML_DOCUMENT_EVALUATE, 416 dom_document_fixture_setup, 417 test_dom_document_evaluate, 418 dom_document_fixture_teardown); 419 383 420 g_test_add("/webkit/domdocument/test_garbage_collection", 384 421 DomDocumentFixture, HTML_DOCUMENT_LINKS,
Note: See TracChangeset
for help on using the changeset viewer.