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

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

Issue 2122193003: [Typed-OM] Add CSSTokenStreamValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 #include "core/css/cssom/CSSTokenStreamValue.h"
2
3 #include "bindings/core/v8/ExceptionState.h"
4 #include "bindings/core/v8/Iterable.h"
5 #include "bindings/core/v8/ScriptWrappable.h"
6 #include "core/CoreExport.h"
7 #include "core/css/CSSCustomIdentValue.h"
8 #include "core/css/CSSPrimitiveValue.h"
9 #include "core/css/CSSValueList.h"
10 #include "core/css/cssom/CSSStyleValue.h"
11 #include "core/css/parser/CSSPropertyParser.h"
12 #include "core/dom/ExceptionCode.h"
13 #include "platform/heap/HeapAllocator.h"
14 #include "wtf/text/StringBuilder.h"
15
16
17 namespace blink {
18
19 namespace {
20
21 class TokenStreamValueIterationSource final : public ValueIterable<String>::Iter ationSource {
22 public:
23 explicit TokenStreamValueIterationSource(CSSTokenStreamValue* tokenStreamVal ue)
24 : m_tokenStreamValue(tokenStreamValue)
25 {
26 }
27
28 bool next(ScriptState* scriptState, String& value, ExceptionState& exception State) override
29 {
30 if (m_index >= m_tokenStreamValue->size())
31 return false;
32 value = m_tokenStreamValue->componentAtIndex(m_index);
33 return true;
34 }
35
36 DEFINE_INLINE_VIRTUAL_TRACE()
37 {
38 visitor->trace(m_tokenStreamValue);
39 ValueIterable<String>::IterationSource::trace(visitor);
40 }
41
42 private:
43 const Member<CSSTokenStreamValue> m_tokenStreamValue;
44 };
45
46 } // namespace
47
48 ValueIterable<String>::IterationSource* CSSTokenStreamValue::startIteration(Scri ptState*, ExceptionState&)
49 {
50 return new TokenStreamValueIterationSource(this);
51 }
52
53 CSSValue* CSSTokenStreamValue::toCSSValue() const
54 {
55 CSSValueList* tokenStreamCSSValue = CSSValueList::createSpaceSeparated();
56
57 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.
58 tokenStreamCSSValue->append(*CSSCustomIdentValue::create(m_listOfReferen ces[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.
59 }
60
61 return tokenStreamCSSValue;
62 }
63
64 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698