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

Unified Diff: third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp

Issue 2140073002: [Typed-OM] Add compound type of CSSVariableReferenceValue and String with some tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@CSSTokenStreamValue
Patch Set: Removed unused variables Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp
diff --git a/third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp b/third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp
index c51d7d110994304cb71382f60f718a59d035da64..8f71e53b56658544108b770991a82648e0fad313 100644
--- a/third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp
+++ b/third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp
@@ -13,6 +13,7 @@
#include "core/css/CSSValueList.h"
#include "core/css/CSSVariableReferenceValue.h"
#include "core/css/cssom/CSSStyleValue.h"
+#include "core/css/cssom/CSSStyleVariableReferenceValue.h"
#include "core/css/parser/CSSPropertyParser.h"
#include "core/css/parser/CSSTokenizer.h"
#include "core/dom/ExceptionCode.h"
@@ -24,14 +25,14 @@ namespace blink {
namespace {
-class TokenStreamValueIterationSource final : public ValueIterable<String>::IterationSource {
+class TokenStreamValueIterationSource final : public ValueIterable<StringOrCSSVariableReferenceValue>::IterationSource {
public:
explicit TokenStreamValueIterationSource(CSSTokenStreamValue* tokenStreamValue)
: m_tokenStreamValue(tokenStreamValue)
{
}
- bool next(ScriptState* scriptState, String& value, ExceptionState& exceptionState) override
+ bool next(ScriptState* scriptState, StringOrCSSVariableReferenceValue& value, ExceptionState& exceptionState) override
{
if (m_index >= m_tokenStreamValue->size())
return false;
@@ -42,7 +43,7 @@ public:
DEFINE_INLINE_VIRTUAL_TRACE()
{
visitor->trace(m_tokenStreamValue);
- ValueIterable<String>::IterationSource::trace(visitor);
+ ValueIterable<StringOrCSSVariableReferenceValue>::IterationSource::trace(visitor);
}
private:
@@ -51,7 +52,7 @@ private:
} // namespace
-ValueIterable<String>::IterationSource* CSSTokenStreamValue::startIteration(ScriptState*, ExceptionState&)
+ValueIterable<StringOrCSSVariableReferenceValue>::IterationSource* CSSTokenStreamValue::startIteration(ScriptState*, ExceptionState&)
{
return new TokenStreamValueIterationSource(this);
}
@@ -60,10 +61,13 @@ CSSValue* CSSTokenStreamValue::toCSSValue() const
{
StringBuilder tokens;
- for (unsigned i = 0; i < m_listOfReferences.size(); ++i) {
+ for (unsigned i = 0; i < m_listOfReferences.size(); i++) {
if (i)
tokens.append("/**/");
- tokens.append(m_listOfReferences[i]);
+ if (m_listOfReferences[i].isString())
+ tokens.append(m_listOfReferences[i].getAsString());
+ else
+ tokens.append(m_listOfReferences[i].getAsCSSVariableReferenceValue()->variable());
meade_UTC10 2016/07/18 06:21:38 Theoretically it could still be null, how about th
}
CSSTokenizer::Scope scope(tokens.toString());

Powered by Google App Engine
This is Rietveld 408576698