summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLIFrameElement.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/html/HTMLIFrameElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLIFrameElement.cpp45
1 files changed, 19 insertions, 26 deletions
diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp
index a2f9d10cd..d30322dc0 100644
--- a/Source/WebCore/html/HTMLIFrameElement.cpp
+++ b/Source/WebCore/html/HTMLIFrameElement.cpp
@@ -25,8 +25,8 @@
#include "config.h"
#include "HTMLIFrameElement.h"
-#include "Attribute.h"
#include "CSSPropertyNames.h"
+#include "DOMTokenList.h"
#include "Frame.h"
#include "HTMLDocument.h"
#include "HTMLNames.h"
@@ -41,17 +41,25 @@ inline HTMLIFrameElement::HTMLIFrameElement(const QualifiedName& tagName, Docume
: HTMLFrameElementBase(tagName, document)
{
ASSERT(hasTagName(iframeTag));
- setHasCustomStyleResolveCallbacks();
}
-PassRefPtr<HTMLIFrameElement> HTMLIFrameElement::create(const QualifiedName& tagName, Document& document)
+Ref<HTMLIFrameElement> HTMLIFrameElement::create(const QualifiedName& tagName, Document& document)
{
- return adoptRef(new HTMLIFrameElement(tagName, document));
+ return adoptRef(*new HTMLIFrameElement(tagName, document));
+}
+
+DOMTokenList& HTMLIFrameElement::sandbox()
+{
+ if (!m_sandbox)
+ m_sandbox = std::make_unique<DOMTokenList>(*this, sandboxAttr, [](StringView token) {
+ return SecurityContext::isSupportedSandboxPolicy(token);
+ });
+ return *m_sandbox;
}
bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const
{
- if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr || name == seamlessAttr)
+ if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr)
return true;
return HTMLFrameElementBase::isPresentationAttribute(name);
}
@@ -78,14 +86,13 @@ void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName
void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value)
{
if (name == sandboxAttr) {
+ if (m_sandbox)
+ m_sandbox->associatedAttributeValueChanged(value);
+
String invalidTokens;
setSandboxFlags(value.isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(value, invalidTokens));
if (!invalidTokens.isNull())
- document().addConsoleMessage(OtherMessageSource, ErrorMessageLevel, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
- } else if (name == seamlessAttr) {
- // If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
- if (contentDocument())
- contentDocument()->styleResolverChanged(DeferRecalcStyle);
+ document().addConsoleMessage(MessageSource::Other, MessageLevel::Error, "Error while parsing the 'sandbox' attribute: " + invalidTokens);
} else
HTMLFrameElementBase::parseAttribute(name, value);
}
@@ -95,23 +102,9 @@ bool HTMLIFrameElement::rendererIsNeeded(const RenderStyle& style)
return isURLAllowed() && style.display() != NONE;
}
-RenderPtr<RenderElement> HTMLIFrameElement::createElementRenderer(PassRef<RenderStyle> style)
-{
- return createRenderer<RenderIFrame>(*this, std::move(style));
-}
-
-bool HTMLIFrameElement::shouldDisplaySeamlessly() const
-{
- return contentDocument() && contentDocument()->shouldDisplaySeamlesslyWithParent();
-}
-
-void HTMLIFrameElement::didRecalcStyle(Style::Change styleChange)
+RenderPtr<RenderElement> HTMLIFrameElement::createElementRenderer(RenderStyle&& style, const RenderTreePosition&)
{
- if (!shouldDisplaySeamlessly())
- return;
- Document* childDocument = contentDocument();
- if (styleChange >= Style::Inherit || childDocument->childNeedsStyleRecalc() || childDocument->needsStyleRecalc())
- contentDocument()->recalcStyle(styleChange == Style::Detach ? Style::Force : styleChange);
+ return createRenderer<RenderIFrame>(*this, WTFMove(style));
}
}