#include "config.h"
#include "WebElement.h"
#include "Element.h"
#include "RenderBoxModelObject.h"
#include "RenderObject.h"
#include "ShadowRoot.h"
#include <wtf/PassRefPtr.h>
#include "WebNamedNodeMap.h"
using namespace WebCore;
namespace WebKit {
bool WebElement::isFormControlElement() const
{
return constUnwrap<Element>()->isFormControlElement();
}
bool WebElement::isTextFormControlElement() const
{
return constUnwrap<Element>()->isTextFormControl();
}
WebString WebElement::tagName() const
{
return constUnwrap<Element>()->tagName();
}
bool WebElement::hasTagName(const WebString& tagName) const
{
return equalIgnoringCase(constUnwrap<Element>()->tagName(),
tagName.operator String());
}
bool WebElement::hasAttribute(const WebString& attrName) const
{
return constUnwrap<Element>()->hasAttribute(attrName);
}
WebString WebElement::getAttribute(const WebString& attrName) const
{
return constUnwrap<Element>()->getAttribute(attrName);
}
bool WebElement::setAttribute(const WebString& attrName, const WebString& attrValue)
{
ExceptionCode exceptionCode = 0;
unwrap<Element>()->setAttribute(attrName, attrValue, exceptionCode);
return !exceptionCode;
}
WebNamedNodeMap WebElement::attributes() const
{
return WebNamedNodeMap(m_private->attributes());
}
WebString WebElement::innerText() const
{
return constUnwrap<Element>()->innerText();
}
WebNode WebElement::shadowRoot()
{
return PassRefPtr<Node>(static_cast<Node*>(unwrap<Element>()->shadowRoot()));
}
WebNode WebElement::ensureShadowRoot()
{
return PassRefPtr<Node>(static_cast<Node*>(unwrap<Element>()->ensureShadowRoot()));
}
void WebElement::removeShadowRoot()
{
unwrap<Element>()->removeShadowRoot();
}
WebString WebElement::shadowPseudoId() const
{
return WebString(constUnwrap<Element>()->shadowPseudoId().string());
}
WebString WebElement::computeInheritedLanguage() const
{
return WebString(constUnwrap<Element>()->computeInheritedLanguage());
}
WebElement::WebElement(const PassRefPtr<Element>& elem)
: WebNode(elem)
{
}
WebElement& WebElement::operator=(const PassRefPtr<Element>& elem)
{
m_private = elem;
return *this;
}
WebElement::operator PassRefPtr<Element>() const
{
return static_cast<Element*>(m_private.get());
}
}