Changeset 27441 in webkit


Ignore:
Timestamp:
Nov 5, 2007 10:52:49 AM (16 years ago)
Author:
mitz@apple.com
Message:

WebCore:

Reviewed by Oliver Hunt.

  • fix ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) when a class attribute is all-whitespace

Test: fast/dom/class-all-whitespace.html

  • dom/StyledElement.cpp: (WebCore::StyledElement::parseMappedAttribute): Check if there is any non-whitespace character in the class attribute.

LayoutTests:

Reviewed by Oliver Hunt.

  • test that an all-whitespace class attribute does not cause an assertion failure
  • fast/dom/class-all-whitespace-expected.txt: Added.
  • fast/dom/class-all-whitespace.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r27435 r27441  
     12007-11-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        - test that an all-whitespace class attribute does not cause an assertion failure
     6
     7        * fast/dom/class-all-whitespace-expected.txt: Added.
     8        * fast/dom/class-all-whitespace.html: Added.
     9
    1102007-11-05  Alexey Proskuryakov  <ap@webkit.org>
    211
  • trunk/WebCore/ChangeLog

    r27440 r27441  
     12007-11-05  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        - fix ASSERTION FAILED: !HashTranslator::equal(KeyTraits::emptyValue(), key) when a class attribute is all-whitespace
     6
     7        Test: fast/dom/class-all-whitespace.html
     8
     9        * dom/StyledElement.cpp:
     10        (WebCore::StyledElement::parseMappedAttribute): Check if there is any
     11        non-whitespace character in the class attribute.
     12
    1132007-11-05  Brady Eidson  <beidson@apple.com>
    214
  • trunk/WebCore/dom/StyledElement.cpp

    r27221 r27441  
    217217    } else if (attr->name() == classAttr) {
    218218        // class
    219         setHasClass(!attr->isEmpty());
     219        bool hasClass = false;
     220        if (!attr->isEmpty()) {
     221            const AtomicString& value = attr->value();
     222            unsigned len = value.length();
     223            for (unsigned i = 0; i < len; ++i) {
     224                if (!isClassWhitespace(value[i])) {
     225                    hasClass = true;
     226                    break;
     227                }
     228            }
     229        }
     230        setHasClass(hasClass);
    220231        if (namedAttrMap)
    221232            mappedAttributes()->parseClassAttribute(attr->value());
Note: See TracChangeset for help on using the changeset viewer.