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

Unified Diff: Source/core/dom/Range.cpp

Issue 308963002: Minimize calls to Node::nodeType() as it is virtual (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix typo Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 9189f403bbb65bda280a75d7fa493fb648135f57..8208db20b812596323b1bc7a981b61b45cfe07c0 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -951,7 +951,8 @@ String Range::toString() const
Node* pastLast = pastLastNode();
for (Node* n = firstNode(); n != pastLast; n = NodeTraversal::next(*n)) {
- if (n->nodeType() == Node::TEXT_NODE || n->nodeType() == Node::CDATA_SECTION_NODE) {
+ Node::NodeType type = n->nodeType();
+ if (type == Node::TEXT_NODE || type == Node::CDATA_SECTION_NODE) {
String data = toCharacterData(n)->data();
int length = data.length();
int start = (n == m_start.container()) ? min(max(0, m_start.offset()), length) : 0;

Powered by Google App Engine
This is Rietveld 408576698