2011-05-02 Ian Henderson <ianh@apple.com>

        Reviewed by Dan Bernstein.

        CSS !important not respected by JavaScript
        https://bugs.webkit.org/show_bug.cgi?id=60007

        * fast/css/important-js-override-expected.txt: Added.
        * fast/css/important-js-override.html: Added.
2011-05-02  Ian Henderson  <ianh@apple.com>

        Reviewed by Dan Bernstein.

        CSS !important not respected by JavaScript
        https://bugs.webkit.org/show_bug.cgi?id=60007

        The addParsedProperty and addParsedProperties methods were subtly
        different.  The former did not check for !important before setting the
        given property.

        Change addParsedProperties to call addParsedProperty and move the
        relevant code.  The one other caller of this method, in
        editing/markup.cpp, probably wanted this behavior anyway.

        Test: fast/css/important-js-override.html

        * css/CSSMutableStyleDeclaration.cpp:
        (WebCore::CSSMutableStyleDeclaration::addParsedProperties):
        (WebCore::CSSMutableStyleDeclaration::addParsedProperty):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@85585 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 87d60161
2011-05-02 Ian Henderson <ianh@apple.com>
Reviewed by Dan Bernstein.
CSS !important not respected by JavaScript
https://bugs.webkit.org/show_bug.cgi?id=60007
* fast/css/important-js-override-expected.txt: Added.
* fast/css/important-js-override.html: Added.
2011-05-02 Alpha Lam <hclam@chromium.org>
Not reviewed. Build fix.
The background of this element should be green. It is green
<div id="a" style="background-color: green !important">The background of this element should be green. It is </div>
<script>
if (window.layoutTestController)
layoutTestController.dumpAsText();
var a = document.getElementById("a");
a.style.backgroundColor = "red";
a.innerHTML += a.style.backgroundColor;
</script>
2011-05-02 Ian Henderson <ianh@apple.com>
Reviewed by Dan Bernstein.
CSS !important not respected by JavaScript
https://bugs.webkit.org/show_bug.cgi?id=60007
The addParsedProperty and addParsedProperties methods were subtly
different. The former did not check for !important before setting the
given property.
Change addParsedProperties to call addParsedProperty and move the
relevant code. The one other caller of this method, in
editing/markup.cpp, probably wanted this behavior anyway.
Test: fast/css/important-js-override.html
* css/CSSMutableStyleDeclaration.cpp:
(WebCore::CSSMutableStyleDeclaration::addParsedProperties):
(WebCore::CSSMutableStyleDeclaration::addParsedProperty):
2011-05-02 Ben Wells <benwells@chromium.org>
Reviewed by Simon Fraser.
......@@ -642,17 +642,11 @@ void CSSMutableStyleDeclaration::parseDeclaration(const String& styleDeclaration
void CSSMutableStyleDeclaration::addParsedProperties(const CSSProperty* const* properties, int numProperties)
{
ASSERT(!m_iteratorCount);
m_properties.reserveCapacity(numProperties);
for (int i = 0; i < numProperties; ++i) {
// Only add properties that have no !important counterpart present
if (!getPropertyPriority(properties[i]->id()) || properties[i]->isImportant()) {
removeProperty(properties[i]->id(), false);
ASSERT(properties[i]);
m_properties.append(*properties[i]);
}
}
for (int i = 0; i < numProperties; ++i)
addParsedProperty(*properties[i]);
// FIXME: This probably should have a call to setNeedsStyleRecalc() if something changed. We may also wish to add
// a notifyChanged argument to this function to follow the model of other functions in this class.
}
......@@ -661,7 +655,11 @@ void CSSMutableStyleDeclaration::addParsedProperty(const CSSProperty& property)
{
ASSERT(!m_iteratorCount);
setPropertyInternal(property);
// Only add properties that have no !important counterpart present
if (!getPropertyPriority(property.id()) || property.isImportant()) {
removeProperty(property.id(), false);
m_properties.append(property);
}
}
void CSSMutableStyleDeclaration::setLengthProperty(int propertyId, const String& value, bool important, bool /*multiLength*/)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment