diff options
author | Steve Block <steveblock@google.com> | 2010-02-02 14:57:50 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-02-04 15:06:55 +0000 |
commit | d0825bca7fe65beaee391d30da42e937db621564 (patch) | |
tree | 7461c49eb5844ffd1f35d1ba2c8b7584c1620823 /WebCore/xml | |
parent | 3db770bd97c5a59b6c7574ca80a39e5a51c1defd (diff) | |
download | external_webkit-d0825bca7fe65beaee391d30da42e937db621564.zip external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.gz external_webkit-d0825bca7fe65beaee391d30da42e937db621564.tar.bz2 |
Merge webkit.org at r54127 : Initial merge by git
Change-Id: Ib661abb595522f50ea406f72d3a0ce17f7193c82
Diffstat (limited to 'WebCore/xml')
-rw-r--r-- | WebCore/xml/DOMParser.idl | 2 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequest.cpp | 4 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequest.h | 4 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequest.idl | 1 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestException.idl | 1 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestProgressEvent.idl | 1 | ||||
-rw-r--r-- | WebCore/xml/XMLHttpRequestUpload.idl | 1 | ||||
-rw-r--r-- | WebCore/xml/XMLSerializer.idl | 2 | ||||
-rw-r--r-- | WebCore/xml/XPathEvaluator.idl | 2 | ||||
-rw-r--r-- | WebCore/xml/XPathException.idl | 1 | ||||
-rw-r--r-- | WebCore/xml/XPathExpression.idl | 3 | ||||
-rw-r--r-- | WebCore/xml/XPathNSResolver.idl | 2 | ||||
-rw-r--r-- | WebCore/xml/XPathResult.idl | 2 | ||||
-rw-r--r-- | WebCore/xml/XPathStep.cpp | 5 | ||||
-rw-r--r-- | WebCore/xml/XSLImportRule.cpp | 14 | ||||
-rw-r--r-- | WebCore/xml/XSLImportRule.h | 2 | ||||
-rw-r--r-- | WebCore/xml/XSLStyleSheet.h | 16 | ||||
-rw-r--r-- | WebCore/xml/XSLStyleSheetLibxslt.cpp | 12 | ||||
-rw-r--r-- | WebCore/xml/XSLStyleSheetQt.cpp | 4 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessor.idl | 3 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessorLibxslt.cpp | 3 | ||||
-rw-r--r-- | WebCore/xml/XSLTProcessorQt.cpp | 34 | ||||
-rw-r--r-- | WebCore/xml/xmlnsattrs.in | 4 |
23 files changed, 79 insertions, 44 deletions
diff --git a/WebCore/xml/DOMParser.idl b/WebCore/xml/DOMParser.idl index 9caaa21..90a8b52 100644 --- a/WebCore/xml/DOMParser.idl +++ b/WebCore/xml/DOMParser.idl @@ -18,7 +18,7 @@ */ module xpath { - interface [GenerateConstructor, CanBeConstructed] DOMParser { + interface [CanBeConstructed] DOMParser { Document parseFromString(in DOMString str, in DOMString contentType); }; } diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp index f1a7969..32818df 100644 --- a/WebCore/xml/XMLHttpRequest.cpp +++ b/WebCore/xml/XMLHttpRequest.cpp @@ -22,6 +22,7 @@ #include "config.h" #include "XMLHttpRequest.h" +#include "Blob.h" #include "Cache.h" #include "CString.h" #include "CrossOriginAccessControl.h" @@ -31,7 +32,6 @@ #include "EventException.h" #include "EventListener.h" #include "EventNames.h" -#include "File.h" #include "HTTPParsers.h" #include "InspectorTimelineAgent.h" #include "ResourceError.h" @@ -435,7 +435,7 @@ void XMLHttpRequest::send(const String& body, ExceptionCode& ec) createRequest(ec); } -void XMLHttpRequest::send(File* body, ExceptionCode& ec) +void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) { if (!initSend(ec)) return; diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h index 69019a5..2cea5c6 100644 --- a/WebCore/xml/XMLHttpRequest.h +++ b/WebCore/xml/XMLHttpRequest.h @@ -33,8 +33,8 @@ namespace WebCore { +class Blob; class Document; -class File; class ResourceRequest; class TextResourceDecoder; class ThreadableLoader; @@ -72,7 +72,7 @@ public: void send(ExceptionCode&); void send(Document*, ExceptionCode&); void send(const String&, ExceptionCode&); - void send(File*, ExceptionCode&); + void send(Blob*, ExceptionCode&); void abort(); void setRequestHeader(const AtomicString& name, const String& value, ExceptionCode&); void overrideMimeType(const String& override); diff --git a/WebCore/xml/XMLHttpRequest.idl b/WebCore/xml/XMLHttpRequest.idl index 89d9c7f..70cd58a 100644 --- a/WebCore/xml/XMLHttpRequest.idl +++ b/WebCore/xml/XMLHttpRequest.idl @@ -29,6 +29,7 @@ module xml { interface [ + CustomConstructor, CustomMarkFunction, EventTarget, NoStaticTables diff --git a/WebCore/xml/XMLHttpRequestException.idl b/WebCore/xml/XMLHttpRequestException.idl index 380e426..7121468 100644 --- a/WebCore/xml/XMLHttpRequestException.idl +++ b/WebCore/xml/XMLHttpRequestException.idl @@ -29,7 +29,6 @@ module xml { interface [ - GenerateConstructor, NoStaticTables ] XMLHttpRequestException { diff --git a/WebCore/xml/XMLHttpRequestProgressEvent.idl b/WebCore/xml/XMLHttpRequestProgressEvent.idl index 549308b..bc5055a 100644 --- a/WebCore/xml/XMLHttpRequestProgressEvent.idl +++ b/WebCore/xml/XMLHttpRequestProgressEvent.idl @@ -26,7 +26,6 @@ module events { interface [ - GenerateConstructor, NoStaticTables // We should also inherit from LSProgressEvent when the idl is added. ] XMLHttpRequestProgressEvent : ProgressEvent { diff --git a/WebCore/xml/XMLHttpRequestUpload.idl b/WebCore/xml/XMLHttpRequestUpload.idl index 901b47c..ce392f3 100644 --- a/WebCore/xml/XMLHttpRequestUpload.idl +++ b/WebCore/xml/XMLHttpRequestUpload.idl @@ -31,7 +31,6 @@ module xml { interface [ CustomMarkFunction, EventTarget, - GenerateConstructor, NoStaticTables ] XMLHttpRequestUpload { // From XMLHttpRequestEventTarget diff --git a/WebCore/xml/XMLSerializer.idl b/WebCore/xml/XMLSerializer.idl index 6dcc3a4..8c59446 100644 --- a/WebCore/xml/XMLSerializer.idl +++ b/WebCore/xml/XMLSerializer.idl @@ -20,7 +20,7 @@ module xpath { - interface [GenerateConstructor, CanBeConstructed] XMLSerializer { + interface [CanBeConstructed] XMLSerializer { DOMString serializeToString(in Node node) raises(DOMException); }; diff --git a/WebCore/xml/XPathEvaluator.idl b/WebCore/xml/XPathEvaluator.idl index da6155b..c075b01 100644 --- a/WebCore/xml/XPathEvaluator.idl +++ b/WebCore/xml/XPathEvaluator.idl @@ -18,7 +18,7 @@ */ module xpath { - interface [GenerateConstructor, CanBeConstructed, Conditional=XPATH] XPathEvaluator { + interface [CanBeConstructed, Conditional=XPATH] XPathEvaluator { XPathExpression createExpression(in DOMString expression, in XPathNSResolver resolver) raises(core::DOMException); diff --git a/WebCore/xml/XPathException.idl b/WebCore/xml/XPathException.idl index c3c95e3..d5a9af6 100644 --- a/WebCore/xml/XPathException.idl +++ b/WebCore/xml/XPathException.idl @@ -29,7 +29,6 @@ module xpath { interface [ - GenerateConstructor, Conditional=XPATH ] XPathException { diff --git a/WebCore/xml/XPathExpression.idl b/WebCore/xml/XPathExpression.idl index c1fc15e..6b6ceeb 100644 --- a/WebCore/xml/XPathExpression.idl +++ b/WebCore/xml/XPathExpression.idl @@ -22,8 +22,7 @@ module xpath { interface [ - Conditional=XPATH, - GenerateConstructor + Conditional=XPATH ] XPathExpression { [OldStyleObjC] XPathResult evaluate(in Node contextNode, in unsigned short type, diff --git a/WebCore/xml/XPathNSResolver.idl b/WebCore/xml/XPathNSResolver.idl index 48c0113..4e996c2 100644 --- a/WebCore/xml/XPathNSResolver.idl +++ b/WebCore/xml/XPathNSResolver.idl @@ -20,7 +20,7 @@ module xpath { - interface [ObjCProtocol, Conditional=XPATH] XPathNSResolver { + interface [ObjCProtocol, Conditional=XPATH, OmitConstructor] XPathNSResolver { [ConvertNullStringTo=Null] DOMString lookupNamespaceURI(in DOMString prefix); }; diff --git a/WebCore/xml/XPathResult.idl b/WebCore/xml/XPathResult.idl index bc36c3e..ebbff42 100644 --- a/WebCore/xml/XPathResult.idl +++ b/WebCore/xml/XPathResult.idl @@ -19,7 +19,7 @@ module xpath { - interface [GenerateConstructor, Conditional=XPATH] XPathResult { + interface [Conditional=XPATH] XPathResult { const unsigned short ANY_TYPE = 0; const unsigned short NUMBER_TYPE = 1; const unsigned short STRING_TYPE = 2; diff --git a/WebCore/xml/XPathStep.cpp b/WebCore/xml/XPathStep.cpp index e5f2048..6e60952 100644 --- a/WebCore/xml/XPathStep.cpp +++ b/WebCore/xml/XPathStep.cpp @@ -34,6 +34,7 @@ #include "Document.h" #include "Element.h" #include "NamedNodeMap.h" +#include "XMLNSNames.h" #include "XPathParser.h" #include "XPathUtil.h" @@ -173,7 +174,7 @@ static inline bool nodeMatchesBasicTest(Node* node, Step::Axis axis, const Step: ASSERT(node->isAttributeNode()); // In XPath land, namespace nodes are not accessible on the attribute axis. - if (node->namespaceURI() == "http://www.w3.org/2000/xmlns/") + if (node->namespaceURI() == XMLNSNames::xmlnsNamespaceURI) return false; if (name == starAtom) @@ -335,7 +336,7 @@ void Step::nodesInAxis(Node* context, NodeSet& nodes) const // Avoid lazily creating attribute nodes for attributes that we do not need anyway. if (m_nodeTest.kind() == NodeTest::NameTest && m_nodeTest.data() != starAtom) { RefPtr<Node> n = static_cast<Element*>(context)->getAttributeNodeNS(m_nodeTest.namespaceURI(), m_nodeTest.data()); - if (n && n->namespaceURI() != "http://www.w3.org/2000/xmlns/") { // In XPath land, namespace nodes are not accessible on the attribute axis. + if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { // In XPath land, namespace nodes are not accessible on the attribute axis. if (nodeMatches(n.get(), AttributeAxis, m_nodeTest)) // Still need to check merged predicates. nodes.append(n.release()); } diff --git a/WebCore/xml/XSLImportRule.cpp b/WebCore/xml/XSLImportRule.cpp index b697c0d..c0f6363 100644 --- a/WebCore/xml/XSLImportRule.cpp +++ b/WebCore/xml/XSLImportRule.cpp @@ -52,13 +52,13 @@ XSLStyleSheet* XSLImportRule::parentStyleSheet() const return (parent() && parent()->isXSLStyleSheet()) ? static_cast<XSLStyleSheet*>(parent()) : 0; } -void XSLImportRule::setXSLStyleSheet(const String& url, const String& sheet) +void XSLImportRule::setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet) { if (m_styleSheet) m_styleSheet->setParent(0); - - m_styleSheet = XSLStyleSheet::create(this, url); - + + m_styleSheet = XSLStyleSheet::create(this, href, baseURL); + XSLStyleSheet* parent = parentStyleSheet(); if (parent) m_styleSheet->setParentStyleSheet(parent); @@ -87,14 +87,14 @@ void XSLImportRule::loadSheet() String absHref = m_strHref; XSLStyleSheet* parentSheet = parentStyleSheet(); - if (!parentSheet->href().isNull()) + if (!parentSheet->putativeBaseURL().isNull()) // use parent styleheet's URL as the base URL - absHref = KURL(KURL(ParsedURLString, parentSheet->href()), m_strHref).string(); + absHref = KURL(parentSheet->putativeBaseURL(), m_strHref).string(); // Check for a cycle in our import chain. If we encounter a stylesheet // in our parent chain with the same URL, then just bail. for (parent = this->parent(); parent; parent = parent->parent()) { - if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->href()) + if (parent->isXSLStyleSheet() && absHref == static_cast<XSLStyleSheet*>(parent)->putativeBaseURL().string()) return; } diff --git a/WebCore/xml/XSLImportRule.h b/WebCore/xml/XSLImportRule.h index fc7a7f8..f3a9318 100644 --- a/WebCore/xml/XSLImportRule.h +++ b/WebCore/xml/XSLImportRule.h @@ -57,7 +57,7 @@ private: virtual bool isImportRule() { return true; } // from CachedResourceClient - virtual void setXSLStyleSheet(const String& url, const String& sheet); + virtual void setXSLStyleSheet(const String& href, const KURL& baseURL, const String& sheet); String m_strHref; RefPtr<XSLStyleSheet> m_styleSheet; diff --git a/WebCore/xml/XSLStyleSheet.h b/WebCore/xml/XSLStyleSheet.h index c9729bb..b3861a0 100644 --- a/WebCore/xml/XSLStyleSheet.h +++ b/WebCore/xml/XSLStyleSheet.h @@ -43,18 +43,18 @@ class XSLImportRule; class XSLStyleSheet : public StyleSheet { public: #if !USE(QXMLQUERY) - static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href) + static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& href, const KURL& baseURL) { - return adoptRef(new XSLStyleSheet(parentImport, href)); + return adoptRef(new XSLStyleSheet(parentImport, href, baseURL)); } #endif - static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href) + static PassRefPtr<XSLStyleSheet> create(Node* parentNode, const String& href, const KURL& baseURL) { - return adoptRef(new XSLStyleSheet(parentNode, href, false)); + return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, false)); } - static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href) + static PassRefPtr<XSLStyleSheet> createEmbedded(Node* parentNode, const String& href, const KURL& baseURL) { - return adoptRef(new XSLStyleSheet(parentNode, href, true)); + return adoptRef(new XSLStyleSheet(parentNode, href, baseURL, true)); } virtual ~XSLStyleSheet(); @@ -90,9 +90,9 @@ public: bool processed() const { return m_processed; } private: - XSLStyleSheet(Node* parentNode, const String& href, bool embedded); + XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded); #if !USE(QXMLQUERY) - XSLStyleSheet(XSLImportRule* parentImport, const String& href); + XSLStyleSheet(XSLImportRule* parentImport, const String& href, const KURL& baseURL); #endif Document* m_ownerDocument; diff --git a/WebCore/xml/XSLStyleSheetLibxslt.cpp b/WebCore/xml/XSLStyleSheetLibxslt.cpp index 2ae8b82..4122aa1 100644 --- a/WebCore/xml/XSLStyleSheetLibxslt.cpp +++ b/WebCore/xml/XSLStyleSheetLibxslt.cpp @@ -55,8 +55,8 @@ SOFT_LINK(libxslt, xsltLoadStylesheetPI, xsltStylesheetPtr, (xmlDocPtr doc), (do namespace WebCore { -XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href) - : StyleSheet(parentRule, href) +XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href, const KURL& baseURL) + : StyleSheet(parentRule, href, baseURL) , m_ownerDocument(0) , m_embedded(false) , m_processed(false) // Child sheets get marked as processed when the libxslt engine has finally seen them. @@ -66,8 +66,8 @@ XSLStyleSheet::XSLStyleSheet(XSLImportRule* parentRule, const String& href) { } -XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, bool embedded) - : StyleSheet(parentNode, href) +XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded) + : StyleSheet(parentNode, href, baseURL) , m_ownerDocument(parentNode->document()) , m_embedded(embedded) , m_processed(true) // The root sheet starts off processed. @@ -168,7 +168,7 @@ bool XSLStyleSheet::parseString(const String& string, bool) } m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size, - href().utf8().data(), + putativeBaseURL().string().utf8().data(), BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA); xmlFreeParserCtxt(ctxt); @@ -192,7 +192,7 @@ void XSLStyleSheet::loadChildSheets() if (m_embedded) { // We have to locate (by ID) the appropriate embedded stylesheet element, so that we can walk the // import/include list. - xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(href().utf8().data())); + xmlAttrPtr idNode = xmlGetID(document(), (const xmlChar*)(putativeBaseURL().string().utf8().data())); if (!idNode) return; stylesheetRoot = idNode->parent; diff --git a/WebCore/xml/XSLStyleSheetQt.cpp b/WebCore/xml/XSLStyleSheetQt.cpp index 6d27e20..4151be4 100644 --- a/WebCore/xml/XSLStyleSheetQt.cpp +++ b/WebCore/xml/XSLStyleSheetQt.cpp @@ -33,8 +33,8 @@ namespace WebCore { -XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, bool embedded) - : StyleSheet(parentNode, href) +XSLStyleSheet::XSLStyleSheet(Node* parentNode, const String& href, const KURL& baseURL, bool embedded) + : StyleSheet(parentNode, href, baseURL) , m_ownerDocument(parentNode->document()) , m_embedded(embedded) { diff --git a/WebCore/xml/XSLTProcessor.idl b/WebCore/xml/XSLTProcessor.idl index 0a6ff93..28bd878 100644 --- a/WebCore/xml/XSLTProcessor.idl +++ b/WebCore/xml/XSLTProcessor.idl @@ -33,7 +33,8 @@ module xml { // http://bugs.webkit.org/show_bug.cgi?id=5446 interface [ - Conditional=XSLT + Conditional=XSLT, + CustomConstructor ] XSLTProcessor { [Custom] void importStylesheet(in Node stylesheet); diff --git a/WebCore/xml/XSLTProcessorLibxslt.cpp b/WebCore/xml/XSLTProcessorLibxslt.cpp index 200c56b..ded5c68 100644 --- a/WebCore/xml/XSLTProcessorLibxslt.cpp +++ b/WebCore/xml/XSLTProcessorLibxslt.cpp @@ -226,7 +226,8 @@ static xsltStylesheetPtr xsltStylesheetPointer(RefPtr<XSLStyleSheet>& cachedStyl { if (!cachedStylesheet && stylesheetRootNode) { cachedStylesheet = XSLStyleSheet::create(stylesheetRootNode->parent() ? stylesheetRootNode->parent() : stylesheetRootNode, - stylesheetRootNode->document()->url().string()); + stylesheetRootNode->document()->url().string(), + stylesheetRootNode->document()->url()); // FIXME: Should we use baseURL here? cachedStylesheet->parseString(createMarkup(stylesheetRootNode)); } diff --git a/WebCore/xml/XSLTProcessorQt.cpp b/WebCore/xml/XSLTProcessorQt.cpp index 50ee427..9ac3f5d 100644 --- a/WebCore/xml/XSLTProcessorQt.cpp +++ b/WebCore/xml/XSLTProcessorQt.cpp @@ -36,6 +36,7 @@ #include <wtf/Vector.h> #include <qabstractmessagehandler.h> +#include <qabstracturiresolver.h> #include <qbuffer.h> #include <qsourcelocation.h> #include <qxmlquery.h> @@ -87,6 +88,31 @@ void XSLTMessageHandler::handleMessage(QtMsgType type, const QString& descriptio sourceLocation.line(), sourceLocation.uri().toString()); } +class XSLTUriResolver : public QAbstractUriResolver { + +public: + XSLTUriResolver(Document* document); + virtual QUrl resolve(const QUrl& relative, const QUrl& baseURI) const; + +private: + Document* m_document; +}; + +XSLTUriResolver::XSLTUriResolver(Document* document) + : QAbstractUriResolver() + , m_document(document) +{ +} + +QUrl XSLTUriResolver::resolve(const QUrl& relative, const QUrl& baseURI) const +{ + QUrl url = baseURI.resolved(relative); + + if (!m_document->frame() || !m_document->securityOrigin()->canRequest(url)) + return QUrl(); + return url; +} + bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultString, String&) { bool success = false; @@ -94,7 +120,9 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS RefPtr<XSLStyleSheet> stylesheet = m_stylesheet; if (!stylesheet && m_stylesheetRootNode) { Node* node = m_stylesheetRootNode.get(); - stylesheet = XSLStyleSheet::create(node->parent() ? node->parent() : node, node->document()->url().string()); + stylesheet = XSLStyleSheet::create(node->parent() ? node->parent() : node, + node->document()->url().string(), + node->document()->url()); // FIXME: Should we use baseURL here? stylesheet->parseString(createMarkup(node)); } @@ -107,6 +135,7 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS QXmlQuery query(QXmlQuery::XSLT20); XSLTMessageHandler messageHandler(ownerDocument.get()); + XSLTUriResolver uriResolver(ownerDocument.get()); query.setMessageHandler(&messageHandler); XSLTProcessor::ParameterMap::iterator end = m_parameters.end(); @@ -132,6 +161,9 @@ bool XSLTProcessor::transformToString(Node* sourceNode, String&, String& resultS query.setFocus(&inputBuffer); query.setQuery(&styleSheetBuffer, QUrl(stylesheet->href())); + + query.setUriResolver(&uriResolver); + success = query.evaluateTo(&outputBuffer); outputBuffer.reset(); resultString = QString::fromUtf8(outputBuffer.readAll()).trimmed(); diff --git a/WebCore/xml/xmlnsattrs.in b/WebCore/xml/xmlnsattrs.in new file mode 100644 index 0000000..7ac415a --- /dev/null +++ b/WebCore/xml/xmlnsattrs.in @@ -0,0 +1,4 @@ +namespace="XMLNS" +namespaceURI="http://www.w3.org/2000/xmlns/" + +xmlns |