This source file includes following definitions.
- m_didLoadNonEmptyDocument
- create
- isPresentationAttribute
- collectStyleForPresentationAttribute
- parseAttribute
- rendererIsNeeded
- createRenderer
- insertedInto
- removedFrom
- isInteractiveContent
#include "config.h"
#include "core/html/HTMLIFrameElement.h"
#include "CSSPropertyNames.h"
#include "HTMLNames.h"
#include "core/html/HTMLDocument.h"
#include "core/rendering/RenderIFrame.h"
namespace WebCore {
using namespace HTMLNames;
inline HTMLIFrameElement::HTMLIFrameElement(Document& document)
: HTMLFrameElementBase(iframeTag, document)
, m_didLoadNonEmptyDocument(false)
{
ScriptWrappable::init(this);
}
PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(Document& document)
{
return adoptRef(new HTMLIFrameElement(document));
}
bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const
{
if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr)
return true;
return HTMLFrameElementBase::isPresentationAttribute(name);
}
void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style)
{
if (name == widthAttr)
addHTMLLengthToStyle(style, CSSPropertyWidth, value);
else if (name == heightAttr)
addHTMLLengthToStyle(style, CSSPropertyHeight, value);
else if (name == alignAttr)
applyAlignmentAttributeToStyle(value, style);
else if (name == frameborderAttr) {
if (!value.toInt()) {
addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, 0, CSSPrimitiveValue::CSS_PX);
}
} else
HTMLFrameElementBase::collectStyleForPresentationAttribute(name, value, style);
}
void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == nameAttr) {
if (inDocument() && document().isHTMLDocument() && !isInShadowTree()) {
HTMLDocument& document = toHTMLDocument(this->document());
document.removeExtraNamedItem(m_name);
document.addExtraNamedItem(value);
}
m_name = value;
} else if (name == sandboxAttr) {
String invalidTokens;
setSandboxFlags(value.isNull() ? SandboxNone : parseSandboxPolicy(value, invalidTokens));
if (!invalidTokens.isNull())
document().addConsoleMessage(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
} else {
HTMLFrameElementBase::parseAttribute(name, value);
}
}
bool HTMLIFrameElement::rendererIsNeeded(const RenderStyle& style)
{
return isURLAllowed() && HTMLElement::rendererIsNeeded(style);
}
RenderObject* HTMLIFrameElement::createRenderer(RenderStyle*)
{
return new RenderIFrame(this);
}
Node::InsertionNotificationRequest HTMLIFrameElement::insertedInto(ContainerNode* insertionPoint)
{
InsertionNotificationRequest result = HTMLFrameElementBase::insertedInto(insertionPoint);
if (insertionPoint->inDocument() && document().isHTMLDocument() && !insertionPoint->isInShadowTree())
toHTMLDocument(document()).addExtraNamedItem(m_name);
return result;
}
void HTMLIFrameElement::removedFrom(ContainerNode* insertionPoint)
{
HTMLFrameElementBase::removedFrom(insertionPoint);
if (insertionPoint->inDocument() && document().isHTMLDocument() && !insertionPoint->isInShadowTree())
toHTMLDocument(document()).removeExtraNamedItem(m_name);
}
bool HTMLIFrameElement::isInteractiveContent() const
{
return true;
}
}