HTMLNoScriptElement.cpp [plain text]
#include "config.h"
#if ENABLE(XHTMLMP)
#include "HTMLNoScriptElement.h"
#include "CSSStyleSelector.h"
#include "HTMLNames.h"
#include "RenderObject.h"
namespace WebCore {
using namespace HTMLNames;
HTMLNoScriptElement::HTMLNoScriptElement(const QualifiedName& tagName, Document* doc)
: HTMLElement(tagName, doc)
{
ASSERT(hasTagName(noscriptTag));
}
HTMLNoScriptElement::~HTMLNoScriptElement()
{
}
bool HTMLNoScriptElement::checkDTD(const Node* newChild)
{
return newChild->isTextNode() || inBlockTagList(newChild);
}
void HTMLNoScriptElement::attach()
{
HTMLElement::attach();
if (!document()->shouldProcessNoscriptElement()) {
if (renderer() && renderer()->style())
renderer()->style()->setDisplay(NONE);
setNeedsStyleRecalc();
}
}
void HTMLNoScriptElement::recalcStyle(StyleChange change)
{
if (!document()->shouldProcessNoscriptElement() || !renderer() || !renderer()->style())
return;
RefPtr<RenderStyle> style = renderer()->style();
if (style->display() == NONE) {
style->setDisplay(INLINE);
if (hasChildNodes()) {
for (Node* n = firstChild(); n; n = n->traverseNextNode(this))
if (!n->renderer())
n->createRendererIfNeeded();
}
}
}
bool HTMLNoScriptElement::childShouldCreateRenderer(Node* child) const
{
return document()->shouldProcessNoscriptElement();
}
}
#endif