Remove support for QXmlStream as the XML parser.
authorallan.jensen@digia.com <allan.jensen@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 14:34:27 +0000 (14:34 +0000)
committerallan.jensen@digia.com <allan.jensen@digia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Sep 2013 14:34:27 +0000 (14:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=121229

Reviewed by Andreas Kling.

Source/WebCore:

Remove the implementation and all the #ifdef related to it.

* Target.pri:
* WebCore.pri:
* dom/TransformSource.h:
* xml/XMLErrors.h:
* xml/XSLStyleSheet.h:
* xml/XSLTProcessor.h:
* xml/parser/XMLDocumentParser.cpp:
(WebCore::XMLDocumentParser::enterText):
(WebCore::toString):
(WebCore::XMLDocumentParser::exitText):
(WebCore::XMLDocumentParser::insertErrorMessageBlock):
* xml/parser/XMLDocumentParser.h:
* xml/parser/XMLDocumentParserQt.cpp: Removed.

Source/WebKit/blackberry:

Removed USE flags.

* WebCoreSupport/AboutDataUseFeatures.in:

Source/WTF:

Removed USE flags.

* wtf/Platform.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@155697 268f45cc-cd09-0410-ab3c-d52691b4dbfc

14 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/Platform.h
Source/WebCore/ChangeLog
Source/WebCore/Target.pri
Source/WebCore/WebCore.pri
Source/WebCore/dom/TransformSource.h
Source/WebCore/xml/XMLErrors.h
Source/WebCore/xml/XSLStyleSheet.h
Source/WebCore/xml/XSLTProcessor.h
Source/WebCore/xml/parser/XMLDocumentParser.cpp
Source/WebCore/xml/parser/XMLDocumentParser.h
Source/WebCore/xml/parser/XMLDocumentParserQt.cpp [deleted file]
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in

index bbe660f..9eea805 100644 (file)
@@ -1,3 +1,14 @@
+2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
+
+        Remove support for QXmlStream as the XML parser.
+        https://bugs.webkit.org/show_bug.cgi?id=121229
+
+        Reviewed by Andreas Kling.
+
+        Removed USE flags.
+
+        * wtf/Platform.h:
+
 2013-09-12  Mark Hahnenberg  <mhahnenberg@apple.com>
 
         Bitmap's WordType should be a template parameter
index 153e5c0..887fb8a 100644 (file)
 #endif
 #endif
 
-/* Use the QXmlStreamReader implementation for XMLDocumentParser */
-/* Use the QXmlQuery implementation for XSLTProcessor */
-#if PLATFORM(QT)
-#if !USE(LIBXML2)
-#define WTF_USE_QXMLSTREAM 1
-#define WTF_USE_QXMLQUERY 1
-#endif
-#endif
-
 /* Accelerated compositing */
 #if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !USE(WINGDI) && !PLATFORM(WIN_CAIRO))
 #define WTF_USE_ACCELERATED_COMPOSITING 1
index a9b9dc8..3e811ae 100644 (file)
@@ -1,3 +1,26 @@
+2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
+
+        Remove support for QXmlStream as the XML parser.
+        https://bugs.webkit.org/show_bug.cgi?id=121229
+
+        Reviewed by Andreas Kling.
+
+        Remove the implementation and all the #ifdef related to it.
+
+        * Target.pri:
+        * WebCore.pri:
+        * dom/TransformSource.h:
+        * xml/XMLErrors.h:
+        * xml/XSLStyleSheet.h:
+        * xml/XSLTProcessor.h:
+        * xml/parser/XMLDocumentParser.cpp:
+        (WebCore::XMLDocumentParser::enterText):
+        (WebCore::toString):
+        (WebCore::XMLDocumentParser::exitText):
+        (WebCore::XMLDocumentParser::insertErrorMessageBlock):
+        * xml/parser/XMLDocumentParser.h:
+        * xml/parser/XMLDocumentParserQt.cpp: Removed.
+
 2013-09-13  Andreas Kling  <akling@apple.com>
 
         [CTTE] RenderSVGViewportContainer always has a SVGSVGElement.
index c1f36cd..44dafb0 100644 (file)
@@ -2952,8 +2952,6 @@ use?(LIBXML2) {
     SOURCES += \
             xml/parser/XMLDocumentParserLibxml2.cpp \
             xml/parser/XMLDocumentParserScope.cpp
-} else {
-    SOURCES += xml/parser/XMLDocumentParserQt.cpp
 }
 
 enable?(SMOOTH_SCROLLING) {
index a7a1182..7af60e9 100644 (file)
@@ -114,8 +114,10 @@ use?(LIBXML2) {
     mac {
         INCLUDEPATH += /usr/include/libxml2
         LIBS += -lxml2
-    } else {
+    } else:!contains(QT_CONFIG, no-pkg-config) {
         PKGCONFIG += libxml-2.0
+    } else {
+        LIBS += -lxml2
     }
 }
 
@@ -123,8 +125,10 @@ enable?(XSLT) {
     mac {
         INCLUDEPATH += /usr/include/libxslt
         LIBS += -lxslt
-    } else {
+    } else:!contains(QT_CONFIG, no-pkg-config) {
         PKGCONFIG += libxslt
+    } else {
+        LIBS += -lxslt
     }
 }
 
index d0b0273..78db44e 100644 (file)
 
 namespace WebCore {
 
-#if USE(QXMLQUERY)
-    typedef String PlatformTransformSource;
-#else
     typedef void* PlatformTransformSource;
-#endif
 
     class TransformSource {
         WTF_MAKE_NONCOPYABLE(TransformSource); WTF_MAKE_FAST_ALLOCATED;
index d4e48b3..0032e84 100644 (file)
@@ -32,9 +32,7 @@
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/TextPosition.h>
 
-#if !USE(QXMLSTREAM)
 #include <libxml/parser.h>
-#endif
 
 namespace WebCore {
 
index 4b10c1f..d346aaf 100644 (file)
 #include "ProcessingInstruction.h"
 #include "StyleSheet.h"
 
-#if !USE(QXMLQUERY)
 #include <libxml/parser.h>
 #include <libxslt/transform.h>
-#endif
 
 #include <wtf/PassRefPtr.h>
 
@@ -42,12 +40,10 @@ class XSLImportRule;
     
 class XSLStyleSheet FINAL : public StyleSheet {
 public:
-#if !USE(QXMLQUERY)
     static PassRefPtr<XSLStyleSheet> create(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL)
     {
         return adoptRef(new XSLStyleSheet(parentImport, originalURL, finalURL));
     }
-#endif
     static PassRefPtr<XSLStyleSheet> create(ProcessingInstruction* parentNode, const String& originalURL, const KURL& finalURL)
     {
         return adoptRef(new XSLStyleSheet(parentNode, originalURL, finalURL, false));
@@ -81,13 +77,9 @@ public:
     virtual XSLStyleSheet* parentStyleSheet() const OVERRIDE { return m_parentStyleSheet; }
     void setParentStyleSheet(XSLStyleSheet* parent);
 
-#if USE(QXMLQUERY)
-    String sheetString() const { return m_sheetString; }
-#else
     xmlDocPtr document();
     xsltStylesheetPtr compileStyleSheet();
     xmlDocPtr locateStylesheetSubResource(xmlDocPtr parentDoc, const xmlChar* uri);
-#endif
 
     void clearDocuments();
 
@@ -109,9 +101,7 @@ public:
 
 private:
     XSLStyleSheet(Node* parentNode, const String& originalURL, const KURL& finalURL, bool embedded);
-#if !USE(QXMLQUERY)
     XSLStyleSheet(XSLImportRule* parentImport, const String& originalURL, const KURL& finalURL);
-#endif
     
     Node* m_ownerNode;
     String m_originalURL;
@@ -123,12 +113,8 @@ private:
     bool m_embedded;
     bool m_processed;
 
-#if USE(QXMLQUERY)
-    String m_sheetString;
-#else
     xmlDocPtr m_stylesheetDoc;
     bool m_stylesheetDocTaken;
-#endif
     
     XSLStyleSheet* m_parentStyleSheet;
 };
index 81f4a6a..8f72634 100644 (file)
 #include <wtf/HashMap.h>
 #include <wtf/text/StringHash.h>
 
-#if !USE(QXMLQUERY)
 #include <libxml/parserInternals.h>
 #include <libxslt/documents.h>
-#endif
 
 namespace WebCore {
 
@@ -66,13 +64,11 @@ public:
 
     void reset();
 
-#if !USE(QXMLQUERY)
     static void parseErrorFunc(void* userData, xmlError*);
     static void genericErrorFunc(void* userData, const char* msg, ...);
     
     // Only for libXSLT callbacks
     XSLStyleSheet* xslStylesheet() const { return m_stylesheet.get(); }
-#endif
 
     typedef HashMap<String, String> ParameterMap;
 
index 0ed67b3..8a025bf 100644 (file)
@@ -145,20 +145,16 @@ void XMLDocumentParser::handleError(XMLErrors::ErrorType type, const char* m, Te
 
 void XMLDocumentParser::enterText()
 {
-#if !USE(QXMLSTREAM)
     ASSERT(m_bufferedText.size() == 0);
-#endif
     ASSERT(!m_leafTextNode);
     m_leafTextNode = Text::create(&m_currentNode->document(), "");
     m_currentNode->parserAppendChild(m_leafTextNode.get());
 }
 
-#if !USE(QXMLSTREAM)
 static inline String toString(const xmlChar* string, size_t size) 
 { 
     return String::fromUTF8(reinterpret_cast<const char*>(string), size); 
 }
-#endif
 
 
 void XMLDocumentParser::exitText()
@@ -169,11 +165,9 @@ void XMLDocumentParser::exitText()
     if (!m_leafTextNode)
         return;
 
-#if !USE(QXMLSTREAM)
     m_leafTextNode->appendData(toString(m_bufferedText.data(), m_bufferedText.size()), IGNORE_EXCEPTION);
     Vector<xmlChar> empty;
     m_bufferedText.swap(empty);
-#endif
 
     if (m_view && m_leafTextNode->parentNode() && m_leafTextNode->parentNode()->attached() && !m_leafTextNode->attached())
         Style::attachTextRenderer(*m_leafTextNode);
@@ -232,10 +226,6 @@ void XMLDocumentParser::finish()
 
 void XMLDocumentParser::insertErrorMessageBlock()
 {
-#if USE(QXMLSTREAM)
-    if (m_parsingFragment)
-        return;
-#endif
     ASSERT(m_xmlErrors);
     m_xmlErrors->insertErrorMessageBlock();
 }
index 876d876..05eb880 100644 (file)
 #include <wtf/text/AtomicStringHash.h>
 #include <wtf/text/CString.h>
 
-#if USE(QXMLSTREAM)
-#include <qxmlstream.h>
-#else
 #include <libxml/tree.h>
 #include <libxml/xmlstring.h>
-#endif
 
 namespace WebCore {
 
@@ -55,7 +51,6 @@ class FrameView;
 class PendingCallbacks;
 class Text;
 
-#if !USE(QXMLSTREAM)
     class XMLParserContext : public RefCounted<XMLParserContext> {
     public:
         static PassRefPtr<XMLParserContext> createMemoryParser(xmlSAXHandlerPtr, void* userData, const CString& chunk);
@@ -70,7 +65,6 @@ class Text;
         }
         xmlParserCtxtPtr m_context;
     };
-#endif
 
     class XMLDocumentParser : public ScriptableDocumentParser, public CachedResourceClient {
         WTF_MAKE_FAST_ALLOCATED;
@@ -125,20 +119,6 @@ class Text;
 
         bool appendFragmentSource(const String&);
 
-#if USE(QXMLSTREAM)
-private:
-        void parse();
-        void startDocument();
-        void parseStartElement();
-        void parseEndElement();
-        void parseCharacters();
-        void parseProcessingInstruction();
-        void parseCdata();
-        void parseComment();
-        void endDocument();
-        void parseDtd();
-        bool hasError() const;
-#else
 public:
         // callbacks from parser SAX
         void error(XMLErrors::ErrorType, const char* message, va_list args) WTF_ATTRIBUTE_PRINTF(3, 0);
@@ -158,7 +138,7 @@ public:
 
         int depthTriggeringEntityExpansion() const { return m_depthTriggeringEntityExpansion; }
         void setDepthTriggeringEntityExpansion(int depth) { m_depthTriggeringEntityExpansion = depth; }
-#endif
+
     private:
         void initializeParserContext(const CString& chunk = CString());
 
@@ -178,17 +158,13 @@ public:
 
         SegmentedString m_originalSourceForTransform;
 
-#if USE(QXMLSTREAM)
-        QXmlStreamReader m_stream;
-        bool m_wroteText;
-#else
         xmlParserCtxtPtr context() const { return m_context ? m_context->context() : 0; };
         RefPtr<XMLParserContext> m_context;
         OwnPtr<PendingCallbacks> m_pendingCallbacks;
         Vector<xmlChar> m_bufferedText;
         int m_depthTriggeringEntityExpansion;
         bool m_isParsingEntityDeclaration;
-#endif
+
         ContainerNode* m_currentNode;
         Vector<ContainerNode*> m_currentNodeStack;
 
diff --git a/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp b/Source/WebCore/xml/parser/XMLDocumentParserQt.cpp
deleted file mode 100644 (file)
index e46bbd3..0000000
+++ /dev/null
@@ -1,630 +0,0 @@
-/*
- * Copyright (C) 2000 Peter Kelly (pmk@post.com)
- * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved.
- * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org)
- * Copyright (C) 2007 Samuel Weinig (sam@webkit.org)
- * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2008 Holger Hans Peter Freyther
- * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-#include "XMLDocumentParser.h"
-
-#include "CDATASection.h"
-#include "CachedScript.h"
-#include "Comment.h"
-#include "CachedResourceLoader.h"
-#include "Document.h"
-#include "DocumentFragment.h"
-#include "DocumentType.h"
-#include "ExceptionCodePlaceholder.h"
-#include "Frame.h"
-#include "FrameLoader.h"
-#include "FrameView.h"
-#include "HTMLEntityParser.h"
-#include "HTMLHtmlElement.h"
-#include "HTMLLinkElement.h"
-#include "HTMLNames.h"
-#include "HTMLStyleElement.h"
-#include "ProcessingInstruction.h"
-#include "ResourceError.h"
-#include "ResourceHandle.h"
-#include "ResourceRequest.h"
-#include "ResourceResponse.h"
-#include "ScriptableDocumentParser.h"
-#include "ScriptElement.h"
-#include "ScriptSourceCode.h"
-#include "ScriptValue.h"
-#include "TextResourceDecoder.h"
-#include "TransformSource.h"
-#include "XMLNSNames.h"
-#include <QDebug>
-#include <wtf/StringExtras.h>
-#include <wtf/Threading.h>
-#include <wtf/Vector.h>
-#include <wtf/text/CString.h>
-
-using namespace std;
-
-namespace WebCore {
-
-static inline void setAttributes(Element* element, Vector<Attribute>& attributeVector, ParserContentPolicy parserContentPolicy)
-{
-    if (!scriptingContentIsAllowed(parserContentPolicy))
-        element->stripScriptingAttributes(attributeVector);
-    element->parserSetAttributes(attributeVector);
-}
-
-class EntityResolver : public QXmlStreamEntityResolver {
-    virtual QString resolveUndeclaredEntity(const QString &name);
-};
-
-static QString decodeNamedEntity(const QString& entityName)
-{
-    UChar utf16DecodedEntity[4];
-    size_t numberOfCodePoints = decodeNamedEntityToUCharArray(entityName.toUtf8().constData(), utf16DecodedEntity);
-    return QString(reinterpret_cast<const QChar*>(utf16DecodedEntity), numberOfCodePoints);
-}
-
-QString EntityResolver::resolveUndeclaredEntity(const QString &name)
-{
-    return decodeNamedEntity(name);
-}
-
-// --------------------------------
-
-bool XMLDocumentParser::supportsXMLVersion(const String& version)
-{
-    return version == "1.0";
-}
-
-XMLDocumentParser::XMLDocumentParser(Document* document, FrameView* frameView)
-    : ScriptableDocumentParser(document)
-    , m_view(frameView)
-    , m_wroteText(false)
-    , m_currentNode(document)
-    , m_sawError(false)
-    , m_sawCSS(false)
-    , m_sawXSLTransform(false)
-    , m_sawFirstElement(false)
-    , m_isXHTMLDocument(false)
-    , m_parserPaused(false)
-    , m_requestingScript(false)
-    , m_finishCalled(false)
-    , m_pendingScript(0)
-    , m_scriptStartPosition(TextPosition::belowRangePosition())
-    , m_parsingFragment(false)
-{
-    m_stream.setEntityResolver(new EntityResolver);
-}
-
-XMLDocumentParser::XMLDocumentParser(DocumentFragment* fragment, Element* parentElement, ParserContentPolicy parserContentPolicy)
-    : ScriptableDocumentParser(fragment->document(), parserContentPolicy)
-    , m_view(0)
-    , m_wroteText(false)
-    , m_currentNode(fragment)
-    , m_sawError(false)
-    , m_sawCSS(false)
-    , m_sawXSLTransform(false)
-    , m_sawFirstElement(false)
-    , m_isXHTMLDocument(false)
-    , m_parserPaused(false)
-    , m_requestingScript(false)
-    , m_finishCalled(false)
-    , m_pendingScript(0)
-    , m_scriptStartPosition(TextPosition::belowRangePosition())
-    , m_parsingFragment(true)
-{
-    fragment->ref();
-
-    // Add namespaces based on the parent node
-    Vector<Element*> elemStack;
-    while (parentElement) {
-        elemStack.append(parentElement);
-
-        Node* n = parentElement->parentNode();
-        if (!n || !n->isElementNode())
-            break;
-        parentElement = toElement(n);
-    }
-
-    if (elemStack.isEmpty())
-        return;
-
-    QXmlStreamNamespaceDeclarations namespaces;
-    for (Element* element = elemStack.last(); !elemStack.isEmpty(); elemStack.removeLast()) {
-        element->synchronizeAllAttributes();
-        if (const ElementData* attrs = element->elementData()) {
-            for (unsigned i = 0; i < attrs->length(); i++) {
-                const Attribute& attr = attrs->attributeAt(i);
-                if (attr.localName() == "xmlns")
-                    m_defaultNamespaceURI = attr.value();
-                else if (attr.prefix() == "xmlns")
-                    namespaces.append(QXmlStreamNamespaceDeclaration(attr.localName(), attr.value()));
-            }
-        }
-    }
-    m_stream.addExtraNamespaceDeclarations(namespaces);
-    m_stream.setEntityResolver(new EntityResolver);
-
-    // If the parent element is not in document tree, there may be no xmlns attribute; just default to the parent's namespace.
-    if (m_defaultNamespaceURI.isNull() && !parentElement->inDocument())
-        m_defaultNamespaceURI = parentElement->namespaceURI();
-}
-
-XMLDocumentParser::~XMLDocumentParser()
-{
-    clearCurrentNodeStack();
-    if (m_pendingScript)
-        m_pendingScript->removeClient(this);
-    delete m_stream.entityResolver();
-}
-
-void XMLDocumentParser::doWrite(const String& parseString)
-{
-    m_wroteText = true;
-
-    if (document()->decoder() && document()->decoder()->sawError()) {
-        // If the decoder saw an error, report it as fatal (stops parsing)
-        handleError(XMLErrors::fatal, "Encoding error", textPosition());
-        return;
-    }
-
-    QString data(parseString);
-    if (!data.isEmpty()) {
-        // JavaScript may cause the parser to detach,
-        // keep this alive until this function is done.
-        RefPtr<XMLDocumentParser> protect(this);
-
-        m_stream.addData(data);
-        parse();
-    }
-
-    return;
-}
-
-void XMLDocumentParser::initializeParserContext(const CString&)
-{
-    DocumentParser::startParsing();
-    m_sawError = false;
-    m_sawCSS = false;
-    m_sawXSLTransform = false;
-    m_sawFirstElement = false;
-}
-
-void XMLDocumentParser::doEnd()
-{
-    if (m_stream.error() == QXmlStreamReader::PrematureEndOfDocumentError
-        || (m_wroteText && !m_sawFirstElement && !m_sawXSLTransform && !m_sawError))
-        handleError(XMLErrors::fatal, qPrintable(m_stream.errorString()), textPosition());
-}
-
-OrdinalNumber XMLDocumentParser::lineNumber() const
-{
-    return OrdinalNumber::fromOneBasedInt(m_stream.lineNumber());
-}
-
-OrdinalNumber XMLDocumentParser::columnNumber() const
-{
-    return OrdinalNumber::fromOneBasedInt(m_stream.columnNumber());
-}
-
-TextPosition XMLDocumentParser::textPosition() const
-{
-    return TextPosition(lineNumber(), columnNumber());
-}
-
-void XMLDocumentParser::stopParsing()
-{
-    ScriptableDocumentParser::stopParsing();
-}
-
-void XMLDocumentParser::resumeParsing()
-{
-    ASSERT(m_parserPaused);
-
-    m_parserPaused = false;
-
-    // First, execute any pending callbacks
-    parse();
-    if (m_parserPaused)
-        return;
-
-    // Then, write any pending data
-    SegmentedString rest = m_pendingSrc;
-    m_pendingSrc.clear();
-    append(rest.toString().impl());
-
-    // Finally, if finish() has been called and append() didn't result
-    // in any further callbacks being queued, call end()
-    if (m_finishCalled && !m_parserPaused && !m_pendingScript)
-        end();
-}
-
-bool XMLDocumentParser::appendFragmentSource(const String& source)
-{
-    ASSERT(!m_sawFirstElement);
-    append(String("<qxmlstreamdummyelement>").impl());
-    append(source.impl());
-    append(String("</qxmlstreamdummyelement>").impl());
-    return !hasError();
-}
-
-// --------------------------------
-
-struct AttributeParseState {
-    HashMap<String, String> attributes;
-    bool gotAttributes;
-};
-
-static void attributesStartElementNsHandler(AttributeParseState* state, const QXmlStreamAttributes& attrs)
-{
-    if (attrs.count() <= 0)
-        return;
-
-    state->gotAttributes = true;
-
-    for (int i = 0; i < attrs.count(); i++) {
-        const QXmlStreamAttribute& attr = attrs[i];
-        String attrLocalName = attr.name();
-        String attrValue     = attr.value();
-        String attrURI       = attr.namespaceUri();
-        String attrQName     = attr.qualifiedName();
-        state->attributes.set(attrQName, attrValue);
-    }
-}
-
-HashMap<String, String> parseAttributes(const String& string, bool& attrsOK)
-{
-    AttributeParseState state;
-    state.gotAttributes = false;
-
-    QXmlStreamReader stream;
-    QString dummy = QString(QLatin1String("<?xml version=\"1.0\"?><attrs %1 />")).arg(string);
-    stream.addData(dummy);
-    while (!stream.atEnd()) {
-        stream.readNext();
-        if (stream.isStartElement()) {
-            attributesStartElementNsHandler(&state, stream.attributes());
-        }
-    }
-    attrsOK = state.gotAttributes;
-    return state.attributes;
-}
-
-static inline String prefixFromQName(const QString& qName)
-{
-    const int offset = qName.indexOf(QLatin1Char(':'));
-    if (offset <= 0)
-        return String();
-    else
-        return qName.left(offset);
-}
-
-static inline void handleNamespaceAttributes(Vector<Attribute>& prefixedAttributes, const QXmlStreamNamespaceDeclarations &ns, ExceptionCode& ec)
-{
-    for (int i = 0; i < ns.count(); ++i) {
-        const QXmlStreamNamespaceDeclaration &decl = ns[i];
-        String namespaceURI = decl.namespaceUri();
-        String namespaceQName = decl.prefix().isEmpty() ? String("xmlns") : String("xmlns:");
-        namespaceQName.append(decl.prefix());
-
-        QualifiedName parsedName = anyName;
-        if (!Element::parseAttributeName(parsedName, XMLNSNames::xmlnsNamespaceURI, namespaceQName, ec))
-            return;
-
-        prefixedAttributes.append(Attribute(parsedName, namespaceURI));
-    }
-}
-
-static inline void handleElementAttributes(Vector<Attribute>& prefixedAttributes, const QXmlStreamAttributes &attrs, ExceptionCode& ec)
-{
-    for (int i = 0; i < attrs.count(); ++i) {
-        const QXmlStreamAttribute &attr = attrs[i];
-        String attrLocalName = attr.name();
-        String attrValue     = attr.value();
-        String attrURI       = attr.namespaceUri().isEmpty() ? String() : String(attr.namespaceUri());
-        String attrQName     = attr.qualifiedName();
-
-        QualifiedName parsedName = anyName;
-        if (!Element::parseAttributeName(parsedName, attrURI, attrQName, ec))
-            return;
-
-        prefixedAttributes.append(Attribute(parsedName, attrValue));
-    }
-}
-
-void XMLDocumentParser::parse()
-{
-    while (!isStopped() && !m_parserPaused && !m_stream.atEnd()) {
-        m_stream.readNext();
-        switch (m_stream.tokenType()) {
-        case QXmlStreamReader::StartDocument:
-            startDocument();
-            break;
-        case QXmlStreamReader::EndDocument:
-            endDocument();
-            break;
-        case QXmlStreamReader::StartElement:
-            parseStartElement();
-            break;
-        case QXmlStreamReader::EndElement:
-            parseEndElement();
-            break;
-        case QXmlStreamReader::Characters: {
-            if (m_stream.isCDATA()) {
-                //cdata
-                parseCdata();
-            } else {
-                //characters
-                parseCharacters();
-            }
-            break;
-        }
-        case QXmlStreamReader::Comment:
-            parseComment();
-            break;
-        case QXmlStreamReader::DTD:
-            //qDebug()<<"------------- DTD";
-            parseDtd();
-            break;
-        case QXmlStreamReader::EntityReference: {
-            //qDebug()<<"---------- ENTITY = "<<m_stream.name().toString()
-            //        <<", t = "<<m_stream.text().toString();
-            if (isXHTMLDocument()) {
-                QString entity = m_stream.name().toString();
-                if (!m_leafTextNode)
-                    enterText();
-                // qDebug()<<" ------- adding entity "<<str;
-                m_leafTextNode->appendData(decodeNamedEntity(entity), IGNORE_EXCEPTION);
-            }
-            break;
-        }
-        case QXmlStreamReader::ProcessingInstruction:
-            parseProcessingInstruction();
-            break;
-        default: {
-            if (m_stream.error() != QXmlStreamReader::PrematureEndOfDocumentError) {
-                XMLErrors::ErrorType type = (m_stream.error() == QXmlStreamReader::NotWellFormedError) ?
-                                 XMLErrors::fatal : XMLErrors::warning;
-                handleError(type, qPrintable(m_stream.errorString()), textPosition());
-            }
-            break;
-        }
-        }
-    }
-}
-
-void XMLDocumentParser::startDocument()
-{
-    initializeParserContext();
-
-    if (!m_parsingFragment) {
-        document()->setXMLStandalone(m_stream.isStandaloneDocument(), IGNORE_EXCEPTION);
-
-        QStringRef version = m_stream.documentVersion();
-        if (!version.isEmpty())
-            document()->setXMLVersion(version, IGNORE_EXCEPTION);
-        QStringRef encoding = m_stream.documentEncoding();
-        if (!encoding.isEmpty())
-            document()->setXMLEncoding(encoding);
-        document()->setHasXMLDeclaration(!version.isEmpty());
-    }
-}
-
-void XMLDocumentParser::parseStartElement()
-{
-    if (!m_sawFirstElement && m_parsingFragment) {
-        // skip dummy element for fragments
-        m_sawFirstElement = true;
-        return;
-    }
-
-    exitText();
-
-    String localName = m_stream.name();
-    String uri       = m_stream.namespaceUri();
-    String prefix    = prefixFromQName(m_stream.qualifiedName().toString());
-
-    if (m_parsingFragment && uri.isNull()) {
-        Q_ASSERT(prefix.isNull());
-        uri = m_defaultNamespaceURI;
-    }
-
-    QualifiedName qName(prefix, localName, uri);
-    RefPtr<Element> newElement = document()->createElement(qName, true);
-    if (!newElement) {
-        stopParsing();
-        return;
-    }
-
-    bool isFirstElement = !m_sawFirstElement;
-    m_sawFirstElement = true;
-
-    Vector<Attribute> prefixedAttributes;
-    ExceptionCode ec = 0;
-    handleNamespaceAttributes(prefixedAttributes, m_stream.namespaceDeclarations(), ec);
-    if (ec) {
-        setAttributes(newElement.get(), prefixedAttributes, parserContentPolicy());
-        stopParsing();
-        return;
-    }
-
-    handleElementAttributes(prefixedAttributes, m_stream.attributes(), ec);
-    setAttributes(newElement.get(), prefixedAttributes, parserContentPolicy());
-    if (ec) {
-        stopParsing();
-        return;
-    }
-
-    ScriptElement* scriptElement = toScriptElementIfPossible(newElement.get());
-    if (scriptElement)
-        m_scriptStartPosition = textPosition();
-
-    m_currentNode->parserAppendChild(newElement.get());
-
-    pushCurrentNode(newElement.get());
-    if (m_view && !newElement->attached())
-        Style::attachRenderTree(newElement.get());
-
-    if (newElement->hasTagName(HTMLNames::htmlTag))
-        static_cast<HTMLHtmlElement*>(newElement.get())->insertedByParser();
-
-    if (isFirstElement && document()->frame())
-        document()->frame()->loader().dispatchDocumentElementAvailable();
-}
-
-void XMLDocumentParser::parseEndElement()
-{
-    exitText();
-
-    RefPtr<ContainerNode> n = m_currentNode;
-    n->finishParsingChildren();
-
-    if (!scriptingContentIsAllowed(parserContentPolicy()) && n->isElementNode() && toScriptElementIfPossible(toElement(n.get()))) {
-        popCurrentNode();
-        n->remove(IGNORE_EXCEPTION);
-        return;
-    }
-
-    if (!n->isElementNode() || !m_view) {
-        if (!m_currentNodeStack.isEmpty())
-            popCurrentNode();
-        return;
-    }
-
-    Element* element = toElement(n.get());
-
-    // The element's parent may have already been removed from document.
-    // Parsing continues in this case, but scripts aren't executed.
-    if (!element->inDocument()) {
-        popCurrentNode();
-        return;
-    }
-
-    ScriptElement* scriptElement = toScriptElementIfPossible(element);
-    if (!scriptElement) {
-        popCurrentNode();
-        return;
-    }
-
-    // don't load external scripts for standalone documents (for now)
-    ASSERT(!m_pendingScript);
-    m_requestingScript = true;
-
-    if (scriptElement->prepareScript(m_scriptStartPosition, ScriptElement::AllowLegacyTypeInTypeAttribute)) {
-        if (scriptElement->readyToBeParserExecuted())
-            scriptElement->executeScript(ScriptSourceCode(scriptElement->scriptContent(), document()->url(), m_scriptStartPosition));
-        else if (scriptElement->willBeParserExecuted()) {
-            m_pendingScript = scriptElement->cachedScript();
-            m_scriptElement = element;
-            m_pendingScript->addClient(this);
-
-            // m_pendingScript will be 0 if script was already loaded and addClient() executed it.
-            if (m_pendingScript)
-                pauseParsing();
-        } else
-            m_scriptElement = 0;
-    }
-    m_requestingScript = false;
-    popCurrentNode();
-}
-
-void XMLDocumentParser::parseCharacters()
-{
-    if (!m_leafTextNode)
-        enterText();
-    m_leafTextNode->appendData(m_stream.text(), IGNORE_EXCEPTION);
-}
-
-void XMLDocumentParser::parseProcessingInstruction()
-{
-    exitText();
-
-    // ### handle exceptions
-    int exception = 0;
-    RefPtr<ProcessingInstruction> pi = document()->createProcessingInstruction(
-        m_stream.processingInstructionTarget(),
-        m_stream.processingInstructionData(), exception);
-    if (exception)
-        return;
-
-    pi->setCreatedByParser(true);
-
-    m_currentNode->parserAppendChild(pi.get());
-
-    pi->finishParsingChildren();
-
-    if (pi->isCSS())
-        m_sawCSS = true;
-}
-
-void XMLDocumentParser::parseCdata()
-{
-    exitText();
-
-    RefPtr<CDATASection> newNode = CDATASection::create(document(), m_stream.text());
-
-    m_currentNode->parserAppendChild(newNode.get());
-    if (m_view && !newNode->attached())
-        Style::attachTextRenderer(*newNode);
-}
-
-void XMLDocumentParser::parseComment()
-{
-    exitText();
-
-    RefPtr<Comment> newNode = Comment::create(document(), m_stream.text());
-
-    m_currentNode->parserAppendChild(newNode.get());
-}
-
-void XMLDocumentParser::endDocument()
-{
-}
-
-bool XMLDocumentParser::hasError() const
-{
-    return m_stream.hasError();
-}
-
-void XMLDocumentParser::parseDtd()
-{
-    QStringRef name = m_stream.dtdName();
-    QStringRef publicId = m_stream.dtdPublicId();
-    QStringRef systemId = m_stream.dtdSystemId();
-
-    //qDebug() << dtd << name << publicId << systemId;
-    if ((publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Transitional//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Strict//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML 1.0 Frameset//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML Basic 1.0//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"))
-        || (publicId == QLatin1String("-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"))
-        || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.0//EN"))
-        || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.1//EN"))
-        || (publicId == QLatin1String("-//WAPFORUM//DTD XHTML Mobile 1.2//EN"))
-       )
-        setIsXHTMLDocument(true); // controls if we replace entities or not.
-    if (!m_parsingFragment)
-        document()->parserAppendChild(DocumentType::create(document(), name, publicId, systemId));
-
-}
-}
index 9e2e522..3f30d5d 100644 (file)
@@ -1,3 +1,14 @@
+2013-09-13  Allan Sandfeld Jensen  <allan.jensen@digia.com>
+
+        Remove support for QXmlStream as the XML parser.
+        https://bugs.webkit.org/show_bug.cgi?id=121229
+
+        Reviewed by Andreas Kling.
+
+        Removed USE flags.
+
+        * WebCoreSupport/AboutDataUseFeatures.in:
+
 2013-09-11  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
 
         Generate more HTML type checks and casting
index 23f5bd1..dd4a54c 100644 (file)
@@ -80,8 +80,6 @@ QT_MOBILITY_SYSTEMINFO
 QT_MULTIMEDIA
 QUERY_PERFORMANCE_COUNTER
 QUICK_LOOK
-QXMLQUERY
-QXMLSTREAM
 REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR
 REQUEST_ANIMATION_FRAME_TIMER
 RTL_SCROLLBAR