summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSStyleRule.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/css/CSSStyleRule.cpp')
-rw-r--r--Source/WebCore/css/CSSStyleRule.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp
index 7f82ae593..365d8d90f 100644
--- a/Source/WebCore/css/CSSStyleRule.cpp
+++ b/Source/WebCore/css/CSSStyleRule.cpp
@@ -26,10 +26,10 @@
#include "CSSSelector.h"
#include "CSSStyleSheet.h"
#include "Document.h"
-#include "MemoryInstrumentation.h"
#include "PropertySetCSSStyleDeclaration.h"
#include "StylePropertySet.h"
#include "StyleRule.h"
+#include "WebCoreMemoryInstrumentation.h"
#include <wtf/text/StringBuilder.h>
namespace WebCore {
@@ -101,24 +101,25 @@ void CSSStyleRule::setSelectorText(const String& selectorText)
CSSStyleSheet::RuleMutationScope mutationScope(this);
- String oldSelectorText = this->selectorText();
m_styleRule->wrapperAdoptSelectorList(selectorList);
if (hasCachedSelectorText()) {
- ASSERT(selectorTextCache().contains(this));
- selectorTextCache().set(this, generateSelectorText());
+ selectorTextCache().remove(this);
+ setHasCachedSelectorText(false);
}
}
String CSSStyleRule::cssText() const
{
- String result = selectorText();
-
- result += " { ";
- result += m_styleRule->properties()->asText();
- result += "}";
-
- return result;
+ StringBuilder result;
+ result.append(selectorText());
+ result.appendLiteral(" { ");
+ String decls = m_styleRule->properties()->asText();
+ result.append(decls);
+ if (!decls.isEmpty())
+ result.append(' ');
+ result.append('}');
+ return result.toString();
}
void CSSStyleRule::reattach(StyleRule* rule)
@@ -130,7 +131,7 @@ void CSSStyleRule::reattach(StyleRule* rule)
void CSSStyleRule::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
- MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
+ MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
info.addInstrumentedMember(m_styleRule);
info.addInstrumentedMember(m_propertiesCSSOMWrapper);