#include "config.h"
#include "HTMLBRElement.h"
#include "Attribute.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
#include "RenderBR.h"
namespace WebCore {
using namespace HTMLNames;
HTMLBRElement::HTMLBRElement(const QualifiedName& tagName, Document* document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(brTag));
}
PassRefPtr<HTMLBRElement> HTMLBRElement::create(Document* document)
{
return adoptRef(new HTMLBRElement(brTag, document));
}
PassRefPtr<HTMLBRElement> HTMLBRElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLBRElement(tagName, document));
}
bool HTMLBRElement::isPresentationAttribute(const QualifiedName& name) const
{
if (name == clearAttr)
return true;
return HTMLElement::isPresentationAttribute(name);
}
void HTMLBRElement::collectStyleForAttribute(Attribute* attr, StylePropertySet* style)
{
if (attr->name() == clearAttr) {
if (!attr->isEmpty()) {
if (equalIgnoringCase(attr->value(), "all"))
addPropertyToAttributeStyle(style, CSSPropertyClear, CSSValueBoth);
else
addPropertyToAttributeStyle(style, CSSPropertyClear, attr->value());
}
} else
HTMLElement::collectStyleForAttribute(attr, style);
}
RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->hasContent())
return RenderObject::createObject(this, style);
return new (arena) RenderBR(this);
}
}