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

Side by Side Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 2668903003: Replace WTF::emptyString{16Bit}() with a static global (Closed)
Patch Set: Replace WTF::emptyString{16Bit}() with a static global Created 3 years, 10 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 Peter Kelly (pmk@post.com) 4 * (C) 2001 Peter Kelly (pmk@post.com)
5 * (C) 2001 Dirk Mueller (mueller@kde.org) 5 * (C) 2001 Dirk Mueller (mueller@kde.org)
6 * (C) 2007 David Smith (catfish.man@gmail.com) 6 * (C) 2007 David Smith (catfish.man@gmail.com)
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc. 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * (C) 2007 Eric Seidel (eric@webkit.org) 9 * (C) 2007 Eric Seidel (eric@webkit.org)
10 * 10 *
(...skipping 3048 matching lines...) Expand 10 before | Expand all | Expand 10 after
3059 for (Node* child = firstChild(); child; child = child->nextSibling()) { 3059 for (Node* child = firstChild(); child; child = child->nextSibling()) {
3060 if (!child->isTextNode()) 3060 if (!child->isTextNode())
3061 continue; 3061 continue;
3062 Text* text = toText(child); 3062 Text* text = toText(child);
3063 if (!firstTextNode) 3063 if (!firstTextNode)
3064 firstTextNode = text; 3064 firstTextNode = text;
3065 else 3065 else
3066 foundMultipleTextNodes = true; 3066 foundMultipleTextNodes = true;
3067 unsigned length = text->data().length(); 3067 unsigned length = text->data().length();
3068 if (length > std::numeric_limits<unsigned>::max() - totalLength) 3068 if (length > std::numeric_limits<unsigned>::max() - totalLength)
3069 return emptyString(); 3069 return emptyString;
3070 totalLength += length; 3070 totalLength += length;
3071 } 3071 }
3072 3072
3073 if (!firstTextNode) 3073 if (!firstTextNode)
3074 return emptyString(); 3074 return emptyString;
3075 3075
3076 if (firstTextNode && !foundMultipleTextNodes) { 3076 if (firstTextNode && !foundMultipleTextNodes) {
3077 firstTextNode->atomize(); 3077 firstTextNode->atomize();
3078 return firstTextNode->data(); 3078 return firstTextNode->data();
3079 } 3079 }
3080 3080
3081 StringBuilder content; 3081 StringBuilder content;
3082 content.reserveCapacity(totalLength); 3082 content.reserveCapacity(totalLength);
3083 for (Node* child = firstTextNode; child; child = child->nextSibling()) { 3083 for (Node* child = firstTextNode; child; child = child->nextSibling()) {
3084 if (!child->isTextNode()) 3084 if (!child->isTextNode())
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after
4141 } 4141 }
4142 4142
4143 DEFINE_TRACE_WRAPPERS(Element) { 4143 DEFINE_TRACE_WRAPPERS(Element) {
4144 if (hasRareData()) { 4144 if (hasRareData()) {
4145 visitor->traceWrappers(elementRareData()); 4145 visitor->traceWrappers(elementRareData());
4146 } 4146 }
4147 ContainerNode::traceWrappers(visitor); 4147 ContainerNode::traceWrappers(visitor);
4148 } 4148 }
4149 4149
4150 } // namespace blink 4150 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/Document.cpp ('k') | third_party/WebKit/Source/core/dom/ExecutionContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698