Changeset 21934 in webkit


Ignore:
Timestamp:
Jun 1, 2007, 1:13:25 AM (18 years ago)
Author:
eseidel
Message:

2007-06-01 Eric Seidel <eric@webkit.org>

Reviewed by hyatt.

Fix for: http://bugs.webkit.org/show_bug.cgi?id=12187

Tests: fast/dom/attribute-case-sensitivity.html, fast/dom/attribute-case-sensitivity2.xhtml

  • dom/Element.cpp: (WebCore::shouldIgnoreAttributeCase): check to make sure element is an HTMLElement (WebCore::Element::getAttribute): (WebCore::Element::setAttribute): (WebCore::Element::removeAttribute): (WebCore::Element::getAttributeNode): (WebCore::Element::hasAttribute):
  • dom/NamedAttrMap.cpp: (WebCore::shouldIgnoreAttributeCase): (WebCore::NamedAttrMap::getNamedItem): (WebCore::NamedAttrMap::removeNamedItem):
Location:
branches/feature-branch
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-branch/LayoutTests/ChangeLog

    r21920 r21934  
     12007-06-01  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by hyatt.
     4       
     5        Add tests to document attribute case sensitivity prior to fixing:
     6        http://bugs.webkit.org/show_bug.cgi?id=12187
     7
     8        * fast/dom/attribute-case-sensitivity-expected.txt: Added.
     9        * fast/dom/attribute-case-sensitivity.html: Added.
     10        * fast/dom/attribute-case-sensitivity2-expected.txt: Added.
     11        * fast/dom/attribute-case-sensitivity2.xhtml: Added.
     12        * fast/dom/resources/attr-case-sensitivity.js: Added.
     13
    1142007-05-31  Eric Seidel  <eric@webkit.org>
    215
  • branches/feature-branch/WebCore/ChangeLog

    r21920 r21934  
     12007-06-01  Eric Seidel  <eric@webkit.org>
     2
     3        Reviewed by hyatt.
     4
     5        Fix for: http://bugs.webkit.org/show_bug.cgi?id=12187
     6
     7        Tests: fast/dom/attribute-case-sensitivity.html, fast/dom/attribute-case-sensitivity2.xhtml
     8
     9        * dom/Element.cpp:
     10        (WebCore::shouldIgnoreAttributeCase): check to make sure element is an HTMLElement
     11        (WebCore::Element::getAttribute):
     12        (WebCore::Element::setAttribute):
     13        (WebCore::Element::removeAttribute):
     14        (WebCore::Element::getAttributeNode):
     15        (WebCore::Element::hasAttribute):
     16        * dom/NamedAttrMap.cpp:
     17        (WebCore::shouldIgnoreAttributeCase):
     18        (WebCore::NamedAttrMap::getNamedItem):
     19        (WebCore::NamedAttrMap::removeNamedItem):
     20
    1212007-05-31  Eric Seidel  <eric@webkit.org>
    222
  • branches/feature-branch/WebCore/dom/Element.cpp

    r21278 r21934  
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    66 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     7 *           (C) 2007 Eric Seidel (eric@webkit.org)
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    394395}
    395396
    396 static inline bool inHTMLDocument(const Element* e)
    397 {
    398     return e && e->document()->isHTMLDocument();
     397static inline bool shouldIgnoreAttributeCase(const Element* e)
     398{
     399    return e && e->document()->isHTMLDocument() && e->isHTMLElement();
    399400}
    400401
    401402const AtomicString& Element::getAttribute(const String& name) const
    402403{
    403     String localName = inHTMLDocument(this) ? name.lower() : name;
     404    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    404405    if (localName == styleAttr.localName())
    405406        updateStyleAttributeIfNeeded();
     
    424425    }
    425426
    426     String localName = inHTMLDocument(this) ? name.lower() : name;
     427    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    427428
    428429    // allocate attributemap if necessary
     
    910911void Element::removeAttribute(const String& name, ExceptionCode& ec)
    911912{
    912     String localName = inHTMLDocument(this) ? name.lower() : name;
     913    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    913914
    914915    if (namedAttrMap) {
     
    929930    if (!attrs)
    930931        return 0;
    931     String localName = inHTMLDocument(this) ? name.lower() : name;
     932    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    932933    return static_pointer_cast<Attr>(attrs->getNamedItem(localName));
    933934}
     
    946947    if (!attrs)
    947948        return false;
    948     String localName = inHTMLDocument(this) ? name.lower() : name;
     949    String localName = shouldIgnoreAttributeCase(this) ? name.lower() : name;
    949950    return attrs->getAttributeItem(localName);
    950951}
  • branches/feature-branch/WebCore/dom/NamedAttrMap.cpp

    r21184 r21934  
    55 *           (C) 2001 Dirk Mueller (mueller@kde.org)
    66 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
     7 *           (C) 2007 Eric Seidel (eric@webkit.org)
    78 *
    89 * This library is free software; you can redistribute it and/or
     
    3435using namespace HTMLNames;
    3536
    36 static inline bool inHTMLDocument(const Element* e)
    37 {
    38     return e && e->document()->isHTMLDocument();
     37static inline bool shouldIgnoreAttributeCase(const Element* e)
     38{
     39    return e && e->document()->isHTMLDocument() && e->isHTMLElement();
    3940}
    4041
     
    5859PassRefPtr<Node> NamedAttrMap::getNamedItem(const String& name) const
    5960{
    60     String localName = inHTMLDocument(element) ? name.lower() : name;
     61    String localName = shouldIgnoreAttributeCase(element) ? name.lower() : name;
    6162    Attribute* a = getAttributeItem(localName);
    6263    if (!a)
     
    7374PassRefPtr<Node> NamedAttrMap::removeNamedItem(const String& name, ExceptionCode& ec)
    7475{
    75     String localName = inHTMLDocument(element) ? name.lower() : name;
     76    String localName = shouldIgnoreAttributeCase(element) ? name.lower() : name;
    7677    Attribute* a = getAttributeItem(localName);
    7778    if (!a) {
Note: See TracChangeset for help on using the changeset viewer.