summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLFrameOwnerElement.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/WebCore/html/HTMLFrameOwnerElement.cpp
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/WebCore/html/HTMLFrameOwnerElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLFrameOwnerElement.cpp51
1 files changed, 22 insertions, 29 deletions
diff --git a/Source/WebCore/html/HTMLFrameOwnerElement.cpp b/Source/WebCore/html/HTMLFrameOwnerElement.cpp
index 253aaee8f..3779ec96e 100644
--- a/Source/WebCore/html/HTMLFrameOwnerElement.cpp
+++ b/Source/WebCore/html/HTMLFrameOwnerElement.cpp
@@ -22,22 +22,20 @@
#include "HTMLFrameOwnerElement.h"
#include "DOMWindow.h"
+#include "ExceptionCode.h"
#include "Frame.h"
#include "FrameLoader.h"
#include "RenderWidget.h"
#include "ShadowRoot.h"
-#include <wtf/Ref.h>
-
-#if ENABLE(SVG)
-#include "ExceptionCode.h"
#include "SVGDocument.h"
-#endif
+#include "StyleTreeResolver.h"
+#include <wtf/Ref.h>
namespace WebCore {
HTMLFrameOwnerElement::HTMLFrameOwnerElement(const QualifiedName& tagName, Document& document)
: HTMLElement(tagName, document)
- , m_contentFrame(0)
+ , m_contentFrame(nullptr)
, m_sandboxFlags(SandboxNone)
{
}
@@ -46,9 +44,9 @@ RenderWidget* HTMLFrameOwnerElement::renderWidget() const
{
// HTMLObjectElement and HTMLEmbedElement may return arbitrary renderers
// when using fallback content.
- if (!renderer() || !renderer()->isWidget())
- return 0;
- return toRenderWidget(renderer());
+ if (!is<RenderWidget>(renderer()))
+ return nullptr;
+ return downcast<RenderWidget>(renderer());
}
void HTMLFrameOwnerElement::setContentFrame(Frame* frame)
@@ -57,7 +55,7 @@ void HTMLFrameOwnerElement::setContentFrame(Frame* frame)
ASSERT(!m_contentFrame || m_contentFrame->ownerElement() != this);
ASSERT(frame);
// Disconnected frames should not be allowed to load.
- ASSERT(inDocument());
+ ASSERT(isConnected());
m_contentFrame = frame;
for (ContainerNode* node = this; node; node = node->parentOrShadowHostNode())
@@ -109,34 +107,29 @@ void HTMLFrameOwnerElement::setSandboxFlags(SandboxFlags flags)
m_sandboxFlags = flags;
}
-bool HTMLFrameOwnerElement::isKeyboardFocusable(KeyboardEvent* event) const
+bool HTMLFrameOwnerElement::isKeyboardFocusable(KeyboardEvent& event) const
{
return m_contentFrame && HTMLElement::isKeyboardFocusable(event);
}
-#if ENABLE(SVG)
-SVGDocument* HTMLFrameOwnerElement::getSVGDocument(ExceptionCode& ec) const
+ExceptionOr<Document&> HTMLFrameOwnerElement::getSVGDocument() const
{
- Document* doc = contentDocument();
- if (doc && doc->isSVGDocument())
- return toSVGDocument(doc);
+ auto* document = contentDocument();
+ if (is<SVGDocument>(document))
+ return *document;
// Spec: http://www.w3.org/TR/SVG/struct.html#InterfaceGetSVGDocument
- ec = NOT_SUPPORTED_ERR;
- return 0;
-}
-#endif
-
-static void needsStyleRecalcCallback(Node& node, unsigned data)
-{
- node.setNeedsStyleRecalc(static_cast<StyleChangeType>(data));
+ return Exception { NOT_SUPPORTED_ERR };
}
-void HTMLFrameOwnerElement::scheduleSetNeedsStyleRecalc(StyleChangeType changeType)
+void HTMLFrameOwnerElement::scheduleinvalidateStyleAndLayerComposition()
{
- if (postAttachCallbacksAreSuspended())
- queuePostAttachCallback(needsStyleRecalcCallback, *this, static_cast<unsigned>(changeType));
- else
- setNeedsStyleRecalc(changeType);
+ if (Style::postResolutionCallbacksAreSuspended()) {
+ RefPtr<HTMLFrameOwnerElement> element = this;
+ Style::queuePostResolutionCallback([element] {
+ element->invalidateStyleAndLayerComposition();
+ });
+ } else
+ invalidateStyleAndLayerComposition();
}
bool SubframeLoadingDisabler::canLoadFrame(HTMLFrameOwnerElement& owner)