<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: https://svn.webkit.org/repository/webkit/trunk@107554
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-02-13 Andreas Kling <awesomekling@apple.com>
+
+ 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:
+
2012-02-13 Kentaro Hara <haraken@chromium.org>
Add [JSCustomToJSObject] IDL attribute to interfaces that have
if (!(attr->name() == styleAttr && isSynchronizingStyleAttribute()))
parseAttribute(attr);
+ if (isPresentationAttribute(attr)) {
+ setAttributeStyleDirty();
+ setNeedsStyleRecalc();
+ }
+
Element::attributeChanged(attr);
}
{
}
- void setNeedsAttributeStyleUpdate();
-
virtual void attributeChanged(Attribute*) OVERRIDE;
virtual void parseAttribute(Attribute*);
virtual void copyNonAttributeProperties(const Element*);
+ virtual bool isPresentationAttribute(Attribute*) const { return false; }
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) { }
virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
return attributeData() ? attributeData()->attributeStyle() : 0;
}
-inline void StyledElement::setNeedsAttributeStyleUpdate()
-{
- setAttributeStyleDirty();
- setNeedsStyleRecalc();
-}
-
} //namespace
#endif
return adoptRef(new HTMLBRElement(tagName, document));
}
+bool HTMLBRElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == clearAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLBRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == clearAttr) {
HTMLElement::collectStyleForAttribute(attr, style);
}
-void HTMLBRElement::parseAttribute(Attribute* attr)
-{
- if (attr->name() == clearAttr)
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
-}
-
RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->hasContent())
private:
HTMLBRElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
{
}
-static inline bool isRespectedPresentationAttributeForHTMLBodyElement(Attribute* attr)
+bool HTMLBodyElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == backgroundAttr || attr->name() == marginwidthAttr || attr->name() == leftmarginAttr || attr->name() == marginheightAttr || attr->name() == topmarginAttr || attr->name() == bgcolorAttr || attr->name() == textAttr || attr->name() == bgpropertiesAttr;
-
+ if (attr->name() == backgroundAttr || attr->name() == marginwidthAttr || attr->name() == leftmarginAttr || attr->name() == marginheightAttr || attr->name() == topmarginAttr || attr->name() == bgcolorAttr || attr->name() == textAttr || attr->name() == bgpropertiesAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
void HTMLBodyElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
} else if (attr->name() == bgpropertiesAttr) {
if (equalIgnoringCase(attr->value(), "fixed"))
style->setProperty(CSSPropertyBackgroundAttachment, CSSValueFixed);
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLBodyElement(attr));
+ } else
HTMLElement::collectStyleForAttribute(attr, style);
- }
}
void HTMLBodyElement::parseAttribute(Attribute* attr)
{
- if (isRespectedPresentationAttributeForHTMLBodyElement(attr))
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == vlinkAttr || attr->name() == alinkAttr || attr->name() == linkAttr) {
+ if (attr->name() == vlinkAttr || attr->name() == alinkAttr || attr->name() == linkAttr) {
if (attr->isNull()) {
if (attr->name() == linkAttr)
document()->resetLinkColor();
HTMLBodyElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void insertedIntoDocument();
return emptyAtom;
}
+bool HTMLButtonElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr) {
+ // Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera.
+ // See http://bugs.webkit.org/show_bug.cgi?id=12071
+ return false;
+ }
+
+ return HTMLFormControlElement::isPresentationAttribute(attr);
+}
+
void HTMLButtonElement::parseAttribute(Attribute* attr)
{
if (attr->name() == typeAttr) {
else
m_type = SUBMIT;
setNeedsWillValidateCheck();
- } else if (attr->name() == alignAttr) {
- // Don't map 'align' attribute. This matches what Firefox and IE do, but not Opera.
- // See http://bugs.webkit.org/show_bug.cgi?id=12071
} else
HTMLFormControlElement::parseAttribute(attr);
}
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void defaultEventHandler(Event*);
virtual bool appendFormData(FormDataList&, bool);
return adoptRef(new HTMLDivElement(tagName, document));
}
+bool HTMLDivElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLDivElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == alignAttr) {
HTMLElement::collectStyleForAttribute(attr, style);
}
-void HTMLDivElement::parseAttribute(Attribute* attr)
-{
- if (attr->name() == alignAttr)
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
-}
-
}
HTMLDivElement(const QualifiedName&, Document*);
private:
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
}
}
+bool HTMLElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr || attr->name() == contenteditableAttr || attr->name() == hiddenAttr || attr->name() == langAttr || attr->name().matches(XMLNames::langAttr) || attr->name() == draggableAttr || attr->name() == dirAttr)
+ return true;
+ return StyledElement::isPresentationAttribute(attr);
+}
+
void HTMLElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == alignAttr) {
if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
return StyledElement::parseAttribute(attr);
- if (attr->name() == alignAttr || attr->name() == contenteditableAttr || attr->name() == hiddenAttr || attr->name() == langAttr || attr->name().matches(XMLNames::langAttr) || attr->name() == draggableAttr)
- setNeedsAttributeStyleUpdate();
+ if (attr->name() == dirAttr)
+ dirAttributeChanged(attr);
else if (attr->name() == tabindexAttr) {
int tabindex = 0;
if (attr->isEmpty())
// Clamp tabindex to the range of 'short' to match Firefox's behavior.
setTabIndexExplicitly(max(static_cast<int>(std::numeric_limits<short>::min()), min(tabindex, static_cast<int>(std::numeric_limits<short>::max()))));
}
- } else if (attr->name() == dirAttr) {
- setNeedsAttributeStyleUpdate();
- dirAttributeChanged(attr);
#if ENABLE(MICRODATA)
} else if (attr->name() == itempropAttr) {
setItemProp(attr->value());
void applyBorderAttributeToStyle(Attribute*, StylePropertySet*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
return findWidgetRenderer(this);
}
+bool HTMLEmbedElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == hiddenAttr)
+ return true;
+ return HTMLPlugInImageElement::isPresentationAttribute(attr);
+}
+
void HTMLEmbedElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == hiddenAttr) {
m_imageLoader = adoptPtr(new HTMLImageLoader(this));
m_imageLoader->updateFromElementIgnoringPreviousError();
}
- } else if (attr->name() == hiddenAttr)
- setNeedsAttributeStyleUpdate();
- else
+ } else
HTMLPlugInImageElement::parseAttribute(attr);
}
HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
return true;
}
+bool HTMLFontElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == sizeAttr || attr->name() == colorAttr || attr->name() == faceAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLFontElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == sizeAttr) {
HTMLElement::collectStyleForAttribute(attr, style);
}
-void HTMLFontElement::parseAttribute(Attribute* attr)
-{
- if (attr->name() == sizeAttr || attr->name() == colorAttr || attr->name() == faceAttr)
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
-}
-
}
private:
HTMLFontElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
return adoptRef(new HTMLFrameSetElement(tagName, document));
}
+bool HTMLFrameSetElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == bordercolorAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLFrameSetElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == bordercolorAttr)
m_borderSet = true;
} else
m_borderSet = false;
- } else if (attr->name() == bordercolorAttr) {
+ } else if (attr->name() == bordercolorAttr)
m_borderColorSet = !attr->isEmpty();
- setNeedsAttributeStyleUpdate();
- } else if (attr->name() == onloadAttr)
+ else if (attr->name() == onloadAttr)
document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attr));
else if (attr->name() == onbeforeunloadAttr)
document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document()->frame(), attr));
HTMLFrameSetElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void attach();
return adoptRef(new HTMLHRElement(tagName, document));
}
-static inline bool isRespectedPresentationAttributeForHTMLHRElement(Attribute* attr)
+bool HTMLHRElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == alignAttr || attr->name() == widthAttr || attr->name() == colorAttr || attr->name() == noshadeAttr || attr->name() == sizeAttr;
+ if (attr->name() == alignAttr || attr->name() == widthAttr || attr->name() == colorAttr || attr->name() == noshadeAttr || attr->name() == sizeAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
void HTMLHRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
style->setProperty(CSSPropertyBorderBottomWidth, String("0")); // FIXME: Pass as integer.
else
addHTMLLengthToStyle(style, CSSPropertyHeight, String::number(size - 2)); // FIXME: Pass as integer.
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLHRElement(attr));
+ } else
HTMLElement::collectStyleForAttribute(attr, style);
- }
-}
-
-void HTMLHRElement::parseAttribute(Attribute* attr)
-{
- if (isRespectedPresentationAttributeForHTMLHRElement(attr))
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
}
}
private:
HTMLHRElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
return adoptRef(new HTMLIFrameElement(tagName, document));
}
-static inline bool isRespectedPresentationAttributeForHTMLIFrameElement(Attribute* attr)
+bool HTMLIFrameElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == alignAttr || attr->name() == frameborderAttr;
+ if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == alignAttr || attr->name() == frameborderAttr)
+ return true;
+ return HTMLFrameElementBase::isPresentationAttribute(attr);
}
void HTMLIFrameElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
// Add a rule that nulls out our border width.
addHTMLLengthToStyle(style, CSSPropertyBorderWidth, "0"); // FIXME: Pass as integer.
}
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLIFrameElement(attr));
+ } else
HTMLFrameElementBase::collectStyleForAttribute(attr, style);
- }
}
void HTMLIFrameElement::parseAttribute(Attribute* attr)
{
- if (isRespectedPresentationAttributeForHTMLIFrameElement(attr))
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == nameAttr) {
+ if (attr->name() == nameAttr) {
const AtomicString& newName = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
HTMLIFrameElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void insertedIntoDocument();
return image.release();
}
-static inline bool isRespectedPresentationAttributeForHTMLImageElement(Attribute* attr)
+bool HTMLImageElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == borderAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == valignAttr;
+ if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == borderAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == valignAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
void HTMLImageElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
applyAlignmentAttributeToStyle(attr, style);
else if (attr->name() == valignAttr)
style->setProperty(CSSPropertyVerticalAlign, attr->value());
- else {
- ASSERT(!isRespectedPresentationAttributeForHTMLImageElement(attr));
+ else
HTMLElement::collectStyleForAttribute(attr, style);
- }
}
void HTMLImageElement::parseAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
- if (isRespectedPresentationAttributeForHTMLImageElement(attr))
- setNeedsAttributeStyleUpdate();
- else if (attrName == altAttr) {
+ if (attrName == altAttr) {
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->updateAltText();
} else if (attrName == srcAttr)
private:
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void attach();
m_inputType->accessKeyAction(sendMouseEvents);
}
-static inline bool isRespectedPresentationAttributeForHTMLInputElement(HTMLInputElement* element, Attribute* attr)
+bool HTMLInputElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == widthAttr || attr->name() == heightAttr || (attr->name() == borderAttr && element->isImageButton());
+ if (attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr || attr->name() == widthAttr || attr->name() == heightAttr || (attr->name() == borderAttr && isImageButton()))
+ return true;
+ return HTMLTextFormControlElement::isPresentationAttribute(attr);
}
void HTMLInputElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
} else if (attr->name() == borderAttr && isImageButton())
applyBorderAttributeToStyle(attr, style);
- else {
- ASSERT(!isRespectedPresentationAttributeForHTMLInputElement(this, attr));
+ else
return HTMLTextFormControlElement::collectStyleForAttribute(attr, style);
- }
}
void HTMLInputElement::parseAttribute(Attribute* attr)
{
- if (isRespectedPresentationAttributeForHTMLInputElement(this, attr))
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == nameAttr) {
+ if (attr->name() == nameAttr) {
checkedRadioButtons().removeButton(this);
m_name = attr->value();
checkedRadioButtons().addButton(this);
virtual void accessKeyAction(bool sendMouseEvents);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void finishParsingChildren();
return adoptRef(new HTMLLIElement(tagName, document));
}
+bool HTMLLIElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == typeAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLLIElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == typeAttr) {
if (attr->name() == valueAttr) {
if (renderer() && renderer()->isListItem())
parseValue(attr->value());
- } else if (attr->name() == typeAttr)
- setNeedsAttributeStyleUpdate();
- else
+ } else
HTMLElement::parseAttribute(attr);
}
HTMLLIElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void attach();
return marqueeElement.release();
}
-static inline bool isRespectedPresentationAttributeForHTMLMarqueeElement(Attribute* attr)
+bool HTMLMarqueeElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == bgcolorAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == scrollamountAttr || attr->name() == scrolldelayAttr || attr->name() == loopAttr || attr->name() == behaviorAttr || attr->name() == directionAttr;
+ if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == bgcolorAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == scrollamountAttr || attr->name() == scrolldelayAttr || attr->name() == loopAttr || attr->name() == behaviorAttr || attr->name() == directionAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
void HTMLMarqueeElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
} else if (attr->name() == directionAttr) {
if (!attr->value().isEmpty())
style->setProperty(CSSPropertyWebkitMarqueeDirection, attr->value());
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLMarqueeElement(attr));
+ } else
HTMLElement::collectStyleForAttribute(attr, style);
- }
}
void HTMLMarqueeElement::parseAttribute(Attribute* attr)
{
- if (isRespectedPresentationAttributeForHTMLMarqueeElement(attr))
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == truespeedAttr)
+ if (attr->name() == truespeedAttr) {
+ // FIXME: Factor this out and remove HTMLMarqueeElement::parseAttribute().
m_minimumDelay = !attr->isEmpty() ? 0 : defaultMinimumDelay;
- else
+ } else
HTMLElement::parseAttribute(attr);
}
HTMLMarqueeElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
// ActiveDOMObject
return adoptRef(new HTMLOListElement(tagName, document));
}
+bool HTMLOListElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == typeAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLOListElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == typeAttr) {
void HTMLOListElement::parseAttribute(Attribute* attr)
{
- if (attr->name() == typeAttr)
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == startAttr) {
+ if (attr->name() == startAttr) {
int oldStart = start();
bool canParse;
int parsedStart = attr->value().toInt(&canParse);
void recalculateItemCount();
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
int m_start;
return renderPart(); // This will return 0 if the renderer is not a RenderPart.
}
+bool HTMLObjectElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == borderAttr)
+ return true;
+ return HTMLPlugInImageElement::isPresentationAttribute(attr);
+}
+
void HTMLObjectElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == borderAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
else if (attr->name() == onbeforeloadAttr)
setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == borderAttr)
- setNeedsAttributeStyleUpdate();
else
HTMLPlugInImageElement::parseAttribute(attr);
}
HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void insertedIntoTree(bool deep);
return adoptRef(new HTMLParagraphElement(tagName, document));
}
+bool HTMLParagraphElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
+}
+
void HTMLParagraphElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == alignAttr) {
HTMLElement::collectStyleForAttribute(attr, style);
}
-void HTMLParagraphElement::parseAttribute(Attribute* attr)
-{
- if (attr->name() == alignAttr)
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
-}
-
}
private:
HTMLParagraphElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
return renderWidget->widget();
}
-static inline bool isRespectedPresentationAttributeForHTMLPlugInElement(Attribute* attr)
+bool HTMLPlugInElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr;
+ if (attr->name() == widthAttr || attr->name() == heightAttr || attr->name() == vspaceAttr || attr->name() == hspaceAttr || attr->name() == alignAttr)
+ return true;
+ return HTMLFrameOwnerElement::isPresentationAttribute(attr);
}
void HTMLPlugInElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
} else if (attr->name() == alignAttr)
applyAlignmentAttributeToStyle(attr, style);
- else {
- ASSERT(!isRespectedPresentationAttributeForHTMLPlugInElement(attr));
- HTMLFrameOwnerElement::collectStyleForAttribute(attr, style);
- }
-}
-
-void HTMLPlugInElement::parseAttribute(Attribute* attr)
-{
- if (isRespectedPresentationAttributeForHTMLPlugInElement(attr))
- setNeedsAttributeStyleUpdate();
else
- HTMLFrameOwnerElement::parseAttribute(attr);
+ HTMLFrameOwnerElement::collectStyleForAttribute(attr, style);
}
void HTMLPlugInElement::defaultEventHandler(Event* event)
virtual void detach();
virtual void removedFromDocument();
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
bool m_inBeforeLoadEventHandler;
return adoptRef(new HTMLPreElement(tagName, document));
}
-void HTMLPreElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+bool HTMLPreElement::isPresentationAttribute(Attribute* attr) const
{
if (attr->name() == wrapAttr)
- style->setProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
- else
- HTMLElement::collectStyleForAttribute(attr, style);
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
-void HTMLPreElement::parseAttribute(Attribute* attr)
+void HTMLPreElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
- if (attr->name() == widthAttr) {
- // FIXME: Implement this some day. Width on a <pre> is the # of characters that
- // we should size the pre to. We basically need to take the width of a space,
- // multiply by the value of the attribute and then set that as the width CSS
- // property.
- } else if (attr->name() == wrapAttr)
- setNeedsAttributeStyleUpdate();
+ if (attr->name() == wrapAttr)
+ style->setProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
else
- return HTMLElement::parseAttribute(attr);
+ HTMLElement::collectStyleForAttribute(attr, style);
}
}
private:
HTMLPreElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
setSelectedIndex(-1);
}
+bool HTMLSelectElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr) {
+ // Don't map 'align' attribute. This matches what Firefox, Opera and IE do.
+ // See http://bugs.webkit.org/show_bug.cgi?id=12072
+ return false;
+ }
+
+ return HTMLFormControlElementWithState::isPresentationAttribute(attr);
+}
+
void HTMLSelectElement::parseAttribute(Attribute* attr)
{
if (attr->name() == sizeAttr) {
parseMultipleAttribute(attr);
else if (attr->name() == accesskeyAttr) {
// FIXME: ignore for the moment.
- } else if (attr->name() == alignAttr) {
- // Don't map 'align' attribute. This matches what Firefox, Opera and IE do.
- // See http://bugs.webkit.org/show_bug.cgi?id=12072
} else if (attr->name() == onchangeAttr)
setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr));
else
virtual void restoreFormControlState(const String&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle *);
virtual bool appendFormData(FormDataList&, bool);
return adoptRef(new HTMLTableCaptionElement(tagName, document));
}
+bool HTMLTableCaptionElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr); // Note that we are bypassing HTMLTablePartElement here.
+}
+
void HTMLTableCaptionElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == alignAttr) {
void HTMLTableCaptionElement::parseAttribute(Attribute* attr)
{
- if (attr->name() == alignAttr)
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr); // Note that we are bypassing HTMLTablePartElement here.
+ HTMLElement::parseAttribute(attr); // Note that we are bypassing HTMLTablePartElement here.
}
}
HTMLTableCaptionElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
return index;
}
-static inline bool isRespectedPresentationAttributeForHTMLTableCellElement(Attribute* attr)
+bool HTMLTableCellElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == nowrapAttr || attr->name() == widthAttr || attr->name() == heightAttr;
+ if (attr->name() == nowrapAttr || attr->name() == widthAttr || attr->name() == heightAttr)
+ return true;
+ return HTMLTablePartElement::isPresentationAttribute(attr);
}
void HTMLTableCellElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
if (heightInt > 0) // height="0" is ignored for compatibility with WinIE.
addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
}
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLTableCellElement(attr));
+ } else
HTMLTablePartElement::collectStyleForAttribute(attr, style);
- }
}
void HTMLTableCellElement::parseAttribute(Attribute* attr)
{
- if (isRespectedPresentationAttributeForHTMLTableCellElement(attr))
- setNeedsAttributeStyleUpdate();
- else if (attr->name() == rowspanAttr) {
+ if (attr->name() == rowspanAttr) {
if (renderer() && renderer()->isTableCell())
toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
} else if (attr->name() == colspanAttr) {
HTMLTableCellElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual StylePropertySet* additionalAttributeStyle() OVERRIDE;
return adoptRef(new HTMLTableColElement(tagName, document));
}
+bool HTMLTableColElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == widthAttr)
+ return true;
+ return HTMLTablePartElement::isPresentationAttribute(attr);
+}
+
void HTMLTableColElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == widthAttr)
if (renderer() && renderer()->isTableCol())
renderer()->updateFromElement();
} else if (attr->name() == widthAttr) {
- setNeedsAttributeStyleUpdate();
if (!attr->value().isEmpty()) {
if (renderer() && renderer()->isTableCol()) {
RenderTableCol* col = toRenderTableCol(renderer());
HTMLTableColElement(const QualifiedName& tagName, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual StylePropertySet* additionalAttributeStyle() OVERRIDE;
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;
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"))
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());
HTMLTableElement(const QualifiedName&, Document*);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual bool isURLAttribute(Attribute*) const;
using namespace HTMLNames;
-static inline bool isRespectedPresentationAttributeForHTMLTablePartElement(Attribute* attr)
+bool HTMLTablePartElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == bgcolorAttr || attr->name() == backgroundAttr || attr->name() == bordercolorAttr || attr->name() == valignAttr || attr->name() == alignAttr || attr->name() == heightAttr;
+ if (attr->name() == bgcolorAttr || attr->name() == backgroundAttr || attr->name() == bordercolorAttr || attr->name() == valignAttr || attr->name() == alignAttr || attr->name() == heightAttr)
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
void HTMLTablePartElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
} else if (attr->name() == heightAttr) {
if (!attr->value().isEmpty())
addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- } else {
- ASSERT(!isRespectedPresentationAttributeForHTMLTablePartElement(attr));
+ } else
HTMLElement::collectStyleForAttribute(attr, style);
- }
-}
-
-void HTMLTablePartElement::parseAttribute(Attribute* attr)
-{
- if (isRespectedPresentationAttributeForHTMLTablePartElement(attr))
- setNeedsAttributeStyleUpdate();
- else
- HTMLElement::parseAttribute(attr);
}
HTMLTableElement* HTMLTablePartElement::findParentTable() const
: HTMLElement(tagName, document)
{
}
- virtual void parseAttribute(Attribute*) OVERRIDE;
+
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
HTMLTableElement* findParentTable() const;
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
+bool HTMLTextAreaElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == alignAttr) {
+ // Don't map 'align' attribute. This matches what Firefox, Opera and IE do.
+ // See http://bugs.webkit.org/show_bug.cgi?id=7075
+ return false;
+ }
+
+ if (attr->name() == wrapAttr)
+ return true;
+ return HTMLTextFormControlElement::isPresentationAttribute(attr);
+}
+
void HTMLTextAreaElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == wrapAttr) {
wrap = SoftWrap;
if (wrap != m_wrap) {
m_wrap = wrap;
- setNeedsAttributeStyleUpdate();
-
if (renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
}
} else if (attr->name() == accesskeyAttr) {
// ignore for the moment
- } else if (attr->name() == alignAttr) {
- // Don't map 'align' attribute. This matches what Firefox, Opera and IE do.
- // See http://bugs.webkit.org/show_bug.cgi?id=7075
} else if (attr->name() == maxlengthAttr)
setNeedsValidityCheck();
else
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool appendFormData(FormDataList&, bool);
return adoptRef(new HTMLUListElement(tagName, document));
}
-void HTMLUListElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+bool HTMLUListElement::isPresentationAttribute(Attribute* attr) const
{
if (attr->name() == typeAttr)
- style->setProperty(CSSPropertyListStyleType, attr->value());
- else
- HTMLElement::collectStyleForAttribute(attr, style);
+ return true;
+ return HTMLElement::isPresentationAttribute(attr);
}
-void HTMLUListElement::parseAttribute(Attribute* attr)
+void HTMLUListElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == typeAttr)
- setNeedsAttributeStyleUpdate();
+ style->setProperty(CSSPropertyListStyleType, attr->value());
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::collectStyleForAttribute(attr, style);
}
}
private:
HTMLUListElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
HTMLMediaElement::collectStyleForAttribute(attr, style);
}
+bool HTMLVideoElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == widthAttr || attr->name() == heightAttr)
+ return true;
+ return HTMLMediaElement::isPresentationAttribute(attr);
+}
+
void HTMLVideoElement::parseAttribute(Attribute* attr)
{
const QualifiedName& attrName = attr->name();
toRenderImage(renderer())->imageResource()->setCachedImage(0);
}
#endif
- } else if (attrName == widthAttr || attrName == heightAttr)
- setNeedsAttributeStyleUpdate();
- else
+ } else
HTMLMediaElement::parseAttribute(attr);
}
virtual void attach();
virtual void detach();
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual bool isVideo() const { return true; }
virtual bool hasVideo() const { return player() && player()->hasVideo(); }
return adoptRef(new MathMLElement(tagName, document));
}
-static inline bool isRespectedPresentationAttributeForMathMLElement(Attribute* attr)
+bool MathMLElement::isPresentationAttribute(Attribute* attr) const
{
- return attr->name() == mathbackgroundAttr || attr->name() == mathsizeAttr || attr->name() == mathcolorAttr || attr->name() == fontsizeAttr || attr->name() == backgroundAttr || attr->name() == colorAttr || attr->name() == fontstyleAttr || attr->name() == fontweightAttr || attr->name() == fontfamilyAttr;
+ if (attr->name() == mathbackgroundAttr || attr->name() == mathsizeAttr || attr->name() == mathcolorAttr || attr->name() == fontsizeAttr || attr->name() == backgroundAttr || attr->name() == colorAttr || attr->name() == fontstyleAttr || attr->name() == fontweightAttr || attr->name() == fontfamilyAttr)
+ return true;
+ return StyledElement::isPresentationAttribute(attr);
}
void MathMLElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
else if (attr->name() == fontfamilyAttr)
style->setProperty(CSSPropertyFontFamily, attr->value());
else {
- ASSERT(!isRespectedPresentationAttributeForMathMLElement(attr));
+ ASSERT(!isPresentationAttribute(attr));
StyledElement::collectStyleForAttribute(attr, style);
}
}
-void MathMLElement::parseAttribute(Attribute* attr)
-{
- if (isRespectedPresentationAttributeForMathMLElement(attr))
- setNeedsAttributeStyleUpdate();
- else
- StyledElement::parseAttribute(attr);
-}
-
}
#endif // ENABLE(MATHML)
private:
virtual bool isMathMLElement() const { return true; }
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
};
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
+bool SVGImageElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name() == SVGNames::widthAttr || attr->name() == SVGNames::heightAttr)
+ return true;
+ return SVGStyledTransformableElement::isPresentationAttribute(attr);
+}
+
void SVGImageElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (!isSupportedAttribute(attr->name()))
setYBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError));
else if (attr->name() == SVGNames::preserveAspectRatioAttr)
SVGPreserveAspectRatio::parsePreserveAspectRatio(this, attr->value());
- else if (attr->name() == SVGNames::widthAttr) {
+ else if (attr->name() == SVGNames::widthAttr)
setWidthBaseValue(SVGLength::construct(LengthModeWidth, attr->value(), parseError, ForbidNegativeLengths));
- setNeedsAttributeStyleUpdate();
- } else if (attr->name() == SVGNames::heightAttr) {
+ else if (attr->name() == SVGNames::heightAttr)
setHeightBaseValue(SVGLength::construct(LengthModeHeight, attr->value(), parseError, ForbidNegativeLengths));
- setNeedsAttributeStyleUpdate();
- } else if (SVGTests::parseAttribute(attr)
+ else if (SVGTests::parseAttribute(attr)
|| SVGLangSpace::parseAttribute(attr)
|| SVGExternalResourcesRequired::parseAttribute(attr)
|| SVGURIReference::parseAttribute(attr)) {
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
return cssPropertyToTypeMap().contains(attrName);
}
+bool SVGStyledElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()) > 0)
+ return true;
+ return SVGElement::isPresentationAttribute(attr);
+}
+
void SVGStyledElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
int propertyID = SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name());
void SVGStyledElement::parseAttribute(Attribute* attr)
{
- if (SVGStyledElement::cssPropertyIdForSVGAttributeName(attr->name()) > 0) {
- setNeedsAttributeStyleUpdate();
- return;
- }
-
// SVG animation has currently requires special storage of values so we set
// the className here. svgAttributeChanged actually causes the resulting
// style updates (instead of StyledElement::parseAttribute). We don't
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
+bool SVGTextContentElement::isPresentationAttribute(Attribute* attr) const
+{
+ if (attr->name().matches(XMLNames::spaceAttr))
+ return true;
+ return SVGStyledElement::isPresentationAttribute(attr);
+}
+
void SVGTextContentElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (!isSupportedAttribute(attr->name()))
} else if (SVGTests::parseAttribute(attr)
|| SVGExternalResourcesRequired::parseAttribute(attr)) {
} else if (SVGLangSpace::parseAttribute(attr)) {
- if (attr->name().matches(XMLNames::spaceAttr))
- setNeedsAttributeStyleUpdate();
} else
ASSERT_NOT_REACHED();
bool isSupportedAttribute(const QualifiedName&);
virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual bool isPresentationAttribute(Attribute*) const OVERRIDE;
virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);