Changeset 37391 in webkit


Ignore:
Timestamp:
Oct 7, 2008 2:27:54 PM (16 years ago)
Author:
eric@webkit.org
Message:

Reviewed by Darin Adler, Nikolas Zimmermann and Dave Hyatt.

svgElement.className.baseValue = "foo" does not work
https://bugs.webkit.org/show_bug.cgi?id=20651

  • dom/StyledElement.cpp: (WebCore::StyledElement::classAttributeChanged): (WebCore::StyledElement::parseMappedAttribute):
  • dom/StyledElement.h:
  • svg/SVGStyledElement.cpp: (WebCore::SVGStyledElement::svgAttributeChanged):
Location:
trunk
Files:
4 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r37328 r37391  
     12008-10-06  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Darin Adler, Nikolas Zimmermann and Dave Hyatt.
     4       
     5        svgElement.className.baseValue = "foo" doesn't work
     6        https://bugs.webkit.org/show_bug.cgi?id=20651
     7
     8        * svg/custom/class-baseValue.svg: Added.
     9
    1102008-10-04  Eric Seidel  <eric@webkit.org>
    211
  • trunk/WebCore/ChangeLog

    r37389 r37391  
     12008-10-02  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by Darin Adler, Nikolas Zimmermann and Dave Hyatt.
     4
     5        svgElement.className.baseValue = "foo" does not work
     6        https://bugs.webkit.org/show_bug.cgi?id=20651
     7
     8        * dom/StyledElement.cpp:
     9        (WebCore::StyledElement::classAttributeChanged):
     10        (WebCore::StyledElement::parseMappedAttribute):
     11        * dom/StyledElement.h:
     12        * svg/SVGStyledElement.cpp:
     13        (WebCore::SVGStyledElement::svgAttributeChanged):
     14
    1152008-10-06  Timothy Hatcher  <timothy@apple.com>
    216
  • trunk/WebCore/dom/StyledElement.cpp

    r36918 r37391  
    211211}
    212212
     213void StyledElement::classAttributeChanged(const AtomicString& newClassString)
     214{
     215    const UChar* characters = newClassString.characters();
     216    unsigned length = newClassString.length();
     217    unsigned i;
     218    for (i = 0; i < length; ++i) {
     219        if (!isClassWhitespace(characters[i]))
     220            break;
     221    }
     222    setHasClass(i < length);
     223    if (namedAttrMap) {
     224        if (i < length)
     225            mappedAttributes()->setClass(newClassString);
     226        else
     227            mappedAttributes()->clearClass();
     228    }
     229    setChanged();
     230}
     231
    213232void StyledElement::parseMappedAttribute(MappedAttribute *attr)
    214233{
     
    225244        }
    226245        setChanged();
    227     } else if (attr->name() == classAttr) {
    228         // class
    229         const AtomicString& value = attr->value();
    230         const UChar* characters = value.characters();
    231         unsigned length = value.length();
    232         unsigned i;
    233         for (i = 0; i < length; ++i) {
    234             if (!isClassWhitespace(characters[i]))
    235                 break;
    236         }
    237         setHasClass(i < length);
    238         if (namedAttrMap) {
    239             if (i < length)
    240                 mappedAttributes()->setClass(value);
    241             else
    242                 mappedAttributes()->clearClass();
    243         }
    244         setChanged();
    245     } else if (attr->name() == styleAttr) {
     246    } else if (attr->name() == classAttr)
     247        classAttributeChanged(attr->value());
     248    else if (attr->name() == styleAttr) {
    246249        if (attr->isNull())
    247250            destroyInlineStyleDecl();
  • trunk/WebCore/dom/StyledElement.h

    r34536 r37391  
    8282
    8383protected:
     84    // classAttributeChanged() exists to share code between
     85    // parseMappedAttribute (called via setAttribute()) and
     86    // svgAttributeChanged (called when element.className.baseValue is set)
     87    void classAttributeChanged(const AtomicString& newClassString);
     88
    8489    RefPtr<CSSMutableStyleDeclaration> m_inlineStyleDecl;
    8590};
  • trunk/WebCore/svg/SVGStyledElement.cpp

    r36918 r37391  
    187187    SVGElement::svgAttributeChanged(attrName);
    188188
     189    if (attrName == HTMLNames::classAttr)
     190        classAttributeChanged(className());
     191
    189192    // If we're the child of a resource element, be sure to invalidate it.
    190193    invalidateResourcesInAncestorChain();
Note: See TracChangeset for help on using the changeset viewer.