summaryrefslogtreecommitdiff
path: root/Source/WebKit/qt/Api/qwebelement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:09:45 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-11-22 09:10:13 +0100
commit470286ecfe79d59df14944e5b5d34630fc739391 (patch)
tree43983212872e06cebefd2ae474418fa2908ca54c /Source/WebKit/qt/Api/qwebelement.cpp
parent23037105e948c2065da5a937d3a2396b0ff45c1e (diff)
downloadqtwebkit-470286ecfe79d59df14944e5b5d34630fc739391.tar.gz
Imported WebKit commit e89504fa9195b2063b2530961d4b73dd08de3242 (http://svn.webkit.org/repository/webkit/trunk@135485)
Change-Id: I03774e5ac79721c13ffa30d152537a74d0b12e66 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'Source/WebKit/qt/Api/qwebelement.cpp')
-rw-r--r--Source/WebKit/qt/Api/qwebelement.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/Source/WebKit/qt/Api/qwebelement.cpp b/Source/WebKit/qt/Api/qwebelement.cpp
index 298f6cdc3..108b9b06f 100644
--- a/Source/WebKit/qt/Api/qwebelement.cpp
+++ b/Source/WebKit/qt/Api/qwebelement.cpp
@@ -807,7 +807,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str
if (!propID)
return QString();
- const StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureInlineStyle();
+ const StylePropertySet* style = static_cast<StyledElement*>(m_element)->ensureMutableInlineStyle();
if (strategy == InlineStyle)
return style->getPropertyValue(propID);
@@ -825,7 +825,7 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str
// declarations, as well as embedded and inline style declarations.
Document* doc = m_element->document();
- if (RefPtr<CSSRuleList> rules = doc->styleResolver()->styleRulesForElement(m_element, /*authorOnly*/ true)) {
+ if (RefPtr<CSSRuleList> rules = doc->styleResolver()->styleRulesForElement(m_element, StyleResolver::AuthorCSSRules | StyleResolver::CrossOriginCSSRules)) {
for (int i = rules->length(); i > 0; --i) {
CSSStyleRule* rule = static_cast<CSSStyleRule*>(rules->item(i - 1));
@@ -869,8 +869,18 @@ void QWebElement::setStyleProperty(const QString &name, const QString &value)
if (!m_element || !m_element->isStyledElement())
return;
+ // Do the parsing of the token manually since WebCore isn't doing this for us anymore.
+ const QLatin1String importantToken("!important");
+ QString adjustedValue(value);
+ bool important = false;
+ if (adjustedValue.contains(importantToken)) {
+ important = true;
+ adjustedValue.remove(importantToken);
+ adjustedValue = adjustedValue.trimmed();
+ }
+
CSSPropertyID propID = cssPropertyID(name);
- static_cast<StyledElement*>(m_element)->setInlineStyleProperty(propID, value);
+ static_cast<StyledElement*>(m_element)->setInlineStyleProperty(propID, adjustedValue, important);
}
/*!