Title: [174132] trunk/Source/WebCore
Revision
174132
Author
[email protected]
Date
2014-09-30 16:03:38 -0700 (Tue, 30 Sep 2014)

Log Message

Use is<>() / downcast<>() for ContainerNode
https://bugs.webkit.org/show_bug.cgi?id=137270

Reviewed by Andreas Kling.

Use is<>() / downcast<>() for ContainerNode instead of isContainerNode()
/ toContainerNode(). Also kill the NODE_TYPE_CASTS() macro as this was
its last user.

No new tests, no behavior change.

* dom/ContainerNode.cpp:
(WebCore::collectChildrenAndRemoveFromOldParent):
(WebCore::ContainerNode::willRemoveChild):
(WebCore::cloneChildNodesAvoidingDeleteButton):
* dom/ContainerNode.h:
(WebCore::Node::countChildNodes):
(WebCore::Node::traverseToChildAt):
(WebCore::Node::firstChild):
(WebCore::Node::lastChild):
(isType):
(WebCore::isContainerNode): Deleted.
* dom/ContainerNodeAlgorithms.cpp:
(WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree):
(WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree):
* dom/ContainerNodeAlgorithms.h:
(WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument):
(WebCore::ChildNodeInsertionNotifier::notify):
(WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument):
(WebCore::ChildNodeRemovalNotifier::notify):
* dom/Node.cpp:
(WebCore::Node::childNodes):
(WebCore::Node::insertBefore):
(WebCore::Node::replaceChild):
(WebCore::Node::removeChild):
(WebCore::Node::appendChild):
(WebCore::Node::setTextContent):
* dom/Node.h:
* dom/Range.cpp:
(WebCore::Range::surroundContents):
* dom/TextNodeTraversal.cpp:
(WebCore::TextNodeTraversal::contentsAsString):
* editing/ApplyStyleCommand.cpp:
(WebCore::ApplyStyleCommand::applyBlockStyle):
* editing/CompositeEditCommand.cpp:
(WebCore::CompositeEditCommand::insertNodeAt):
* editing/Editor.cpp:
(WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
* html/MediaDocument.cpp:
(WebCore::MediaDocument::defaultEventHandler):
* html/parser/HTMLConstructionSite.h:
(WebCore::HTMLConstructionSiteTask::oldParent):
* html/track/VTTCue.cpp:
(WebCore::VTTCue::copyWebVTTNodeToDOMTree):
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::querySelector):
(WebCore::InspectorDOMAgent::querySelectorAll):
* inspector/InspectorNodeFinder.cpp:
(WebCore::InspectorNodeFinder::searchUsingCSSSelectors):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (174131 => 174132)


--- trunk/Source/WebCore/ChangeLog	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/ChangeLog	2014-09-30 23:03:38 UTC (rev 174132)
@@ -1,3 +1,65 @@
+2014-09-30  Christophe Dumez  <[email protected]>
+
+        Use is<>() / downcast<>() for ContainerNode
+        https://bugs.webkit.org/show_bug.cgi?id=137270
+
+        Reviewed by Andreas Kling.
+
+        Use is<>() / downcast<>() for ContainerNode instead of isContainerNode()
+        / toContainerNode(). Also kill the NODE_TYPE_CASTS() macro as this was
+        its last user.
+
+        No new tests, no behavior change.
+
+        * dom/ContainerNode.cpp:
+        (WebCore::collectChildrenAndRemoveFromOldParent):
+        (WebCore::ContainerNode::willRemoveChild):
+        (WebCore::cloneChildNodesAvoidingDeleteButton):
+        * dom/ContainerNode.h:
+        (WebCore::Node::countChildNodes):
+        (WebCore::Node::traverseToChildAt):
+        (WebCore::Node::firstChild):
+        (WebCore::Node::lastChild):
+        (isType):
+        (WebCore::isContainerNode): Deleted.
+        * dom/ContainerNodeAlgorithms.cpp:
+        (WebCore::ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree):
+        (WebCore::ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree):
+        * dom/ContainerNodeAlgorithms.h:
+        (WebCore::ChildNodeInsertionNotifier::notifyNodeInsertedIntoDocument):
+        (WebCore::ChildNodeInsertionNotifier::notify):
+        (WebCore::ChildNodeRemovalNotifier::notifyNodeRemovedFromDocument):
+        (WebCore::ChildNodeRemovalNotifier::notify):
+        * dom/Node.cpp:
+        (WebCore::Node::childNodes):
+        (WebCore::Node::insertBefore):
+        (WebCore::Node::replaceChild):
+        (WebCore::Node::removeChild):
+        (WebCore::Node::appendChild):
+        (WebCore::Node::setTextContent):
+        * dom/Node.h:
+        * dom/Range.cpp:
+        (WebCore::Range::surroundContents):
+        * dom/TextNodeTraversal.cpp:
+        (WebCore::TextNodeTraversal::contentsAsString):
+        * editing/ApplyStyleCommand.cpp:
+        (WebCore::ApplyStyleCommand::applyBlockStyle):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::CompositeEditCommand::insertNodeAt):
+        * editing/Editor.cpp:
+        (WebCore::correctSpellcheckingPreservingTextCheckingParagraph):
+        * html/MediaDocument.cpp:
+        (WebCore::MediaDocument::defaultEventHandler):
+        * html/parser/HTMLConstructionSite.h:
+        (WebCore::HTMLConstructionSiteTask::oldParent):
+        * html/track/VTTCue.cpp:
+        (WebCore::VTTCue::copyWebVTTNodeToDOMTree):
+        * inspector/InspectorDOMAgent.cpp:
+        (WebCore::InspectorDOMAgent::querySelector):
+        (WebCore::InspectorDOMAgent::querySelectorAll):
+        * inspector/InspectorNodeFinder.cpp:
+        (WebCore::InspectorNodeFinder::searchUsingCSSSelectors):
+
 2014-09-30  Roger Fong  <[email protected]>
 
         [Windows] Remove an errant WTFLogAlways that makes test output hard to read and generates stderr output.

Modified: trunk/Source/WebCore/dom/ContainerNode.cpp (174131 => 174132)


--- trunk/Source/WebCore/dom/ContainerNode.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/ContainerNode.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -71,7 +71,7 @@
 
 static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes, ExceptionCode& ec)
 {
-    if (!node.isDocumentFragment()) {
+    if (!is<DocumentFragment>(node)) {
         nodes.append(node);
         if (ContainerNode* oldParent = node.parentNode())
             oldParent->removeChild(&node, ec);
@@ -79,7 +79,7 @@
     }
 
     getChildNodes(node, nodes);
-    toContainerNode(node).removeChildren();
+    downcast<DocumentFragment>(node).removeChildren();
 }
 
 // FIXME: This function must get a new name.
@@ -483,8 +483,8 @@
         return;
 
     child.document().nodeWillBeRemoved(&child); // e.g. mutation event listener can create a new range.
-    if (child.isContainerNode())
-        disconnectSubframesIfNeeded(toContainerNode(child), RootAndDescendants);
+    if (is<ContainerNode>(child))
+        disconnectSubframesIfNeeded(downcast<ContainerNode>(child), RootAndDescendants);
 }
 
 static void willRemoveChildren(ContainerNode& container)
@@ -786,8 +786,8 @@
         RefPtr<Node> clonedChild = child->cloneNode(false);
         clonedParent->appendChild(clonedChild, ec);
 
-        if (!ec && child->isContainerNode())
-            cloneChildNodesAvoidingDeleteButton(toContainerNode(child), toContainerNode(clonedChild.get()), deleteButtonContainerElement);
+        if (!ec && is<ContainerNode>(child))
+            cloneChildNodesAvoidingDeleteButton(downcast<ContainerNode>(child), downcast<ContainerNode>(clonedChild.get()), deleteButtonContainerElement);
     }
 }
 

Modified: trunk/Source/WebCore/dom/ContainerNode.h (174131 => 174132)


--- trunk/Source/WebCore/dom/ContainerNode.h	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/ContainerNode.h	2014-09-30 23:03:38 UTC (rev 174132)
@@ -173,11 +173,6 @@
     Node* m_lastChild;
 };
 
-inline bool isContainerNode(const Node& node) { return node.isContainerNode(); }
-void isContainerNode(const ContainerNode&); // Catch unnecessary runtime check of type known at compile time.
-
-NODE_TYPE_CASTS(ContainerNode)
-
 inline ContainerNode::ContainerNode(Document& document, ConstructionType type)
     : Node(document, type)
     , m_firstChild(0)
@@ -187,30 +182,30 @@
 
 inline unsigned Node::countChildNodes() const
 {
-    if (!isContainerNode())
+    if (!is<ContainerNode>(*this))
         return 0;
-    return toContainerNode(this)->countChildNodes();
+    return downcast<ContainerNode>(*this).countChildNodes();
 }
 
 inline Node* Node::traverseToChildAt(unsigned index) const
 {
-    if (!isContainerNode())
-        return 0;
-    return toContainerNode(this)->traverseToChildAt(index);
+    if (!is<ContainerNode>(*this))
+        return nullptr;
+    return downcast<ContainerNode>(*this).traverseToChildAt(index);
 }
 
 inline Node* Node::firstChild() const
 {
-    if (!isContainerNode())
-        return 0;
-    return toContainerNode(this)->firstChild();
+    if (!is<ContainerNode>(*this))
+        return nullptr;
+    return downcast<ContainerNode>(*this).firstChild();
 }
 
 inline Node* Node::lastChild() const
 {
-    if (!isContainerNode())
-        return 0;
-    return toContainerNode(this)->lastChild();
+    if (!is<ContainerNode>(*this))
+        return nullptr;
+    return downcast<ContainerNode>(*this).lastChild();
 }
 
 inline Node* Node::highestAncestor() const
@@ -316,4 +311,8 @@
 
 } // namespace WebCore
 
+SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::ContainerNode)
+    static bool isType(const WebCore::Node& node) { return node.isContainerNode(); }
+SPECIALIZE_TYPE_TRAITS_END()
+
 #endif // ContainerNode_h

Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp (174131 => 174132)


--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -52,8 +52,8 @@
 void ChildNodeInsertionNotifier::notifyDescendantInsertedIntoTree(ContainerNode& node)
 {
     for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
-        if (child->isContainerNode())
-            notifyNodeInsertedIntoTree(*toContainerNode(child));
+        if (is<ContainerNode>(child))
+            notifyNodeInsertedIntoTree(downcast<ContainerNode>(*child));
     }
 
     if (ShadowRoot* root = node.shadowRoot())
@@ -86,8 +86,8 @@
 void ChildNodeRemovalNotifier::notifyDescendantRemovedFromTree(ContainerNode& node)
 {
     for (Node* child = node.firstChild(); child; child = child->nextSibling()) {
-        if (child->isContainerNode())
-            notifyNodeRemovedFromTree(*toContainerNode(child));
+        if (is<ContainerNode>(child))
+            notifyNodeRemovedFromTree(downcast<ContainerNode>(*child));
     }
 
     if (!is<Element>(node))

Modified: trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h (174131 => 174132)


--- trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/ContainerNodeAlgorithms.h	2014-09-30 23:03:38 UTC (rev 174132)
@@ -199,8 +199,8 @@
     ASSERT(m_insertionPoint.inDocument());
     if (Node::InsertionShouldCallDidNotifySubtreeInsertions == node.insertedInto(m_insertionPoint))
         m_postInsertionNotificationTargets.append(node);
-    if (node.isContainerNode())
-        notifyDescendantInsertedIntoDocument(toContainerNode(node));
+    if (is<ContainerNode>(node))
+        notifyDescendantInsertedIntoDocument(downcast<ContainerNode>(node));
 }
 
 inline void ChildNodeInsertionNotifier::notifyNodeInsertedIntoTree(ContainerNode& node)
@@ -226,8 +226,8 @@
 
     if (m_insertionPoint.inDocument())
         notifyNodeInsertedIntoDocument(node);
-    else if (node.isContainerNode())
-        notifyNodeInsertedIntoTree(toContainerNode(node));
+    else if (is<ContainerNode>(node))
+        notifyNodeInsertedIntoTree(downcast<ContainerNode>(node));
 
     for (size_t i = 0; i < m_postInsertionNotificationTargets.size(); ++i)
         m_postInsertionNotificationTargets[i]->didNotifySubtreeInsertions(&m_insertionPoint);
@@ -239,8 +239,8 @@
     ASSERT(m_insertionPoint.inDocument());
     node.removedFrom(m_insertionPoint);
 
-    if (node.isContainerNode())
-        notifyDescendantRemovedFromDocument(toContainerNode(node));
+    if (is<ContainerNode>(node))
+        notifyDescendantRemovedFromDocument(downcast<ContainerNode>(node));
 }
 
 inline void ChildNodeRemovalNotifier::notifyNodeRemovedFromTree(ContainerNode& node)
@@ -257,8 +257,8 @@
     if (node.inDocument()) {
         notifyNodeRemovedFromDocument(node);
         node.document().notifyRemovePendingSheetIfNeeded();
-    } else if (node.isContainerNode())
-        notifyNodeRemovedFromTree(toContainerNode(node));
+    } else if (is<ContainerNode>(node))
+        notifyNodeRemovedFromTree(downcast<ContainerNode>(node));
 }
 
 enum SubframeDisconnectPolicy {

Modified: trunk/Source/WebCore/dom/Node.cpp (174131 => 174132)


--- trunk/Source/WebCore/dom/Node.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/Node.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -405,8 +405,8 @@
 
 PassRefPtr<NodeList> Node::childNodes()
 {
-    if (isContainerNode())
-        return ensureRareData().ensureNodeLists().ensureChildNodeList(toContainerNode(*this));
+    if (is<ContainerNode>(*this))
+        return ensureRareData().ensureNodeLists().ensureChildNodeList(downcast<ContainerNode>(*this));
     return ensureRareData().ensureNodeLists().ensureEmptyChildNodeList(*this);
 }
 
@@ -428,38 +428,38 @@
 
 bool Node::insertBefore(PassRefPtr<Node> newChild, Node* refChild, ExceptionCode& ec)
 {
-    if (!isContainerNode()) {
+    if (!is<ContainerNode>(*this)) {
         ec = HIERARCHY_REQUEST_ERR;
         return false;
     }
-    return toContainerNode(this)->insertBefore(newChild, refChild, ec);
+    return downcast<ContainerNode>(*this).insertBefore(newChild, refChild, ec);
 }
 
 bool Node::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionCode& ec)
 {
-    if (!isContainerNode()) {
+    if (!is<ContainerNode>(*this)) {
         ec = HIERARCHY_REQUEST_ERR;
         return false;
     }
-    return toContainerNode(this)->replaceChild(newChild, oldChild, ec);
+    return downcast<ContainerNode>(*this).replaceChild(newChild, oldChild, ec);
 }
 
 bool Node::removeChild(Node* oldChild, ExceptionCode& ec)
 {
-    if (!isContainerNode()) {
+    if (!is<ContainerNode>(*this)) {
         ec = NOT_FOUND_ERR;
         return false;
     }
-    return toContainerNode(this)->removeChild(oldChild, ec);
+    return downcast<ContainerNode>(*this).removeChild(oldChild, ec);
 }
 
 bool Node::appendChild(PassRefPtr<Node> newChild, ExceptionCode& ec)
 {
-    if (!isContainerNode()) {
+    if (!is<ContainerNode>(*this)) {
         ec = HIERARCHY_REQUEST_ERR;
         return false;
     }
-    return toContainerNode(this)->appendChild(newChild, ec);
+    return downcast<ContainerNode>(*this).appendChild(newChild, ec);
 }
 
 void Node::remove(ExceptionCode& ec)
@@ -1363,7 +1363,7 @@
         case ENTITY_NODE:
         case ENTITY_REFERENCE_NODE:
         case DOCUMENT_FRAGMENT_NODE: {
-            Ref<ContainerNode> container(*toContainerNode(this));
+            Ref<ContainerNode> container(downcast<ContainerNode>(*this));
             ChildListMutationScope mutation(container.get());
             container->removeChildren();
             if (!text.isEmpty())

Modified: trunk/Source/WebCore/dom/Node.h (174131 => 174132)


--- trunk/Source/WebCore/dom/Node.h	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/Node.h	2014-09-30 23:03:38 UTC (rev 174132)
@@ -740,10 +740,6 @@
     return parentNode();
 }
 
-// FIXME: This should be removed and all uses should be replaced with SPECIALIZE_TYPE_TRAITS_*().
-#define NODE_TYPE_CASTS(ToClassName) \
-    TYPE_CASTS_BASE(ToClassName, Node, node, WebCore::is##ToClassName(*node), WebCore::is##ToClassName(node))
-
 } // namespace WebCore
 
 #ifndef NDEBUG

Modified: trunk/Source/WebCore/dom/Range.cpp (174131 => 174132)


--- trunk/Source/WebCore/dom/Range.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/Range.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -1480,7 +1480,7 @@
 
     ec = 0;
     while (Node* n = newParent->firstChild()) {
-        toContainerNode(newParent.get())->removeChild(n, ec);
+        downcast<ContainerNode>(*newParent).removeChild(n, ec);
         if (ec)
             return;
     }

Modified: trunk/Source/WebCore/dom/TextNodeTraversal.cpp (174131 => 174132)


--- trunk/Source/WebCore/dom/TextNodeTraversal.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/dom/TextNodeTraversal.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -49,8 +49,8 @@
 {
     if (is<Text>(root))
         return downcast<Text>(*root).data();
-    if (root->isContainerNode())
-        return contentsAsString(toContainerNode(root));
+    if (is<ContainerNode>(root))
+        return contentsAsString(downcast<ContainerNode>(root));
     return String();
 }
 

Modified: trunk/Source/WebCore/editing/ApplyStyleCommand.cpp (174131 => 174132)


--- trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/editing/ApplyStyleCommand.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -291,8 +291,8 @@
         nextParagraphStart = endOfParagraph(paragraphStart).next();
     }
     
-    startRange = TextIterator::rangeFromLocationAndLength(toContainerNode(scope), startIndex, 0, true);
-    endRange = TextIterator::rangeFromLocationAndLength(toContainerNode(scope), endIndex, 0, true);
+    startRange = TextIterator::rangeFromLocationAndLength(downcast<ContainerNode>(scope), startIndex, 0, true);
+    endRange = TextIterator::rangeFromLocationAndLength(downcast<ContainerNode>(scope), endIndex, 0, true);
     if (startRange && endRange)
         updateStartEnd(startRange->startPosition(), endRange->startPosition());
 }

Modified: trunk/Source/WebCore/editing/CompositeEditCommand.cpp (174131 => 174132)


--- trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/editing/CompositeEditCommand.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -375,7 +375,7 @@
         if (child)
             insertNodeBefore(insertChild, child);
         else
-            appendNode(insertChild, toContainerNode(refChild));
+            appendNode(insertChild, downcast<ContainerNode>(refChild));
     } else if (caretMinOffset(refChild) >= offset)
         insertNodeBefore(insertChild, refChild);
     else if (is<Text>(refChild) && caretMaxOffset(refChild) > offset) {

Modified: trunk/Source/WebCore/editing/Editor.cpp (174131 => 174132)


--- trunk/Source/WebCore/editing/Editor.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/editing/Editor.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -2468,7 +2468,7 @@
 
 static void correctSpellcheckingPreservingTextCheckingParagraph(TextCheckingParagraph& paragraph, PassRefPtr<Range> rangeToReplace, const String& replacement, int resultLocation, int resultLength)
 {
-    ContainerNode* scope = toContainerNode(highestAncestor(paragraph.paragraphRange()->startContainer()));
+    ContainerNode* scope = downcast<ContainerNode>(highestAncestor(paragraph.paragraphRange()->startContainer()));
 
     size_t paragraphLocation;
     size_t paragraphLength;

Modified: trunk/Source/WebCore/html/MediaDocument.cpp (174131 => 174132)


--- trunk/Source/WebCore/html/MediaDocument.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/html/MediaDocument.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -201,9 +201,9 @@
         }
     }
 
-    if (!targetNode->isContainerNode())
+    if (!is<ContainerNode>(targetNode))
         return;
-    ContainerNode& targetContainer = toContainerNode(*targetNode);
+    ContainerNode& targetContainer = downcast<ContainerNode>(*targetNode);
     if (event->type() == eventNames().keydownEvent && event->isKeyboardEvent()) {
         HTMLVideoElement* video = descendentVideoElement(targetContainer);
         if (!video)

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.h (174131 => 174132)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.h	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.h	2014-09-30 23:03:38 UTC (rev 174132)
@@ -56,7 +56,7 @@
         // It's sort of ugly, but we store the |oldParent| in the |child| field
         // of the task so that we don't bloat the HTMLConstructionSiteTask
         // object in the common case of the Insert operation.
-        return toContainerNode(child.get());
+        return downcast<ContainerNode>(child.get());
     }
 
     Operation operation;

Modified: trunk/Source/WebCore/html/track/VTTCue.cpp (174131 => 174132)


--- trunk/Source/WebCore/html/track/VTTCue.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/html/track/VTTCue.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -502,8 +502,8 @@
         else
             clonedNode = node->cloneNode(false);
         parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION);
-        if (node->isContainerNode())
-            copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clonedNode.get()));
+        if (is<ContainerNode>(node))
+            copyWebVTTNodeToDOMTree(downcast<ContainerNode>(node), downcast<ContainerNode>(clonedNode.get()));
     }
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp (174131 => 174132)


--- trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -520,13 +520,13 @@
     Node* node = assertNode(errorString, nodeId);
     if (!node)
         return;
-    if (!node->isContainerNode()) {
+    if (!is<ContainerNode>(node)) {
         assertElement(errorString, nodeId);
         return;
     }
 
     ExceptionCode ec = 0;
-    RefPtr<Element> element = toContainerNode(node)->querySelector(selectors, ec);
+    RefPtr<Element> element = downcast<ContainerNode>(*node).querySelector(selectors, ec);
     if (ec) {
         *errorString = "DOM Error while querying";
         return;
@@ -541,13 +541,13 @@
     Node* node = assertNode(errorString, nodeId);
     if (!node)
         return;
-    if (!node->isContainerNode()) {
+    if (!is<ContainerNode>(node)) {
         assertElement(errorString, nodeId);
         return;
     }
 
     ExceptionCode ec = 0;
-    RefPtr<NodeList> nodes = toContainerNode(node)->querySelectorAll(selectors, ec);
+    RefPtr<NodeList> nodes = downcast<ContainerNode>(*node).querySelectorAll(selectors, ec);
     if (ec) {
         *errorString = "DOM Error while querying";
         return;

Modified: trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp (174131 => 174132)


--- trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp	2014-09-30 22:59:28 UTC (rev 174131)
+++ trunk/Source/WebCore/inspector/InspectorNodeFinder.cpp	2014-09-30 23:03:38 UTC (rev 174132)
@@ -157,11 +157,11 @@
 
 void InspectorNodeFinder::searchUsingCSSSelectors(Node* parentNode)
 {
-    if (!parentNode->isContainerNode())
+    if (!is<ContainerNode>(parentNode))
         return;
 
     ExceptionCode ec = 0;
-    RefPtr<NodeList> nodeList = toContainerNode(parentNode)->querySelectorAll(m_whitespaceTrimmedQuery, ec);
+    RefPtr<NodeList> nodeList = downcast<ContainerNode>(*parentNode).querySelectorAll(m_whitespaceTrimmedQuery, ec);
     if (ec || !nodeList)
         return;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to