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

Side by Side Diff: Source/core/editing/MarkupAccumulator.cpp

Issue 405973004: Optimize / clean up hasTagName() call sites (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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 namespaceHash.set(xmlAtom, XMLNames::xmlNamespaceURI); 118 namespaceHash.set(xmlAtom, XMLNames::xmlNamespaceURI);
119 namespaces = &namespaceHash; 119 namespaces = &namespaceHash;
120 } 120 }
121 121
122 serializeNodesWithNamespaces(targetNode, childrenOnly, namespaces, tagNamesT oSkip); 122 serializeNodesWithNamespaces(targetNode, childrenOnly, namespaces, tagNamesT oSkip);
123 return m_markup.toString(); 123 return m_markup.toString();
124 } 124 }
125 125
126 void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildren Only childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNames ToSkip) 126 void MarkupAccumulator::serializeNodesWithNamespaces(Node& targetNode, EChildren Only childrenOnly, const Namespaces* namespaces, Vector<QualifiedName>* tagNames ToSkip)
127 { 127 {
128 if (tagNamesToSkip) { 128 if (tagNamesToSkip && targetNode.isElementNode()) {
129 for (size_t i = 0; i < tagNamesToSkip->size(); ++i) { 129 for (size_t i = 0; i < tagNamesToSkip->size(); ++i) {
130 if (targetNode.hasTagName(tagNamesToSkip->at(i))) 130 if (toElement(targetNode).hasTagName(tagNamesToSkip->at(i)))
131 return; 131 return;
132 } 132 }
133 } 133 }
134 134
135 Namespaces namespaceHash; 135 Namespaces namespaceHash;
136 if (namespaces) 136 if (namespaces)
137 namespaceHash = *namespaces; 137 namespaceHash = *namespaces;
138 138
139 if (!childrenOnly) 139 if (!childrenOnly)
140 appendStartTag(targetNode, &namespaceHash); 140 appendStartTag(targetNode, &namespaceHash);
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 } 561 }
562 562
563 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const 563 bool MarkupAccumulator::serializeAsHTMLDocument(const Node& node) const
564 { 564 {
565 if (m_serializationType == ForcedXML) 565 if (m_serializationType == ForcedXML)
566 return false; 566 return false;
567 return node.document().isHTMLDocument(); 567 return node.document().isHTMLDocument();
568 } 568 }
569 569
570 } 570 }
OLDNEW
« no previous file with comments | « Source/core/editing/InsertListCommand.cpp ('k') | Source/core/editing/ReplaceSelectionCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698