⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 94074 in webkit


Ignore:
Timestamp:
Aug 30, 2011, 6:16:38 AM (15 years ago)
Author:
commit-queue@webkit.org
Message:

HTMLImageElement: Don't cache "ismap" and "usemap" attributes.
https://bugs.webkit.org/show_bug.cgi?id=66784

Patch by Andreas Kling <kling@webkit.org> on 2011-08-30
Reviewed by Darin Adler.

  • html/HTMLImageElement.h: Remove the "ismap" and "usemap" members,

shrinking HTMLImageElement by 16 bytes (on 64-bit.)

  • html/HTMLImageElement.cpp:

(WebCore::HTMLImageElement::HTMLImageElement):
(WebCore::HTMLImageElement::parseMappedAttribute): Most of the logic
for "ismap" and "usemap" moved into isServerMap().
(WebCore::HTMLImageElement::isServerMap): Out-of-lined and implemented
using fast*Attribute().

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r94068 r94074  
     12011-08-30  Andreas Kling  <kling@webkit.org>
     2
     3        HTMLImageElement: Don't cache "ismap" and "usemap" attributes.
     4        https://bugs.webkit.org/show_bug.cgi?id=66784
     5
     6        Reviewed by Darin Adler.
     7
     8        * html/HTMLImageElement.h: Remove the "ismap" and "usemap" members,
     9        shrinking HTMLImageElement by 16 bytes (on 64-bit.)
     10        * html/HTMLImageElement.cpp:
     11        (WebCore::HTMLImageElement::HTMLImageElement):
     12        (WebCore::HTMLImageElement::parseMappedAttribute): Most of the logic
     13        for "ismap" and "usemap" moved into isServerMap().
     14        (WebCore::HTMLImageElement::isServerMap): Out-of-lined and implemented
     15        using fast*Attribute().
     16
    1172011-08-30  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Source/WebCore/html/HTMLImageElement.cpp

    r92118 r94074  
    4545    : HTMLElement(tagName, document)
    4646    , m_imageLoader(this)
    47     , ismap(false)
    4847    , m_form(form)
    4948    , m_compositeOperator(CompositeSourceOver)
     
    128127    else if (attrName == valignAttr)
    129128        addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value());
    130     else if (attrName == usemapAttr) {
    131         if (attr->value().string()[0] == '#')
    132             usemap = attr->value();
    133         else
    134             usemap = document()->completeURL(stripLeadingAndTrailingHTMLSpaces(attr->value())).string();
     129    else if (attrName == usemapAttr)
    135130        setIsLink(!attr->isNull());
    136     } else if (attrName == ismapAttr)
    137         ismap = true;
    138131    else if (attrName == onabortAttr)
    139132        setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
     
    401394}
    402395
    403 }
     396bool HTMLImageElement::isServerMap() const
     397{
     398    if (!fastHasAttribute(ismapAttr))
     399        return false;
     400
     401    const AtomicString& usemap = fastGetAttribute(usemapAttr);
     402   
     403    // If the usemap attribute starts with '#', it refers to a map element in the document.
     404    if (usemap.string()[0] == '#')
     405        return false;
     406
     407    return document()->completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)).isEmpty();
     408}
     409
     410}
  • trunk/Source/WebCore/html/HTMLImageElement.h

    r91404 r94074  
    4848    int naturalHeight() const;
    4949
    50     bool isServerMap() const { return ismap && usemap.isEmpty(); }
     50    bool isServerMap() const;
    5151
    5252    String altText() const;
     
    104104
    105105    HTMLImageLoader m_imageLoader;
    106     String usemap;
    107     bool ismap;
    108106    HTMLFormElement* m_form;
    109107    AtomicString m_name;
Note: See TracChangeset for help on using the changeset viewer.