#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::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
if (name == clearAttr) {
if (!value.isEmpty()) {
if (equalIgnoringCase(value, "all"))
addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, CSSValueBoth);
else
addPropertyToPresentationAttributeStyle(style, CSSPropertyClear, value);
}
} else
HTMLElement::collectStyleForPresentationAttribute(name, value, style);
}
RenderObject* HTMLBRElement::createRenderer(RenderArena* arena, RenderStyle* style)
{
if (style->hasContent())
return RenderObject::createObject(this, style);
return new (arena) RenderBR(this);
}
}