#include "config.h"
#include "HTMLBRElement.h"
#include "CSSPropertyNames.h"
#include "CSSValueKeywords.h"
#include "HTMLNames.h"
#include "RenderLineBreak.h"
namespace WebCore {
using namespace HTMLNames;
HTMLBRElement::HTMLBRElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
{
ASSERT(hasTagName(brTag));
}
Ref<HTMLBRElement> HTMLBRElement::create(Document& document)
{
return adoptRef(*new HTMLBRElement(brTag, document));
}
Ref<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, MutableStyleProperties& 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);
}
RenderPtr<RenderElement> HTMLBRElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&)
{
if (style.get().hasContent())
return RenderElement::createFor(*this, WTF::move(style));
return createRenderer<RenderLineBreak>(*this, WTF::move(style));
}
}