summaryrefslogtreecommitdiff
path: root/Source/WebCore/css/CSSStyleRule.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebCore/css/CSSStyleRule.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebCore/css/CSSStyleRule.cpp')
-rw-r--r--Source/WebCore/css/CSSStyleRule.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/Source/WebCore/css/CSSStyleRule.cpp b/Source/WebCore/css/CSSStyleRule.cpp
index 7a1d66fca..65da867c5 100644
--- a/Source/WebCore/css/CSSStyleRule.cpp
+++ b/Source/WebCore/css/CSSStyleRule.cpp
@@ -22,35 +22,34 @@
#include "config.h"
#include "CSSStyleRule.h"
-#include "CSSPageRule.h"
#include "CSSParser.h"
#include "CSSSelector.h"
#include "CSSStyleSheet.h"
#include "Document.h"
#include "StylePropertySet.h"
-#include "StyledElement.h"
-#include "StyleSheet.h"
-
+#include "StyleRule.h"
#include <wtf/text/StringBuilder.h>
namespace WebCore {
CSSStyleRule::CSSStyleRule(CSSStyleSheet* parent, int line)
: CSSRule(parent, CSSRule::STYLE_RULE)
+ , m_styleRule(adoptPtr(new StyleRule(line, this)))
{
- setSourceLine(line);
-
- // m_sourceLine is a bitfield, so let's catch any overflow early in debug mode.
- ASSERT(sourceLine() == line);
}
CSSStyleRule::~CSSStyleRule()
{
- if (m_style)
- m_style->clearParentRule(this);
+ if (m_styleRule->properties())
+ m_styleRule->properties()->clearParentRule(this);
cleanup();
}
+CSSStyleDeclaration* CSSStyleRule::style() const
+{
+ return m_styleRule->properties()->ensureRuleCSSStyleDeclaration(this);
+}
+
typedef HashMap<const CSSStyleRule*, String> SelectorTextCache;
static SelectorTextCache& selectorTextCache()
{
@@ -69,8 +68,8 @@ inline void CSSStyleRule::cleanup()
String CSSStyleRule::generateSelectorText() const
{
StringBuilder builder;
- for (CSSSelector* s = selectorList().first(); s; s = CSSSelectorList::next(s)) {
- if (s != selectorList().first())
+ for (CSSSelector* s = m_styleRule->selectorList().first(); s; s = CSSSelectorList::next(s)) {
+ if (s != m_styleRule->selectorList().first())
builder.append(", ");
builder.append(s->selectorText());
}
@@ -106,7 +105,7 @@ void CSSStyleRule::setSelectorText(const String& selectorText)
return;
String oldSelectorText = this->selectorText();
- m_selectorList.adopt(selectorList);
+ m_styleRule->adoptSelectorList(selectorList);
if (hasCachedSelectorText()) {
ASSERT(selectorTextCache().contains(this));
@@ -124,16 +123,10 @@ String CSSStyleRule::cssText() const
String result = selectorText();
result += " { ";
- result += m_style->asText();
+ result += m_styleRule->properties()->asText();
result += "}";
return result;
}
-void CSSStyleRule::addSubresourceStyleURLs(ListHashSet<KURL>& urls)
-{
- if (m_style)
- m_style->addSubresourceStyleURLs(urls, parentStyleSheet());
-}
-
} // namespace WebCore