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

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

Issue 2017053003: Remove StringBuilder::appendLiteral. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/css/StyleRuleKeyframe.h" 5 #include "core/css/StyleRuleKeyframe.h"
6 6
7 #include "core/css/StylePropertySet.h" 7 #include "core/css/StylePropertySet.h"
8 #include "core/css/parser/CSSParser.h" 8 #include "core/css/parser/CSSParser.h"
9 #include "wtf/text/StringBuilder.h" 9 #include "wtf/text/StringBuilder.h"
10 10
11 namespace blink { 11 namespace blink {
12 12
13 StyleRuleKeyframe::StyleRuleKeyframe(PassOwnPtr<Vector<double>> keys, StylePrope rtySet* properties) 13 StyleRuleKeyframe::StyleRuleKeyframe(PassOwnPtr<Vector<double>> keys, StylePrope rtySet* properties)
14 : StyleRuleBase(Keyframe) 14 : StyleRuleBase(Keyframe)
15 , m_properties(properties) 15 , m_properties(properties)
16 , m_keys(*keys) 16 , m_keys(*keys)
17 { 17 {
18 } 18 }
19 19
20 String StyleRuleKeyframe::keyText() const 20 String StyleRuleKeyframe::keyText() const
21 { 21 {
22 ASSERT(!m_keys.isEmpty()); 22 ASSERT(!m_keys.isEmpty());
23 23
24 StringBuilder keyText; 24 StringBuilder keyText;
25 for (unsigned i = 0; i < m_keys.size(); ++i) { 25 for (unsigned i = 0; i < m_keys.size(); ++i) {
26 if (i) 26 if (i)
27 keyText.appendLiteral(", "); 27 keyText.append(", ");
28 keyText.appendNumber(m_keys.at(i) * 100); 28 keyText.appendNumber(m_keys.at(i) * 100);
29 keyText.append('%'); 29 keyText.append('%');
30 } 30 }
31 31
32 return keyText.toString(); 32 return keyText.toString();
33 } 33 }
34 34
35 bool StyleRuleKeyframe::setKeyText(const String& keyText) 35 bool StyleRuleKeyframe::setKeyText(const String& keyText)
36 { 36 {
37 ASSERT(!keyText.isNull()); 37 ASSERT(!keyText.isNull());
(...skipping 15 matching lines...) Expand all
53 { 53 {
54 if (!m_properties->isMutable()) 54 if (!m_properties->isMutable())
55 m_properties = m_properties->mutableCopy(); 55 m_properties = m_properties->mutableCopy();
56 return *toMutableStylePropertySet(m_properties.get()); 56 return *toMutableStylePropertySet(m_properties.get());
57 } 57 }
58 58
59 String StyleRuleKeyframe::cssText() const 59 String StyleRuleKeyframe::cssText() const
60 { 60 {
61 StringBuilder result; 61 StringBuilder result;
62 result.append(keyText()); 62 result.append(keyText());
63 result.appendLiteral(" { "); 63 result.append(" { ");
64 String decls = m_properties->asText(); 64 String decls = m_properties->asText();
65 result.append(decls); 65 result.append(decls);
66 if (!decls.isEmpty()) 66 if (!decls.isEmpty())
67 result.append(' '); 67 result.append(' ');
68 result.append('}'); 68 result.append('}');
69 return result.toString(); 69 return result.toString();
70 } 70 }
71 71
72 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframe) 72 DEFINE_TRACE_AFTER_DISPATCH(StyleRuleKeyframe)
73 { 73 {
74 visitor->trace(m_properties); 74 visitor->trace(m_properties);
75 StyleRuleBase::traceAfterDispatch(visitor); 75 StyleRuleBase::traceAfterDispatch(visitor);
76 } 76 }
77 77
78 } // namespace blink 78 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698