Changeset 49191 in webkit
- Timestamp:
- Oct 6, 2009 10:15:22 AM (15 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r49189 r49191 1 2009-10-06 Anton Muhin <antonm@chromium> 2 3 Reviewed by Dimitri Glazkov. 4 5 Non standard, but popular exetension allows automagically 6 turn a function into a namespace resolver. Support that in 7 Chromium as well. 8 9 This adds new layout tests. 10 https://bugs.webkit.org/show_bug.cgi?id=30128 11 12 * fast/xpath/xpath-namespaces-expected.txt: 13 * fast/xpath/xpath-namespaces.html: 14 1 15 2009-10-06 Jakub Wieczorek <faw217@gmail.com> 2 16 -
trunk/LayoutTests/fast/xpath/xpath-namespaces-expected.txt
r20554 r49191 4 4 PASS /ns:* 5 5 PASS /foo:* 6 PASS /xmpl:* 7 PASS /xmpl:* 6 8 PASS successfullyParsed is true 7 9 -
trunk/LayoutTests/fast/xpath/xpath-namespaces.html
r20554 r49191 27 27 checkSnapshot("/foo:*", result, []); 28 28 29 // Now try a resolver originating from the function 30 var namespaces = { xmpl: "http://www.example.org" }; 31 var mapResolver = function(prefix) { return namespaces[prefix]; }; 32 33 var expr = doc.createExpression("/xmpl:*", mapResolver); 34 var result = expr.evaluate(contextNode, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 35 checkSnapshot("/xmpl:*", result, [doc.documentElement]); 36 37 var evaluator = new XPathEvaluator(); 38 var result = evaluator.evaluate("/xmpl:*", doc, mapResolver, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); 39 checkSnapshot("/xmpl:*", result, [doc.documentElement]); 40 29 41 var successfullyParsed = true; 30 42 -
trunk/WebCore/ChangeLog
r49190 r49191 1 2009-10-06 Anton Muhin <antonm@chromium> 2 3 Reviewed by Dimitri Glazkov. 4 5 Non standard, but popular exetension allows automagically 6 turn a function into a namespace resolver. Support that in 7 Chromium as well. 8 9 Adjust CodeGeneratorV8 to treat XPathNSResolver in a special way. 10 https://bugs.webkit.org/show_bug.cgi?id=30128 11 12 * bindings/scripts/CodeGeneratorV8.pm: 13 * bindings/v8/V8DOMWrapper.h: 14 (WebCore::V8DOMWrapper::getXPathNSResolver): 15 * bindings/v8/custom/V8DocumentCustom.cpp: 16 (WebCore::CALLBACK_FUNC_DECL): 17 1 18 2009-10-06 Pavel Feldman <pfeldman@chromium.org> 2 19 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r48978 r49191 1464 1464 } 1465 1465 1466 if ($parameter->type eq "NodeFilter" ) {1466 if ($parameter->type eq "NodeFilter" || $parameter->type eq "XPathNSResolver") { 1467 1467 $functionString .= "$paramName.get()"; 1468 1468 } else { … … 1746 1746 return "RefPtr<NodeFilter>" if $type eq "NodeFilter"; 1747 1747 1748 # necessary as resolvers could be constructed on fly. 1749 return "RefPtr<XPathNSResolver>" if $type eq "XPathNSResolver"; 1750 1748 1751 return "RefPtr<${type}>" if IsRefPtrType($type) and not $isParameter; 1749 1752 … … 1902 1905 } 1903 1906 1907 if ($type eq "XPathNSResolver") { 1908 return "V8DOMWrapper::getXPathNSResolver($value)"; 1909 } 1910 1904 1911 AddIncludesForType($type); 1905 1912 # $implIncludes{"$type.h"} = 1 unless AvoidInclusionOfType($type); … … 1953 1960 else { $result .= ", "; } 1954 1961 if (IsWrapperType($parameter->type)) { 1955 my $type = $parameter->type; 1956 my $header = GetV8HeaderName($type); 1957 $implIncludes{$header} = 1; 1958 $result .= "V8${type}::GetRawTemplate()"; 1962 if ($parameter->type eq "XPathNSResolver") { 1963 # Special case for XPathNSResolver. All other browsers accepts a callable, 1964 # so, even though it's against IDL, accept objects here. 1965 $result .= "v8::Handle<v8::FunctionTemplate>()"; 1966 } else { 1967 my $type = $parameter->type; 1968 my $header = GetV8HeaderName($type); 1969 $implIncludes{$header} = 1; 1970 $result .= "V8${type}::GetRawTemplate()"; 1971 } 1959 1972 } else { 1960 1973 $result .= "v8::Handle<v8::FunctionTemplate>()"; -
trunk/WebCore/bindings/v8/V8DOMWrapper.h
r48978 r49191 38 38 #include "PlatformString.h" // for WebCore::String 39 39 #include "V8CustomBinding.h" 40 #include "V8CustomXPathNSResolver.h" 40 41 #include "V8DOMMap.h" 41 42 #include "V8Index.h" 42 43 #include "V8Utilities.h" 44 #include "V8XPathNSResolver.h" 45 #include "XPathNSResolver.h" 43 46 #include <v8.h> 44 47 … … 240 243 241 244 245 // XPath-related utilities 246 static RefPtr<XPathNSResolver> getXPathNSResolver(v8::Handle<v8::Value> value) 247 { 248 RefPtr<XPathNSResolver> resolver; 249 if (V8XPathNSResolver::HasInstance(value)) 250 resolver = convertToNativeObject<XPathNSResolver>(V8ClassIndex::XPATHNSRESOLVER, v8::Handle<v8::Object>::Cast(value)); 251 else if (value->IsObject()) 252 resolver = V8CustomXPathNSResolver::create(value->ToObject()); 253 return resolver; 254 } 255 242 256 // DOMImplementation is a singleton and it is handled in a special 243 257 // way. A wrapper is generated per document and stored in an -
trunk/WebCore/bindings/v8/custom/V8DocumentCustom.cpp
r48781 r49191 62 62 contextNode = V8DOMWrapper::convertDOMWrapperToNode<Node>(v8::Handle<v8::Object>::Cast(args[1])); 63 63 64 RefPtr<XPathNSResolver> resolver; 65 if (V8XPathNSResolver::HasInstance(args[2])) 66 resolver = V8DOMWrapper::convertToNativeObject<XPathNSResolver>(V8ClassIndex::XPATHNSRESOLVER, v8::Handle<v8::Object>::Cast(args[2])); 67 else if (args[2]->IsObject()) 68 resolver = V8CustomXPathNSResolver::create(args[2]->ToObject()); 69 else if (!args[2]->IsNull() && !args[2]->IsUndefined()) 64 RefPtr<XPathNSResolver> resolver = V8DOMWrapper::getXPathNSResolver(args[2]); 65 if (!resolver && !args[2]->IsNull() && !args[2]->IsUndefined()) 70 66 return throwError(TYPE_MISMATCH_ERR); 71 67
Note: See TracChangeset
for help on using the changeset viewer.