Move attribute style invalidation to attributeChanged().
<http://webkit.org/b/78461>

Reviewed by Antti Koivisto.

Moved attribute style invalidation out of the parseAttribute() overloads
and added an "isPresentationAttribute(Attribute*) virtual to StyledElement.
Returning true for a given Attribute will cause attribute style invalidation
when that attribute passes through attributeChanged().

Removed a couple of parseAttribute() overloads whose only remaining purpose
was invalidating attribute style.

For form elements that deliberately don't map the "align" attribute, added
short-circuits in isPresentationAttribute instead of falling back to the
respective base class (which may othweise then map "align")

* dom/StyledElement.cpp:
(WebCore::StyledElement::attributeChanged):
* dom/StyledElement.h:
(WebCore::StyledElement::isPresentationAttribute):
* html/HTMLBRElement.cpp:
(WebCore::HTMLBRElement::isPresentationAttribute):
* html/HTMLBRElement.h:
* html/HTMLBodyElement.cpp:
(WebCore::HTMLBodyElement::isPresentationAttribute):
(WebCore::HTMLBodyElement::collectStyleForAttribute):
(WebCore::HTMLBodyElement::parseAttribute):
* html/HTMLBodyElement.h:
* html/HTMLButtonElement.cpp:
(WebCore::HTMLButtonElement::isPresentationAttribute):
(WebCore::HTMLButtonElement::parseAttribute):
* html/HTMLButtonElement.h:
* html/HTMLDivElement.cpp:
(WebCore::HTMLDivElement::isPresentationAttribute):
* html/HTMLDivElement.h:
* html/HTMLElement.cpp:
(WebCore::HTMLElement::isPresentationAttribute):
(WebCore::HTMLElement::parseAttribute):
* html/HTMLElement.h:
* html/HTMLEmbedElement.cpp:
(WebCore::HTMLEmbedElement::isPresentationAttribute):
(WebCore::HTMLEmbedElement::parseAttribute):
* html/HTMLEmbedElement.h:
* html/HTMLFontElement.cpp:
(WebCore::HTMLFontElement::isPresentationAttribute):
* html/HTMLFontElement.h:
* html/HTMLFrameSetElement.cpp:
(WebCore::HTMLFrameSetElement::isPresentationAttribute):
(WebCore::HTMLFrameSetElement::parseAttribute):
* html/HTMLFrameSetElement.h:
* html/HTMLHRElement.cpp:
(WebCore::HTMLHRElement::isPresentationAttribute):
(WebCore::HTMLHRElement::collectStyleForAttribute):
* html/HTMLHRElement.h:
* html/HTMLIFrameElement.cpp:
(WebCore::HTMLIFrameElement::isPresentationAttribute):
(WebCore::HTMLIFrameElement::collectStyleForAttribute):
(WebCore::HTMLIFrameElement::parseAttribute):
* html/HTMLIFrameElement.h:
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::isPresentationAttribute):
(WebCore::HTMLImageElement::collectStyleForAttribute):
(WebCore::HTMLImageElement::parseAttribute):
* html/HTMLImageElement.h:
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::isPresentationAttribute):
(WebCore::HTMLInputElement::collectStyleForAttribute):
(WebCore::HTMLInputElement::parseAttribute):
* html/HTMLInputElement.h:
* html/HTMLLIElement.cpp:
(WebCore::HTMLLIElement::isPresentationAttribute):
(WebCore::HTMLLIElement::parseAttribute):
* html/HTMLLIElement.h:
* html/HTMLMarqueeElement.cpp:
(WebCore::HTMLMarqueeElement::isPresentationAttribute):
(WebCore::HTMLMarqueeElement::collectStyleForAttribute):
(WebCore::HTMLMarqueeElement::parseAttribute):
* html/HTMLMarqueeElement.h:
* html/HTMLOListElement.cpp:
(WebCore::HTMLOListElement::isPresentationAttribute):
(WebCore::HTMLOListElement::parseAttribute):
* html/HTMLOListElement.h:
* html/HTMLObjectElement.cpp:
(WebCore::HTMLObjectElement::isPresentationAttribute):
(WebCore::HTMLObjectElement::parseAttribute):
* html/HTMLObjectElement.h:
* html/HTMLParagraphElement.cpp:
(WebCore::HTMLParagraphElement::isPresentationAttribute):
* html/HTMLParagraphElement.h:
* html/HTMLPlugInElement.cpp:
(WebCore::HTMLPlugInElement::isPresentationAttribute):
(WebCore::HTMLPlugInElement::collectStyleForAttribute):
* html/HTMLPlugInElement.h:
* html/HTMLPreElement.cpp:
(WebCore::HTMLPreElement::isPresentationAttribute):
(WebCore::HTMLPreElement::collectStyleForAttribute):
* html/HTMLPreElement.h:
* html/HTMLSelectElement.cpp:
(WebCore::HTMLSelectElement::isPresentationAttribute):
(WebCore::HTMLSelectElement::parseAttribute):
* html/HTMLSelectElement.h:
* html/HTMLTableCaptionElement.cpp:
(WebCore::HTMLTableCaptionElement::isPresentationAttribute):
(WebCore::HTMLTableCaptionElement::parseAttribute):
* html/HTMLTableCaptionElement.h:
* html/HTMLTableCellElement.cpp:
(WebCore::HTMLTableCellElement::isPresentationAttribute):
(WebCore::HTMLTableCellElement::collectStyleForAttribute):
(WebCore::HTMLTableCellElement::parseAttribute):
* html/HTMLTableCellElement.h:
* html/HTMLTableColElement.cpp:
(WebCore::HTMLTableColElement::isPresentationAttribute):
(WebCore::HTMLTableColElement::parseAttribute):
* html/HTMLTableColElement.h:
* html/HTMLTableElement.cpp:
(WebCore::HTMLTableElement::isPresentationAttribute):
(WebCore::HTMLTableElement::parseAttribute):
* html/HTMLTableElement.h:
* html/HTMLTablePartElement.cpp:
(WebCore::HTMLTablePartElement::isPresentationAttribute):
(WebCore::HTMLTablePartElement::collectStyleForAttribute):
* html/HTMLTablePartElement.h:
* html/HTMLTextAreaElement.cpp:
(WebCore::HTMLTextAreaElement::isPresentationAttribute):
(WebCore::HTMLTextAreaElement::parseAttribute):
* html/HTMLTextAreaElement.h:
* html/HTMLUListElement.cpp:
(WebCore::HTMLUListElement::isPresentationAttribute):
(WebCore::HTMLUListElement::collectStyleForAttribute):
* html/HTMLUListElement.h:
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::isPresentationAttribute):
(WebCore::HTMLVideoElement::parseAttribute):
* html/HTMLVideoElement.h:
* mathml/MathMLElement.cpp:
(WebCore::MathMLElement::isPresentationAttribute):
(WebCore::MathMLElement::collectStyleForAttribute):
* mathml/MathMLElement.h:
* svg/SVGImageElement.cpp:
(WebCore::SVGImageElement::isPresentationAttribute):
(WebCore::SVGImageElement::parseAttribute):
* svg/SVGImageElement.h:
* svg/SVGStyledElement.cpp:
(WebCore::SVGStyledElement::isPresentationAttribute):
(WebCore::SVGStyledElement::parseAttribute):
* svg/SVGStyledElement.h:
* svg/SVGTextContentElement.cpp:
(WebCore::SVGTextContentElement::isPresentationAttribute):
(WebCore::SVGTextContentElement::parseAttribute):
* svg/SVGTextContentElement.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@107554 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/html/HTMLTableElement.cpp b/Source/WebCore/html/HTMLTableElement.cpp
index 84835dc..e9d55a4 100644
--- a/Source/WebCore/html/HTMLTableElement.cpp
+++ b/Source/WebCore/html/HTMLTableElement.cpp
@@ -354,24 +354,27 @@
         HTMLElement::collectStyleForAttribute(attr, style);
 }
 
+bool HTMLTableElement::isPresentationAttribute(Attribute* attr) const
+{
+    if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == bgcolorAttr || attr->name() == backgroundAttr || attr->name() == valignAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == cellspacingAttr || attr->name() == borderAttr || attr->name() == bordercolorAttr || attr->name() == frameAttr || attr->name() == rulesAttr)
+        return true;
+    return HTMLElement::isPresentationAttribute(attr);
+}
+
 void HTMLTableElement::parseAttribute(Attribute* attr)
 {
     CellBorders bordersBefore = cellBorders();
     unsigned short oldPadding = m_padding;
 
-    if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == bgcolorAttr || attr->name() == backgroundAttr || attr->name() == valignAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == cellspacingAttr)
-        setNeedsAttributeStyleUpdate();
-    else if (attr->name() == borderAttr)  {
+    if (attr->name() == borderAttr)  {
         // FIXME: This attribute is a mess.
         m_borderAttr = true;
         if (!attr->isNull()) {
             int border = attr->isEmpty() ? 1 : attr->value().toInt();
             m_borderAttr = border;
         }
-        setNeedsAttributeStyleUpdate();
     } else if (attr->name() == bordercolorAttr) {
         m_borderColorAttr = !attr->isEmpty();
-        setNeedsAttributeStyleUpdate();
     } else if (attr->name() == frameAttr) {
         // FIXME: This attribute is a mess.
         bool borderTop;
@@ -379,7 +382,6 @@
         bool borderBottom;
         bool borderLeft;
         m_frameAttr = getBordersFromFrameAttributeValue(attr->value(), borderTop, borderRight, borderBottom, borderLeft);
-        setNeedsAttributeStyleUpdate();
     } else if (attr->name() == rulesAttr) {
         m_rulesAttr = UnsetRules;
         if (equalIgnoringCase(attr->value(), "none"))
@@ -392,8 +394,6 @@
             m_rulesAttr = ColsRules;
         if (equalIgnoringCase(attr->value(), "all"))
             m_rulesAttr = AllRules;
-
-        setNeedsAttributeStyleUpdate();
     } else if (attr->name() == cellpaddingAttr) {
         if (!attr->value().isEmpty())
             m_padding = max(0, attr->value().toInt());