+2012-05-15 Andreas Kling <kling@webkit.org>
+
+ Pass Attribute by const reference as much as possible.
+ <http://webkit.org/b/86487>
+
+ Reviewed by Darin Adler.
+
+ Switch to passing around "const Attribute&" instead of "Attribute*" wherever possible.
+ This helps enforce the constness and non-nullity of these arguments at compile time.
+
+ Also renamed 'attr' to 'attribute' in the touched code. Attr and Attribute are two
+ different classes, so having "Attribute attr" just looks wrong.
+
+ * bindings/js/ScriptEventListener.cpp:
+ (WebCore::createAttributeEventListener):
+ * bindings/js/ScriptEventListener.h:
+ * bindings/v8/ScriptEventListener.cpp:
+ (WebCore::createAttributeEventListener):
+ * bindings/v8/ScriptEventListener.h:
+ * dom/Attr.cpp:
+ (WebCore::Attr::setPrefix):
+ (WebCore::Attr::setValue):
+ (WebCore::Attr::childrenChanged):
+ (WebCore::Attr::style):
+ (WebCore::Attr::elementAttribute):
+ * dom/Attr.h:
+ * dom/Element.cpp:
+ (WebCore::Element::setAttributeInternal):
+ (WebCore::Element::attributeChanged):
+ (WebCore::Element::parserSetAttributes):
+ (WebCore::Element::didAddAttribute):
+ (WebCore::Element::didModifyAttribute):
+ (WebCore::Element::didRemoveAttribute):
+ * dom/Element.h:
+ * dom/ElementAttributeData.cpp:
+ (WebCore::ElementAttributeData::addAttribute):
+ (WebCore::ElementAttributeData::setAttributes):
+ (WebCore::ElementAttributeData::replaceAttribute):
+ * dom/StyledElement.cpp:
+ (WebCore::StyledElement::attributeChanged):
+ (WebCore::StyledElement::parseAttribute):
+ (WebCore::StyledElement::updateAttributeStyle):
+ * dom/StyledElement.h:
+ (WebCore::StyledElement::collectStyleForAttribute):
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::parseAttribute):
+ * html/HTMLAnchorElement.h:
+ * html/HTMLAppletElement.cpp:
+ (WebCore::HTMLAppletElement::parseAttribute):
+ * html/HTMLAppletElement.h:
+ * html/HTMLAreaElement.cpp:
+ (WebCore::HTMLAreaElement::parseAttribute):
+ * html/HTMLAreaElement.h:
+ * html/HTMLBRElement.cpp:
+ (WebCore::HTMLBRElement::collectStyleForAttribute):
+ * html/HTMLBRElement.h:
+ * html/HTMLBaseElement.cpp:
+ (WebCore::HTMLBaseElement::parseAttribute):
+ * html/HTMLBaseElement.h:
+ * html/HTMLBodyElement.cpp:
+ (WebCore::HTMLBodyElement::collectStyleForAttribute):
+ (WebCore::HTMLBodyElement::parseAttribute):
+ * html/HTMLBodyElement.h:
+ * html/HTMLButtonElement.cpp:
+ (WebCore::HTMLButtonElement::parseAttribute):
+ * html/HTMLButtonElement.h:
+ * html/HTMLCanvasElement.cpp:
+ (WebCore::HTMLCanvasElement::parseAttribute):
+ * html/HTMLCanvasElement.h:
+ * html/HTMLDetailsElement.cpp:
+ (WebCore::HTMLDetailsElement::parseAttribute):
+ * html/HTMLDetailsElement.h:
+ * html/HTMLDivElement.cpp:
+ (WebCore::HTMLDivElement::collectStyleForAttribute):
+ * html/HTMLDivElement.h:
+ * html/HTMLElement.cpp:
+ (WebCore::parseBorderWidthAttribute):
+ (WebCore::HTMLElement::applyBorderAttributeToStyle):
+ (WebCore::HTMLElement::mapLanguageAttributeToLocale):
+ (WebCore::HTMLElement::collectStyleForAttribute):
+ (WebCore::HTMLElement::parseAttribute):
+ (WebCore::HTMLElement::applyAlignmentAttributeToStyle):
+ (WebCore::HTMLElement::dirAttributeChanged):
+ * html/HTMLElement.h:
+ * html/HTMLEmbedElement.cpp:
+ (WebCore::HTMLEmbedElement::collectStyleForAttribute):
+ (WebCore::HTMLEmbedElement::parseAttribute):
+ * html/HTMLEmbedElement.h:
+ * html/HTMLFontElement.cpp:
+ (WebCore::HTMLFontElement::collectStyleForAttribute):
+ * html/HTMLFontElement.h:
+ * html/HTMLFormControlElement.cpp:
+ (WebCore::HTMLFormControlElement::parseAttribute):
+ * html/HTMLFormControlElement.h:
+ * html/HTMLFormElement.cpp:
+ (WebCore::HTMLFormElement::parseAttribute):
+ * html/HTMLFormElement.h:
+ * html/HTMLFrameElement.cpp:
+ (WebCore::HTMLFrameElement::parseAttribute):
+ * html/HTMLFrameElement.h:
+ * html/HTMLFrameElementBase.cpp:
+ (WebCore::HTMLFrameElementBase::parseAttribute):
+ * html/HTMLFrameElementBase.h:
+ (HTMLFrameElementBase):
+ * html/HTMLFrameSetElement.cpp:
+ (WebCore::HTMLFrameSetElement::collectStyleForAttribute):
+ (WebCore::HTMLFrameSetElement::parseAttribute):
+ * html/HTMLFrameSetElement.h:
+ * html/HTMLHRElement.cpp:
+ (WebCore::HTMLHRElement::collectStyleForAttribute):
+ * html/HTMLHRElement.h:
+ * html/HTMLIFrameElement.cpp:
+ (WebCore::HTMLIFrameElement::collectStyleForAttribute):
+ (WebCore::HTMLIFrameElement::parseAttribute):
+ * html/HTMLIFrameElement.h:
+ * html/HTMLImageElement.cpp:
+ (WebCore::HTMLImageElement::collectStyleForAttribute):
+ (WebCore::HTMLImageElement::parseAttribute):
+ * html/HTMLImageElement.h:
+ * html/HTMLInputElement.cpp:
+ (WebCore::HTMLInputElement::updateType):
+ (WebCore::HTMLInputElement::collectStyleForAttribute):
+ (WebCore::HTMLInputElement::parseAttribute):
+ (WebCore::HTMLInputElement::parseMaxLengthAttribute):
+ * html/HTMLInputElement.h:
+ * html/HTMLKeygenElement.cpp:
+ (WebCore::HTMLKeygenElement::parseAttribute):
+ * html/HTMLKeygenElement.h:
+ * html/HTMLLIElement.cpp:
+ (WebCore::HTMLLIElement::collectStyleForAttribute):
+ (WebCore::HTMLLIElement::parseAttribute):
+ * html/HTMLLIElement.h:
+ * html/HTMLLinkElement.cpp:
+ (WebCore::HTMLLinkElement::parseAttribute):
+ * html/HTMLLinkElement.h:
+ * html/HTMLMapElement.cpp:
+ (WebCore::HTMLMapElement::parseAttribute):
+ * html/HTMLMapElement.h:
+ * html/HTMLMarqueeElement.cpp:
+ (WebCore::HTMLMarqueeElement::collectStyleForAttribute):
+ * html/HTMLMarqueeElement.h:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::parseAttribute):
+ * html/HTMLMediaElement.h:
+ * html/HTMLMetaElement.cpp:
+ (WebCore::HTMLMetaElement::parseAttribute):
+ * html/HTMLMetaElement.h:
+ * html/HTMLMeterElement.cpp:
+ (WebCore::HTMLMeterElement::parseAttribute):
+ * html/HTMLMeterElement.h:
+ * html/HTMLOListElement.cpp:
+ (WebCore::HTMLOListElement::collectStyleForAttribute):
+ (WebCore::HTMLOListElement::parseAttribute):
+ * html/HTMLOListElement.h:
+ * html/HTMLObjectElement.cpp:
+ (WebCore::HTMLObjectElement::collectStyleForAttribute):
+ (WebCore::HTMLObjectElement::parseAttribute):
+ * html/HTMLObjectElement.h:
+ * html/HTMLOptGroupElement.cpp:
+ (WebCore::HTMLOptGroupElement::parseAttribute):
+ * html/HTMLOptGroupElement.h:
+ * html/HTMLOptionElement.cpp:
+ (WebCore::HTMLOptionElement::parseAttribute):
+ * html/HTMLOptionElement.h:
+ * html/HTMLOutputElement.cpp:
+ (WebCore::HTMLOutputElement::parseAttribute):
+ * html/HTMLOutputElement.h:
+ * html/HTMLParagraphElement.cpp:
+ (WebCore::HTMLParagraphElement::collectStyleForAttribute):
+ * html/HTMLParagraphElement.h:
+ * html/HTMLPlugInElement.cpp:
+ (WebCore::HTMLPlugInElement::collectStyleForAttribute):
+ * html/HTMLPlugInElement.h:
+ * html/HTMLPreElement.cpp:
+ (WebCore::HTMLPreElement::collectStyleForAttribute):
+ * html/HTMLPreElement.h:
+ * html/HTMLProgressElement.cpp:
+ (WebCore::HTMLProgressElement::parseAttribute):
+ * html/HTMLProgressElement.h:
+ * html/HTMLScriptElement.cpp:
+ (WebCore::HTMLScriptElement::parseAttribute):
+ * html/HTMLScriptElement.h:
+ * html/HTMLSelectElement.cpp:
+ (WebCore::HTMLSelectElement::parseAttribute):
+ (WebCore::HTMLSelectElement::parseMultipleAttribute):
+ * html/HTMLSelectElement.h:
+ * html/HTMLStyleElement.cpp:
+ (WebCore::HTMLStyleElement::parseAttribute):
+ * html/HTMLStyleElement.h:
+ * html/HTMLTableCaptionElement.cpp:
+ (WebCore::HTMLTableCaptionElement::collectStyleForAttribute):
+ * html/HTMLTableCaptionElement.h:
+ * html/HTMLTableCellElement.cpp:
+ (WebCore::HTMLTableCellElement::collectStyleForAttribute):
+ (WebCore::HTMLTableCellElement::parseAttribute):
+ * html/HTMLTableCellElement.h:
+ * html/HTMLTableColElement.cpp:
+ (WebCore::HTMLTableColElement::collectStyleForAttribute):
+ (WebCore::HTMLTableColElement::parseAttribute):
+ * html/HTMLTableColElement.h:
+ * html/HTMLTableElement.cpp:
+ (WebCore::HTMLTableElement::collectStyleForAttribute):
+ (WebCore::HTMLTableElement::parseAttribute):
+ * html/HTMLTableElement.h:
+ * html/HTMLTablePartElement.cpp:
+ (WebCore::HTMLTablePartElement::collectStyleForAttribute):
+ * html/HTMLTablePartElement.h:
+ * html/HTMLTextAreaElement.cpp:
+ (WebCore::HTMLTextAreaElement::collectStyleForAttribute):
+ (WebCore::HTMLTextAreaElement::parseAttribute):
+ * html/HTMLTextAreaElement.h:
+ * html/HTMLTextFormControlElement.cpp:
+ (WebCore::HTMLTextFormControlElement::parseAttribute):
+ * html/HTMLTextFormControlElement.h:
+ * html/HTMLTrackElement.cpp:
+ (WebCore::HTMLTrackElement::parseAttribute):
+ * html/HTMLTrackElement.h:
+ * html/HTMLUListElement.cpp:
+ (WebCore::HTMLUListElement::collectStyleForAttribute):
+ * html/HTMLUListElement.h:
+ * html/HTMLVideoElement.cpp:
+ (WebCore::HTMLVideoElement::collectStyleForAttribute):
+ (WebCore::HTMLVideoElement::parseAttribute):
+ * html/HTMLVideoElement.h:
+ * html/shadow/HTMLContentElement.cpp:
+ (WebCore::HTMLContentElement::parseAttribute):
+ * html/shadow/HTMLContentElement.h:
+ * mathml/MathMLElement.cpp:
+ (WebCore::MathMLElement::collectStyleForAttribute):
+ * mathml/MathMLElement.h:
+ * svg/SVGAElement.cpp:
+ (WebCore::SVGAElement::parseAttribute):
+ * svg/SVGAElement.h:
+ * svg/SVGAnimateMotionElement.cpp:
+ (WebCore::SVGAnimateMotionElement::parseAttribute):
+ * svg/SVGAnimateMotionElement.h:
+ * svg/SVGAnimateTransformElement.cpp:
+ (WebCore::SVGAnimateTransformElement::parseAttribute):
+ * svg/SVGAnimateTransformElement.h:
+ * svg/SVGAnimationElement.cpp:
+ (WebCore::SVGAnimationElement::parseAttribute):
+ * svg/SVGAnimationElement.h:
+ * svg/SVGCircleElement.cpp:
+ (WebCore::SVGCircleElement::parseAttribute):
+ * svg/SVGCircleElement.h:
+ * svg/SVGClipPathElement.cpp:
+ (WebCore::SVGClipPathElement::parseAttribute):
+ * svg/SVGClipPathElement.h:
+ * svg/SVGComponentTransferFunctionElement.cpp:
+ (WebCore::SVGComponentTransferFunctionElement::parseAttribute):
+ * svg/SVGComponentTransferFunctionElement.h:
+ * svg/SVGCursorElement.cpp:
+ (WebCore::SVGCursorElement::parseAttribute):
+ * svg/SVGCursorElement.h:
+ * svg/SVGElement.cpp:
+ (WebCore::SVGElement::reportAttributeParsingError):
+ (WebCore::SVGElement::parseAttribute):
+ (WebCore::SVGElement::attributeChanged):
+ * svg/SVGElement.h:
+ * svg/SVGEllipseElement.cpp:
+ (WebCore::SVGEllipseElement::parseAttribute):
+ * svg/SVGEllipseElement.h:
+ * svg/SVGExternalResourcesRequired.cpp:
+ (WebCore::SVGExternalResourcesRequired::parseAttribute):
+ * svg/SVGExternalResourcesRequired.h:
+ (SVGExternalResourcesRequired):
+ * svg/SVGFEBlendElement.cpp:
+ (WebCore::SVGFEBlendElement::parseAttribute):
+ * svg/SVGFEBlendElement.h:
+ * svg/SVGFEColorMatrixElement.cpp:
+ (WebCore::SVGFEColorMatrixElement::parseAttribute):
+ * svg/SVGFEColorMatrixElement.h:
+ * svg/SVGFEComponentTransferElement.cpp:
+ (WebCore::SVGFEComponentTransferElement::parseAttribute):
+ * svg/SVGFEComponentTransferElement.h:
+ * svg/SVGFECompositeElement.cpp:
+ (WebCore::SVGFECompositeElement::parseAttribute):
+ * svg/SVGFECompositeElement.h:
+ * svg/SVGFEConvolveMatrixElement.cpp:
+ (WebCore::SVGFEConvolveMatrixElement::parseAttribute):
+ * svg/SVGFEConvolveMatrixElement.h:
+ * svg/SVGFEDiffuseLightingElement.cpp:
+ (WebCore::SVGFEDiffuseLightingElement::parseAttribute):
+ * svg/SVGFEDiffuseLightingElement.h:
+ * svg/SVGFEDisplacementMapElement.cpp:
+ (WebCore::SVGFEDisplacementMapElement::parseAttribute):
+ * svg/SVGFEDisplacementMapElement.h:
+ * svg/SVGFEDropShadowElement.cpp:
+ (WebCore::SVGFEDropShadowElement::parseAttribute):
+ * svg/SVGFEDropShadowElement.h:
+ * svg/SVGFEGaussianBlurElement.cpp:
+ (WebCore::SVGFEGaussianBlurElement::parseAttribute):
+ * svg/SVGFEGaussianBlurElement.h:
+ * svg/SVGFEImageElement.cpp:
+ (WebCore::SVGFEImageElement::parseAttribute):
+ * svg/SVGFEImageElement.h:
+ * svg/SVGFELightElement.cpp:
+ (WebCore::SVGFELightElement::parseAttribute):
+ * svg/SVGFELightElement.h:
+ * svg/SVGFEMergeNodeElement.cpp:
+ (WebCore::SVGFEMergeNodeElement::parseAttribute):
+ * svg/SVGFEMergeNodeElement.h:
+ * svg/SVGFEMorphologyElement.cpp:
+ (WebCore::SVGFEMorphologyElement::parseAttribute):
+ * svg/SVGFEMorphologyElement.h:
+ * svg/SVGFEOffsetElement.cpp:
+ (WebCore::SVGFEOffsetElement::parseAttribute):
+ * svg/SVGFEOffsetElement.h:
+ * svg/SVGFESpecularLightingElement.cpp:
+ (WebCore::SVGFESpecularLightingElement::parseAttribute):
+ * svg/SVGFESpecularLightingElement.h:
+ * svg/SVGFETileElement.cpp:
+ (WebCore::SVGFETileElement::parseAttribute):
+ * svg/SVGFETileElement.h:
+ * svg/SVGFETurbulenceElement.cpp:
+ (WebCore::SVGFETurbulenceElement::parseAttribute):
+ * svg/SVGFETurbulenceElement.h:
+ * svg/SVGFilterElement.cpp:
+ (WebCore::SVGFilterElement::parseAttribute):
+ * svg/SVGFilterElement.h:
+ * svg/SVGFilterPrimitiveStandardAttributes.cpp:
+ (WebCore::SVGFilterPrimitiveStandardAttributes::parseAttribute):
+ * svg/SVGFilterPrimitiveStandardAttributes.h:
+ (SVGFilterPrimitiveStandardAttributes):
+ * svg/SVGFitToViewBox.cpp:
+ (WebCore::SVGFitToViewBox::parseAttribute):
+ * svg/SVGFitToViewBox.h:
+ (SVGFitToViewBox):
+ * svg/SVGFontFaceElement.cpp:
+ (WebCore::SVGFontFaceElement::parseAttribute):
+ * svg/SVGFontFaceElement.h:
+ * svg/SVGFontFaceUriElement.cpp:
+ (WebCore::SVGFontFaceUriElement::parseAttribute):
+ * svg/SVGFontFaceUriElement.h:
+ * svg/SVGForeignObjectElement.cpp:
+ (WebCore::SVGForeignObjectElement::parseAttribute):
+ * svg/SVGForeignObjectElement.h:
+ * svg/SVGGElement.cpp:
+ (WebCore::SVGGElement::parseAttribute):
+ * svg/SVGGElement.h:
+ * svg/SVGGlyphElement.cpp:
+ (WebCore::SVGGlyphElement::parseAttribute):
+ * svg/SVGGlyphElement.h:
+ * svg/SVGGlyphRefElement.cpp:
+ (WebCore::SVGGlyphRefElement::parseAttribute):
+ * svg/SVGGlyphRefElement.h:
+ * svg/SVGGradientElement.cpp:
+ (WebCore::SVGGradientElement::parseAttribute):
+ * svg/SVGGradientElement.h:
+ * svg/SVGImageElement.cpp:
+ (WebCore::SVGImageElement::collectStyleForAttribute):
+ (WebCore::SVGImageElement::parseAttribute):
+ * svg/SVGImageElement.h:
+ * svg/SVGImageLoader.cpp:
+ (WebCore::SVGImageLoader::sourceURI):
+ * svg/SVGLangSpace.cpp:
+ (WebCore::SVGLangSpace::parseAttribute):
+ * svg/SVGLangSpace.h:
+ (SVGLangSpace):
+ * svg/SVGLineElement.cpp:
+ (WebCore::SVGLineElement::parseAttribute):
+ * svg/SVGLineElement.h:
+ * svg/SVGLinearGradientElement.cpp:
+ (WebCore::SVGLinearGradientElement::parseAttribute):
+ * svg/SVGLinearGradientElement.h:
+ * svg/SVGMPathElement.cpp:
+ (WebCore::SVGMPathElement::parseAttribute):
+ * svg/SVGMPathElement.h:
+ * svg/SVGMarkerElement.cpp:
+ (WebCore::SVGMarkerElement::parseAttribute):
+ * svg/SVGMarkerElement.h:
+ * svg/SVGMaskElement.cpp:
+ (WebCore::SVGMaskElement::parseAttribute):
+ * svg/SVGMaskElement.h:
+ * svg/SVGPathElement.cpp:
+ (WebCore::SVGPathElement::parseAttribute):
+ * svg/SVGPathElement.h:
+ * svg/SVGPatternElement.cpp:
+ (WebCore::SVGPatternElement::parseAttribute):
+ * svg/SVGPatternElement.h:
+ * svg/SVGPolyElement.cpp:
+ (WebCore::SVGPolyElement::parseAttribute):
+ * svg/SVGPolyElement.h:
+ * svg/SVGRadialGradientElement.cpp:
+ (WebCore::SVGRadialGradientElement::parseAttribute):
+ * svg/SVGRadialGradientElement.h:
+ * svg/SVGRectElement.cpp:
+ (WebCore::SVGRectElement::parseAttribute):
+ * svg/SVGRectElement.h:
+ * svg/SVGSVGElement.cpp:
+ (WebCore::SVGSVGElement::parseAttribute):
+ * svg/SVGSVGElement.h:
+ * svg/SVGScriptElement.cpp:
+ (WebCore::SVGScriptElement::parseAttribute):
+ * svg/SVGScriptElement.h:
+ * svg/SVGStopElement.cpp:
+ (WebCore::SVGStopElement::parseAttribute):
+ * svg/SVGStopElement.h:
+ * svg/SVGStyleElement.cpp:
+ (WebCore::SVGStyleElement::parseAttribute):
+ * svg/SVGStyleElement.h:
+ * svg/SVGStyledElement.cpp:
+ (WebCore::SVGStyledElement::collectStyleForAttribute):
+ (WebCore::SVGStyledElement::parseAttribute):
+ * svg/SVGStyledElement.h:
+ * svg/SVGStyledTransformableElement.cpp:
+ (WebCore::SVGStyledTransformableElement::parseAttribute):
+ * svg/SVGStyledTransformableElement.h:
+ * svg/SVGSymbolElement.cpp:
+ (WebCore::SVGSymbolElement::parseAttribute):
+ * svg/SVGSymbolElement.h:
+ * svg/SVGTRefElement.cpp:
+ (WebCore::SVGTRefElement::parseAttribute):
+ * svg/SVGTRefElement.h:
+ * svg/SVGTests.cpp:
+ (WebCore::SVGTests::parseAttribute):
+ * svg/SVGTests.h:
+ (SVGTests):
+ * svg/SVGTextContentElement.cpp:
+ (WebCore::SVGTextContentElement::collectStyleForAttribute):
+ (WebCore::SVGTextContentElement::parseAttribute):
+ * svg/SVGTextContentElement.h:
+ * svg/SVGTextElement.cpp:
+ (WebCore::SVGTextElement::parseAttribute):
+ * svg/SVGTextElement.h:
+ * svg/SVGTextPathElement.cpp:
+ (WebCore::SVGTextPathElement::parseAttribute):
+ * svg/SVGTextPathElement.h:
+ * svg/SVGTextPositioningElement.cpp:
+ (WebCore::SVGTextPositioningElement::parseAttribute):
+ * svg/SVGTextPositioningElement.h:
+ * svg/SVGURIReference.cpp:
+ (WebCore::SVGURIReference::parseAttribute):
+ * svg/SVGURIReference.h:
+ (SVGURIReference):
+ * svg/SVGUseElement.cpp:
+ (WebCore::SVGUseElement::parseAttribute):
+ * svg/SVGUseElement.h:
+ * svg/SVGViewElement.cpp:
+ (WebCore::SVGViewElement::parseAttribute):
+ * svg/SVGViewElement.h:
+ * svg/SVGZoomAndPan.cpp:
+ (WebCore::SVGZoomAndPan::parseAttribute):
+ * svg/SVGZoomAndPan.h:
+ (SVGZoomAndPan):
+ * svg/animation/SVGSMILElement.cpp:
+ (WebCore::SVGSMILElement::parseAttribute):
+ * svg/animation/SVGSMILElement.h:
+
2012-05-15 Kenneth Russell <kbr@google.com>
Assertion failure running Mozilla's WebGL performance regression tests
return isSVGEvent ? evtString : eventString;
}
-PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
+PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node* node, const Attribute& attribute)
{
ASSERT(node);
- ASSERT(attr);
- if (attr->isNull())
+ if (attribute.isNull())
return 0;
TextPosition position = TextPosition::minimumPosition();
sourceURL = node->document()->url().string();
}
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), node, sourceURL, position, 0, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attribute.localName().string(), eventParameterName(node->isSVGElement()), attribute.value(), node, sourceURL, position, 0, mainThreadNormalWorld());
}
-PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
+PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame* frame, const Attribute& attribute)
{
if (!frame)
return 0;
- ASSERT(attr);
- if (attr->isNull())
+ if (attribute.isNull())
return 0;
ScriptController* scriptController = frame->script();
TextPosition position = scriptController->eventHandlerPosition();
String sourceURL = frame->document()->url().string();
JSObject* wrapper = toJSDOMWindow(frame, mainThreadNormalWorld());
- return JSLazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), 0, sourceURL, position, wrapper, mainThreadNormalWorld());
+ return JSLazyEventListener::create(attribute.localName().string(), eventParameterName(frame->document()->isSVGDocument()), attribute.value(), 0, sourceURL, position, wrapper, mainThreadNormalWorld());
}
String eventListenerHandlerBody(Document* document, EventListener* eventListener)
class Frame;
class Node;
- PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, Attribute*);
- PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Node*, const Attribute&);
+ PassRefPtr<JSLazyEventListener> createAttributeEventListener(Frame*, const Attribute&);
String eventListenerHandlerBody(Document*, EventListener*);
bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);
} // namespace WebCore
return isSVGEvent ? evtString : eventString;
}
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, Attribute* attr)
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node* node, const Attribute& attribute)
{
ASSERT(node);
- ASSERT(attr);
- if (attr->isNull())
+ if (attribute.isNull())
return 0;
// FIXME: Very strange: we initialize zero-based number with '1'.
sourceURL = node->document()->url().string();
}
- return V8LazyEventListener::create(attr->localName().string(), eventParameterName(node->isSVGElement()), attr->value(), sourceURL, position, node, WorldContextHandle(UseMainWorld));
+ return V8LazyEventListener::create(attribute.localName().string(), eventParameterName(node->isSVGElement()), attribute.value(), sourceURL, position, node, WorldContextHandle(UseMainWorld));
}
-PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, Attribute* attr)
+PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame* frame, const Attribute& attribute)
{
if (!frame)
return 0;
- ASSERT(attr);
- if (attr->isNull())
+ if (attribute.isNull())
return 0;
ScriptController* scriptController = frame->script();
TextPosition position = scriptController->eventHandlerPosition();
String sourceURL = frame->document()->url().string();
- return V8LazyEventListener::create(attr->localName().string(), eventParameterName(frame->document()->isSVGDocument()), attr->value(), sourceURL, position, 0, WorldContextHandle(UseMainWorld));
+ return V8LazyEventListener::create(attribute.localName().string(), eventParameterName(frame->document()->isSVGDocument()), attribute.value(), sourceURL, position, 0, WorldContextHandle(UseMainWorld));
}
String eventListenerHandlerBody(Document* document, EventListener* listener)
class Frame;
class Node;
- PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, Attribute*);
- PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, Attribute*);
+ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Node*, const Attribute&);
+ PassRefPtr<V8LazyEventListener> createAttributeEventListener(Frame*, const Attribute&);
String eventListenerHandlerBody(Document*, EventListener*);
bool eventListenerHandlerLocation(Document*, EventListener*, String& sourceName, int& lineNumber);
const AtomicString& newPrefix = prefix.isEmpty() ? nullAtom : prefix;
- if (Attribute* attribute = elementAttribute())
- attribute->setPrefix(newPrefix);
+ if (m_element)
+ elementAttribute().setPrefix(newPrefix);
m_name.setPrefix(newPrefix);
}
m_ignoreChildrenChanged++;
removeChildren();
if (m_element)
- elementAttribute()->setValue(value);
+ elementAttribute().setValue(value);
else
m_standaloneValue = value;
createTextChild();
m_element->willModifyAttribute(qualifiedName(), value(), newValue);
if (m_element)
- elementAttribute()->setValue(newValue);
+ elementAttribute().setValue(newValue);
else
m_standaloneValue = newValue;
CSSStyleDeclaration* Attr::style()
{
// This function only exists to support the Obj-C bindings.
- if (!m_element->isStyledElement())
+ if (!m_element || !m_element->isStyledElement())
return 0;
m_style = StylePropertySet::create();
static_cast<StyledElement*>(m_element)->collectStyleForAttribute(elementAttribute(), m_style.get());
return m_standaloneValue;
}
-Attribute* Attr::elementAttribute()
+Attribute& Attr::elementAttribute()
{
- if (!m_element || !m_element->attributeData())
- return 0;
- return m_element->getAttributeItem(qualifiedName());
+ ASSERT(m_element);
+ ASSERT(m_element->attributeData());
+ return *m_element->getAttributeItem(qualifiedName());
}
void Attr::detachFromElementWithValue(const AtomicString& value)
virtual const AtomicString& virtualLocalName() const { return localName(); }
virtual const AtomicString& virtualNamespaceURI() const { return namespaceURI(); }
- Attribute* elementAttribute();
+ Attribute& elementAttribute();
// Attr wraps either an element/name, or a name/value pair (when it's a standalone Node.)
// Note that m_name is always set, but m_element/m_standaloneValue may be null.
old->setValue(value);
if (inUpdateStyleAttribute == NotInUpdateStyleAttribute)
- didModifyAttribute(old);
+ didModifyAttribute(*old);
}
-void Element::attributeChanged(Attribute* attr)
+void Element::attributeChanged(const Attribute& attribute)
{
document()->incDOMTreeVersion();
- if (isIdAttributeName(attr->name())) {
+ if (isIdAttributeName(attribute.name())) {
if (attributeData()) {
- if (attr->isNull())
+ if (attribute.isNull())
attributeData()->setIdForStyleResolution(nullAtom);
else if (document()->inQuirksMode())
- attributeData()->setIdForStyleResolution(attr->value().lower());
+ attributeData()->setIdForStyleResolution(attribute.value().lower());
else
- attributeData()->setIdForStyleResolution(attr->value());
+ attributeData()->setIdForStyleResolution(attribute.value());
}
setNeedsStyleRecalc();
- } else if (attr->name() == HTMLNames::nameAttr)
- setHasName(!attr->isNull());
+ } else if (attribute.name() == HTMLNames::nameAttr)
+ setHasName(!attribute.isNull());
if (!needsStyleRecalc() && document()->attached()) {
StyleResolver* styleResolver = document()->styleResolverIfExists();
- if (!styleResolver || styleResolver->hasSelectorForAttribute(attr->name().localName()))
+ if (!styleResolver || styleResolver->hasSelectorForAttribute(attribute.name().localName()))
setNeedsStyleRecalc();
}
- invalidateNodeListsCacheAfterAttributeChanged(attr->name());
+ invalidateNodeListsCacheAfterAttributeChanged(attribute.name());
if (!AXObjectCache::accessibilityEnabled())
return;
- const QualifiedName& attrName = attr->name();
+ const QualifiedName& attrName = attribute.name();
if (attrName == aria_activedescendantAttr) {
// any change to aria-activedescendant attribute triggers accessibility focus change, but document focus remains intact
document()->axObjectCache()->handleActiveDescendantChanged(renderer());
// attributeChanged mutates m_attributeData.
Vector<Attribute> clonedAttributes = m_attributeData->clonedAttributeVector();
for (unsigned i = 0; i < clonedAttributes.size(); ++i)
- attributeChanged(&clonedAttributes[i]);
+ attributeChanged(clonedAttributes[i]);
}
bool Element::hasAttributes() const
#endif
}
-void Element::didAddAttribute(Attribute* attr)
+void Element::didAddAttribute(const Attribute& attribute)
{
- attributeChanged(attr);
- InspectorInstrumentation::didModifyDOMAttr(document(), this, attr->name().localName(), attr->value());
+ attributeChanged(attribute);
+ InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value());
dispatchSubtreeModifiedEvent();
}
-void Element::didModifyAttribute(Attribute* attr)
+void Element::didModifyAttribute(const Attribute& attribute)
{
- attributeChanged(attr);
- InspectorInstrumentation::didModifyDOMAttr(document(), this, attr->name().localName(), attr->value());
+ attributeChanged(attribute);
+ InspectorInstrumentation::didModifyDOMAttr(document(), this, attribute.localName(), attribute.value());
// Do not dispatch a DOMSubtreeModified event here; see bug 81141.
}
void Element::didRemoveAttribute(const QualifiedName& name)
{
- Attribute dummyAttribute(name, nullAtom);
- attributeChanged(&dummyAttribute);
-
+ attributeChanged(Attribute(name, nullAtom));
InspectorInstrumentation::didRemoveDOMAttr(document(), this, name.localName());
dispatchSubtreeModifiedEvent();
}
NamedNodeMap* attributes() const;
// This method is called whenever an attribute is added, changed or removed.
- virtual void attributeChanged(Attribute*);
+ virtual void attributeChanged(const Attribute&);
// Only called by the parser immediately after element construction.
void parserSetAttributes(const Vector<Attribute>&, FragmentScriptingPermission);
void willModifyAttribute(const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
void willRemoveAttribute(const QualifiedName&, const AtomicString& value);
- void didAddAttribute(Attribute*);
- void didModifyAttribute(Attribute*);
+ void didAddAttribute(const Attribute&);
+ void didModifyAttribute(const Attribute&);
void didRemoveAttribute(const QualifiedName&);
LayoutSize minimumSizeForResizing() const;
m_attributes.append(attribute);
if (element && inUpdateStyleAttribute == NotInUpdateStyleAttribute)
- element->didAddAttribute(const_cast<Attribute*>(&attribute));
+ element->didAddAttribute(attribute);
}
void ElementAttributeData::removeAttribute(size_t index, Element* element, EInUpdateStyleAttribute inUpdateStyleAttribute)
clearAttributes(element);
m_attributes = other.m_attributes;
for (unsigned i = 0; i < m_attributes.size(); ++i)
- element->attributeChanged(&m_attributes[i]);
+ element->attributeChanged(m_attributes[i]);
}
void ElementAttributeData::clearAttributes(Element* element)
element->willModifyAttribute(attribute.name(), m_attributes[index].value(), attribute.value());
m_attributes[index] = attribute;
- element->didModifyAttribute(const_cast<Attribute*>(&attribute));
+ element->didModifyAttribute(attribute);
}
PassRefPtr<Attr> ElementAttributeData::getAttributeNode(const String& name, bool shouldIgnoreAttributeCase, Element* element) const
return ensureAttributeData()->ensureMutableInlineStyle(this)->ensureInlineCSSStyleDeclaration(this);
}
-void StyledElement::attributeChanged(Attribute* attr)
+void StyledElement::attributeChanged(const Attribute& attribute)
{
- parseAttribute(attr);
+ parseAttribute(attribute);
- if (isPresentationAttribute(attr->name())) {
+ if (isPresentationAttribute(attribute.name())) {
setAttributeStyleDirty();
setNeedsStyleRecalc(InlineStyleChange);
}
- Element::attributeChanged(attr);
+ Element::attributeChanged(attribute);
}
void StyledElement::classAttributeChanged(const AtomicString& newClassString)
setNeedsStyleRecalc();
}
-void StyledElement::parseAttribute(Attribute* attr)
+void StyledElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == classAttr)
- classAttributeChanged(attr->value());
- else if (attr->name() == styleAttr) {
- if (attr->isNull())
+ if (attribute.name() == classAttr)
+ classAttributeChanged(attribute.value());
+ else if (attribute.name() == styleAttr) {
+ if (attribute.isNull())
destroyInlineStyle();
else if (document()->contentSecurityPolicy()->allowInlineStyle())
- ensureAttributeData()->updateInlineStyleAvoidingMutation(this, attr->value());
+ ensureAttributeData()->updateInlineStyleAvoidingMutation(this, attribute.value());
setIsStyleAttributeValid();
setNeedsStyleRecalc();
InspectorInstrumentation::didInvalidateStyleAttr(document(), this);
unsigned size = attributeCount();
for (unsigned i = 0; i < size; ++i) {
Attribute* attribute = attributeItem(i);
- collectStyleForAttribute(attribute, style.get());
+ collectStyleForAttribute(*attribute, style.get());
}
}
clearAttributeStyleDirty();
const SpaceSplitString& classNames() const;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) { }
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) { }
protected:
StyledElement(const QualifiedName& name, Document* document, ConstructionType type)
{
}
- virtual void attributeChanged(Attribute*) OVERRIDE;
- virtual void parseAttribute(Attribute*);
+ virtual void attributeChanged(const Attribute&) OVERRIDE;
+ virtual void parseAttribute(const Attribute&);
virtual void copyNonAttributeProperties(const Element*);
virtual bool isPresentationAttribute(const QualifiedName&) const { return false; }
ContainerNode::setActive(down, pause);
}
-void HTMLAnchorElement::parseAttribute(Attribute* attr)
+void HTMLAnchorElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == hrefAttr) {
+ if (attribute.name() == hrefAttr) {
bool wasLink = isLink();
- setIsLink(!attr->isNull());
+ setIsLink(!attribute.isNull());
if (wasLink != isLink())
setNeedsStyleRecalc();
if (isLink()) {
- String parsedURL = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ String parsedURL = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (document()->isDNSPrefetchEnabled()) {
if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//"))
prefetchDNS(document()->completeURL(parsedURL).host());
}
}
invalidateCachedVisitedLinkHash();
- } else if (attr->name() == nameAttr || attr->name() == titleAttr) {
+ } else if (attribute.name() == nameAttr || attribute.name() == titleAttr) {
// Do nothing.
- } else if (attr->name() == relAttr)
- setRel(attr->value());
+ } else if (attribute.name() == relAttr)
+ setRel(attribute.value());
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
void HTMLAnchorElement::accessKeyAction(bool sendMouseEvents)
protected:
HTMLAnchorElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
private:
virtual bool supportsFocus() const;
return adoptRef(new HTMLAppletElement(tagName, document));
}
-void HTMLAppletElement::parseAttribute(Attribute* attr)
+void HTMLAppletElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == altAttr ||
- attr->name() == archiveAttr ||
- attr->name() == codeAttr ||
- attr->name() == codebaseAttr ||
- attr->name() == mayscriptAttr ||
- attr->name() == objectAttr) {
+ if (attribute.name() == altAttr
+ || attribute.name() == archiveAttr
+ || attribute.name() == codeAttr
+ || attribute.name() == codebaseAttr
+ || attribute.name() == mayscriptAttr
+ || attribute.name() == objectAttr) {
// Do nothing.
} else
- HTMLPlugInElement::parseAttribute(attr);
+ HTMLPlugInElement::parseAttribute(attribute);
}
bool HTMLAppletElement::rendererIsNeeded(const NodeRenderingContext& context)
private:
HTMLAppletElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
return adoptRef(new HTMLAreaElement(tagName, document));
}
-void HTMLAreaElement::parseAttribute(Attribute* attr)
+void HTMLAreaElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == shapeAttr) {
- if (equalIgnoringCase(attr->value(), "default"))
+ if (attribute.name() == shapeAttr) {
+ if (equalIgnoringCase(attribute.value(), "default"))
m_shape = Default;
- else if (equalIgnoringCase(attr->value(), "circle"))
+ else if (equalIgnoringCase(attribute.value(), "circle"))
m_shape = Circle;
- else if (equalIgnoringCase(attr->value(), "poly"))
+ else if (equalIgnoringCase(attribute.value(), "poly"))
m_shape = Poly;
- else if (equalIgnoringCase(attr->value(), "rect"))
+ else if (equalIgnoringCase(attribute.value(), "rect"))
m_shape = Rect;
invalidateCachedRegion();
- } else if (attr->name() == coordsAttr) {
- m_coords = newCoordsArray(attr->value().string(), m_coordsLen);
+ } else if (attribute.name() == coordsAttr) {
+ m_coords = newCoordsArray(attribute.value().string(), m_coordsLen);
invalidateCachedRegion();
- } else if (attr->name() == altAttr || attr->name() == accesskeyAttr) {
+ } else if (attribute.name() == altAttr || attribute.name() == accesskeyAttr) {
// Do nothing.
} else
- HTMLAnchorElement::parseAttribute(attr);
+ HTMLAnchorElement::parseAttribute(attribute);
}
void HTMLAreaElement::invalidateCachedRegion()
private:
HTMLAreaElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool supportsFocus() const;
virtual String target() const;
virtual bool isKeyboardFocusable(KeyboardEvent*) const;
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLBRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLBRElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == clearAttr) {
+ if (attribute.name() == clearAttr) {
// If the string is empty, then don't add the clear property.
// <br clear> and <br clear=""> are just treated like <br> by Gecko, Mac IE, etc. -dwh
- if (!attr->isEmpty()) {
- if (equalIgnoringCase(attr->value(), "all"))
+ if (!attribute.isEmpty()) {
+ if (equalIgnoringCase(attribute.value(), "all"))
addPropertyToAttributeStyle(style, CSSPropertyClear, CSSValueBoth);
else
- addPropertyToAttributeStyle(style, CSSPropertyClear, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyClear, attribute.value());
}
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style)
HTMLBRElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
};
return adoptRef(new HTMLBaseElement(tagName, document));
}
-void HTMLBaseElement::parseAttribute(Attribute* attribute)
+void HTMLBaseElement::parseAttribute(const Attribute& attribute)
{
- if (attribute->name() == hrefAttr || attribute->name() == targetAttr)
+ if (attribute.name() == hrefAttr || attribute.name() == targetAttr)
document()->processBaseElement();
else
HTMLElement::parseAttribute(attribute);
virtual String target() const;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
};
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLBodyElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLBodyElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == backgroundAttr) {
- String url = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ if (attribute.name() == backgroundAttr) {
+ String url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (!url.isEmpty())
style->setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document()->completeURL(url).string())));
- } else if (attr->name() == marginwidthAttr || attr->name() == leftmarginAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- } else if (attr->name() == marginheightAttr || attr->name() == topmarginAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- } else if (attr->name() == bgcolorAttr) {
- addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attr->value());
- } else if (attr->name() == textAttr) {
- addHTMLColorToStyle(style, CSSPropertyColor, attr->value());
- } else if (attr->name() == bgpropertiesAttr) {
- if (equalIgnoringCase(attr->value(), "fixed"))
+ } else if (attribute.name() == marginwidthAttr || attribute.name() == leftmarginAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ } else if (attribute.name() == marginheightAttr || attribute.name() == topmarginAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ } else if (attribute.name() == bgcolorAttr) {
+ addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ } else if (attribute.name() == textAttr) {
+ addHTMLColorToStyle(style, CSSPropertyColor, attribute.value());
+ } else if (attribute.name() == bgpropertiesAttr) {
+ if (equalIgnoringCase(attribute.value(), "fixed"))
addPropertyToAttributeStyle(style, CSSPropertyBackgroundAttachment, CSSValueFixed);
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
-void HTMLBodyElement::parseAttribute(Attribute* attr)
+void HTMLBodyElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == vlinkAttr || attr->name() == alinkAttr || attr->name() == linkAttr) {
- if (attr->isNull()) {
- if (attr->name() == linkAttr)
+ if (attribute.name() == vlinkAttr || attribute.name() == alinkAttr || attribute.name() == linkAttr) {
+ if (attribute.isNull()) {
+ if (attribute.name() == linkAttr)
document()->resetLinkColor();
- else if (attr->name() == vlinkAttr)
+ else if (attribute.name() == vlinkAttr)
document()->resetVisitedLinkColor();
else
document()->resetActiveLinkColor();
} else {
RGBA32 color;
- if (CSSParser::parseColor(color, attr->value(), !document()->inQuirksMode())) {
- if (attr->name() == linkAttr)
+ if (CSSParser::parseColor(color, attribute.value(), !document()->inQuirksMode())) {
+ if (attribute.name() == linkAttr)
document()->setLinkColor(color);
- else if (attr->name() == vlinkAttr)
+ else if (attribute.name() == vlinkAttr)
document()->setVisitedLinkColor(color);
else
document()->setActiveLinkColor(color);
}
setNeedsStyleRecalc();
- } 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));
- else if (attr->name() == onunloadAttr)
- document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onpagehideAttr)
- document()->setWindowAttributeEventListener(eventNames().pagehideEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onpageshowAttr)
- document()->setWindowAttributeEventListener(eventNames().pageshowEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onpopstateAttr)
- document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onblurAttr)
- document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onfocusAttr)
- document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr));
+ } else if (attribute.name() == onloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onbeforeunloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onunloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onpagehideAttr)
+ document()->setWindowAttributeEventListener(eventNames().pagehideEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onpageshowAttr)
+ document()->setWindowAttributeEventListener(eventNames().pageshowEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onpopstateAttr)
+ document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onblurAttr)
+ document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onfocusAttr)
+ document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attribute));
#if ENABLE(ORIENTATION_EVENTS)
- else if (attr->name() == onorientationchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr));
+ else if (attribute.name() == onorientationchangeAttr)
+ document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attribute));
#endif
- else if (attr->name() == onhashchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onresizeAttr)
- document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onscrollAttr)
- document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onselectionchangeAttr)
- document()->setAttributeEventListener(eventNames().selectionchangeEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onstorageAttr)
- document()->setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == ononlineAttr)
- document()->setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onofflineAttr)
- document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attr));
+ else if (attribute.name() == onhashchangeAttr)
+ document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onresizeAttr)
+ document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onscrollAttr)
+ document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onselectionchangeAttr)
+ document()->setAttributeEventListener(eventNames().selectionchangeEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onstorageAttr)
+ document()->setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == ononlineAttr)
+ document()->setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onofflineAttr)
+ document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attribute));
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
Node::InsertionNotificationRequest HTMLBodyElement::insertedInto(Node* insertionPoint)
private:
HTMLBodyElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void didNotifyDescendantInseretions(Node*) OVERRIDE;
return HTMLFormControlElement::isPresentationAttribute(name);
}
-void HTMLButtonElement::parseAttribute(Attribute* attr)
+void HTMLButtonElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == typeAttr) {
- if (equalIgnoringCase(attr->value(), "reset"))
+ if (attribute.name() == typeAttr) {
+ if (equalIgnoringCase(attribute.value(), "reset"))
m_type = RESET;
- else if (equalIgnoringCase(attr->value(), "button"))
+ else if (equalIgnoringCase(attribute.value(), "button"))
m_type = BUTTON;
else
m_type = SUBMIT;
setNeedsWillValidateCheck();
} else
- HTMLFormControlElement::parseAttribute(attr);
+ HTMLFormControlElement::parseAttribute(attribute);
}
void HTMLButtonElement::defaultEventHandler(Event* event)
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
virtual void defaultEventHandler(Event*);
virtual bool appendFormData(FormDataList&, bool);
m_context.clear(); // Ensure this goes away before the ImageBuffer.
}
-void HTMLCanvasElement::parseAttribute(Attribute* attr)
+void HTMLCanvasElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attr->name();
- if (attrName == widthAttr || attrName == heightAttr)
+ if (attribute.name() == widthAttr || attribute.name() == heightAttr)
reset();
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
RenderObject* HTMLCanvasElement::createRenderer(RenderArena* arena, RenderStyle* style)
private:
HTMLCanvasElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
void reset();
return static_cast<DetailsSummaryElement*>(shadow()->oldestShadowRoot()->firstChild())->fallbackSummary();
}
-void HTMLDetailsElement::parseAttribute(Attribute* attr)
+void HTMLDetailsElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == openAttr) {
+ if (attribute.name() == openAttr) {
bool oldValue = m_isOpen;
- m_isOpen = !attr->value().isNull();
+ m_isOpen = !attribute.isNull();
if (oldValue != m_isOpen)
reattachIfAttached();
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
bool HTMLDetailsElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
void createShadowSubtree();
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLDivElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLDivElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == alignAttr) {
- if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
+ if (attribute.name() == alignAttr) {
+ if (equalIgnoringCase(attribute.value(), "middle") || equalIgnoringCase(attribute.value(), "center"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
- else if (equalIgnoringCase(attr->value(), "left"))
+ else if (equalIgnoringCase(attribute.value(), "left"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
- else if (equalIgnoringCase(attr->value(), "right"))
+ else if (equalIgnoringCase(attribute.value(), "right"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
else
- addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
private:
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace WebCore
return CSSValueWebkitIsolate;
}
-static unsigned parseBorderWidthAttribute(Attribute* attr)
+static unsigned parseBorderWidthAttribute(const Attribute& attribute)
{
- ASSERT(attr && attr->name() == borderAttr);
-
+ ASSERT(attribute.name() == borderAttr);
unsigned borderWidth = 0;
- if (!attr->value().isEmpty())
- parseHTMLNonNegativeInteger(attr->value(), borderWidth);
-
+ if (!attribute.isEmpty())
+ parseHTMLNonNegativeInteger(attribute.value(), borderWidth);
return borderWidth;
}
-void HTMLElement::applyBorderAttributeToStyle(Attribute* attr, StylePropertySet* style)
+void HTMLElement::applyBorderAttributeToStyle(const Attribute& attribute, StylePropertySet* style)
{
- addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(attr), CSSPrimitiveValue::CSS_PX);
+ addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, parseBorderWidthAttribute(attribute), CSSPrimitiveValue::CSS_PX);
addPropertyToAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
}
-void HTMLElement::mapLanguageAttributeToLocale(Attribute* attribute, StylePropertySet* style)
+void HTMLElement::mapLanguageAttributeToLocale(const Attribute& attribute, StylePropertySet* style)
{
- ASSERT(attribute && (attribute->name() == langAttr || attribute->name().matches(XMLNames::langAttr)));
- if (!attribute->isEmpty()) {
+ ASSERT((attribute.name() == langAttr || attribute.name().matches(XMLNames::langAttr)));
+ if (!attribute.isEmpty()) {
// Have to quote so the locale id is treated as a string instead of as a CSS keyword.
- addPropertyToAttributeStyle(style, CSSPropertyWebkitLocale, quoteCSSString(attribute->value()));
+ addPropertyToAttributeStyle(style, CSSPropertyWebkitLocale, quoteCSSString(attribute.value()));
} else {
// The empty string means the language is explicitly unknown.
addPropertyToAttributeStyle(style, CSSPropertyWebkitLocale, CSSValueAuto);
return StyledElement::isPresentationAttribute(name);
}
-void HTMLElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == alignAttr) {
- if (equalIgnoringCase(attr->value(), "middle"))
+ if (attribute.name() == alignAttr) {
+ if (equalIgnoringCase(attribute.value(), "middle"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
else
- addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attr->value());
- } else if (attr->name() == contenteditableAttr) {
- if (attr->isEmpty() || equalIgnoringCase(attr->value(), "true")) {
+ addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attribute.value());
+ } else if (attribute.name() == contenteditableAttr) {
+ if (attribute.isEmpty() || equalIgnoringCase(attribute.value(), "true")) {
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserModify, CSSValueReadWrite);
addPropertyToAttributeStyle(style, CSSPropertyWordWrap, CSSValueBreakWord);
addPropertyToAttributeStyle(style, CSSPropertyWebkitNbspMode, CSSValueSpace);
addPropertyToAttributeStyle(style, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace);
- } else if (equalIgnoringCase(attr->value(), "plaintext-only")) {
+ } else if (equalIgnoringCase(attribute.value(), "plaintext-only")) {
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserModify, CSSValueReadWritePlaintextOnly);
addPropertyToAttributeStyle(style, CSSPropertyWordWrap, CSSValueBreakWord);
addPropertyToAttributeStyle(style, CSSPropertyWebkitNbspMode, CSSValueSpace);
addPropertyToAttributeStyle(style, CSSPropertyWebkitLineBreak, CSSValueAfterWhiteSpace);
- } else if (equalIgnoringCase(attr->value(), "false"))
+ } else if (equalIgnoringCase(attribute.value(), "false"))
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserModify, CSSValueReadOnly);
- } else if (attr->name() == hiddenAttr) {
+ } else if (attribute.name() == hiddenAttr) {
addPropertyToAttributeStyle(style, CSSPropertyDisplay, CSSValueNone);
- } else if (attr->name() == draggableAttr) {
- if (equalIgnoringCase(attr->value(), "true")) {
+ } else if (attribute.name() == draggableAttr) {
+ if (equalIgnoringCase(attribute.value(), "true")) {
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueElement);
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserSelect, CSSValueNone);
- } else if (equalIgnoringCase(attr->value(), "false"))
+ } else if (equalIgnoringCase(attribute.value(), "false"))
addPropertyToAttributeStyle(style, CSSPropertyWebkitUserDrag, CSSValueNone);
- } else if (attr->name() == dirAttr) {
- if (equalIgnoringCase(attr->value(), "auto"))
+ } else if (attribute.name() == dirAttr) {
+ if (equalIgnoringCase(attribute.value(), "auto"))
addPropertyToAttributeStyle(style, CSSPropertyUnicodeBidi, unicodeBidiAttributeForDirAuto(this));
else {
- addPropertyToAttributeStyle(style, CSSPropertyDirection, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyDirection, attribute.value());
if (!hasTagName(bdiTag) && !hasTagName(bdoTag) && !hasTagName(outputTag))
addPropertyToAttributeStyle(style, CSSPropertyUnicodeBidi, CSSValueEmbed);
}
- } else if (attr->name().matches(XMLNames::langAttr)) {
- mapLanguageAttributeToLocale(attr, style);
- } else if (attr->name() == langAttr) {
+ } else if (attribute.name().matches(XMLNames::langAttr)) {
+ mapLanguageAttributeToLocale(attribute, style);
+ } else if (attribute.name() == langAttr) {
// xml:lang has a higher priority than lang.
if (!fastHasAttribute(XMLNames::langAttr))
- mapLanguageAttributeToLocale(attr, style);
+ mapLanguageAttributeToLocale(attribute, style);
} else
- StyledElement::collectStyleForAttribute(attr, style);
+ StyledElement::collectStyleForAttribute(attribute, style);
}
-void HTMLElement::parseAttribute(Attribute* attr)
+void HTMLElement::parseAttribute(const Attribute& attribute)
{
- if (isIdAttributeName(attr->name()) || attr->name() == classAttr || attr->name() == styleAttr)
- return StyledElement::parseAttribute(attr);
+ if (isIdAttributeName(attribute.name()) || attribute.name() == classAttr || attribute.name() == styleAttr)
+ return StyledElement::parseAttribute(attribute);
- if (attr->name() == dirAttr)
- dirAttributeChanged(attr);
- else if (attr->name() == tabindexAttr) {
+ if (attribute.name() == dirAttr)
+ dirAttributeChanged(attribute);
+ else if (attribute.name() == tabindexAttr) {
int tabindex = 0;
- if (attr->isEmpty())
+ if (attribute.isEmpty())
clearTabIndexExplicitly();
- else if (parseHTMLInteger(attr->value(), tabindex)) {
+ else if (parseHTMLInteger(attribute.value(), tabindex)) {
// 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()))));
}
#if ENABLE(MICRODATA)
- } else if (attr->name() == itempropAttr) {
- setItemProp(attr->value());
- } else if (attr->name() == itemrefAttr) {
- setItemRef(attr->value());
- } else if (attr->name() == itemtypeAttr) {
- setItemType(attr->value());
+ } else if (attribute.name() == itempropAttr) {
+ setItemProp(attribute.value());
+ } else if (attribute.name() == itemrefAttr) {
+ setItemRef(attribute.value());
+ } else if (attribute.name() == itemtypeAttr) {
+ setItemType(attribute.value());
#endif
}
// standard events
- else if (attr->name() == onclickAttr) {
- setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oncontextmenuAttr) {
- setAttributeEventListener(eventNames().contextmenuEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondblclickAttr) {
- setAttributeEventListener(eventNames().dblclickEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmousedownAttr) {
- setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmousemoveAttr) {
- setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmouseoutAttr) {
- setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmouseoverAttr) {
- setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmouseupAttr) {
- setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onmousewheelAttr) {
- setAttributeEventListener(eventNames().mousewheelEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onfocusAttr) {
- setAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onfocusinAttr) {
- setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onfocusoutAttr) {
- setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onblurAttr) {
- setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onkeydownAttr) {
- setAttributeEventListener(eventNames().keydownEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onkeypressAttr) {
- setAttributeEventListener(eventNames().keypressEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onkeyupAttr) {
- setAttributeEventListener(eventNames().keyupEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onscrollAttr) {
- setAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onbeforecutAttr) {
- setAttributeEventListener(eventNames().beforecutEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oncutAttr) {
- setAttributeEventListener(eventNames().cutEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onbeforecopyAttr) {
- setAttributeEventListener(eventNames().beforecopyEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oncopyAttr) {
- setAttributeEventListener(eventNames().copyEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onbeforepasteAttr) {
- setAttributeEventListener(eventNames().beforepasteEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onpasteAttr) {
- setAttributeEventListener(eventNames().pasteEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragenterAttr) {
- setAttributeEventListener(eventNames().dragenterEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragoverAttr) {
- setAttributeEventListener(eventNames().dragoverEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragleaveAttr) {
- setAttributeEventListener(eventNames().dragleaveEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondropAttr) {
- setAttributeEventListener(eventNames().dropEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragstartAttr) {
- setAttributeEventListener(eventNames().dragstartEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragAttr) {
- setAttributeEventListener(eventNames().dragEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ondragendAttr) {
- setAttributeEventListener(eventNames().dragendEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onselectstartAttr) {
- setAttributeEventListener(eventNames().selectstartEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onsubmitAttr) {
- setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onerrorAttr) {
- setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onwebkitanimationstartAttr) {
- setAttributeEventListener(eventNames().webkitAnimationStartEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onwebkitanimationiterationAttr) {
- setAttributeEventListener(eventNames().webkitAnimationIterationEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onwebkitanimationendAttr) {
- setAttributeEventListener(eventNames().webkitAnimationEndEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onwebkittransitionendAttr) {
- setAttributeEventListener(eventNames().webkitTransitionEndEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oninputAttr) {
- setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == oninvalidAttr) {
- setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ontouchstartAttr) {
- setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ontouchmoveAttr) {
- setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ontouchendAttr) {
- setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == ontouchcancelAttr) {
- setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attr));
+ else if (attribute.name() == onclickAttr) {
+ setAttributeEventListener(eventNames().clickEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == oncontextmenuAttr) {
+ setAttributeEventListener(eventNames().contextmenuEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondblclickAttr) {
+ setAttributeEventListener(eventNames().dblclickEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmousedownAttr) {
+ setAttributeEventListener(eventNames().mousedownEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmousemoveAttr) {
+ setAttributeEventListener(eventNames().mousemoveEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmouseoutAttr) {
+ setAttributeEventListener(eventNames().mouseoutEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmouseoverAttr) {
+ setAttributeEventListener(eventNames().mouseoverEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmouseupAttr) {
+ setAttributeEventListener(eventNames().mouseupEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onmousewheelAttr) {
+ setAttributeEventListener(eventNames().mousewheelEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onfocusAttr) {
+ setAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onfocusinAttr) {
+ setAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onfocusoutAttr) {
+ setAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onblurAttr) {
+ setAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onkeydownAttr) {
+ setAttributeEventListener(eventNames().keydownEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onkeypressAttr) {
+ setAttributeEventListener(eventNames().keypressEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onkeyupAttr) {
+ setAttributeEventListener(eventNames().keyupEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onscrollAttr) {
+ setAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onbeforecutAttr) {
+ setAttributeEventListener(eventNames().beforecutEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == oncutAttr) {
+ setAttributeEventListener(eventNames().cutEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onbeforecopyAttr) {
+ setAttributeEventListener(eventNames().beforecopyEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == oncopyAttr) {
+ setAttributeEventListener(eventNames().copyEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onbeforepasteAttr) {
+ setAttributeEventListener(eventNames().beforepasteEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onpasteAttr) {
+ setAttributeEventListener(eventNames().pasteEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragenterAttr) {
+ setAttributeEventListener(eventNames().dragenterEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragoverAttr) {
+ setAttributeEventListener(eventNames().dragoverEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragleaveAttr) {
+ setAttributeEventListener(eventNames().dragleaveEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondropAttr) {
+ setAttributeEventListener(eventNames().dropEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragstartAttr) {
+ setAttributeEventListener(eventNames().dragstartEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragAttr) {
+ setAttributeEventListener(eventNames().dragEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ondragendAttr) {
+ setAttributeEventListener(eventNames().dragendEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onselectstartAttr) {
+ setAttributeEventListener(eventNames().selectstartEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onsubmitAttr) {
+ setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onerrorAttr) {
+ setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onwebkitanimationstartAttr) {
+ setAttributeEventListener(eventNames().webkitAnimationStartEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onwebkitanimationiterationAttr) {
+ setAttributeEventListener(eventNames().webkitAnimationIterationEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onwebkitanimationendAttr) {
+ setAttributeEventListener(eventNames().webkitAnimationEndEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onwebkittransitionendAttr) {
+ setAttributeEventListener(eventNames().webkitTransitionEndEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == oninputAttr) {
+ setAttributeEventListener(eventNames().inputEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == oninvalidAttr) {
+ setAttributeEventListener(eventNames().invalidEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ontouchstartAttr) {
+ setAttributeEventListener(eventNames().touchstartEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ontouchmoveAttr) {
+ setAttributeEventListener(eventNames().touchmoveEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ontouchendAttr) {
+ setAttributeEventListener(eventNames().touchendEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == ontouchcancelAttr) {
+ setAttributeEventListener(eventNames().touchcancelEvent, createAttributeEventListener(this, attribute));
#if ENABLE(FULLSCREEN_API)
- } else if (attr->name() == onwebkitfullscreenchangeAttr) {
- setAttributeEventListener(eventNames().webkitfullscreenchangeEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == onwebkitfullscreenerrorAttr) {
- setAttributeEventListener(eventNames().webkitfullscreenerrorEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == onwebkitfullscreenchangeAttr) {
+ setAttributeEventListener(eventNames().webkitfullscreenchangeEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == onwebkitfullscreenerrorAttr) {
+ setAttributeEventListener(eventNames().webkitfullscreenerrorEvent, createAttributeEventListener(this, attribute));
#endif
}
}
insertAdjacent(where, textNode.get(), ec);
}
-void HTMLElement::applyAlignmentAttributeToStyle(Attribute* attr, StylePropertySet* style)
+void HTMLElement::applyAlignmentAttributeToStyle(const Attribute& attribute, StylePropertySet* style)
{
// Vertical alignment with respect to the current baseline of the text
// right or left means floating images.
int floatValue = CSSValueInvalid;
int verticalAlignValue = CSSValueInvalid;
- const AtomicString& alignment = attr->value();
+ const AtomicString& alignment = attribute.value();
if (equalIgnoringCase(alignment, "absmiddle"))
verticalAlignValue = CSSValueMiddle;
else if (equalIgnoringCase(alignment, "absbottom"))
return LTR;
}
-void HTMLElement::dirAttributeChanged(Attribute* attribute)
+void HTMLElement::dirAttributeChanged(const Attribute& attribute)
{
Element* parent = parentElement();
if (parent && parent->isHTMLElement() && parent->selfOrAncestorHasDirAutoAttribute())
toHTMLElement(parent)->adjustDirectionalityIfNeededAfterChildAttributeChanged(this);
- if (equalIgnoringCase(attribute->value(), "auto"))
+ if (equalIgnoringCase(attribute.value(), "auto"))
calculateAndAdjustDirectionality();
}
void addHTMLLengthToStyle(StylePropertySet*, CSSPropertyID, const String& value);
void addHTMLColorToStyle(StylePropertySet*, CSSPropertyID, const String& color);
- void applyAlignmentAttributeToStyle(Attribute*, StylePropertySet*);
- void applyBorderAttributeToStyle(Attribute*, StylePropertySet*);
+ void applyAlignmentAttributeToStyle(const Attribute&, StylePropertySet*);
+ void applyBorderAttributeToStyle(const Attribute&, StylePropertySet*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
void calculateAndAdjustDirectionality();
private:
virtual String nodeName() const;
- void mapLanguageAttributeToLocale(Attribute*, StylePropertySet*);
+ void mapLanguageAttributeToLocale(const Attribute&, StylePropertySet*);
virtual HTMLFormElement* virtualForm() const;
Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&);
PassRefPtr<DocumentFragment> textToFragment(const String&, ExceptionCode&);
- void dirAttributeChanged(Attribute*);
+ void dirAttributeChanged(const Attribute&);
void adjustDirectionalityIfNeededAfterChildAttributeChanged(Element* child);
void adjustDirectionalityIfNeededAfterChildrenChanged(Node* beforeChange, int childCountDelta);
TextDirection directionality(Node** strongDirectionalityTextNode= 0) const;
return HTMLPlugInImageElement::isPresentationAttribute(name);
}
-void HTMLEmbedElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLEmbedElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == hiddenAttr) {
- if (equalIgnoringCase(attr->value(), "yes") || equalIgnoringCase(attr->value(), "true")) {
+ if (attribute.name() == hiddenAttr) {
+ if (equalIgnoringCase(attribute.value(), "yes") || equalIgnoringCase(attribute.value(), "true")) {
addPropertyToAttributeStyle(style, CSSPropertyWidth, 0, CSSPrimitiveValue::CSS_PX);
addPropertyToAttributeStyle(style, CSSPropertyHeight, 0, CSSPrimitiveValue::CSS_PX);
}
} else
- HTMLPlugInImageElement::collectStyleForAttribute(attr, style);
+ HTMLPlugInImageElement::collectStyleForAttribute(attribute, style);
}
-void HTMLEmbedElement::parseAttribute(Attribute* attr)
+void HTMLEmbedElement::parseAttribute(const Attribute& attribute)
{
- const AtomicString& value = attr->value();
-
- if (attr->name() == typeAttr) {
- m_serviceType = value.string().lower();
+ if (attribute.name() == typeAttr) {
+ m_serviceType = attribute.value().string().lower();
size_t pos = m_serviceType.find(";");
if (pos != notFound)
m_serviceType = m_serviceType.left(pos);
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
- } else if (attr->name() == codeAttr)
- m_url = stripLeadingAndTrailingHTMLSpaces(value.string());
- else if (attr->name() == srcAttr) {
- m_url = stripLeadingAndTrailingHTMLSpaces(value.string());
+ } else if (attribute.name() == codeAttr)
+ m_url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
+ else if (attribute.name() == srcAttr) {
+ m_url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (renderer() && isImageType()) {
if (!m_imageLoader)
m_imageLoader = adoptPtr(new HTMLImageLoader(this));
m_imageLoader->updateFromElementIgnoringPreviousError();
}
} else
- HTMLPlugInImageElement::parseAttribute(attr);
+ HTMLPlugInImageElement::parseAttribute(attribute);
}
void HTMLEmbedElement::parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues)
private:
HTMLEmbedElement(const QualifiedName&, Document*, bool createdByParser);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual bool rendererIsNeeded(const NodeRenderingContext&);
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLFontElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLFontElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == sizeAttr) {
+ if (attribute.name() == sizeAttr) {
int size = 0;
- if (cssValueFromFontSizeNumber(attr->value(), size))
+ if (cssValueFromFontSizeNumber(attribute.value(), size))
addPropertyToAttributeStyle(style, CSSPropertyFontSize, size);
- } else if (attr->name() == colorAttr)
- addHTMLColorToStyle(style, CSSPropertyColor, attr->value());
- else if (attr->name() == faceAttr) {
- if (RefPtr<CSSValueList> fontFaceValue = cssValuePool().createFontFaceValue(attr->value()))
+ } else if (attribute.name() == colorAttr)
+ addHTMLColorToStyle(style, CSSPropertyColor, attribute.value());
+ else if (attribute.name() == faceAttr) {
+ if (RefPtr<CSSValueList> fontFaceValue = cssValuePool().createFontFaceValue(attribute.value()))
style->setProperty(CSSProperty(CSSPropertyFontFamily, fontFaceValue.release()));
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLFontElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace
m_fieldSetAncestorValid = true;
}
-void HTMLFormControlElement::parseAttribute(Attribute* attr)
+void HTMLFormControlElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == formAttr)
+ if (attribute.name() == formAttr)
formAttributeChanged();
- else if (attr->name() == disabledAttr) {
+ else if (attribute.name() == disabledAttr) {
bool oldDisabled = m_disabled;
- m_disabled = !attr->isNull();
+ m_disabled = !attribute.isNull();
if (oldDisabled != m_disabled)
disabledAttributeChanged();
- } else if (attr->name() == readonlyAttr) {
+ } else if (attribute.name() == readonlyAttr) {
bool oldReadOnly = m_readOnly;
- m_readOnly = !attr->isNull();
+ m_readOnly = !attribute.isNull();
if (oldReadOnly != m_readOnly) {
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
renderer()->theme()->stateChanged(renderer(), ReadOnlyState);
}
- } else if (attr->name() == requiredAttr) {
+ } else if (attribute.name() == requiredAttr) {
bool oldRequired = m_required;
- m_required = !attr->isNull();
+ m_required = !attribute.isNull();
if (oldRequired != m_required)
requiredAttributeChanged();
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
setNeedsWillValidateCheck();
}
protected:
HTMLFormControlElement(const QualifiedName& tagName, Document*, HTMLFormElement*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual void requiredAttributeChanged();
virtual void disabledAttributeChanged();
virtual void attach();
m_isInResetFunction = false;
}
-void HTMLFormElement::parseAttribute(Attribute* attr)
-{
- if (attr->name() == actionAttr)
- m_attributes.parseAction(attr->value());
- else if (attr->name() == targetAttr)
- m_attributes.setTarget(attr->value());
- else if (attr->name() == methodAttr)
- m_attributes.updateMethodType(attr->value());
- else if (attr->name() == enctypeAttr)
- m_attributes.updateEncodingType(attr->value());
- else if (attr->name() == accept_charsetAttr)
- m_attributes.setAcceptCharset(attr->value());
- else if (attr->name() == autocompleteAttr) {
+void HTMLFormElement::parseAttribute(const Attribute& attribute)
+{
+ if (attribute.name() == actionAttr)
+ m_attributes.parseAction(attribute.value());
+ else if (attribute.name() == targetAttr)
+ m_attributes.setTarget(attribute.value());
+ else if (attribute.name() == methodAttr)
+ m_attributes.updateMethodType(attribute.value());
+ else if (attribute.name() == enctypeAttr)
+ m_attributes.updateEncodingType(attribute.value());
+ else if (attribute.name() == accept_charsetAttr)
+ m_attributes.setAcceptCharset(attribute.value());
+ else if (attribute.name() == autocompleteAttr) {
if (!shouldAutocomplete())
document()->registerForPageCacheSuspensionCallbacks(this);
else
document()->unregisterForPageCacheSuspensionCallbacks(this);
- } else if (attr->name() == onsubmitAttr)
- setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onresetAttr)
- setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == onsubmitAttr)
+ setAttributeEventListener(eventNames().submitEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onresetAttr)
+ setAttributeEventListener(eventNames().resetEvent, createAttributeEventListener(this, attribute));
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
template<class T, size_t n> static void removeFromVector(Vector<T*, n> & vec, T* item)
virtual void handleLocalEvents(Event*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
virtual void documentDidResumeFromPageCache();
}
}
-void HTMLFrameElement::parseAttribute(Attribute* attr)
+void HTMLFrameElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == frameborderAttr) {
- m_frameBorder = attr->value().toInt();
- m_frameBorderSet = !attr->isNull();
+ if (attribute.name() == frameborderAttr) {
+ m_frameBorder = attribute.value().toInt();
+ m_frameBorderSet = !attribute.isNull();
// FIXME: If we are already attached, this has no effect.
- } else if (attr->name() == noresizeAttr) {
+ } else if (attribute.name() == noresizeAttr) {
if (renderer())
renderer()->updateFromElement();
} else
- HTMLFrameElementBase::parseAttribute(attr);
+ HTMLFrameElementBase::parseAttribute(attribute);
}
} // namespace WebCore
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
#if ENABLE(FULLSCREEN_API)
virtual bool allowFullScreen() const { return false; }
contentFrame()->setInViewSourceMode(viewSourceMode());
}
-void HTMLFrameElementBase::parseAttribute(Attribute* attr)
+void HTMLFrameElementBase::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == srcdocAttr)
+ if (attribute.name() == srcdocAttr)
setLocation("about:srcdoc");
- else if (attr->name() == srcAttr && !fastHasAttribute(srcdocAttr))
- setLocation(stripLeadingAndTrailingHTMLSpaces(attr->value()));
- else if (isIdAttributeName(attr->name())) {
+ else if (attribute.name() == srcAttr && !fastHasAttribute(srcdocAttr))
+ setLocation(stripLeadingAndTrailingHTMLSpaces(attribute.value()));
+ else if (isIdAttributeName(attribute.name())) {
// Important to call through to base for the id attribute so the hasID bit gets set.
- HTMLFrameOwnerElement::parseAttribute(attr);
- m_frameName = attr->value();
- } else if (attr->name() == nameAttr) {
- m_frameName = attr->value();
+ HTMLFrameOwnerElement::parseAttribute(attribute);
+ m_frameName = attribute.value();
+ } else if (attribute.name() == nameAttr) {
+ m_frameName = attribute.value();
// FIXME: If we are already attached, this doesn't actually change the frame's name.
// FIXME: If we are already attached, this doesn't check for frame name
// conflicts and generate a unique frame name.
- } else if (attr->name() == marginwidthAttr) {
- m_marginWidth = attr->value().toInt();
+ } else if (attribute.name() == marginwidthAttr) {
+ m_marginWidth = attribute.value().toInt();
// FIXME: If we are already attached, this has no effect.
- } else if (attr->name() == marginheightAttr) {
- m_marginHeight = attr->value().toInt();
+ } else if (attribute.name() == marginheightAttr) {
+ m_marginHeight = attribute.value().toInt();
// FIXME: If we are already attached, this has no effect.
- } else if (attr->name() == scrollingAttr) {
+ } else if (attribute.name() == scrollingAttr) {
// Auto and yes both simply mean "allow scrolling." No means "don't allow scrolling."
- if (equalIgnoringCase(attr->value(), "auto") || equalIgnoringCase(attr->value(), "yes"))
+ if (equalIgnoringCase(attribute.value(), "auto") || equalIgnoringCase(attribute.value(), "yes"))
m_scrolling = document()->frameElementsShouldIgnoreScrolling() ? ScrollbarAlwaysOff : ScrollbarAuto;
- else if (equalIgnoringCase(attr->value(), "no"))
+ else if (equalIgnoringCase(attribute.value(), "no"))
m_scrolling = ScrollbarAlwaysOff;
// FIXME: If we are already attached, this has no effect.
- } else if (attr->name() == viewsourceAttr) {
- m_viewSource = !attr->isNull();
+ } else if (attribute.name() == viewsourceAttr) {
+ m_viewSource = !attribute.isNull();
if (contentFrame())
contentFrame()->setInViewSourceMode(viewSourceMode());
- } else if (attr->name() == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onbeforeunloadAttr) {
+ } else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeunloadAttr) {
// FIXME: should <frame> elements have beforeunload handlers?
- setAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(this, attr));
+ setAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(this, attribute));
} else
- HTMLFrameOwnerElement::parseAttribute(attr);
+ HTMLFrameOwnerElement::parseAttribute(attribute);
}
void HTMLFrameElementBase::setNameAndOpenURL()
bool isURLAllowed() const;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void didNotifyDescendantInseretions(Node*) OVERRIDE;
virtual void attach();
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLFrameSetElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLFrameSetElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == bordercolorAttr)
- addHTMLColorToStyle(style, CSSPropertyBorderColor, attr->value());
+ if (attribute.name() == bordercolorAttr)
+ addHTMLColorToStyle(style, CSSPropertyBorderColor, attribute.value());
else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
-void HTMLFrameSetElement::parseAttribute(Attribute* attr)
+void HTMLFrameSetElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == rowsAttr) {
- if (!attr->isNull()) {
- m_rowLengths = newLengthArray(attr->value().string(), m_totalRows);
+ if (attribute.name() == rowsAttr) {
+ if (!attribute.isNull()) {
+ m_rowLengths = newLengthArray(attribute.value().string(), m_totalRows);
setNeedsStyleRecalc();
}
- } else if (attr->name() == colsAttr) {
- if (!attr->isNull()) {
- m_colLengths = newLengthArray(attr->value().string(), m_totalCols);
+ } else if (attribute.name() == colsAttr) {
+ if (!attribute.isNull()) {
+ m_colLengths = newLengthArray(attribute.value().string(), m_totalCols);
setNeedsStyleRecalc();
}
- } else if (attr->name() == frameborderAttr) {
- if (!attr->isNull()) {
+ } else if (attribute.name() == frameborderAttr) {
+ if (!attribute.isNull()) {
// false or "no" or "0"..
- if (attr->value().toInt() == 0) {
+ if (attribute.value().toInt() == 0) {
m_frameborder = false;
m_border = 0;
}
m_frameborder = false;
m_frameborderSet = false;
}
- } else if (attr->name() == noresizeAttr) {
+ } else if (attribute.name() == noresizeAttr) {
m_noresize = true;
- } else if (attr->name() == borderAttr) {
- if (!attr->isNull()) {
- m_border = attr->value().toInt();
+ } else if (attribute.name() == borderAttr) {
+ if (!attribute.isNull()) {
+ m_border = attribute.value().toInt();
if (!m_border)
m_frameborder = false;
m_borderSet = true;
} else
m_borderSet = false;
- } else if (attr->name() == bordercolorAttr)
- m_borderColorSet = !attr->isEmpty();
- 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));
- else if (attr->name() == onunloadAttr)
- document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onblurAttr)
- document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onfocusAttr)
- document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onfocusinAttr)
- document()->setWindowAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onfocusoutAttr)
- document()->setWindowAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(document()->frame(), attr));
+ } else if (attribute.name() == bordercolorAttr)
+ m_borderColorSet = !attribute.isEmpty();
+ else if (attribute.name() == onloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onbeforeunloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().beforeunloadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onunloadAttr)
+ document()->setWindowAttributeEventListener(eventNames().unloadEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onblurAttr)
+ document()->setWindowAttributeEventListener(eventNames().blurEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onfocusAttr)
+ document()->setWindowAttributeEventListener(eventNames().focusEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onfocusinAttr)
+ document()->setWindowAttributeEventListener(eventNames().focusinEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onfocusoutAttr)
+ document()->setWindowAttributeEventListener(eventNames().focusoutEvent, createAttributeEventListener(document()->frame(), attribute));
#if ENABLE(ORIENTATION_EVENTS)
- else if (attr->name() == onorientationchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attr));
+ else if (attribute.name() == onorientationchangeAttr)
+ document()->setWindowAttributeEventListener(eventNames().orientationchangeEvent, createAttributeEventListener(document()->frame(), attribute));
#endif
- else if (attr->name() == onhashchangeAttr)
- document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onresizeAttr)
- document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onscrollAttr)
- document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onstorageAttr)
- document()->setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == ononlineAttr)
- document()->setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onofflineAttr)
- document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attr));
- else if (attr->name() == onpopstateAttr)
- document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attr));
+ else if (attribute.name() == onhashchangeAttr)
+ document()->setWindowAttributeEventListener(eventNames().hashchangeEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onresizeAttr)
+ document()->setWindowAttributeEventListener(eventNames().resizeEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onscrollAttr)
+ document()->setWindowAttributeEventListener(eventNames().scrollEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onstorageAttr)
+ document()->setWindowAttributeEventListener(eventNames().storageEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == ononlineAttr)
+ document()->setWindowAttributeEventListener(eventNames().onlineEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onofflineAttr)
+ document()->setWindowAttributeEventListener(eventNames().offlineEvent, createAttributeEventListener(document()->frame(), attribute));
+ else if (attribute.name() == onpopstateAttr)
+ document()->setWindowAttributeEventListener(eventNames().popstateEvent, createAttributeEventListener(document()->frame(), attribute));
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
bool HTMLFrameSetElement::rendererIsNeeded(const NodeRenderingContext& context)
private:
HTMLFrameSetElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual void attach();
virtual bool rendererIsNeeded(const NodeRenderingContext&);
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLHRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLHRElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == alignAttr) {
- if (equalIgnoringCase(attr->value(), "left")) {
+ if (attribute.name() == alignAttr) {
+ if (equalIgnoringCase(attribute.value(), "left")) {
addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, 0, CSSPrimitiveValue::CSS_PX);
addPropertyToAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
- } else if (equalIgnoringCase(attr->value(), "right")) {
+ } else if (equalIgnoringCase(attribute.value(), "right")) {
addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
addPropertyToAttributeStyle(style, CSSPropertyMarginRight, 0, CSSPrimitiveValue::CSS_PX);
} else {
addPropertyToAttributeStyle(style, CSSPropertyMarginLeft, CSSValueAuto);
addPropertyToAttributeStyle(style, CSSPropertyMarginRight, CSSValueAuto);
}
- } else if (attr->name() == widthAttr) {
+ } else if (attribute.name() == widthAttr) {
bool ok;
- int v = attr->value().toInt(&ok);
+ int v = attribute.value().toInt(&ok);
if (ok && !v)
addPropertyToAttributeStyle(style, CSSPropertyWidth, 1, CSSPrimitiveValue::CSS_PX);
else
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- } else if (attr->name() == colorAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ } else if (attribute.name() == colorAttr) {
addPropertyToAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
- addHTMLColorToStyle(style, CSSPropertyBorderColor, attr->value());
- addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attr->value());
- } else if (attr->name() == noshadeAttr) {
+ addHTMLColorToStyle(style, CSSPropertyBorderColor, attribute.value());
+ addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ } else if (attribute.name() == noshadeAttr) {
addPropertyToAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
RefPtr<CSSPrimitiveValue> darkGrayValue = cssValuePool().createColorValue(Color::darkGray);
style->setProperty(CSSPropertyBorderColor, darkGrayValue);
style->setProperty(CSSPropertyBackgroundColor, darkGrayValue);
- } else if (attr->name() == sizeAttr) {
- StringImpl* si = attr->value().impl();
+ } else if (attribute.name() == sizeAttr) {
+ StringImpl* si = attribute.value().impl();
int size = si->toInt();
if (size <= 1)
addPropertyToAttributeStyle(style, CSSPropertyBorderBottomWidth, 0, CSSPrimitiveValue::CSS_PX);
else
addPropertyToAttributeStyle(style, CSSPropertyHeight, size - 2, CSSPrimitiveValue::CSS_PX);
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLHRElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace WebCore
return HTMLFrameElementBase::isPresentationAttribute(name);
}
-void HTMLIFrameElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLIFrameElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- else if (attr->name() == heightAttr)
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- else if (attr->name() == alignAttr)
- applyAlignmentAttributeToStyle(attr, style);
- else if (attr->name() == frameborderAttr) {
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ else if (attribute.name() == heightAttr)
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ else if (attribute.name() == alignAttr)
+ applyAlignmentAttributeToStyle(attribute, style);
+ else if (attribute.name() == frameborderAttr) {
// Frame border doesn't really match the HTML4 spec definition for iframes. It simply adds
// a presentational hint that the border should be off if set to zero.
- if (!attr->isNull() && !attr->value().toInt()) {
+ if (!attribute.isNull() && !attribute.value().toInt()) {
// Add a rule that nulls out our border width.
addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::CSS_PX);
}
} else
- HTMLFrameElementBase::collectStyleForAttribute(attr, style);
+ HTMLFrameElementBase::collectStyleForAttribute(attribute, style);
}
-void HTMLIFrameElement::parseAttribute(Attribute* attr)
+void HTMLIFrameElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == nameAttr) {
- const AtomicString& newName = attr->value();
+ if (attribute.name() == nameAttr) {
+ const AtomicString& newName = attribute.value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
document->removeExtraNamedItem(m_name);
document->addExtraNamedItem(newName);
}
m_name = newName;
- } else if (attr->name() == sandboxAttr)
- setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value()));
- else if (attr->name() == seamlessAttr) {
+ } else if (attribute.name() == sandboxAttr)
+ setSandboxFlags(attribute.isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attribute.value()));
+ else if (attribute.name() == seamlessAttr) {
// If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
if (contentDocument())
contentDocument()->styleResolverChanged(DeferRecalcStyle);
} else
- HTMLFrameElementBase::parseAttribute(attr);
+ HTMLFrameElementBase::parseAttribute(attribute);
}
bool HTMLIFrameElement::rendererIsNeeded(const NodeRenderingContext& context)
private:
HTMLIFrameElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLImageElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
-{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- else if (attr->name() == heightAttr)
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- else if (attr->name() == borderAttr)
- applyBorderAttributeToStyle(attr, style);
- else if (attr->name() == vspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
- } else if (attr->name() == hspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
- } else if (attr->name() == alignAttr)
- applyAlignmentAttributeToStyle(attr, style);
- else if (attr->name() == valignAttr)
- addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attr->value());
+void HTMLImageElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
+{
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ else if (attribute.name() == heightAttr)
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ else if (attribute.name() == borderAttr)
+ applyBorderAttributeToStyle(attribute, style);
+ else if (attribute.name() == vspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
+ } else if (attribute.name() == hspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
+ } else if (attribute.name() == alignAttr)
+ applyAlignmentAttributeToStyle(attribute, style);
+ else if (attribute.name() == valignAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attribute.value());
else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
-void HTMLImageElement::parseAttribute(Attribute* attr)
+void HTMLImageElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attr->name();
- if (attrName == altAttr) {
+ if (attribute.name() == altAttr) {
if (renderer() && renderer()->isImage())
toRenderImage(renderer())->updateAltText();
- } else if (attrName == srcAttr)
+ } else if (attribute.name() == srcAttr)
m_imageLoader.updateFromElementIgnoringPreviousError();
- else if (attrName == usemapAttr)
- setIsLink(!attr->isNull());
- else if (attrName == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attrName == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attrName == compositeAttr) {
- if (!parseCompositeOperator(attr->value(), m_compositeOperator))
+ else if (attribute.name() == usemapAttr)
+ setIsLink(!attribute.isNull());
+ else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == compositeAttr) {
+ if (!parseCompositeOperator(attribute.value(), m_compositeOperator))
m_compositeOperator = CompositeSourceOver;
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
String HTMLImageElement::altText() const
virtual void didMoveToNewDocument(Document* oldDocument) OVERRIDE;
private:
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual void attach();
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
if (didRespectHeightAndWidth != m_inputType->shouldRespectHeightAndWidthAttributes()) {
ASSERT(attributeData());
if (Attribute* height = getAttributeItem(heightAttr))
- attributeChanged(height);
+ attributeChanged(*height);
if (Attribute* width = getAttributeItem(widthAttr))
- attributeChanged(width);
+ attributeChanged(*width);
if (Attribute* align = getAttributeItem(alignAttr))
- attributeChanged(align);
+ attributeChanged(*align);
}
if (wasAttached) {
return HTMLTextFormControlElement::isPresentationAttribute(name);
}
-void HTMLInputElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLInputElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == vspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
- } else if (attr->name() == hspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
- } else if (attr->name() == alignAttr) {
+ if (attribute.name() == vspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
+ } else if (attribute.name() == hspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
+ } else if (attribute.name() == alignAttr) {
if (m_inputType->shouldRespectAlignAttribute())
- applyAlignmentAttributeToStyle(attr, style);
- } else if (attr->name() == widthAttr) {
+ applyAlignmentAttributeToStyle(attribute, style);
+ } else if (attribute.name() == widthAttr) {
if (m_inputType->shouldRespectHeightAndWidthAttributes())
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- } else if (attr->name() == heightAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ } else if (attribute.name() == heightAttr) {
if (m_inputType->shouldRespectHeightAndWidthAttributes())
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- } else if (attr->name() == borderAttr && isImageButton())
- applyBorderAttributeToStyle(attr, style);
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ } else if (attribute.name() == borderAttr && isImageButton())
+ applyBorderAttributeToStyle(attribute, style);
else
- return HTMLTextFormControlElement::collectStyleForAttribute(attr, style);
+ return HTMLTextFormControlElement::collectStyleForAttribute(attribute, style);
}
-void HTMLInputElement::parseAttribute(Attribute* attr)
+void HTMLInputElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == nameAttr) {
+ if (attribute.name() == nameAttr) {
removeFromRadioButtonGroup();
- m_name = attr->value();
+ m_name = attribute.value();
addToRadioButtonGroup();
- HTMLTextFormControlElement::parseAttribute(attr);
- } else if (attr->name() == autocompleteAttr) {
- if (equalIgnoringCase(attr->value(), "off")) {
+ HTMLTextFormControlElement::parseAttribute(attribute);
+ } else if (attribute.name() == autocompleteAttr) {
+ if (equalIgnoringCase(attribute.value(), "off")) {
m_autocomplete = Off;
registerForSuspensionCallbackIfNeeded();
} else {
bool needsToUnregister = m_autocomplete == Off;
- if (attr->isEmpty())
+ if (attribute.isEmpty())
m_autocomplete = Uninitialized;
else
m_autocomplete = On;
if (needsToUnregister)
unregisterForSuspensionCallbackIfNeeded();
}
- } else if (attr->name() == typeAttr) {
+ } else if (attribute.name() == typeAttr) {
updateType();
- } else if (attr->name() == valueAttr) {
+ } else if (attribute.name() == valueAttr) {
// We only need to setChanged if the form is looking at the default value right now.
if (!hasDirtyValue()) {
updatePlaceholderVisibility(false);
}
setFormControlValueMatchesRenderer(false);
setNeedsValidityCheck();
- } else if (attr->name() == checkedAttr) {
+ } else if (attribute.name() == checkedAttr) {
// Another radio button in the same group might be checked by state
// restore. We shouldn't call setChecked() even if this has the checked
// attribute. So, delay the setChecked() call until
// finishParsingChildren() is called if parsing is in progress.
if (!m_parsingInProgress && m_reflectsCheckedAttribute) {
- setChecked(!attr->isNull());
+ setChecked(!attribute.isNull());
m_reflectsCheckedAttribute = true;
}
- } else if (attr->name() == maxlengthAttr)
- parseMaxLengthAttribute(attr);
- else if (attr->name() == sizeAttr) {
+ } else if (attribute.name() == maxlengthAttr)
+ parseMaxLengthAttribute(attribute);
+ else if (attribute.name() == sizeAttr) {
int oldSize = m_size;
- int value = attr->value().toInt();
+ int value = attribute.value().toInt();
m_size = value > 0 ? value : defaultSize;
if (m_size != oldSize && renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
- } else if (attr->name() == altAttr)
+ } else if (attribute.name() == altAttr)
m_inputType->altAttributeChanged();
- else if (attr->name() == srcAttr)
+ else if (attribute.name() == srcAttr)
m_inputType->srcAttributeChanged();
- else if (attr->name() == usemapAttr || attr->name() == accesskeyAttr) {
+ else if (attribute.name() == usemapAttr || attribute.name() == accesskeyAttr) {
// FIXME: ignore for the moment
- } else if (attr->name() == onsearchAttr) {
+ } else if (attribute.name() == onsearchAttr) {
// Search field and slider attributes all just cause updateFromElement to be called through style recalcing.
- setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, attr));
- } else if (attr->name() == resultsAttr) {
+ setAttributeEventListener(eventNames().searchEvent, createAttributeEventListener(this, attribute));
+ } else if (attribute.name() == resultsAttr) {
int oldResults = m_maxResults;
- m_maxResults = !attr->isNull() ? std::min(attr->value().toInt(), maxSavedResults) : -1;
+ m_maxResults = !attribute.isNull() ? std::min(attribute.value().toInt(), maxSavedResults) : -1;
// FIXME: Detaching just for maxResults change is not ideal. We should figure out the right
// time to relayout for this change.
if (m_maxResults != oldResults && (m_maxResults <= 0 || oldResults <= 0))
reattachIfAttached();
setNeedsStyleRecalc();
- } else if (attr->name() == autosaveAttr || attr->name() == incrementalAttr)
+ } else if (attribute.name() == autosaveAttr || attribute.name() == incrementalAttr)
setNeedsStyleRecalc();
- else if (attr->name() == minAttr || attr->name() == maxAttr) {
+ else if (attribute.name() == minAttr || attribute.name() == maxAttr) {
m_inputType->minOrMaxAttributeChanged();
setNeedsValidityCheck();
- } else if (attr->name() == multipleAttr) {
+ } else if (attribute.name() == multipleAttr) {
m_inputType->multipleAttributeChanged();
setNeedsValidityCheck();
- } else if (attr->name() == stepAttr) {
+ } else if (attribute.name() == stepAttr) {
m_inputType->stepAttributeChanged();
setNeedsValidityCheck();
- } else if (attr->name() == patternAttr || attr->name() == precisionAttr)
+ } else if (attribute.name() == patternAttr || attribute.name() == precisionAttr)
setNeedsValidityCheck();
- else if (attr->name() == disabledAttr) {
- HTMLTextFormControlElement::parseAttribute(attr);
+ else if (attribute.name() == disabledAttr) {
+ HTMLTextFormControlElement::parseAttribute(attribute);
m_inputType->disabledAttributeChanged();
- } else if (attr->name() == readonlyAttr) {
- HTMLTextFormControlElement::parseAttribute(attr);
+ } else if (attribute.name() == readonlyAttr) {
+ HTMLTextFormControlElement::parseAttribute(attribute);
m_inputType->readonlyAttributeChanged();
}
#if ENABLE(DATALIST)
- else if (attr->name() == listAttr)
- m_hasNonEmptyList = !attr->isEmpty();
+ else if (attribute.name() == listAttr)
+ m_hasNonEmptyList = !attribute.isEmpty();
// FIXME: we need to tell this change to a renderer if the attribute affects the appearance.
#endif
#if ENABLE(INPUT_SPEECH)
- else if (attr->name() == webkitspeechAttr) {
+ else if (attribute.name() == webkitspeechAttr) {
if (renderer()) {
// This renderer and its children have quite different layouts and styles depending on
// whether the speech button is visible or not. So we reset the whole thing and recreate
}
setFormControlValueMatchesRenderer(false);
setNeedsStyleRecalc();
- } else if (attr->name() == onwebkitspeechchangeAttr)
- setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == onwebkitspeechchangeAttr)
+ setAttributeEventListener(eventNames().webkitspeechchangeEvent, createAttributeEventListener(this, attribute));
#endif
else
- HTMLTextFormControlElement::parseAttribute(attr);
+ HTMLTextFormControlElement::parseAttribute(attribute);
updateInnerTextValue();
}
return m_inputType->updatePlaceholderText();
}
-void HTMLInputElement::parseMaxLengthAttribute(Attribute* attribute)
+void HTMLInputElement::parseMaxLengthAttribute(const Attribute& attribute)
{
int maxLength;
- if (!parseHTMLInteger(attribute->value(), maxLength))
+ if (!parseHTMLInteger(attribute.value(), maxLength))
maxLength = maximumLength;
if (maxLength < 0 || maxLength > maximumLength)
maxLength = maximumLength;
virtual void accessKeyAction(bool sendMouseEvents);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual void finishParsingChildren();
virtual void copyNonAttributeProperties(const Element* source);
#if ENABLE(DATALIST)
HTMLDataListElement* dataList() const;
#endif
- void parseMaxLengthAttribute(Attribute*);
+ void parseMaxLengthAttribute(const Attribute&);
void updateValueIfNeeded();
// Returns null if this isn't associated with any radio button group.
return adoptRef(new HTMLKeygenElement(tagName, document, form));
}
-void HTMLKeygenElement::parseAttribute(Attribute* attr)
+void HTMLKeygenElement::parseAttribute(const Attribute& attribute)
{
// Reflect disabled attribute on the shadow select element
- if (attr->name() == disabledAttr)
- shadowSelect()->setAttribute(attr->name(), attr->value());
+ if (attribute.name() == disabledAttr)
+ shadowSelect()->setAttribute(attribute.name(), attribute.value());
- HTMLFormControlElement::parseAttribute(attr);
+ HTMLFormControlElement::parseAttribute(attribute);
}
bool HTMLKeygenElement::appendFormData(FormDataList& encoded_values, bool)
virtual bool canStartSelection() const { return false; }
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool appendFormData(FormDataList&, bool);
virtual const AtomicString& formControlType() const;
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLLIElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLLIElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == typeAttr) {
- if (attr->value() == "a")
+ if (attribute.name() == typeAttr) {
+ if (attribute.value() == "a")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueLowerAlpha);
- else if (attr->value() == "A")
+ else if (attribute.value() == "A")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueUpperAlpha);
- else if (attr->value() == "i")
+ else if (attribute.value() == "i")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueLowerRoman);
- else if (attr->value() == "I")
+ else if (attribute.value() == "I")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueUpperRoman);
- else if (attr->value() == "1")
+ else if (attribute.value() == "1")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueDecimal);
else
- addPropertyToAttributeStyle(style, CSSPropertyListStyleType, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyListStyleType, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
-void HTMLLIElement::parseAttribute(Attribute* attr)
+void HTMLLIElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == valueAttr) {
+ if (attribute.name() == valueAttr) {
if (renderer() && renderer()->isListItem())
- parseValue(attr->value());
+ parseValue(attribute.value());
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
void HTMLLIElement::attach()
private:
HTMLLIElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual void attach();
}
}
-void HTMLLinkElement::parseAttribute(Attribute* attr)
+void HTMLLinkElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == relAttr) {
- m_relAttribute = LinkRelAttribute(attr->value());
+ if (attribute.name() == relAttr) {
+ m_relAttribute = LinkRelAttribute(attribute.value());
process();
- } else if (attr->name() == hrefAttr) {
- String url = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ } else if (attribute.name() == hrefAttr) {
+ String url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
m_url = url.isEmpty() ? KURL() : document()->completeURL(url);
process();
- } else if (attr->name() == typeAttr) {
- m_type = attr->value();
+ } else if (attribute.name() == typeAttr) {
+ m_type = attribute.value();
process();
- } else if (attr->name() == sizesAttr) {
- setSizes(attr->value());
+ } else if (attribute.name() == sizesAttr) {
+ setSizes(attribute.value());
process();
- } else if (attr->name() == mediaAttr) {
- m_media = attr->value().string().lower();
+ } else if (attribute.name() == mediaAttr) {
+ m_media = attribute.value().string().lower();
process();
- } else if (attr->name() == disabledAttr)
- setDisabledState(!attr->isNull());
- else if (attr->name() == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onerrorAttr)
- setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == disabledAttr)
+ setDisabledState(!attribute.isNull());
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onerrorAttr)
+ setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
else {
- if (attr->name() == titleAttr && m_sheet)
- m_sheet->setTitle(attr->value());
- HTMLElement::parseAttribute(attr);
+ if (attribute.name() == titleAttr && m_sheet)
+ m_sheet->setTitle(attribute.value());
+ HTMLElement::parseAttribute(attribute);
}
}
static void dispatchPendingLoadEvents();
private:
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool shouldLoadLink();
void process();
return 0;
}
-void HTMLMapElement::parseAttribute(Attribute* attribute)
+void HTMLMapElement::parseAttribute(const Attribute& attribute)
{
// FIXME: This logic seems wrong for XML documents.
// Either the id or name will be used depending on the order the attributes are parsed.
- const QualifiedName& attrName = attribute->name();
- if (isIdAttributeName(attrName) || attrName == nameAttr) {
- if (isIdAttributeName(attrName)) {
+ if (isIdAttributeName(attribute.name()) || attribute.name() == nameAttr) {
+ if (isIdAttributeName(attribute.name())) {
// Call base class so that hasID bit gets set.
HTMLElement::parseAttribute(attribute);
if (document()->isHTMLDocument())
}
if (inDocument())
treeScope()->removeImageMap(this);
- String mapName = attribute->value();
+ String mapName = attribute.value();
if (mapName[0] == '#')
mapName = mapName.substring(1);
m_name = document()->isHTMLDocument() ? mapName.lower() : mapName;
private:
HTMLMapElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLMarqueeElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
-{
- if (attr->name() == widthAttr) {
- if (!attr->isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- } else if (attr->name() == heightAttr) {
- if (!attr->value().isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- } else if (attr->name() == bgcolorAttr) {
- if (!attr->value().isEmpty())
- addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attr->value());
- } else if (attr->name() == vspaceAttr) {
- if (!attr->value().isEmpty()) {
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
+void HTMLMarqueeElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
+{
+ if (attribute.name() == widthAttr) {
+ if (!attribute.isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ } else if (attribute.name() == heightAttr) {
+ if (!attribute.isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ } else if (attribute.name() == bgcolorAttr) {
+ if (!attribute.isEmpty())
+ addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ } else if (attribute.name() == vspaceAttr) {
+ if (!attribute.isEmpty()) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
}
- } else if (attr->name() == hspaceAttr) {
- if (!attr->value().isEmpty()) {
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
+ } else if (attribute.name() == hspaceAttr) {
+ if (!attribute.isEmpty()) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
}
- } else if (attr->name() == scrollamountAttr) {
- if (!attr->value().isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeIncrement, attr->value());
- } else if (attr->name() == scrolldelayAttr) {
- if (!attr->value().isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeSpeed, attr->value());
- } else if (attr->name() == loopAttr) {
- if (!attr->value().isEmpty()) {
- if (attr->value() == "-1" || equalIgnoringCase(attr->value(), "infinite"))
+ } else if (attribute.name() == scrollamountAttr) {
+ if (!attribute.isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeIncrement, attribute.value());
+ } else if (attribute.name() == scrolldelayAttr) {
+ if (!attribute.isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeSpeed, attribute.value());
+ } else if (attribute.name() == loopAttr) {
+ if (!attribute.isEmpty()) {
+ if (attribute.value() == "-1" || equalIgnoringCase(attribute.value(), "infinite"))
addPropertyToAttributeStyle(style, CSSPropertyWebkitMarqueeRepetition, CSSValueInfinite);
else
- addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeRepetition, attr->value());
+ addHTMLLengthToStyle(style, CSSPropertyWebkitMarqueeRepetition, attribute.value());
}
- } else if (attr->name() == behaviorAttr) {
- if (!attr->value().isEmpty())
- addPropertyToAttributeStyle(style, CSSPropertyWebkitMarqueeStyle, attr->value());
- } else if (attr->name() == directionAttr) {
- if (!attr->value().isEmpty())
- addPropertyToAttributeStyle(style, CSSPropertyWebkitMarqueeDirection, attr->value());
+ } else if (attribute.name() == behaviorAttr) {
+ if (!attribute.isEmpty())
+ addPropertyToAttributeStyle(style, CSSPropertyWebkitMarqueeStyle, attribute.value());
+ } else if (attribute.name() == directionAttr) {
+ if (!attribute.isEmpty())
+ addPropertyToAttributeStyle(style, CSSPropertyWebkitMarqueeDirection, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
void HTMLMarqueeElement::start()
HTMLMarqueeElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
// ActiveDOMObject
virtual bool canSuspend() const;
return false;
}
-void HTMLMediaElement::parseAttribute(Attribute* attr)
+void HTMLMediaElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attr->name();
-
- if (attrName == srcAttr) {
+ if (attribute.name() == srcAttr) {
// Trigger a reload, as long as the 'src' attribute is present.
if (fastHasAttribute(srcAttr))
scheduleLoad(MediaResource);
- } else if (attrName == controlsAttr)
+ } else if (attribute.name() == controlsAttr)
configureMediaControls();
#if PLATFORM(MAC)
- else if (attrName == loopAttr)
+ else if (attribute.name() == loopAttr)
updateDisableSleep();
#endif
- else if (attrName == preloadAttr) {
- String value = attr->value();
-
- if (equalIgnoringCase(value, "none"))
+ else if (attribute.name() == preloadAttr) {
+ if (equalIgnoringCase(attribute.value(), "none"))
m_preload = MediaPlayer::None;
- else if (equalIgnoringCase(value, "metadata"))
+ else if (equalIgnoringCase(attribute.value(), "metadata"))
m_preload = MediaPlayer::MetaData;
else {
// The spec does not define an "invalid value default" but "auto" is suggested as the
if (!autoplay() && m_player)
m_player->setPreload(m_preload);
- } else if (attrName == mediagroupAttr)
- setMediaGroup(attr->value());
- else if (attrName == onabortAttr)
- setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attr));
- else if (attrName == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
- else if (attrName == oncanplayAttr)
- setAttributeEventListener(eventNames().canplayEvent, createAttributeEventListener(this, attr));
- else if (attrName == oncanplaythroughAttr)
- setAttributeEventListener(eventNames().canplaythroughEvent, createAttributeEventListener(this, attr));
- else if (attrName == ondurationchangeAttr)
- setAttributeEventListener(eventNames().durationchangeEvent, createAttributeEventListener(this, attr));
- else if (attrName == onemptiedAttr)
- setAttributeEventListener(eventNames().emptiedEvent, createAttributeEventListener(this, attr));
- else if (attrName == onendedAttr)
- setAttributeEventListener(eventNames().endedEvent, createAttributeEventListener(this, attr));
- else if (attrName == onerrorAttr)
- setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attr));
- else if (attrName == onloadeddataAttr)
- setAttributeEventListener(eventNames().loadeddataEvent, createAttributeEventListener(this, attr));
- else if (attrName == onloadedmetadataAttr)
- setAttributeEventListener(eventNames().loadedmetadataEvent, createAttributeEventListener(this, attr));
- else if (attrName == onloadstartAttr)
- setAttributeEventListener(eventNames().loadstartEvent, createAttributeEventListener(this, attr));
- else if (attrName == onpauseAttr)
- setAttributeEventListener(eventNames().pauseEvent, createAttributeEventListener(this, attr));
- else if (attrName == onplayAttr)
- setAttributeEventListener(eventNames().playEvent, createAttributeEventListener(this, attr));
- else if (attrName == onplayingAttr)
- setAttributeEventListener(eventNames().playingEvent, createAttributeEventListener(this, attr));
- else if (attrName == onprogressAttr)
- setAttributeEventListener(eventNames().progressEvent, createAttributeEventListener(this, attr));
- else if (attrName == onratechangeAttr)
- setAttributeEventListener(eventNames().ratechangeEvent, createAttributeEventListener(this, attr));
- else if (attrName == onseekedAttr)
- setAttributeEventListener(eventNames().seekedEvent, createAttributeEventListener(this, attr));
- else if (attrName == onseekingAttr)
- setAttributeEventListener(eventNames().seekingEvent, createAttributeEventListener(this, attr));
- else if (attrName == onstalledAttr)
- setAttributeEventListener(eventNames().stalledEvent, createAttributeEventListener(this, attr));
- else if (attrName == onsuspendAttr)
- setAttributeEventListener(eventNames().suspendEvent, createAttributeEventListener(this, attr));
- else if (attrName == ontimeupdateAttr)
- setAttributeEventListener(eventNames().timeupdateEvent, createAttributeEventListener(this, attr));
- else if (attrName == onvolumechangeAttr)
- setAttributeEventListener(eventNames().volumechangeEvent, createAttributeEventListener(this, attr));
- else if (attrName == onwaitingAttr)
- setAttributeEventListener(eventNames().waitingEvent, createAttributeEventListener(this, attr));
- else if (attrName == onwebkitbeginfullscreenAttr)
- setAttributeEventListener(eventNames().webkitbeginfullscreenEvent, createAttributeEventListener(this, attr));
- else if (attrName == onwebkitendfullscreenAttr)
- setAttributeEventListener(eventNames().webkitendfullscreenEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == mediagroupAttr)
+ setMediaGroup(attribute.value());
+ else if (attribute.name() == onabortAttr)
+ setAttributeEventListener(eventNames().abortEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == oncanplayAttr)
+ setAttributeEventListener(eventNames().canplayEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == oncanplaythroughAttr)
+ setAttributeEventListener(eventNames().canplaythroughEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == ondurationchangeAttr)
+ setAttributeEventListener(eventNames().durationchangeEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onemptiedAttr)
+ setAttributeEventListener(eventNames().emptiedEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onendedAttr)
+ setAttributeEventListener(eventNames().endedEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onerrorAttr)
+ setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onloadeddataAttr)
+ setAttributeEventListener(eventNames().loadeddataEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onloadedmetadataAttr)
+ setAttributeEventListener(eventNames().loadedmetadataEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onloadstartAttr)
+ setAttributeEventListener(eventNames().loadstartEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onpauseAttr)
+ setAttributeEventListener(eventNames().pauseEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onplayAttr)
+ setAttributeEventListener(eventNames().playEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onplayingAttr)
+ setAttributeEventListener(eventNames().playingEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onprogressAttr)
+ setAttributeEventListener(eventNames().progressEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onratechangeAttr)
+ setAttributeEventListener(eventNames().ratechangeEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onseekedAttr)
+ setAttributeEventListener(eventNames().seekedEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onseekingAttr)
+ setAttributeEventListener(eventNames().seekingEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onstalledAttr)
+ setAttributeEventListener(eventNames().stalledEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onsuspendAttr)
+ setAttributeEventListener(eventNames().suspendEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == ontimeupdateAttr)
+ setAttributeEventListener(eventNames().timeupdateEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onvolumechangeAttr)
+ setAttributeEventListener(eventNames().volumechangeEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onwaitingAttr)
+ setAttributeEventListener(eventNames().waitingEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onwebkitbeginfullscreenAttr)
+ setAttributeEventListener(eventNames().webkitbeginfullscreenEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onwebkitendfullscreenAttr)
+ setAttributeEventListener(eventNames().webkitendfullscreenEvent, createAttributeEventListener(this, attribute));
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
void HTMLMediaElement::finishParsingChildren()
HTMLMediaElement(const QualifiedName&, Document*, bool);
virtual ~HTMLMediaElement();
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual void finishParsingChildren();
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
virtual void attach();
return adoptRef(new HTMLMetaElement(tagName, document));
}
-void HTMLMetaElement::parseAttribute(Attribute* attr)
+void HTMLMetaElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == http_equivAttr)
+ if (attribute.name() == http_equivAttr)
process();
- else if (attr->name() == contentAttr)
+ else if (attribute.name() == contentAttr)
process();
- else if (attr->name() == nameAttr) {
+ else if (attribute.name() == nameAttr) {
// Do nothing
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
Node::InsertionNotificationRequest HTMLMetaElement::insertedInto(Node* insertionPoint)
private:
HTMLMetaElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
void process();
return Node::supportsFocus() && !disabled();
}
-void HTMLMeterElement::parseAttribute(Attribute* attribute)
+void HTMLMeterElement::parseAttribute(const Attribute& attribute)
{
- if (attribute->name() == valueAttr || attribute->name() == minAttr || attribute->name() == maxAttr || attribute->name() == lowAttr || attribute->name() == highAttr || attribute->name() == optimumAttr)
+ if (attribute.name() == valueAttr || attribute.name() == minAttr || attribute.name() == maxAttr || attribute.name() == lowAttr || attribute.name() == highAttr || attribute.name() == optimumAttr)
didElementStateChange();
else
LabelableElement::parseAttribute(attribute);
virtual bool recalcWillValidate() const { return false; }
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
void didElementStateChange();
void createShadowSubtree();
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLOListElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLOListElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == typeAttr) {
- if (attr->value() == "a")
+ if (attribute.name() == typeAttr) {
+ if (attribute.value() == "a")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueLowerAlpha);
- else if (attr->value() == "A")
+ else if (attribute.value() == "A")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueUpperAlpha);
- else if (attr->value() == "i")
+ else if (attribute.value() == "i")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueLowerRoman);
- else if (attr->value() == "I")
+ else if (attribute.value() == "I")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueUpperRoman);
- else if (attr->value() == "1")
+ else if (attribute.value() == "1")
addPropertyToAttributeStyle(style, CSSPropertyListStyleType, CSSValueDecimal);
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
-void HTMLOListElement::parseAttribute(Attribute* attr)
+void HTMLOListElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == startAttr) {
+ if (attribute.name() == startAttr) {
int oldStart = start();
bool canParse;
- int parsedStart = attr->value().toInt(&canParse);
+ int parsedStart = attribute.value().toInt(&canParse);
m_hasExplicitStart = canParse;
m_start = canParse ? parsedStart : 0xBADBEEF;
if (oldStart == start())
return;
updateItemValues();
- } else if (attr->name() == reversedAttr) {
- bool reversed = !attr->isNull();
+ } else if (attribute.name() == reversedAttr) {
+ bool reversed = !attribute.isNull();
if (reversed == m_isReversed)
return;
m_isReversed = reversed;
updateItemValues();
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
void HTMLOListElement::setStart(int start)
void recalculateItemCount();
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
int m_start;
unsigned m_itemCount;
return HTMLPlugInImageElement::isPresentationAttribute(name);
}
-void HTMLObjectElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLObjectElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == borderAttr)
- applyBorderAttributeToStyle(attr, style);
+ if (attribute.name() == borderAttr)
+ applyBorderAttributeToStyle(attribute, style);
else
- HTMLPlugInImageElement::collectStyleForAttribute(attr, style);
+ HTMLPlugInImageElement::collectStyleForAttribute(attribute, style);
}
-void HTMLObjectElement::parseAttribute(Attribute* attr)
+void HTMLObjectElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == formAttr)
+ if (attribute.name() == formAttr)
formAttributeChanged();
- else if (attr->name() == typeAttr) {
- m_serviceType = attr->value().lower();
+ else if (attribute.name() == typeAttr) {
+ m_serviceType = attribute.value().lower();
size_t pos = m_serviceType.find(";");
if (pos != notFound)
m_serviceType = m_serviceType.left(pos);
setNeedsWidgetUpdate(true);
if (!isImageType() && m_imageLoader)
m_imageLoader.clear();
- } else if (attr->name() == dataAttr) {
- m_url = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ } else if (attribute.name() == dataAttr) {
+ m_url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (renderer()) {
setNeedsWidgetUpdate(true);
if (isImageType()) {
m_imageLoader->updateFromElementIgnoringPreviousError();
}
}
- } else if (attr->name() == classidAttr) {
- m_classId = attr->value();
+ } else if (attribute.name() == classidAttr) {
+ m_classId = attribute.value();
if (renderer())
setNeedsWidgetUpdate(true);
- } else if (attr->name() == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
else
- HTMLPlugInImageElement::parseAttribute(attr);
+ HTMLPlugInImageElement::parseAttribute(attribute);
}
static void mapDataParamToSrc(Vector<String>* paramNames, Vector<String>* paramValues)
private:
HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
HTMLElement::childrenChanged(changedByParser, beforeChange, afterChange, childCountDelta);
}
-void HTMLOptGroupElement::parseAttribute(Attribute* attr)
+void HTMLOptGroupElement::parseAttribute(const Attribute& attribute)
{
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
recalcSelectOptions();
}
virtual const AtomicString& formControlType() const;
virtual bool supportsFocus() const;
virtual bool isFocusable() const;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
virtual void attach();
virtual void detach();
return 0;
}
-void HTMLOptionElement::parseAttribute(Attribute* attr)
+void HTMLOptionElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == disabledAttr) {
+ if (attribute.name() == disabledAttr) {
bool oldDisabled = m_disabled;
- m_disabled = !attr->isNull();
+ m_disabled = !attribute.isNull();
if (oldDisabled != m_disabled) {
setNeedsStyleRecalc();
if (renderer() && renderer()->style()->hasAppearance())
renderer()->theme()->stateChanged(renderer(), EnabledState);
}
- } else if (attr->name() == selectedAttr) {
+ } else if (attribute.name() == selectedAttr) {
// FIXME: This doesn't match what the HTML specification says.
// The specification implies that removing the selected attribute or
// changing the value of a selected attribute that is already present
// has no effect on whether the element is selected. Further, it seems
// that we need to do more than just set m_isSelected to select in that
// case; we'd need to do the other work from the setSelected function.
- m_isSelected = !attr->isNull();
+ m_isSelected = !attribute.isNull();
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
String HTMLOptionElement::value() const
virtual void detach();
virtual void setRenderStyle(PassRefPtr<RenderStyle>);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void accessKeyAction(bool);
return Node::supportsFocus() && !disabled();
}
-void HTMLOutputElement::parseAttribute(Attribute* attr)
+void HTMLOutputElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == HTMLNames::forAttr)
- setFor(attr->value());
+ if (attribute.name() == HTMLNames::forAttr)
+ setFor(attribute.value());
else
- HTMLFormControlElement::parseAttribute(attr);
+ HTMLFormControlElement::parseAttribute(attribute);
}
DOMSettableTokenList* HTMLOutputElement::htmlFor() const
private:
HTMLOutputElement(const QualifiedName&, Document*, HTMLFormElement*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual const AtomicString& formControlType() const;
virtual bool isEnumeratable() const { return true; }
virtual bool supportLabels() const OVERRIDE { return true; }
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLParagraphElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLParagraphElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == alignAttr) {
- if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
+ if (attribute.name() == alignAttr) {
+ if (equalIgnoringCase(attribute.value(), "middle") || equalIgnoringCase(attribute.value(), "center"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
- else if (equalIgnoringCase(attr->value(), "left"))
+ else if (equalIgnoringCase(attribute.value(), "left"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
- else if (equalIgnoringCase(attr->value(), "right"))
+ else if (equalIgnoringCase(attribute.value(), "right"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
else
- addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLParagraphElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace WebCore
return HTMLFrameOwnerElement::isPresentationAttribute(name);
}
-void HTMLPlugInElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLPlugInElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- else if (attr->name() == heightAttr)
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- else if (attr->name() == vspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
- } else if (attr->name() == hspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
- } else if (attr->name() == alignAttr)
- applyAlignmentAttributeToStyle(attr, style);
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ else if (attribute.name() == heightAttr)
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ else if (attribute.name() == vspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
+ } else if (attribute.name() == hspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
+ } else if (attribute.name() == alignAttr)
+ applyAlignmentAttributeToStyle(attribute, style);
else
- HTMLFrameOwnerElement::collectStyleForAttribute(attr, style);
+ HTMLFrameOwnerElement::collectStyleForAttribute(attribute, style);
}
void HTMLPlugInElement::defaultEventHandler(Event* event)
virtual void detach();
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
bool m_inBeforeLoadEventHandler;
// Subclasses should use guardedDispatchBeforeLoadEvent instead of calling dispatchBeforeLoadEvent directly.
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLPreElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLPreElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == wrapAttr)
+ if (attribute.name() == wrapAttr)
style->setProperty(CSSPropertyWhiteSpace, CSSValuePreWrap);
else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLPreElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace WebCore
return Node::supportsFocus() && !disabled();
}
-void HTMLProgressElement::parseAttribute(Attribute* attribute)
+void HTMLProgressElement::parseAttribute(const Attribute& attribute)
{
- if (attribute->name() == valueAttr)
+ if (attribute.name() == valueAttr)
didElementStateChange();
- else if (attribute->name() == maxAttr)
+ else if (attribute.name() == maxAttr)
didElementStateChange();
else
LabelableElement::parseAttribute(attribute);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual void attach();
ScriptElement::childrenChanged();
}
-void HTMLScriptElement::parseAttribute(Attribute* attr)
+void HTMLScriptElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attr->name();
-
- if (attrName == srcAttr)
- handleSourceAttribute(attr->value());
- else if (attr->name() == asyncAttr)
+ if (attribute.name() == srcAttr)
+ handleSourceAttribute(attribute.value());
+ else if (attribute.name() == asyncAttr)
handleAsyncAttribute();
- else if (attrName == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attrName == onbeforeloadAttr)
- setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attr));
+ else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onbeforeloadAttr)
+ setAttributeEventListener(eventNames().beforeloadEvent, createAttributeEventListener(this, attribute));
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
Node::InsertionNotificationRequest HTMLScriptElement::insertedInto(Node* insertionPoint)
private:
HTMLScriptElement(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
return HTMLFormControlElementWithState::isPresentationAttribute(name);
}
-void HTMLSelectElement::parseAttribute(Attribute* attr)
+void HTMLSelectElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == sizeAttr) {
+ if (attribute.name() == sizeAttr) {
int oldSize = m_size;
// Set the attribute value to a number.
// This is important since the style rules for this attribute can determine the appearance property.
- int size = attr->value().toInt();
+ int size = attribute.value().toInt();
String attrSize = String::number(size);
- if (attrSize != attr->value()) {
+ if (attrSize != attribute.value()) {
// FIXME: This is horribly factored.
if (Attribute* sizeAttribute = getAttributeItem(sizeAttr))
sizeAttribute->setValue(attrSize);
reattach();
setRecalcListItems();
}
- } else if (attr->name() == multipleAttr)
- parseMultipleAttribute(attr);
- else if (attr->name() == accesskeyAttr) {
+ } else if (attribute.name() == multipleAttr)
+ parseMultipleAttribute(attribute);
+ else if (attribute.name() == accesskeyAttr) {
// FIXME: ignore for the moment.
- } else if (attr->name() == onchangeAttr)
- setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr));
+ } else if (attribute.name() == onchangeAttr)
+ setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attribute));
else
- HTMLFormControlElementWithState::parseAttribute(attr);
+ HTMLFormControlElementWithState::parseAttribute(attribute);
}
bool HTMLSelectElement::isKeyboardFocusable(KeyboardEvent* event) const
setNeedsValidityCheck();
}
-void HTMLSelectElement::parseMultipleAttribute(const Attribute* attribute)
+void HTMLSelectElement::parseMultipleAttribute(const Attribute& attribute)
{
bool oldUsesMenuList = usesMenuList();
- m_multiple = !attribute->isNull();
+ m_multiple = !attribute.isNull();
setNeedsValidityCheck();
if (oldUsesMenuList != usesMenuList())
reattachIfAttached();
virtual bool saveFormControlState(String& value) const;
virtual void restoreFormControlState(const String&);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
virtual bool childShouldCreateRenderer(const NodeRenderingContext&) const OVERRIDE;
typedef unsigned SelectOptionFlags;
void selectOption(int optionIndex, SelectOptionFlags = 0);
void deselectItemsWithoutValidation(HTMLElement* elementToExclude = 0);
- void parseMultipleAttribute(const Attribute*);
+ void parseMultipleAttribute(const Attribute&);
int lastSelectedListIndex() const;
void updateSelectedState(int listIndex, bool multi, bool shift);
void menuListDefaultEventHandler(Event*);
return adoptRef(new HTMLStyleElement(tagName, document, createdByParser));
}
-void HTMLStyleElement::parseAttribute(Attribute* attr)
+void HTMLStyleElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == titleAttr && m_sheet)
- m_sheet->setTitle(attr->value());
- else if (attr->name() == onloadAttr)
- setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onerrorAttr)
- setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attr));
+ if (attribute.name() == titleAttr && m_sheet)
+ m_sheet->setTitle(attribute.value());
+ else if (attribute.name() == onloadAttr)
+ setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onerrorAttr)
+ setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
#if ENABLE(STYLE_SCOPED)
- else if (attr->name() == scopedAttr) {
- if (!attr->isNull() && !m_isRegisteredWithScopingNode && inDocument())
+ else if (attribute.name() == scopedAttr) {
+ if (!attribute.isNull() && !m_isRegisteredWithScopingNode && inDocument())
registerWithScopingNode();
- else if (attr->isNull() && m_isRegisteredWithScopingNode)
+ else if (attribute.isNull() && m_isRegisteredWithScopingNode)
unregisterWithScopingNode();
}
#endif
else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
}
void HTMLStyleElement::finishParsingChildren()
HTMLStyleElement(const QualifiedName&, Document*, bool createdByParser);
// overload from HTMLElement
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
virtual void removedFrom(Node*) OVERRIDE;
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLTableCaptionElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLTableCaptionElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == alignAttr) {
- if (!attr->isEmpty())
- addPropertyToAttributeStyle(style, CSSPropertyCaptionSide, attr->value());
+ if (attribute.name() == alignAttr) {
+ if (!attribute.isEmpty())
+ addPropertyToAttributeStyle(style, CSSPropertyCaptionSide, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLTableCaptionElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} // namespace
return HTMLTablePartElement::isPresentationAttribute(name);
}
-void HTMLTableCellElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLTableCellElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == nowrapAttr) {
+ if (attribute.name() == nowrapAttr) {
addPropertyToAttributeStyle(style, CSSPropertyWhiteSpace, CSSValueWebkitNowrap);
- } else if (attr->name() == widthAttr) {
- if (!attr->value().isEmpty()) {
- int widthInt = attr->value().toInt();
+ } else if (attribute.name() == widthAttr) {
+ if (!attribute.value().isEmpty()) {
+ int widthInt = attribute.value().toInt();
if (widthInt > 0) // width="0" is ignored for compatibility with WinIE.
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
}
- } else if (attr->name() == heightAttr) {
- if (!attr->value().isEmpty()) {
- int heightInt = attr->value().toInt();
+ } else if (attribute.name() == heightAttr) {
+ if (!attribute.value().isEmpty()) {
+ int heightInt = attribute.value().toInt();
if (heightInt > 0) // height="0" is ignored for compatibility with WinIE.
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
}
} else
- HTMLTablePartElement::collectStyleForAttribute(attr, style);
+ HTMLTablePartElement::collectStyleForAttribute(attribute, style);
}
-void HTMLTableCellElement::parseAttribute(Attribute* attr)
+void HTMLTableCellElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == rowspanAttr) {
+ if (attribute.name() == rowspanAttr) {
if (renderer() && renderer()->isTableCell())
toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
- } else if (attr->name() == colspanAttr) {
+ } else if (attribute.name() == colspanAttr) {
if (renderer() && renderer()->isTableCell())
toRenderTableCell(renderer())->colSpanOrRowSpanChanged();
} else
- HTMLTablePartElement::parseAttribute(attr);
+ HTMLTablePartElement::parseAttribute(attribute);
}
StylePropertySet* HTMLTableCellElement::additionalAttributeStyle()
private:
HTMLTableCellElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual StylePropertySet* additionalAttributeStyle() OVERRIDE;
return HTMLTablePartElement::isPresentationAttribute(name);
}
-void HTMLTableColElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLTableColElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
else
- HTMLTablePartElement::collectStyleForAttribute(attr, style);
+ HTMLTablePartElement::collectStyleForAttribute(attribute, style);
}
-void HTMLTableColElement::parseAttribute(Attribute* attr)
+void HTMLTableColElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == spanAttr) {
- m_span = !attr->isNull() ? attr->value().toInt() : 1;
+ if (attribute.name() == spanAttr) {
+ m_span = !attribute.isNull() ? attribute.value().toInt() : 1;
if (renderer() && renderer()->isTableCol())
renderer()->updateFromElement();
- } else if (attr->name() == widthAttr) {
- if (!attr->value().isEmpty()) {
+ } else if (attribute.name() == widthAttr) {
+ if (!attribute.isEmpty()) {
if (renderer() && renderer()->isTableCol()) {
RenderTableCol* col = toRenderTableCol(renderer());
int newWidth = width().toInt();
}
}
} else
- HTMLTablePartElement::parseAttribute(attr);
+ HTMLTablePartElement::parseAttribute(attribute);
}
StylePropertySet* HTMLTableColElement::additionalAttributeStyle()
private:
HTMLTableColElement(const QualifiedName& tagName, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual StylePropertySet* additionalAttributeStyle() OVERRIDE;
int m_span;
return true;
}
-void HTMLTableElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
-{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- else if (attr->name() == heightAttr)
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
- else if (attr->name() == borderAttr) {
- int borderWidth = attr->isEmpty() ? 1 : attr->value().toInt();
+void HTMLTableElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
+{
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ else if (attribute.name() == heightAttr)
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
+ else if (attribute.name() == borderAttr) {
+ int borderWidth = attribute.isEmpty() ? 1 : attribute.value().toInt();
addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, borderWidth, CSSPrimitiveValue::CSS_PX);
- } else if (attr->name() == bordercolorAttr) {
- if (!attr->isEmpty())
- addHTMLColorToStyle(style, CSSPropertyBorderColor, attr->value());
- } else if (attr->name() == bgcolorAttr)
- addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attr->value());
- else if (attr->name() == backgroundAttr) {
- String url = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ } else if (attribute.name() == bordercolorAttr) {
+ if (!attribute.isEmpty())
+ addHTMLColorToStyle(style, CSSPropertyBorderColor, attribute.value());
+ } else if (attribute.name() == bgcolorAttr)
+ addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ else if (attribute.name() == backgroundAttr) {
+ String url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (!url.isEmpty())
style->setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document()->completeURL(url).string())));
- } else if (attr->name() == valignAttr) {
- if (!attr->isEmpty())
- addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attr->value());
- } else if (attr->name() == cellspacingAttr) {
- if (!attr->isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, attr->value());
- } else if (attr->name() == vspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginTop, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attr->value());
- } else if (attr->name() == hspaceAttr) {
- addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attr->value());
- addHTMLLengthToStyle(style, CSSPropertyMarginRight, attr->value());
- } else if (attr->name() == alignAttr) {
- if (!attr->value().isEmpty()) {
- if (equalIgnoringCase(attr->value(), "center")) {
+ } else if (attribute.name() == valignAttr) {
+ if (!attribute.isEmpty())
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attribute.value());
+ } else if (attribute.name() == cellspacingAttr) {
+ if (!attribute.isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, attribute.value());
+ } else if (attribute.name() == vspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginTop, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginBottom, attribute.value());
+ } else if (attribute.name() == hspaceAttr) {
+ addHTMLLengthToStyle(style, CSSPropertyMarginLeft, attribute.value());
+ addHTMLLengthToStyle(style, CSSPropertyMarginRight, attribute.value());
+ } else if (attribute.name() == alignAttr) {
+ if (!attribute.value().isEmpty()) {
+ if (equalIgnoringCase(attribute.value(), "center")) {
addPropertyToAttributeStyle(style, CSSPropertyWebkitMarginStart, CSSValueAuto);
addPropertyToAttributeStyle(style, CSSPropertyWebkitMarginEnd, CSSValueAuto);
} else
- addPropertyToAttributeStyle(style, CSSPropertyFloat, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyFloat, attribute.value());
}
- } else if (attr->name() == rulesAttr) {
+ } else if (attribute.name() == rulesAttr) {
// The presence of a valid rules attribute causes border collapsing to be enabled.
if (m_rulesAttr != UnsetRules)
addPropertyToAttributeStyle(style, CSSPropertyBorderCollapse, CSSValueCollapse);
- } else if (attr->name() == frameAttr) {
+ } else if (attribute.name() == frameAttr) {
bool borderTop;
bool borderRight;
bool borderBottom;
bool borderLeft;
- if (getBordersFromFrameAttributeValue(attr->value(), borderTop, borderRight, borderBottom, borderLeft)) {
+ if (getBordersFromFrameAttributeValue(attribute.value(), borderTop, borderRight, borderBottom, borderLeft)) {
addPropertyToAttributeStyle(style, CSSPropertyBorderWidth, CSSValueThin);
addPropertyToAttributeStyle(style, CSSPropertyBorderTopStyle, borderTop ? CSSValueSolid : CSSValueHidden);
addPropertyToAttributeStyle(style, CSSPropertyBorderBottomStyle, borderBottom ? CSSValueSolid : CSSValueHidden);
addPropertyToAttributeStyle(style, CSSPropertyBorderRightStyle, borderRight ? CSSValueSolid : CSSValueHidden);
}
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
bool HTMLTableElement::isPresentationAttribute(const QualifiedName& name) const
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLTableElement::parseAttribute(Attribute* attr)
+void HTMLTableElement::parseAttribute(const Attribute& attribute)
{
CellBorders bordersBefore = cellBorders();
unsigned short oldPadding = m_padding;
- if (attr->name() == borderAttr) {
+ if (attribute.name() == borderAttr) {
// FIXME: This attribute is a mess.
m_borderAttr = true;
- if (!attr->isNull()) {
- int border = attr->isEmpty() ? 1 : attr->value().toInt();
+ if (!attribute.isNull()) {
+ int border = attribute.isEmpty() ? 1 : attribute.value().toInt();
m_borderAttr = border;
}
- } else if (attr->name() == bordercolorAttr) {
- m_borderColorAttr = !attr->isEmpty();
- } else if (attr->name() == frameAttr) {
+ } else if (attribute.name() == bordercolorAttr) {
+ m_borderColorAttr = !attribute.isEmpty();
+ } else if (attribute.name() == frameAttr) {
// FIXME: This attribute is a mess.
bool borderTop;
bool borderRight;
bool borderBottom;
bool borderLeft;
- m_frameAttr = getBordersFromFrameAttributeValue(attr->value(), borderTop, borderRight, borderBottom, borderLeft);
- } else if (attr->name() == rulesAttr) {
+ m_frameAttr = getBordersFromFrameAttributeValue(attribute.value(), borderTop, borderRight, borderBottom, borderLeft);
+ } else if (attribute.name() == rulesAttr) {
m_rulesAttr = UnsetRules;
- if (equalIgnoringCase(attr->value(), "none"))
+ if (equalIgnoringCase(attribute.value(), "none"))
m_rulesAttr = NoneRules;
- else if (equalIgnoringCase(attr->value(), "groups"))
+ else if (equalIgnoringCase(attribute.value(), "groups"))
m_rulesAttr = GroupsRules;
- else if (equalIgnoringCase(attr->value(), "rows"))
+ else if (equalIgnoringCase(attribute.value(), "rows"))
m_rulesAttr = RowsRules;
- if (equalIgnoringCase(attr->value(), "cols"))
+ if (equalIgnoringCase(attribute.value(), "cols"))
m_rulesAttr = ColsRules;
- if (equalIgnoringCase(attr->value(), "all"))
+ if (equalIgnoringCase(attribute.value(), "all"))
m_rulesAttr = AllRules;
- } else if (attr->name() == cellpaddingAttr) {
- if (!attr->value().isEmpty())
- m_padding = max(0, attr->value().toInt());
+ } else if (attribute.name() == cellpaddingAttr) {
+ if (!attribute.value().isEmpty())
+ m_padding = max(0, attribute.value().toInt());
else
m_padding = 1;
- } else if (attr->name() == colsAttr) {
+ } else if (attribute.name() == colsAttr) {
// ###
} else
- HTMLElement::parseAttribute(attr);
+ HTMLElement::parseAttribute(attribute);
if (bordersBefore != cellBorders() || oldPadding != m_padding) {
m_sharedCellStyle = 0;
private:
HTMLTableElement(const QualifiedName&, Document*);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual bool isURLAttribute(const Attribute&) const OVERRIDE;
// Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes.
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLTablePartElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLTablePartElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == bgcolorAttr)
- addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attr->value());
- else if (attr->name() == backgroundAttr) {
- String url = stripLeadingAndTrailingHTMLSpaces(attr->value());
+ if (attribute.name() == bgcolorAttr)
+ addHTMLColorToStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ else if (attribute.name() == backgroundAttr) {
+ String url = stripLeadingAndTrailingHTMLSpaces(attribute.value());
if (!url.isEmpty())
style->setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageValue::create(document()->completeURL(url).string())));
- } else if (attr->name() == bordercolorAttr) {
- if (!attr->value().isEmpty()) {
- addHTMLColorToStyle(style, CSSPropertyBorderColor, attr->value());
+ } else if (attribute.name() == bordercolorAttr) {
+ if (!attribute.value().isEmpty()) {
+ addHTMLColorToStyle(style, CSSPropertyBorderColor, attribute.value());
addPropertyToAttributeStyle(style, CSSPropertyBorderStyle, CSSValueSolid);
}
- } else if (attr->name() == valignAttr) {
- if (equalIgnoringCase(attr->value(), "top"))
+ } else if (attribute.name() == valignAttr) {
+ if (equalIgnoringCase(attribute.value(), "top"))
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueTop);
- else if (equalIgnoringCase(attr->value(), "middle"))
+ else if (equalIgnoringCase(attribute.value(), "middle"))
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueMiddle);
- else if (equalIgnoringCase(attr->value(), "bottom"))
+ else if (equalIgnoringCase(attribute.value(), "bottom"))
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBottom);
- else if (equalIgnoringCase(attr->value(), "baseline"))
+ else if (equalIgnoringCase(attribute.value(), "baseline"))
addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, CSSValueBaseline);
else
- addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attr->value());
- } else if (attr->name() == alignAttr) {
- if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center"))
+ addPropertyToAttributeStyle(style, CSSPropertyVerticalAlign, attribute.value());
+ } else if (attribute.name() == alignAttr) {
+ if (equalIgnoringCase(attribute.value(), "middle") || equalIgnoringCase(attribute.value(), "center"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitCenter);
- else if (equalIgnoringCase(attr->value(), "absmiddle"))
+ else if (equalIgnoringCase(attribute.value(), "absmiddle"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueCenter);
- else if (equalIgnoringCase(attr->value(), "left"))
+ else if (equalIgnoringCase(attribute.value(), "left"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitLeft);
- else if (equalIgnoringCase(attr->value(), "right"))
+ else if (equalIgnoringCase(attribute.value(), "right"))
addPropertyToAttributeStyle(style, CSSPropertyTextAlign, CSSValueWebkitRight);
else
- addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attr->value());
- } else if (attr->name() == heightAttr) {
- if (!attr->value().isEmpty())
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
+ addPropertyToAttributeStyle(style, CSSPropertyTextAlign, attribute.value());
+ } else if (attribute.name() == heightAttr) {
+ if (!attribute.value().isEmpty())
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
} else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
HTMLTableElement* HTMLTablePartElement::findParentTable() const
}
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
HTMLTableElement* findParentTable() const;
};
return HTMLTextFormControlElement::isPresentationAttribute(name);
}
-void HTMLTextAreaElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLTextAreaElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == wrapAttr) {
+ if (attribute.name() == wrapAttr) {
if (shouldWrapText()) {
addPropertyToAttributeStyle(style, CSSPropertyWhiteSpace, CSSValuePreWrap);
addPropertyToAttributeStyle(style, CSSPropertyWordWrap, CSSValueBreakWord);
addPropertyToAttributeStyle(style, CSSPropertyWordWrap, CSSValueNormal);
}
} else
- HTMLTextFormControlElement::collectStyleForAttribute(attr, style);
+ HTMLTextFormControlElement::collectStyleForAttribute(attribute, style);
}
-void HTMLTextAreaElement::parseAttribute(Attribute* attr)
+void HTMLTextAreaElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == rowsAttr) {
- int rows = attr->value().toInt();
+ if (attribute.name() == rowsAttr) {
+ int rows = attribute.value().toInt();
if (rows <= 0)
rows = defaultRows;
if (m_rows != rows) {
if (renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
}
- } else if (attr->name() == colsAttr) {
- int cols = attr->value().toInt();
+ } else if (attribute.name() == colsAttr) {
+ int cols = attribute.value().toInt();
if (cols <= 0)
cols = defaultCols;
if (m_cols != cols) {
if (renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
}
- } else if (attr->name() == wrapAttr) {
+ } else if (attribute.name() == wrapAttr) {
// The virtual/physical values were a Netscape extension of HTML 3.0, now deprecated.
// The soft/hard /off values are a recommendation for HTML 4 extension by IE and NS 4.
WrapMethod wrap;
- if (equalIgnoringCase(attr->value(), "physical") || equalIgnoringCase(attr->value(), "hard") || equalIgnoringCase(attr->value(), "on"))
+ if (equalIgnoringCase(attribute.value(), "physical") || equalIgnoringCase(attribute.value(), "hard") || equalIgnoringCase(attribute.value(), "on"))
wrap = HardWrap;
- else if (equalIgnoringCase(attr->value(), "off"))
+ else if (equalIgnoringCase(attribute.value(), "off"))
wrap = NoWrap;
else
wrap = SoftWrap;
if (renderer())
renderer()->setNeedsLayoutAndPrefWidthsRecalc();
}
- } else if (attr->name() == accesskeyAttr) {
+ } else if (attribute.name() == accesskeyAttr) {
// ignore for the moment
- } else if (attr->name() == maxlengthAttr)
+ } else if (attribute.name() == maxlengthAttr)
setNeedsValidityCheck();
else
- HTMLTextFormControlElement::parseAttribute(attr);
+ HTMLTextFormControlElement::parseAttribute(attribute);
}
RenderObject* HTMLTextAreaElement::createRenderer(RenderArena* arena, RenderStyle*)
virtual bool isTextFormControl() const { return true; }
virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
virtual bool appendFormData(FormDataList&, bool);
virtual void reset();
}
}
-void HTMLTextFormControlElement::parseAttribute(Attribute* attr)
+void HTMLTextFormControlElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == placeholderAttr)
+ if (attribute.name() == placeholderAttr)
updatePlaceholderVisibility(true);
- else if (attr->name() == onselectAttr)
- setAttributeEventListener(eventNames().selectEvent, createAttributeEventListener(this, attr));
- else if (attr->name() == onchangeAttr)
- setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attr));
+ else if (attribute.name() == onselectAttr)
+ setAttributeEventListener(eventNames().selectEvent, createAttributeEventListener(this, attribute));
+ else if (attribute.name() == onchangeAttr)
+ setAttributeEventListener(eventNames().changeEvent, createAttributeEventListener(this, attribute));
else
- HTMLFormControlElementWithState::parseAttribute(attr);
+ HTMLFormControlElementWithState::parseAttribute(attribute);
}
void HTMLTextFormControlElement::notifyFormStateChanged()
virtual bool isPlaceholderEmpty() const;
virtual void updatePlaceholderText() = 0;
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
void cacheSelection(int start, int end, TextFieldSelectionDirection direction)
{
HTMLElement::removedFrom(insertionPoint);
}
-void HTMLTrackElement::parseAttribute(Attribute* attribute)
+void HTMLTrackElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attribute->name();
-
if (RuntimeEnabledFeatures::webkitVideoTrackEnabled()) {
- if (attrName == srcAttr) {
- if (!attribute->isEmpty() && mediaElement())
+ if (attribute.name() == srcAttr) {
+ if (!attribute.isEmpty() && mediaElement())
scheduleLoad();
// 4.8.10.12.3 Sourcing out-of-band text tracks
// As the kind, label, and srclang attributes are set, changed, or removed, the text track must update accordingly...
- } else if (attrName == kindAttr)
- track()->setKind(attribute->value());
- else if (attrName == labelAttr)
- track()->setLabel(attribute->value());
- else if (attrName == srclangAttr)
- track()->setLanguage(attribute->value());
+ } else if (attribute.name() == kindAttr)
+ track()->setKind(attribute.value());
+ else if (attribute.name() == labelAttr)
+ track()->setLabel(attribute.value());
+ else if (attribute.name() == srclangAttr)
+ track()->setLanguage(attribute.value());
}
- if (attrName == onloadAttr)
+ if (attribute.name() == onloadAttr)
setAttributeEventListener(eventNames().loadEvent, createAttributeEventListener(this, attribute));
- else if (attrName == onerrorAttr)
+ else if (attribute.name() == onerrorAttr)
setAttributeEventListener(eventNames().errorEvent, createAttributeEventListener(this, attribute));
else
HTMLElement::parseAttribute(attribute);
HTMLTrackElement(const QualifiedName&, Document*);
virtual ~HTMLTrackElement();
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual InsertionNotificationRequest insertedInto(Node*) OVERRIDE;
return HTMLElement::isPresentationAttribute(name);
}
-void HTMLUListElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLUListElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == typeAttr)
- addPropertyToAttributeStyle(style, CSSPropertyListStyleType, attr->value());
+ if (attribute.name() == typeAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyListStyleType, attribute.value());
else
- HTMLElement::collectStyleForAttribute(attr, style);
+ HTMLElement::collectStyleForAttribute(attribute, style);
}
}
HTMLUListElement(const QualifiedName&, Document*);
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
} //namespace
m_imageLoader.clear();
}
-void HTMLVideoElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void HTMLVideoElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == widthAttr)
- addHTMLLengthToStyle(style, CSSPropertyWidth, attr->value());
- else if (attr->name() == heightAttr)
- addHTMLLengthToStyle(style, CSSPropertyHeight, attr->value());
+ if (attribute.name() == widthAttr)
+ addHTMLLengthToStyle(style, CSSPropertyWidth, attribute.value());
+ else if (attribute.name() == heightAttr)
+ addHTMLLengthToStyle(style, CSSPropertyHeight, attribute.value());
else
- HTMLMediaElement::collectStyleForAttribute(attr, style);
+ HTMLMediaElement::collectStyleForAttribute(attribute, style);
}
bool HTMLVideoElement::isPresentationAttribute(const QualifiedName& name) const
return HTMLMediaElement::isPresentationAttribute(name);
}
-void HTMLVideoElement::parseAttribute(Attribute* attr)
+void HTMLVideoElement::parseAttribute(const Attribute& attribute)
{
- const QualifiedName& attrName = attr->name();
-
- if (attrName == posterAttr) {
+ if (attribute.name() == posterAttr) {
// Force a poster recalc by setting m_displayMode to Unknown directly before calling updateDisplayState.
HTMLMediaElement::setDisplayMode(Unknown);
updateDisplayState();
}
#endif
} else
- HTMLMediaElement::parseAttribute(attr);
+ HTMLMediaElement::parseAttribute(attribute);
}
bool HTMLVideoElement::supportsFullscreen() const
#endif
virtual void attach();
virtual void detach();
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
virtual bool isVideo() const { return true; }
virtual bool hasVideo() const { return player() && player()->hasVideo(); }
virtual bool supportsFullscreen() const;
setAttribute(selectAttr, selectValue);
}
-void HTMLContentElement::parseAttribute(Attribute* attr)
+void HTMLContentElement::parseAttribute(const Attribute& attribute)
{
- if (attr->name() == selectAttr) {
+ if (attribute.name() == selectAttr) {
if (ShadowRoot* root = shadowTreeRootNode())
root->owner()->setNeedsRedistributing();
} else
- InsertionPoint::parseAttribute(attr);
+ InsertionPoint::parseAttribute(attribute);
}
}
HTMLContentElement(const QualifiedName&, Document*);
private:
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
};
}
return StyledElement::isPresentationAttribute(name);
}
-void MathMLElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
+void MathMLElement::collectStyleForAttribute(const Attribute& attribute, StylePropertySet* style)
{
- if (attr->name() == mathbackgroundAttr)
- addPropertyToAttributeStyle(style, CSSPropertyBackgroundColor, attr->value());
- else if (attr->name() == mathsizeAttr) {
+ if (attribute.name() == mathbackgroundAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ else if (attribute.name() == mathsizeAttr) {
// The following three values of mathsize are handled in WebCore/css/mathml.css
- if (attr->value() != "normal" && attr->value() != "small" && attr->value() != "big")
- addPropertyToAttributeStyle(style, CSSPropertyFontSize, attr->value());
- } else if (attr->name() == mathcolorAttr)
- addPropertyToAttributeStyle(style, CSSPropertyColor, attr->value());
+ if (attribute.value() != "normal" && attribute.value() != "small" && attribute.value() != "big")
+ addPropertyToAttributeStyle(style, CSSPropertyFontSize, attribute.value());
+ } else if (attribute.name() == mathcolorAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyColor, attribute.value());
// FIXME: deprecated attributes that should loose in a conflict with a non deprecated attribute
- else if (attr->name() == fontsizeAttr)
- addPropertyToAttributeStyle(style, CSSPropertyFontSize, attr->value());
- else if (attr->name() == backgroundAttr)
- addPropertyToAttributeStyle(style, CSSPropertyBackgroundColor, attr->value());
- else if (attr->name() == colorAttr)
- addPropertyToAttributeStyle(style, CSSPropertyColor, attr->value());
- else if (attr->name() == fontstyleAttr)
- addPropertyToAttributeStyle(style, CSSPropertyFontStyle, attr->value());
- else if (attr->name() == fontweightAttr)
- addPropertyToAttributeStyle(style, CSSPropertyFontWeight, attr->value());
- else if (attr->name() == fontfamilyAttr)
- addPropertyToAttributeStyle(style, CSSPropertyFontFamily, attr->value());
+ else if (attribute.name() == fontsizeAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyFontSize, attribute.value());
+ else if (attribute.name() == backgroundAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyBackgroundColor, attribute.value());
+ else if (attribute.name() == colorAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyColor, attribute.value());
+ else if (attribute.name() == fontstyleAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyFontStyle, attribute.value());
+ else if (attribute.name() == fontweightAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyFontWeight, attribute.value());
+ else if (attribute.name() == fontfamilyAttr)
+ addPropertyToAttributeStyle(style, CSSPropertyFontFamily, attribute.value());
else {
- ASSERT(!isPresentationAttribute(attr->name()));
- StyledElement::collectStyleForAttribute(attr, style);
+ ASSERT(!isPresentationAttribute(attribute.name()));
+ StyledElement::collectStyleForAttribute(attribute, style);
}
}
private:
virtual bool isMathMLElement() const { return true; }
virtual bool isPresentationAttribute(const QualifiedName&) const OVERRIDE;
- virtual void collectStyleForAttribute(Attribute*, StylePropertySet*) OVERRIDE;
+ virtual void collectStyleForAttribute(const Attribute&, StylePropertySet*) OVERRIDE;
};
inline MathMLElement* toMathMLElement(Element* element)
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
-void SVGAElement::parseAttribute(Attribute* attr)
+void SVGAElement::parseAttribute(const Attribute& attribute)
{
- if (!isSupportedAttribute(attr->name())) {
- SVGStyledTransformableElement::parseAttribute(attr);
+ if (!isSupportedAttribute(attribute.name())) {
+ SVGStyledTransformableElement::parseAttribute(attribute);
return;
}
- if (attr->name() == SVGNames::targetAttr) {
- setSVGTargetBaseValue(attr->value());
+ if (attribute.name() == SVGNames::targetAttr) {
+ setSVGTargetBaseValue(attribute.value());
return;
}
- if (SVGURIReference::parseAttribute(attr))
+ if (SVGURIReference::parseAttribute(attribute))
return;
- if (SVGTests::parseAttribute(attr))
+ if (SVGTests::parseAttribute(attribute))
return;
- if (SVGLangSpace::parseAttribute(attr))
+ if (SVGLangSpace::parseAttribute(attribute))
return;
- if (SVGExternalResourcesRequired::parseAttribute(attr))
+ if (SVGExternalResourcesRequired::parseAttribute(attribute))
return;
ASSERT_NOT_REACHED();
virtual String target() const { return svgTarget(); }
bool isSupportedAttribute(const QualifiedName&);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual void svgAttributeChanged(const QualifiedName&);
virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
-void SVGAnimateMotionElement::parseAttribute(Attribute* attr)
+void SVGAnimateMotionElement::parseAttribute(const Attribute& attribute)
{
- if (!isSupportedAttribute(attr->name())) {
- SVGAnimationElement::parseAttribute(attr);
+ if (!isSupportedAttribute(attribute.name())) {
+ SVGAnimationElement::parseAttribute(attribute);
return;
}
- if (attr->name() == SVGNames::pathAttr) {
+ if (attribute.name() == SVGNames::pathAttr) {
m_path = Path();
- buildPathFromString(attr->value(), m_path);
+ buildPathFromString(attribute.value(), m_path);
return;
}
virtual bool hasValidAttributeType();
bool isSupportedAttribute(const QualifiedName&);
- virtual void parseAttribute(Attribute*) OVERRIDE;
+ virtual void parseAttribute(const Attribute&) OVERRIDE;
virtual void resetAnimatedType();
virtual void clearAnimatedType(SVGElement* targetElement);
return supportedAttributes.contains<QualifiedName, SVGAttributeHashTranslator>(attrName);
}
-void SVGAnimateTransformElement::parseAttribute(Attribute* attr)
+void SVGAnimateTransformElement::parseAttribute(const Attribute& attribute)
{
- if (!isSupportedAttribute(attr->name())) {
- SVGAnimateElement::parseAttribute(attr);
+ if (!isSupportedAttribute(attribute.name())) {
+ SVGAnimateElement::parseAttribute(attribute);
return;
}
- if (attr->name() == SVGNames::typeAttr) {
- m_type = SVGTransformable::parseTransformType(attr->value());
+ if (attribute.name() == SVGNames::typeAttr) {
+ m_type = SVGTransformable::parseTransformType(attribute.value());
if (m_type == SVGTransform::SVG_TRANSFORM_MATRIX)
m_type = SVGTransform::SVG_TRANSFORM_UNKNOWN;
return;