#include "config.h"
#include "HTMLBRElement.h"
#include "Attribute.h"
#include "CSSPropertyNames.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::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const
{
if (attrName == clearAttr) {
result = eUniversal;
return false;
}
return HTMLElement::mapToEntry(attrName, result);
}
void HTMLBRElement::parseMappedAttribute(Attribute* attr)
{
if (attr->name() == clearAttr) {
const AtomicString& str = attr->value();
if (!str.isEmpty()) {
if (equalIgnoringCase(str, "all"))
addCSSProperty(attr, CSSPropertyClear, "both");
else
addCSSProperty(attr, CSSPropertyClear, str);
}
} else
HTMLElement::parseMappedAttribute(attr);
}
RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->contentData())
return RenderObject::createObject(this, style);
return new (arena) RenderBR(this);
}
}