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

Unified Diff: Source/core/editing/StyledMarkupAccumulator.cpp

Issue 1180623004: Refactoring: Move MarkupFormatter::totalLength to StyledMarkupAccumulator.cpp as an annonymous func… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/editing/MarkupFormatter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/StyledMarkupAccumulator.cpp
diff --git a/Source/core/editing/StyledMarkupAccumulator.cpp b/Source/core/editing/StyledMarkupAccumulator.cpp
index e7cf7f5e3a294be81f1d9867e2abd9f07f6ef99b..d0fbcfcf5231e39f3785a86e82cea7edfd9a8439 100644
--- a/Source/core/editing/StyledMarkupAccumulator.cpp
+++ b/Source/core/editing/StyledMarkupAccumulator.cpp
@@ -37,6 +37,18 @@
namespace blink {
+namespace {
+
+size_t totalLength(const Vector<String>& strings)
+{
+ size_t length = 0;
+ for (const auto& string : strings)
+ length += string.length();
+ return length;
+}
+
+} // namespace
+
using namespace HTMLNames;
StyledMarkupAccumulator::StyledMarkupAccumulator(EAbsoluteURLs shouldResolveURLs, const TextOffset& start, const TextOffset& end, const PassRefPtrWillBeRawPtr<Document> document, EAnnotateForInterchange shouldAnnotate, Node* highestNodeToBeSerialized)
@@ -205,7 +217,7 @@ void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style)
String StyledMarkupAccumulator::takeResults()
{
StringBuilder result;
- result.reserveCapacity(MarkupFormatter::totalLength(m_reversedPrecedingMarkup) + m_result.length());
+ result.reserveCapacity(totalLength(m_reversedPrecedingMarkup) + m_result.length());
for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i)
result.append(m_reversedPrecedingMarkup[i - 1]);
« no previous file with comments | « Source/core/editing/MarkupFormatter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698