#include "config.h"
#include "core/css/CSSStyleRule.h"
-#include "core/css/CSSParser.h"
#include "core/css/CSSSelector.h"
#include "core/css/CSSStyleSheet.h"
#include "core/css/PropertySetCSSStyleDeclaration.h"
#include "core/css/StylePropertySet.h"
#include "core/css/StyleRule.h"
+#include "core/css/parser/CSSParser.h"
#include "wtf/text/StringBuilder.h"
-namespace WebCore {
+namespace blink {
typedef HashMap<const CSSStyleRule*, String> SelectorTextCache;
static SelectorTextCache& selectorTextCache()
CSSStyleRule::~CSSStyleRule()
{
+#if !ENABLE(OILPAN)
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->clearParentRule();
-
+#endif
if (hasCachedSelectorText()) {
selectorTextCache().remove(this);
setHasCachedSelectorText(false);
String CSSStyleRule::generateSelectorText() const
{
StringBuilder builder;
- for (const CSSSelector* selector = m_styleRule->selectorList().first(); selector; selector = CSSSelectorList::next(selector)) {
+ for (const CSSSelector* selector = m_styleRule->selectorList().first(); selector; selector = CSSSelectorList::next(*selector)) {
if (selector != m_styleRule->selectorList().first())
- builder.append(", ");
+ builder.appendLiteral(", ");
builder.append(selector->selectorText());
}
return builder.toString();
void CSSStyleRule::setSelectorText(const String& selectorText)
{
- CSSParser p(parserContext());
+ CSSParserContext context(parserContext(), 0);
+ CSSParser p(context);
CSSSelectorList selectorList;
p.parseSelector(selectorText, selectorList);
if (!selectorList.isValid())
StringBuilder result;
result.append(selectorText());
result.appendLiteral(" { ");
- String decls = m_styleRule->properties()->asText();
+ String decls = m_styleRule->properties().asText();
result.append(decls);
if (!decls.isEmpty())
result.append(' ');
void CSSStyleRule::reattach(StyleRuleBase* rule)
{
ASSERT(rule);
- ASSERT_WITH_SECURITY_IMPLICATION(rule->isStyleRule());
- m_styleRule = static_cast<StyleRule*>(rule);
+ m_styleRule = toStyleRule(rule);
if (m_propertiesCSSOMWrapper)
m_propertiesCSSOMWrapper->reattach(m_styleRule->mutableProperties());
}
-} // namespace WebCore
+void CSSStyleRule::trace(Visitor* visitor)
+{
+ visitor->trace(m_styleRule);
+ visitor->trace(m_propertiesCSSOMWrapper);
+ CSSRule::trace(visitor);
+}
+
+} // namespace blink