HTMLFrameElement.cpp [plain text]
#include "config.h"
#include "HTMLFrameElement.h"
#include "Attribute.h"
#include "Frame.h"
#include "HTMLFrameSetElement.h"
#include "HTMLNames.h"
#include "RenderFrame.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLFrameElement::HTMLFrameElement(const QualifiedName& tagName, Document* document)
: HTMLFrameElementBase(tagName, document)
, m_frameBorder(true)
, m_frameBorderSet(false)
{
ASSERT(hasTagName(frameTag));
}
PassRefPtr<HTMLFrameElement> HTMLFrameElement::create(const QualifiedName& tagName, Document* document)
{
return adoptRef(new HTMLFrameElement(tagName, document));
}
bool HTMLFrameElement::rendererIsNeeded(const NodeRenderingContext&)
{
return isURLAllowed();
}
RenderObject* HTMLFrameElement::createRenderer(RenderArena* arena, RenderStyle*)
{
return new (arena) RenderFrame(this);
}
static inline HTMLFrameSetElement* containingFrameSetElement(Node* node)
{
while ((node = node->parentNode())) {
if (node->hasTagName(framesetTag))
return static_cast<HTMLFrameSetElement*>(node);
}
return 0;
}
bool HTMLFrameElement::noResize() const
{
return hasAttribute(noresizeAttr);
}
void HTMLFrameElement::attach(const AttachContext& context)
{
HTMLFrameElementBase::attach(context);
if (HTMLFrameSetElement* frameSetElement = containingFrameSetElement(this)) {
if (!m_frameBorderSet)
m_frameBorder = frameSetElement->hasFrameBorder();
}
}
void HTMLFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == frameborderAttr) {
m_frameBorder = value.toInt();
m_frameBorderSet = !value.isNull();
} else if (name == noresizeAttr) {
if (renderer())
renderer()->updateFromElement();
} else
HTMLFrameElementBase::parseAttribute(name, value);
}
}