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

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: Rebase 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
« no previous file with comments | « no previous file | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1487 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 String Node::lookupPrefix(const AtomicString &namespaceURI) const 1498 String Node::lookupPrefix(const AtomicString &namespaceURI) const
1499 { 1499 {
1500 // Implemented according to 1500 // Implemented according to
1501 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespacePrefixAlgo 1501 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespacePrefixAlgo
1502 1502
1503 if (namespaceURI.isEmpty()) 1503 if (namespaceURI.isEmpty())
1504 return String(); 1504 return String();
1505 1505
1506 switch (nodeType()) { 1506 switch (nodeType()) {
1507 case ELEMENT_NODE: 1507 case ELEMENT_NODE:
1508 return lookupNamespacePrefix(namespaceURI, static_cast<const Element *>(this)); 1508 return lookupNamespacePrefix(namespaceURI, toElement(this));
1509 case DOCUMENT_NODE: 1509 case DOCUMENT_NODE:
1510 if (Element* de = toDocument(this)->documentElement()) 1510 if (Element* de = toDocument(this)->documentElement())
1511 return de->lookupPrefix(namespaceURI); 1511 return de->lookupPrefix(namespaceURI);
1512 return String(); 1512 return String();
1513 case ENTITY_NODE: 1513 case ENTITY_NODE:
1514 case NOTATION_NODE: 1514 case NOTATION_NODE:
1515 case DOCUMENT_FRAGMENT_NODE: 1515 case DOCUMENT_FRAGMENT_NODE:
1516 case DOCUMENT_TYPE_NODE: 1516 case DOCUMENT_TYPE_NODE:
1517 return String(); 1517 return String();
1518 case ATTRIBUTE_NODE: { 1518 case ATTRIBUTE_NODE: {
(...skipping 12 matching lines...) Expand all
1531 String Node::lookupNamespaceURI(const String &prefix) const 1531 String Node::lookupNamespaceURI(const String &prefix) 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#lookupNamespaceURIAlgo 1534 // http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/namespaces-algori thms.html#lookupNamespaceURIAlgo
1535 1535
1536 if (!prefix.isNull() && prefix.isEmpty()) 1536 if (!prefix.isNull() && prefix.isEmpty())
1537 return String(); 1537 return String();
1538 1538
1539 switch (nodeType()) { 1539 switch (nodeType()) {
1540 case ELEMENT_NODE: { 1540 case ELEMENT_NODE: {
1541 const Element *elem = static_cast<const Element *>(this); 1541 const Element *elem = toElement(this);
1542 1542
1543 if (!elem->namespaceURI().isNull() && elem->prefix() == prefix) 1543 if (!elem->namespaceURI().isNull() && elem->prefix() == prefix)
1544 return elem->namespaceURI(); 1544 return elem->namespaceURI();
1545 1545
1546 if (elem->hasAttributes()) { 1546 if (elem->hasAttributes()) {
1547 for (unsigned i = 0; i < elem->attributeCount(); i++) { 1547 for (unsigned i = 0; i < elem->attributeCount(); i++) {
1548 const Attribute* attr = elem->attributeItem(i); 1548 const Attribute* attr = elem->attributeItem(i);
1549 1549
1550 if (attr->prefix() == xmlnsAtom && attr->localName() == pref ix) { 1550 if (attr->prefix() == xmlnsAtom && attr->localName() == pref ix) {
1551 if (!attr->value().isEmpty()) 1551 if (!attr->value().isEmpty())
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
2734 node->showTreeForThis(); 2734 node->showTreeForThis();
2735 } 2735 }
2736 2736
2737 void showNodePath(const WebCore::Node* node) 2737 void showNodePath(const WebCore::Node* node)
2738 { 2738 {
2739 if (node) 2739 if (node)
2740 node->showNodePathForThis(); 2740 node->showNodePathForThis();
2741 } 2741 }
2742 2742
2743 #endif 2743 #endif
OLDNEW
« no previous file with comments | « no previous file | Source/core/editing/ApplyStyleCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698