blob: 01fa7002163ad4bb6061a4d11f98931b96a8795b [file] [log] [blame]
darincb3524a2006-12-11 23:40:47 +00001/*
darin@apple.comcf9dd0f2009-08-23 06:55:57 +00002 * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved.
darincb3524a2006-12-11 23:40:47 +00003 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public License
15 * along with this library; see the file COPYING.LIB. If not, write to
ddkilzerc8eccec2007-09-26 02:29:57 +000016 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
darincb3524a2006-12-11 23:40:47 +000018 *
19 */
20
21#ifndef HTMLFrameOwnerElement_h
22#define HTMLFrameOwnerElement_h
23
24#include "HTMLElement.h"
akling@apple.com670437f2014-02-17 03:52:02 +000025#include <wtf/HashCountedSet.h>
darincb3524a2006-12-11 23:40:47 +000026
27namespace WebCore {
28
weinig6d162e72007-07-17 17:46:39 +000029class DOMWindow;
darincb3524a2006-12-11 23:40:47 +000030class Frame;
akling@apple.comb95111f2013-09-12 05:21:14 +000031class RenderWidget;
eric@webkit.org346b6362008-02-01 09:35:00 +000032class SVGDocument;
eric@webkit.org346b6362008-02-01 09:35:00 +000033
darincb3524a2006-12-11 23:40:47 +000034class HTMLFrameOwnerElement : public HTMLElement {
darincb3524a2006-12-11 23:40:47 +000035public:
36 virtual ~HTMLFrameOwnerElement();
37
38 Frame* contentFrame() const { return m_contentFrame; }
weinig6d162e72007-07-17 17:46:39 +000039 DOMWindow* contentWindow() const;
commit-queue@webkit.org8cc75642014-08-22 18:25:37 +000040 WEBCORE_EXPORT Document* contentDocument() const;
darincb3524a2006-12-11 23:40:47 +000041
commit-queue@webkit.org8d4344a2012-11-13 04:44:20 +000042 void setContentFrame(Frame*);
commit-queue@webkit.orgbe321c02013-01-25 10:48:14 +000043 void clearContentFrame();
commit-queue@webkit.org8d4344a2012-11-13 04:44:20 +000044
45 void disconnectContentFrame();
46
akling@apple.comb95111f2013-09-12 05:21:14 +000047 // Most subclasses use RenderWidget (either RenderEmbeddedObject or RenderIFrame)
eric@webkit.org4eeaef72010-09-02 02:11:45 +000048 // except for HTMLObjectElement and HTMLEmbedElement which may return any
darin@apple.com8cdf7122013-09-30 02:40:50 +000049 // RenderElement when using fallback content.
akling@apple.comb95111f2013-09-12 05:21:14 +000050 RenderWidget* renderWidget() const;
eric@webkit.org4eeaef72010-09-02 02:11:45 +000051
eric@webkit.org346b6362008-02-01 09:35:00 +000052 SVGDocument* getSVGDocument(ExceptionCode&) const;
eric@webkit.org346b6362008-02-01 09:35:00 +000053
darin@apple.comcf9dd0f2009-08-23 06:55:57 +000054 virtual ScrollbarMode scrollingMode() const { return ScrollbarAuto; }
55
abarth@webkit.orgb8a10552009-12-02 02:40:35 +000056 SandboxFlags sandboxFlags() const { return m_sandboxFlags; }
dimich@chromium.org451eabb2010-01-27 00:22:37 +000057
andersca@apple.com20bdec42013-12-20 22:34:31 +000058 void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange);
59
darin@apple.comcf9dd0f2009-08-23 06:55:57 +000060protected:
weinig@apple.comdedf67e2013-09-15 05:23:01 +000061 HTMLFrameOwnerElement(const QualifiedName& tagName, Document&);
abarth@webkit.orgb8a10552009-12-02 02:40:35 +000062 void setSandboxFlags(SandboxFlags);
dimich@chromium.org451eabb2010-01-27 00:22:37 +000063
darincb3524a2006-12-11 23:40:47 +000064private:
commit-queue@webkit.org2dfe6cb2014-01-16 19:42:50 +000065 virtual bool isKeyboardFocusable(KeyboardEvent*) const override;
cdumez@apple.com8dc7aca2014-10-29 15:09:57 +000066 virtual bool isFrameOwnerElement() const override final { return true; }
darin@apple.comcf9dd0f2009-08-23 06:55:57 +000067
darincb3524a2006-12-11 23:40:47 +000068 Frame* m_contentFrame;
abarth@webkit.orgb8a10552009-12-02 02:40:35 +000069 SandboxFlags m_sandboxFlags;
darincb3524a2006-12-11 23:40:47 +000070};
71
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000072class SubframeLoadingDisabler {
73public:
weinig@apple.com2e067212013-09-23 03:40:47 +000074 explicit SubframeLoadingDisabler(ContainerNode& root)
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000075 : m_root(root)
76 {
weinig@apple.com2e067212013-09-23 03:40:47 +000077 disabledSubtreeRoots().add(&m_root);
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000078 }
79
80 ~SubframeLoadingDisabler()
81 {
weinig@apple.com2e067212013-09-23 03:40:47 +000082 disabledSubtreeRoots().remove(&m_root);
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000083 }
84
weinig@apple.com2e067212013-09-23 03:40:47 +000085 static bool canLoadFrame(HTMLFrameOwnerElement&);
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000086
87private:
akling@apple.com670437f2014-02-17 03:52:02 +000088 static HashCountedSet<ContainerNode*>& disabledSubtreeRoots()
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000089 {
svillar@igalia.com5b31eef2014-03-14 08:30:55 +000090 DEPRECATED_DEFINE_STATIC_LOCAL(HashCountedSet<ContainerNode*>, nodes, ());
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000091 return nodes;
92 }
93
weinig@apple.com2e067212013-09-23 03:40:47 +000094 ContainerNode& m_root;
commit-queue@webkit.org5cbb9f82012-11-14 04:25:11 +000095};
96
weinig6d162e72007-07-17 17:46:39 +000097} // namespace WebCore
darincb3524a2006-12-11 23:40:47 +000098
cdumez@apple.com3e58f0f2014-09-30 21:32:55 +000099SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLFrameOwnerElement)
100 static bool isType(const WebCore::Node& node) { return node.isFrameOwnerElement(); }
101SPECIALIZE_TYPE_TRAITS_END()
102
weinig6d162e72007-07-17 17:46:39 +0000103#endif // HTMLFrameOwnerElement_h