diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/WebCore/html/HTMLIFrameElement.cpp | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/WebCore/html/HTMLIFrameElement.cpp')
-rw-r--r-- | Source/WebCore/html/HTMLIFrameElement.cpp | 64 |
1 files changed, 21 insertions, 43 deletions
diff --git a/Source/WebCore/html/HTMLIFrameElement.cpp b/Source/WebCore/html/HTMLIFrameElement.cpp index b67ad6cd2..ac318fc82 100644 --- a/Source/WebCore/html/HTMLIFrameElement.cpp +++ b/Source/WebCore/html/HTMLIFrameElement.cpp @@ -25,12 +25,11 @@ #include "config.h" #include "HTMLIFrameElement.h" -#include "Attribute.h" +#include "AttributeDOMTokenList.h" #include "CSSPropertyNames.h" #include "Frame.h" #include "HTMLDocument.h" #include "HTMLNames.h" -#include "NodeRenderingContext.h" #include "RenderIFrame.h" #include "ScriptableDocumentParser.h" @@ -38,26 +37,32 @@ namespace WebCore { using namespace HTMLNames; -inline HTMLIFrameElement::HTMLIFrameElement(const QualifiedName& tagName, Document* document) +inline HTMLIFrameElement::HTMLIFrameElement(const QualifiedName& tagName, Document& document) : HTMLFrameElementBase(tagName, document) { ASSERT(hasTagName(iframeTag)); - setHasCustomStyleCallbacks(); } -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<AttributeDOMTokenList>(*this, sandboxAttr); + 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); } -void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStylePropertySet* style) +void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName& name, const AtomicString& value, MutableStyleProperties& style) { if (name == widthAttr) addHTMLLengthToStyle(style, CSSPropertyWidth, value); @@ -79,52 +84,25 @@ void HTMLIFrameElement::collectStyleForPresentationAttribute(const QualifiedName void HTMLIFrameElement::parseAttribute(const QualifiedName& name, const AtomicString& value) { if (name == sandboxAttr) { + if (m_sandbox) + m_sandbox->attributeValueChanged(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); } -bool HTMLIFrameElement::rendererIsNeeded(const NodeRenderingContext& context) -{ - return isURLAllowed() && context.style()->display() != NONE; -} - -RenderObject* HTMLIFrameElement::createRenderer(RenderArena* arena, RenderStyle*) -{ - return new (arena) RenderIFrame(this); -} - -bool HTMLIFrameElement::shouldDisplaySeamlessly() const -{ - return contentDocument() && contentDocument()->shouldDisplaySeamlesslyWithParent(); -} - -void HTMLIFrameElement::didRecalcStyle(StyleChange styleChange) -{ - if (!shouldDisplaySeamlessly()) - return; - Document* childDocument = contentDocument(); - if (styleChange >= Inherit || childDocument->childNeedsStyleRecalc() || childDocument->needsStyleRecalc()) - contentDocument()->recalcStyle(styleChange); -} - -#if ENABLE(MICRODATA) -String HTMLIFrameElement::itemValueText() const +bool HTMLIFrameElement::rendererIsNeeded(const RenderStyle& style) { - return getURLAttribute(srcAttr); + return isURLAllowed() && style.display() != NONE; } -void HTMLIFrameElement::setItemValueText(const String& value, ExceptionCode&) +RenderPtr<RenderElement> HTMLIFrameElement::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&) { - setAttribute(srcAttr, value); + return createRenderer<RenderIFrame>(*this, WTFMove(style)); } -#endif } |