Title: [94074] trunk/Source/WebCore
Revision
94074
Author
[email protected]
Date
2011-08-30 06:16:38 -0700 (Tue, 30 Aug 2011)

Log Message

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

Patch by Andreas Kling <[email protected]> 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().

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (94073 => 94074)


--- trunk/Source/WebCore/ChangeLog	2011-08-30 12:39:59 UTC (rev 94073)
+++ trunk/Source/WebCore/ChangeLog	2011-08-30 13:16:38 UTC (rev 94074)
@@ -1,3 +1,19 @@
+2011-08-30  Andreas Kling  <[email protected]>
+
+        HTMLImageElement: Don't cache "ismap" and "usemap" attributes.
+        https://bugs.webkit.org/show_bug.cgi?id=66784
+
+        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().
+
 2011-08-30  Ryosuke Niwa  <[email protected]>
 
         lastChangeWasUserEdit continues to return true when innerText or textContent is modified

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (94073 => 94074)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2011-08-30 12:39:59 UTC (rev 94073)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2011-08-30 13:16:38 UTC (rev 94074)
@@ -44,7 +44,6 @@
 HTMLImageElement::HTMLImageElement(const QualifiedName& tagName, Document* document, HTMLFormElement* form)
     : HTMLElement(tagName, document)
     , m_imageLoader(this)
-    , ismap(false)
     , m_form(form)
     , m_compositeOperator(CompositeSourceOver)
 {
@@ -127,14 +126,8 @@
         addHTMLAlignment(attr);
     else if (attrName == valignAttr)
         addCSSProperty(attr, CSSPropertyVerticalAlign, attr->value());
-    else if (attrName == usemapAttr) {
-        if (attr->value().string()[0] == '#')
-            usemap = ""
-        else
-            usemap = ""
+    else if (attrName == usemapAttr)
         setIsLink(!attr->isNull());
-    } else if (attrName == ismapAttr)
-        ismap = true;
     else if (attrName == onabortAttr)
         setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
     else if (attrName == onloadAttr)
@@ -400,4 +393,18 @@
     HTMLElement::willMoveToNewOwnerDocument();
 }
 
+bool HTMLImageElement::isServerMap() const
+{
+    if (!fastHasAttribute(ismapAttr))
+        return false;
+
+    const AtomicString& usemap = ""
+    
+    // If the usemap attribute starts with '#', it refers to a map element in the document.
+    if (usemap.string()[0] == '#')
+        return false;
+
+    return document()->completeURL(stripLeadingAndTrailingHTMLSpaces(usemap)).isEmpty();
 }
+
+}

Modified: trunk/Source/WebCore/html/HTMLImageElement.h (94073 => 94074)


--- trunk/Source/WebCore/html/HTMLImageElement.h	2011-08-30 12:39:59 UTC (rev 94073)
+++ trunk/Source/WebCore/html/HTMLImageElement.h	2011-08-30 13:16:38 UTC (rev 94074)
@@ -47,7 +47,7 @@
     int naturalWidth() const;
     int naturalHeight() const;
 
-    bool isServerMap() const { return ismap && usemap.isEmpty(); }
+    bool isServerMap() const;
 
     String altText() const;
 
@@ -103,8 +103,6 @@
     virtual void removedFromTree(bool deep);
 
     HTMLImageLoader m_imageLoader;
-    String usemap;
-    bool ismap;
     HTMLFormElement* m_form;
     AtomicString m_name;
     AtomicString m_id;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to