HTMLContentElement.cpp [plain text]
#include "config.h"
#include "HTMLContentElement.h"
#include "ContentSelectorQuery.h"
#include "HTMLContentSelector.h"
#include "HTMLNames.h"
#include "QualifiedName.h"
#include "RuntimeEnabledFeatures.h"
#include "ShadowRoot.h"
#include "ShadowTree.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
using HTMLNames::selectAttr;
static const QualifiedName& contentTagName()
{
#if ENABLE(SHADOW_DOM)
if (!RuntimeEnabledFeatures::shadowDOMEnabled())
return HTMLNames::webkitShadowContentTag;
return HTMLNames::contentTag;
#else
return HTMLNames::webkitShadowContentTag;
#endif
}
PassRefPtr<HTMLContentElement> HTMLContentElement::create(Document* document)
{
return adoptRef(new HTMLContentElement(contentTagName(), document));
}
PassRefPtr<HTMLContentElement> HTMLContentElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLContentElement(tagName, document));
}
HTMLContentElement::HTMLContentElement(const QualifiedName& name, Document* document)
: InsertionPoint(name, document)
{
}
HTMLContentElement::~HTMLContentElement()
{
}
const AtomicString& HTMLContentElement::select() const
{
return getAttribute(selectAttr);
}
bool HTMLContentElement::isSelectValid() const
{
ContentSelectorQuery query(this);
return query.isValidSelector();
}
void HTMLContentElement::setSelect(const AtomicString& selectValue)
{
setAttribute(selectAttr, selectValue);
}
void HTMLContentElement::parseAttribute(Attribute* attr)
{
if (attr->name() == selectAttr) {
if (ShadowRoot* root = toShadowRoot(shadowTreeRootNode()))
root->tree()->setNeedsReattachHostChildrenAndShadow();
} else
InsertionPoint::parseAttribute(attr);
}
}