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

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

Issue 2017303002: Revert of Remove StringBuilder::appendLiteral. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 /* 1 /*
2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org) 3 * (C) 2002-2003 Dirk Mueller (mueller@kde.org)
4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved. 4 * Copyright (C) 2002, 2005, 2006, 2008, 2012 Apple Inc. All rights reserved.
5 * 5 *
6 * This library is free software; you can redistribute it and/or 6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public 7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version. 9 * version 2 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleR ule->mutableProperties(), const_cast<CSSStyleRule*>(this)); 55 m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_styleR ule->mutableProperties(), const_cast<CSSStyleRule*>(this));
56 } 56 }
57 return m_propertiesCSSOMWrapper.get(); 57 return m_propertiesCSSOMWrapper.get();
58 } 58 }
59 59
60 String CSSStyleRule::generateSelectorText() const 60 String CSSStyleRule::generateSelectorText() const
61 { 61 {
62 StringBuilder builder; 62 StringBuilder builder;
63 for (const CSSSelector* selector = m_styleRule->selectorList().first(); sele ctor; selector = CSSSelectorList::next(*selector)) { 63 for (const CSSSelector* selector = m_styleRule->selectorList().first(); sele ctor; selector = CSSSelectorList::next(*selector)) {
64 if (selector != m_styleRule->selectorList().first()) 64 if (selector != m_styleRule->selectorList().first())
65 builder.append(", "); 65 builder.appendLiteral(", ");
66 builder.append(selector->selectorText()); 66 builder.append(selector->selectorText());
67 } 67 }
68 return builder.toString(); 68 return builder.toString();
69 } 69 }
70 70
71 String CSSStyleRule::selectorText() const 71 String CSSStyleRule::selectorText() const
72 { 72 {
73 if (hasCachedSelectorText()) { 73 if (hasCachedSelectorText()) {
74 ASSERT(selectorTextCache().contains(this)); 74 ASSERT(selectorTextCache().contains(this));
75 return selectorTextCache().get(this); 75 return selectorTextCache().get(this);
(...skipping 20 matching lines...) Expand all
96 if (hasCachedSelectorText()) { 96 if (hasCachedSelectorText()) {
97 selectorTextCache().remove(this); 97 selectorTextCache().remove(this);
98 setHasCachedSelectorText(false); 98 setHasCachedSelectorText(false);
99 } 99 }
100 } 100 }
101 101
102 String CSSStyleRule::cssText() const 102 String CSSStyleRule::cssText() const
103 { 103 {
104 StringBuilder result; 104 StringBuilder result;
105 result.append(selectorText()); 105 result.append(selectorText());
106 result.append(" { "); 106 result.appendLiteral(" { ");
107 String decls = m_styleRule->properties().asText(); 107 String decls = m_styleRule->properties().asText();
108 result.append(decls); 108 result.append(decls);
109 if (!decls.isEmpty()) 109 if (!decls.isEmpty())
110 result.append(' '); 110 result.append(' ');
111 result.append('}'); 111 result.append('}');
112 return result.toString(); 112 return result.toString();
113 } 113 }
114 114
115 void CSSStyleRule::reattach(StyleRuleBase* rule) 115 void CSSStyleRule::reattach(StyleRuleBase* rule)
116 { 116 {
(...skipping 11 matching lines...) Expand all
128 } 128 }
129 129
130 DEFINE_TRACE_WRAPPERS(CSSStyleRule) 130 DEFINE_TRACE_WRAPPERS(CSSStyleRule)
131 { 131 {
132 visitor->traceWrappers(parentRule()); 132 visitor->traceWrappers(parentRule());
133 visitor->traceWrappers(parentStyleSheet()); 133 visitor->traceWrappers(parentStyleSheet());
134 CSSRule::traceWrappers(visitor); 134 CSSRule::traceWrappers(visitor);
135 } 135 }
136 136
137 } // namespace blink 137 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/css/CSSSelectorList.cpp ('k') | third_party/WebKit/Source/core/css/CSSStyleSheet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698