summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSStyleRule.cpp
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2010-09-30 15:42:16 +0100
committerSteve Block <steveblock@google.com>2010-10-07 10:59:29 +0100
commitbec39347bb3bb5bf1187ccaf471d26247f28b585 (patch)
tree56bdc4c2978fbfd3d79d0d36d5d6c640ecc09cc8 /WebCore/css/CSSStyleRule.cpp
parent90b7966e7815b262cd19ac25f03aaad9b21fdc06 (diff)
downloadexternal_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.zip
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.gz
external_webkit-bec39347bb3bb5bf1187ccaf471d26247f28b585.tar.bz2
Merge WebKit at r68651 : Initial merge by git.
Change-Id: I3d6bff59f17eedd6722723354f386fec9be8ad12
Diffstat (limited to 'WebCore/css/CSSStyleRule.cpp')
-rw-r--r--WebCore/css/CSSStyleRule.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/WebCore/css/CSSStyleRule.cpp b/WebCore/css/CSSStyleRule.cpp
index 1036e8f..faf60b0 100644
--- a/WebCore/css/CSSStyleRule.cpp
+++ b/WebCore/css/CSSStyleRule.cpp
@@ -23,7 +23,11 @@
#include "CSSStyleRule.h"
#include "CSSMutableStyleDeclaration.h"
+#include "CSSParser.h"
#include "CSSSelector.h"
+#include "CSSStyleSheet.h"
+#include "Document.h"
+#include "StyleSheet.h"
namespace WebCore {
@@ -50,9 +54,34 @@ String CSSStyleRule::selectorText() const
return str;
}
-void CSSStyleRule::setSelectorText(const String& /*selectorText*/, ExceptionCode& /*ec*/)
+void CSSStyleRule::setSelectorText(const String& selectorText)
{
- // FIXME: Implement!
+ Document* doc = 0;
+ StyleSheet* ownerStyleSheet = m_style->stylesheet();
+ if (ownerStyleSheet) {
+ if (ownerStyleSheet->isCSSStyleSheet())
+ doc = static_cast<CSSStyleSheet*>(ownerStyleSheet)->document();
+ if (!doc)
+ doc = ownerStyleSheet->ownerNode() ? ownerStyleSheet->ownerNode()->document() : 0;
+ }
+ if (!doc)
+ doc = m_style->node() ? m_style->node()->document() : 0;
+
+ if (!doc)
+ return;
+
+ CSSParser p;
+ CSSSelectorList selectorList;
+ p.parseSelector(selectorText, doc, selectorList);
+ if (!selectorList.first())
+ return;
+
+ String oldSelectorText = this->selectorText();
+ m_selectorList.adopt(selectorList);
+ if (this->selectorText() == oldSelectorText)
+ return;
+
+ doc->styleSelectorChanged(DeferRecalcStyle);
}
String CSSStyleRule::cssText() const