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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7a8caca13532953abdb31fea9879077679ed63cf |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/css/cssom/CSSTokenStreamValue.cpp |
@@ -0,0 +1,64 @@ |
+#include "core/css/cssom/CSSTokenStreamValue.h" |
+ |
+#include "bindings/core/v8/ExceptionState.h" |
+#include "bindings/core/v8/Iterable.h" |
+#include "bindings/core/v8/ScriptWrappable.h" |
+#include "core/CoreExport.h" |
+#include "core/css/CSSCustomIdentValue.h" |
+#include "core/css/CSSPrimitiveValue.h" |
+#include "core/css/CSSValueList.h" |
+#include "core/css/cssom/CSSStyleValue.h" |
+#include "core/css/parser/CSSPropertyParser.h" |
+#include "core/dom/ExceptionCode.h" |
+#include "platform/heap/HeapAllocator.h" |
+#include "wtf/text/StringBuilder.h" |
+ |
+ |
+namespace blink { |
+ |
+namespace { |
+ |
+class TokenStreamValueIterationSource final : public ValueIterable<String>::IterationSource { |
+public: |
+ explicit TokenStreamValueIterationSource(CSSTokenStreamValue* tokenStreamValue) |
+ : m_tokenStreamValue(tokenStreamValue) |
+ { |
+ } |
+ |
+ bool next(ScriptState* scriptState, String& value, ExceptionState& exceptionState) override |
+ { |
+ if (m_index >= m_tokenStreamValue->size()) |
+ return false; |
+ value = m_tokenStreamValue->componentAtIndex(m_index); |
+ return true; |
+ } |
+ |
+ DEFINE_INLINE_VIRTUAL_TRACE() |
+ { |
+ visitor->trace(m_tokenStreamValue); |
+ ValueIterable<String>::IterationSource::trace(visitor); |
+ } |
+ |
+private: |
+ const Member<CSSTokenStreamValue> m_tokenStreamValue; |
+}; |
+ |
+} // namespace |
+ |
+ValueIterable<String>::IterationSource* CSSTokenStreamValue::startIteration(ScriptState*, ExceptionState&) |
+{ |
+ return new TokenStreamValueIterationSource(this); |
+} |
+ |
+CSSValue* CSSTokenStreamValue::toCSSValue() const |
+{ |
+ CSSValueList* tokenStreamCSSValue = CSSValueList::createSpaceSeparated(); |
+ |
+ for (size_t i = 0; i < m_listOfReferences.size(); ++i) { |
meade_UTC10
2016/07/07 05:48:01
We usually use something like this:
for (unsigned
anthonyhkf
2016/07/07 08:01:45
Done.
|
+ tokenStreamCSSValue->append(*CSSCustomIdentValue::create(m_listOfReferences[i])); |
meade_UTC10
2016/07/07 05:48:01
I thought you were going to change this to be a CS
anthonyhkf
2016/07/07 08:01:45
Done.
|
+ } |
+ |
+ return tokenStreamCSSValue; |
+} |
+ |
+} // namespace blink |