Drop XPATH_NAMESPACE_NODE from Node::NodeType enum
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2015 18:17:08 +0000 (18:17 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 24 Sep 2015 18:17:08 +0000 (18:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=149532

Reviewed by Ryosuke Niwa.

Drop XPATH_NAMESPACE_NODE from Node::NodeType enum as there is currently
no way to construct such Node in WebKit. This avoid having to handle this
Node type everywhere.

Source/WebCore:

* bindings/gobject/WebKitDOMPrivate.cpp:
(WebKit::wrap): Deleted.
* bindings/objc/DOM.mm:
(kitClass): Deleted.
* dom/Document.cpp:
(WebCore::Document::importNode):
(WebCore::Document::adoptNode): Deleted.
(WebCore::Document::childTypeAllowed): Deleted.
(WebCore::Document::canAcceptChild): Deleted.
* dom/Node.cpp:
(WebCore::Node::dumpStatistics): Deleted.
(WebCore::Node::textContent): Deleted.
(WebCore::Node::ancestorElement): Deleted.
* dom/Node.h:
* dom/Range.cpp:
(WebCore::Range::checkNodeWOffset):
(WebCore::lengthOfContentsInNode): Deleted.
(WebCore::Range::processContentsBetweenOffsets): Deleted.
(WebCore::Range::surroundContents): Deleted.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendStartMarkup): Deleted.
* xml/XPathFunctions.cpp:
(WebCore::XPath::expandedNameLocalPart): Deleted.
* xml/XPathStep.cpp:
(WebCore::XPath::Step::nodesInAxis):
(WebCore::XPath::primaryNodeType): Deleted.
* xml/XPathUtil.cpp:
(WebCore::XPath::stringValue): Deleted.
(WebCore::XPath::isValidContextNode): Deleted.

Source/WebKit2:

* WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
(WebKit::WKDOMNodeClass): Deleted.

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/gobject/WebKitDOMPrivate.cpp
Source/WebCore/bindings/objc/DOM.mm
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Node.h
Source/WebCore/dom/Range.cpp
Source/WebCore/editing/MarkupAccumulator.cpp
Source/WebCore/xml/XPathFunctions.cpp
Source/WebCore/xml/XPathStep.cpp
Source/WebCore/xml/XPathUtil.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm

index 3f34e26..d3105e2 100644 (file)
@@ -1,3 +1,44 @@
+2015-09-24  Chris Dumez  <cdumez@apple.com>
+
+        Drop XPATH_NAMESPACE_NODE from Node::NodeType enum
+        https://bugs.webkit.org/show_bug.cgi?id=149532
+
+        Reviewed by Ryosuke Niwa.
+
+        Drop XPATH_NAMESPACE_NODE from Node::NodeType enum as there is currently
+        no way to construct such Node in WebKit. This avoid having to handle this
+        Node type everywhere.
+
+        * bindings/gobject/WebKitDOMPrivate.cpp:
+        (WebKit::wrap): Deleted.
+        * bindings/objc/DOM.mm:
+        (kitClass): Deleted.
+        * dom/Document.cpp:
+        (WebCore::Document::importNode):
+        (WebCore::Document::adoptNode): Deleted.
+        (WebCore::Document::childTypeAllowed): Deleted.
+        (WebCore::Document::canAcceptChild): Deleted.
+        * dom/Node.cpp:
+        (WebCore::Node::dumpStatistics): Deleted.
+        (WebCore::Node::textContent): Deleted.
+        (WebCore::Node::ancestorElement): Deleted.
+        * dom/Node.h:
+        * dom/Range.cpp:
+        (WebCore::Range::checkNodeWOffset):
+        (WebCore::lengthOfContentsInNode): Deleted.
+        (WebCore::Range::processContentsBetweenOffsets): Deleted.
+        (WebCore::Range::surroundContents): Deleted.
+        * editing/MarkupAccumulator.cpp:
+        (WebCore::MarkupAccumulator::appendStartMarkup): Deleted.
+        * xml/XPathFunctions.cpp:
+        (WebCore::XPath::expandedNameLocalPart): Deleted.
+        * xml/XPathStep.cpp:
+        (WebCore::XPath::Step::nodesInAxis):
+        (WebCore::XPath::primaryNodeType): Deleted.
+        * xml/XPathUtil.cpp:
+        (WebCore::XPath::stringValue): Deleted.
+        (WebCore::XPath::isValidContextNode): Deleted.
+
 2015-09-24  David Hyatt  <hyatt@apple.com>
 
         Add support for CSS Custom Properties (in preparation for implementing CSS Variables).
index aca1f98..d6016f9 100644 (file)
@@ -104,8 +104,6 @@ WebKitDOMNode* wrap(Node* node)
         return WEBKIT_DOM_NODE(wrapDocumentType(static_cast<DocumentType*>(node)));
     case Node::DOCUMENT_FRAGMENT_NODE:
         return WEBKIT_DOM_NODE(wrapDocumentFragment(static_cast<DocumentFragment*>(node)));
-    case Node::XPATH_NAMESPACE_NODE:
-        break;
     }
 
     return wrapNode(node);
index e83965d..63f6b55 100644 (file)
@@ -323,10 +323,6 @@ Class kitClass(WebCore::Node* impl)
             return [DOMDocumentType class];
         case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
             return [DOMDocumentFragment class];
-        case WebCore::Node::XPATH_NAMESPACE_NODE:
-            // FIXME: Create an XPath objective C wrapper
-            // See http://bugs.webkit.org/show_bug.cgi?id=8755
-            return nil;
     }
     ASSERT_NOT_REACHED();
     return nil;
index 7b11e39..1e1da99 100644 (file)
@@ -952,11 +952,8 @@ RefPtr<Node> Document::importNode(Node* importedNode, bool deep, ExceptionCode&
     case DOCUMENT_NODE: // Can't import a document into another document.
     case DOCUMENT_TYPE_NODE: // FIXME: Support cloning a DocumentType node per DOM4.
         break;
-
-    case XPATH_NAMESPACE_NODE:
-        ASSERT_NOT_REACHED(); // These two types of DOM nodes are not implemented.
-        break;
     }
+
     ec = NOT_SUPPORTED_ERR;
     return nullptr;
 }
@@ -973,7 +970,6 @@ RefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
 
     switch (source->nodeType()) {
     case DOCUMENT_NODE:
-    case XPATH_NAMESPACE_NODE:
         ec = NOT_SUPPORTED_ERR;
         return nullptr;
     case ATTRIBUTE_NODE: {                   
@@ -3344,7 +3340,6 @@ bool Document::childTypeAllowed(NodeType type) const
     case DOCUMENT_FRAGMENT_NODE:
     case DOCUMENT_NODE:
     case TEXT_NODE:
-    case XPATH_NAMESPACE_NODE:
         return false;
     case COMMENT_NODE:
     case PROCESSING_INSTRUCTION_NODE:
@@ -3371,7 +3366,6 @@ bool Document::canAcceptChild(const Node& newChild, const Node* refChild, Accept
     case CDATA_SECTION_NODE:
     case DOCUMENT_NODE:
     case TEXT_NODE:
-    case XPATH_NAMESPACE_NODE:
         return false;
     case COMMENT_NODE:
     case PROCESSING_INSTRUCTION_NODE:
index def24ce..108d555 100644 (file)
@@ -108,7 +108,6 @@ void Node::dumpStatistics()
     size_t documentNodes = 0;
     size_t docTypeNodes = 0;
     size_t fragmentNodes = 0;
-    size_t xpathNSNodes = 0;
     size_t shadowRootNodes = 0;
 
     HashMap<String, size_t> perTagCount;
@@ -190,10 +189,6 @@ void Node::dumpStatistics()
                     ++fragmentNodes;
                 break;
             }
-            case XPATH_NAMESPACE_NODE: {
-                ++xpathNSNodes;
-                break;
-            }
         }
     }
 
@@ -211,7 +206,6 @@ void Node::dumpStatistics()
     printf("  Number of Document nodes: %zu\n", documentNodes);
     printf("  Number of DocumentType nodes: %zu\n", docTypeNodes);
     printf("  Number of DocumentFragment nodes: %zu\n", fragmentNodes);
-    printf("  Number of XPathNS nodes: %zu\n", xpathNSNodes);
     printf("  Number of ShadowRoot nodes: %zu\n", shadowRootNodes);
 
     printf("Element tag name distibution:\n");
@@ -1416,7 +1410,6 @@ static void appendTextContent(const Node* node, bool convertBRsToNewlines, bool&
 
     case Node::DOCUMENT_NODE:
     case Node::DOCUMENT_TYPE_NODE:
-    case Node::XPATH_NAMESPACE_NODE:
         break;
     }
 }
@@ -1450,7 +1443,6 @@ void Node::setTextContent(const String& text, ExceptionCode& ec)
         }
         case DOCUMENT_NODE:
         case DOCUMENT_TYPE_NODE:
-        case XPATH_NAMESPACE_NODE:
             // Do nothing.
             return;
     }
index a2fc438..3615f78 100644 (file)
@@ -130,7 +130,6 @@ public:
         DOCUMENT_NODE = 9,
         DOCUMENT_TYPE_NODE = 10,
         DOCUMENT_FRAGMENT_NODE = 11,
-        XPATH_NAMESPACE_NODE = 13,
     };
     enum DeprecatedNodeType {
         ENTITY_REFERENCE_NODE = 5,
index c4cd300..42da2c6 100644 (file)
@@ -556,7 +556,6 @@ static inline unsigned lengthOfContentsInNode(Node& node)
 {
     // This switch statement must be consistent with that of Range::processContentsBetweenOffsets.
     switch (node.nodeType()) {
-    case Node::XPATH_NAMESPACE_NODE: // FIXME: Remove from NodeType as there is no way to construct such Node in WebKit.
     case Node::DOCUMENT_TYPE_NODE:
         return 0;
     case Node::TEXT_NODE:
@@ -727,7 +726,6 @@ RefPtr<Node> Range::processContentsBetweenOffsets(ActionType action, PassRefPtr<
     case Node::DOCUMENT_NODE:
     case Node::DOCUMENT_TYPE_NODE:
     case Node::DOCUMENT_FRAGMENT_NODE:
-    case Node::XPATH_NAMESPACE_NODE:
         // FIXME: Should we assert that some nodes never appear here?
         if (action == Extract || action == Clone) {
             if (fragment)
@@ -1005,8 +1003,7 @@ Node* Range::checkNodeWOffset(Node* n, int offset, ExceptionCode& ec) const
         case Node::ATTRIBUTE_NODE:
         case Node::DOCUMENT_FRAGMENT_NODE:
         case Node::DOCUMENT_NODE:
-        case Node::ELEMENT_NODE:
-        case Node::XPATH_NAMESPACE_NODE: {
+        case Node::ELEMENT_NODE: {
             if (!offset)
                 return nullptr;
             Node* childBefore = n->traverseToChildAt(offset - 1);
@@ -1147,7 +1144,6 @@ void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionCode& ec)
         case Node::ELEMENT_NODE:
         case Node::PROCESSING_INSTRUCTION_NODE:
         case Node::TEXT_NODE:
-        case Node::XPATH_NAMESPACE_NODE:
             break;
     }
 
index 712abfa..b214e0f 100644 (file)
@@ -573,7 +573,6 @@ void MarkupAccumulator::appendStartMarkup(StringBuilder& result, const Node& nod
         appendCDATASection(result, downcast<CDATASection>(node).data());
         break;
     case Node::ATTRIBUTE_NODE:
-    case Node::XPATH_NAMESPACE_NODE:
         ASSERT_NOT_REACHED();
         break;
     }
index 0c2d558..96e1d7a 100644 (file)
@@ -360,8 +360,6 @@ Value FunId::evaluate() const
 
 static inline String expandedNameLocalPart(Node* node)
 {
-    // The local part of an XPath expanded-name matches DOM local name for most node types, except for namespace nodes and processing instruction nodes.
-    ASSERT(node->nodeType() != Node::XPATH_NAMESPACE_NODE); // Not supported yet.
     if (is<ProcessingInstruction>(*node))
         return downcast<ProcessingInstruction>(*node).target();
     return node->localName().string();
index b78724e..7d1b18a 100644 (file)
@@ -153,8 +153,6 @@ static inline Node::NodeType primaryNodeType(Step::Axis axis)
     switch (axis) {
         case Step::AttributeAxis:
             return Node::ATTRIBUTE_NODE;
-        case Step::NamespaceAxis:
-            return Node::XPATH_NAMESPACE_NODE;
         default:
             return Node::ELEMENT_NODE;
     }
@@ -285,7 +283,7 @@ void Step::nodesInAxis(Node& context, NodeSet& nodes) const
             return;
         }
         case FollowingSiblingAxis:
-            if (context.nodeType() == Node::ATTRIBUTE_NODE || context.nodeType() == Node::XPATH_NAMESPACE_NODE)
+            if (context.isAttributeNode())
                 return;
             for (Node* node = context.nextSibling(); node; node = node->nextSibling()) {
                 if (nodeMatches(*node, FollowingSiblingAxis, m_nodeTest))
@@ -293,7 +291,7 @@ void Step::nodesInAxis(Node& context, NodeSet& nodes) const
             }
             return;
         case PrecedingSiblingAxis:
-            if (context.nodeType() == Node::ATTRIBUTE_NODE || context.nodeType() == Node::XPATH_NAMESPACE_NODE)
+            if (context.isAttributeNode())
                 return;
             for (Node* node = context.previousSibling(); node; node = node->previousSibling()) {
                 if (nodeMatches(*node, PrecedingSiblingAxis, m_nodeTest))
index beadb4d..03127af 100644 (file)
@@ -47,7 +47,6 @@ String stringValue(Node* node)
         case Node::COMMENT_NODE:
         case Node::TEXT_NODE:
         case Node::CDATA_SECTION_NODE:
-        case Node::XPATH_NAMESPACE_NODE:
             return node->nodeValue();
         default:
             if (isRootDomNode(node) || node->isElementNode())
@@ -67,7 +66,6 @@ bool isValidContextNode(Node* node)
         case Node::DOCUMENT_NODE:
         case Node::ELEMENT_NODE:
         case Node::PROCESSING_INSTRUCTION_NODE:
-        case Node::XPATH_NAMESPACE_NODE:
             return true;
         case Node::DOCUMENT_FRAGMENT_NODE:
         case Node::DOCUMENT_TYPE_NODE:
index 1696fa6..c4936a8 100644 (file)
@@ -1,3 +1,17 @@
+2015-09-24  Chris Dumez  <cdumez@apple.com>
+
+        Drop XPATH_NAMESPACE_NODE from Node::NodeType enum
+        https://bugs.webkit.org/show_bug.cgi?id=149532
+
+        Reviewed by Ryosuke Niwa.
+
+        Drop XPATH_NAMESPACE_NODE from Node::NodeType enum as there is currently
+        no way to construct such Node in WebKit. This avoid having to handle this
+        Node type everywhere.
+
+        * WebProcess/InjectedBundle/API/mac/WKDOMInternals.mm:
+        (WebKit::WKDOMNodeClass): Deleted.
+
 2015-09-24  Ryosuke Niwa  <rniwa@webkit.org>
 
         Ran sort-Xcode-project-file.
index d57dfcd..650fd47 100644 (file)
@@ -80,7 +80,6 @@ static Class WKDOMNodeClass(WebCore::Node* impl)
     case WebCore::Node::COMMENT_NODE:
     case WebCore::Node::DOCUMENT_TYPE_NODE:
     case WebCore::Node::DOCUMENT_FRAGMENT_NODE:
-    case WebCore::Node::XPATH_NAMESPACE_NODE:
         return [WKDOMNode class];
     }
     ASSERT_NOT_REACHED();