Changeset 85585 in webkit


Ignore:
Timestamp:
May 2, 2011 10:07:52 PM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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):
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85582 r85585  
     12011-05-02  Ian Henderson  <ianh@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        CSS !important not respected by JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=60007
     7
     8        * fast/css/important-js-override-expected.txt: Added.
     9        * fast/css/important-js-override.html: Added.
     10
    1112011-05-02  Alpha Lam  <hclam@chromium.org>
    212
  • trunk/Source/WebCore/ChangeLog

    r85577 r85585  
     12011-05-02  Ian Henderson  <ianh@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        CSS !important not respected by JavaScript
     6        https://bugs.webkit.org/show_bug.cgi?id=60007
     7
     8        The addParsedProperty and addParsedProperties methods were subtly
     9        different.  The former did not check for !important before setting the
     10        given property.
     11
     12        Change addParsedProperties to call addParsedProperty and move the
     13        relevant code.  The one other caller of this method, in
     14        editing/markup.cpp, probably wanted this behavior anyway.
     15
     16        Test: fast/css/important-js-override.html
     17
     18        * css/CSSMutableStyleDeclaration.cpp:
     19        (WebCore::CSSMutableStyleDeclaration::addParsedProperties):
     20        (WebCore::CSSMutableStyleDeclaration::addParsedProperty):
     21
    1222011-05-02  Ben Wells  <benwells@chromium.org>
    223
  • trunk/Source/WebCore/css/CSSMutableStyleDeclaration.cpp

    r83122 r85585  
    643643{
    644644    ASSERT(!m_iteratorCount);
    645    
     645
    646646    m_properties.reserveCapacity(numProperties);
    647    
    648     for (int i = 0; i < numProperties; ++i) {
    649         // Only add properties that have no !important counterpart present
    650         if (!getPropertyPriority(properties[i]->id()) || properties[i]->isImportant()) {
    651             removeProperty(properties[i]->id(), false);
    652             ASSERT(properties[i]);
    653             m_properties.append(*properties[i]);
    654         }
    655     }
     647    for (int i = 0; i < numProperties; ++i)
     648        addParsedProperty(*properties[i]);
     649
    656650    // FIXME: This probably should have a call to setNeedsStyleRecalc() if something changed. We may also wish to add
    657651    // a notifyChanged argument to this function to follow the model of other functions in this class.
     
    662656    ASSERT(!m_iteratorCount);
    663657
    664     setPropertyInternal(property);
     658    // Only add properties that have no !important counterpart present
     659    if (!getPropertyPriority(property.id()) || property.isImportant()) {
     660        removeProperty(property.id(), false);
     661        m_properties.append(property);
     662    }
    665663}
    666664
Note: See TracChangeset for help on using the changeset viewer.