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

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

Issue 415243003: Drop slower Node::hasID() / Node::hasClass() methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/rendering/RenderTreeAsText.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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 1691
1692 // No parent - no conversion needed 1692 // No parent - no conversion needed
1693 return p; 1693 return p;
1694 } 1694 }
1695 1695
1696 String Node::debugName() const 1696 String Node::debugName() const
1697 { 1697 {
1698 StringBuilder name; 1698 StringBuilder name;
1699 name.append(nodeName()); 1699 name.append(nodeName());
1700 1700
1701 if (hasID()) { 1701 if (isElementNode()) {
1702 name.appendLiteral(" id=\'"); 1702 const Element& thisElement = toElement(*this);
1703 name.append(toElement(this)->getIdAttribute()); 1703 if (thisElement.hasID()) {
1704 name.append('\''); 1704 name.appendLiteral(" id=\'");
1705 } 1705 name.append(thisElement.getIdAttribute());
1706 name.append('\'');
1707 }
1706 1708
1707 if (hasClass()) { 1709 if (thisElement.hasClass()) {
1708 name.appendLiteral(" class=\'"); 1710 name.appendLiteral(" class=\'");
1709 for (size_t i = 0; i < toElement(this)->classNames().size(); ++i) { 1711 for (size_t i = 0; i < thisElement.classNames().size(); ++i) {
1710 if (i > 0) 1712 if (i > 0)
1711 name.append(' '); 1713 name.append(' ');
1712 name.append(toElement(this)->classNames()[i]); 1714 name.append(thisElement.classNames()[i]);
1715 }
1716 name.append('\'');
1713 } 1717 }
1714 name.append('\'');
1715 } 1718 }
1716 1719
1717 return name.toString(); 1720 return name.toString();
1718 } 1721 }
1719 1722
1720 #ifndef NDEBUG 1723 #ifndef NDEBUG
1721 1724
1722 static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder, const QualifiedName& name, const char* attrDesc) 1725 static void appendAttributeDesc(const Node* node, StringBuilder& stringBuilder, const QualifiedName& name, const char* attrDesc)
1723 { 1726 {
1724 if (!node->isElementNode()) 1727 if (!node->isElementNode())
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2569 node->showTreeForThis(); 2572 node->showTreeForThis();
2570 } 2573 }
2571 2574
2572 void showNodePath(const blink::Node* node) 2575 void showNodePath(const blink::Node* node)
2573 { 2576 {
2574 if (node) 2577 if (node)
2575 node->showNodePathForThis(); 2578 node->showNodePathForThis();
2576 } 2579 }
2577 2580
2578 #endif 2581 #endif
OLDNEW
« no previous file with comments | « Source/core/dom/Node.h ('k') | Source/core/rendering/RenderTreeAsText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698