diff options
author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
---|---|---|
committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebCore/html/HTMLIFrameElement.cpp | |
parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
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 } |