Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: Source/core/dom/Node.cpp

Issue 16879016: Use toElement instead of static_cast<Element*> and static_cast<const Element*> (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r ights reserved.
6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 6 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) 7 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/)
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1531 String Node::lookupPrefix(const AtomicString &namespaceURI) const 1531 String Node::lookupPrefix(const AtomicString &namespaceURI) const
1532 { 1532 {
1533 // Implemented according to 1533 // Implemented according to
1534 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespacePrefixAlgo 1534 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespacePrefixAlgo
1535 1535
1536 if (namespaceURI.isEmpty()) 1536 if (namespaceURI.isEmpty())
1537 return String(); 1537 return String();
1538 1538
1539 switch (nodeType()) { 1539 switch (nodeType()) {
1540 case ELEMENT_NODE: 1540 case ELEMENT_NODE:
1541 return lookupNamespacePrefix(namespaceURI, static_cast<const Element *>(this)); 1541 return lookupNamespacePrefix(namespaceURI, toElement(this));
1542 case DOCUMENT_NODE: 1542 case DOCUMENT_NODE:
1543 if (Element* de = toDocument(this)->documentElement()) 1543 if (Element* de = toDocument(this)->documentElement())
1544 return de->lookupPrefix(namespaceURI); 1544 return de->lookupPrefix(namespaceURI);
1545 return String(); 1545 return String();
1546 case ENTITY_NODE: 1546 case ENTITY_NODE:
1547 case NOTATION_NODE: 1547 case NOTATION_NODE:
1548 case DOCUMENT_FRAGMENT_NODE: 1548 case DOCUMENT_FRAGMENT_NODE:
1549 case DOCUMENT_TYPE_NODE: 1549 case DOCUMENT_TYPE_NODE:
1550 return String(); 1550 return String();
1551 case ATTRIBUTE_NODE: { 1551 case ATTRIBUTE_NODE: {
(...skipping 12 matching lines...) Expand all
1564 String Node::lookupNamespaceURI(const String &prefix) const 1564 String Node::lookupNamespaceURI(const String &prefix) const
1565 { 1565 {
1566 // Implemented according to 1566 // Implemented according to
1567 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespaceURIAlgo 1567 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespaceURIAlgo
1568 1568
1569 if (!prefix.isNull() && prefix.isEmpty()) 1569 if (!prefix.isNull() && prefix.isEmpty())
1570 return String(); 1570 return String();
1571 1571
1572 switch (nodeType()) { 1572 switch (nodeType()) {
1573 case ELEMENT_NODE: { 1573 case ELEMENT_NODE: {
1574 const Element *elem = static_cast<const Element *>(this); 1574 const Element *elem = toElement(this);
1575 1575
1576 if (!elem->namespaceURI().isNull() && elem->prefix() == prefix) 1576 if (!elem->namespaceURI().isNull() && elem->prefix() == prefix)
1577 return elem->namespaceURI(); 1577 return elem->namespaceURI();
1578 1578
1579 if (elem->hasAttributes()) { 1579 if (elem->hasAttributes()) {
1580 for (unsigned i = 0; i < elem->attributeCount(); i++) { 1580 for (unsigned i = 0; i < elem->attributeCount(); i++) {
1581 const Attribute* attr = elem->attributeItem(i); 1581 const Attribute* attr = elem->attributeItem(i);
1582 1582
1583 if (attr->prefix() == xmlnsAtom && attr->localName() == pref ix) { 1583 if (attr->prefix() == xmlnsAtom && attr->localName() == pref ix) {
1584 if (!attr->value().isEmpty()) 1584 if (!attr->value().isEmpty())
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2767 node->showTreeForThis(); 2767 node->showTreeForThis();
2768 } 2768 }
2769 2769
2770 void showNodePath(const WebCore::Node* node) 2770 void showNodePath(const WebCore::Node* node)
2771 { 2771 {
2772 if (node) 2772 if (node)
2773 node->showNodePathForThis(); 2773 node->showNodePathForThis();
2774 } 2774 }
2775 2775
2776 #endif 2776 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698