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

Unified Diff: third_party/WebKit/Source/core/css/CSSVariableData.cpp

Issue 2024373002: Replace CSSParserString with StringView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Match arguments to equalStringView. Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/cssom/CSSKeywordValue.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/CSSVariableData.cpp
diff --git a/third_party/WebKit/Source/core/css/CSSVariableData.cpp b/third_party/WebKit/Source/core/css/CSSVariableData.cpp
index 7dfc352c77f165b761072020d85699fc48944681..916c8071368dbd9daafac3f74563fbcc04f1d574 100644
--- a/third_party/WebKit/Source/core/css/CSSVariableData.cpp
+++ b/third_party/WebKit/Source/core/css/CSSVariableData.cpp
@@ -7,6 +7,7 @@
#include "core/css/parser/CSSParser.h"
#include "core/css/parser/CSSParserTokenRange.h"
#include "wtf/text/StringBuilder.h"
+#include "wtf/text/StringView.h"
namespace blink {
@@ -26,9 +27,8 @@ template<typename CharacterType> void CSSVariableData::updateTokens(const CSSPar
for (const CSSParserToken& token : range) {
if (token.hasStringBacking()) {
unsigned length = token.value().length();
- CSSParserString parserString;
- parserString.init(currentOffset, length);
- m_tokens.append(token.copyWithUpdatedString(parserString));
+ StringView string(currentOffset, length);
+ m_tokens.append(token.copyWithUpdatedString(string));
currentOffset += length;
} else {
m_tokens.append(token);
@@ -49,13 +49,8 @@ void CSSVariableData::consumeAndUpdateTokens(const CSSParserTokenRange& range)
while (!localRange.atEnd()) {
CSSParserToken token = localRange.consume();
- if (token.hasStringBacking()) {
- CSSParserString value = token.value();
- if (value.is8Bit())
- stringBuilder.append(value.characters8(), value.length());
- else
- stringBuilder.append(value.characters16(), value.length());
- }
+ if (token.hasStringBacking())
+ stringBuilder.append(token.value());
}
m_backingString = stringBuilder.toString();
if (m_backingString.is8Bit())
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/css/cssom/CSSKeywordValue.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698