darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 1 | /* |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 2 | * Copyright (C) 2006, 2007, 2009 Apple Inc. All rights reserved. |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 3 | * |
| 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 |
ddkilzer | c8eccec | 2007-09-26 02:29:57 +0000 | [diff] [blame] | 16 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 17 | * Boston, MA 02110-1301, USA. |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 18 | * |
| 19 | */ |
| 20 | |
| 21 | #ifndef HTMLFrameOwnerElement_h |
| 22 | #define HTMLFrameOwnerElement_h |
| 23 | |
| 24 | #include "HTMLElement.h" |
akling@apple.com | 670437f | 2014-02-17 03:52:02 +0000 | [diff] [blame] | 25 | #include <wtf/HashCountedSet.h> |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 26 | |
| 27 | namespace WebCore { |
| 28 | |
weinig | 6d162e7 | 2007-07-17 17:46:39 +0000 | [diff] [blame] | 29 | class DOMWindow; |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 30 | class Frame; |
akling@apple.com | b95111f | 2013-09-12 05:21:14 +0000 | [diff] [blame] | 31 | class RenderWidget; |
eric@webkit.org | 346b636 | 2008-02-01 09:35:00 +0000 | [diff] [blame] | 32 | class SVGDocument; |
eric@webkit.org | 346b636 | 2008-02-01 09:35:00 +0000 | [diff] [blame] | 33 | |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 34 | class HTMLFrameOwnerElement : public HTMLElement { |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 35 | public: |
| 36 | virtual ~HTMLFrameOwnerElement(); |
| 37 | |
| 38 | Frame* contentFrame() const { return m_contentFrame; } |
weinig | 6d162e7 | 2007-07-17 17:46:39 +0000 | [diff] [blame] | 39 | DOMWindow* contentWindow() const; |
commit-queue@webkit.org | 8cc7564 | 2014-08-22 18:25:37 +0000 | [diff] [blame] | 40 | WEBCORE_EXPORT Document* contentDocument() const; |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 41 | |
commit-queue@webkit.org | 8d4344a | 2012-11-13 04:44:20 +0000 | [diff] [blame] | 42 | void setContentFrame(Frame*); |
commit-queue@webkit.org | be321c0 | 2013-01-25 10:48:14 +0000 | [diff] [blame] | 43 | void clearContentFrame(); |
commit-queue@webkit.org | 8d4344a | 2012-11-13 04:44:20 +0000 | [diff] [blame] | 44 | |
| 45 | void disconnectContentFrame(); |
| 46 | |
akling@apple.com | b95111f | 2013-09-12 05:21:14 +0000 | [diff] [blame] | 47 | // Most subclasses use RenderWidget (either RenderEmbeddedObject or RenderIFrame) |
eric@webkit.org | 4eeaef7 | 2010-09-02 02:11:45 +0000 | [diff] [blame] | 48 | // except for HTMLObjectElement and HTMLEmbedElement which may return any |
darin@apple.com | 8cdf712 | 2013-09-30 02:40:50 +0000 | [diff] [blame] | 49 | // RenderElement when using fallback content. |
akling@apple.com | b95111f | 2013-09-12 05:21:14 +0000 | [diff] [blame] | 50 | RenderWidget* renderWidget() const; |
eric@webkit.org | 4eeaef7 | 2010-09-02 02:11:45 +0000 | [diff] [blame] | 51 | |
eric@webkit.org | 346b636 | 2008-02-01 09:35:00 +0000 | [diff] [blame] | 52 | SVGDocument* getSVGDocument(ExceptionCode&) const; |
eric@webkit.org | 346b636 | 2008-02-01 09:35:00 +0000 | [diff] [blame] | 53 | |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 54 | virtual ScrollbarMode scrollingMode() const { return ScrollbarAuto; } |
| 55 | |
abarth@webkit.org | b8a1055 | 2009-12-02 02:40:35 +0000 | [diff] [blame] | 56 | SandboxFlags sandboxFlags() const { return m_sandboxFlags; } |
dimich@chromium.org | 451eabb | 2010-01-27 00:22:37 +0000 | [diff] [blame] | 57 | |
andersca@apple.com | 20bdec4 | 2013-12-20 22:34:31 +0000 | [diff] [blame] | 58 | void scheduleSetNeedsStyleRecalc(StyleChangeType = FullStyleChange); |
| 59 | |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 60 | protected: |
weinig@apple.com | dedf67e | 2013-09-15 05:23:01 +0000 | [diff] [blame] | 61 | HTMLFrameOwnerElement(const QualifiedName& tagName, Document&); |
abarth@webkit.org | b8a1055 | 2009-12-02 02:40:35 +0000 | [diff] [blame] | 62 | void setSandboxFlags(SandboxFlags); |
dimich@chromium.org | 451eabb | 2010-01-27 00:22:37 +0000 | [diff] [blame] | 63 | |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 64 | private: |
commit-queue@webkit.org | 2dfe6cb | 2014-01-16 19:42:50 +0000 | [diff] [blame] | 65 | virtual bool isKeyboardFocusable(KeyboardEvent*) const override; |
cdumez@apple.com | 8dc7aca | 2014-10-29 15:09:57 +0000 | [diff] [blame] | 66 | virtual bool isFrameOwnerElement() const override final { return true; } |
darin@apple.com | cf9dd0f | 2009-08-23 06:55:57 +0000 | [diff] [blame] | 67 | |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 68 | Frame* m_contentFrame; |
abarth@webkit.org | b8a1055 | 2009-12-02 02:40:35 +0000 | [diff] [blame] | 69 | SandboxFlags m_sandboxFlags; |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 70 | }; |
| 71 | |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 72 | class SubframeLoadingDisabler { |
| 73 | public: |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 74 | explicit SubframeLoadingDisabler(ContainerNode& root) |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 75 | : m_root(root) |
| 76 | { |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 77 | disabledSubtreeRoots().add(&m_root); |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | ~SubframeLoadingDisabler() |
| 81 | { |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 82 | disabledSubtreeRoots().remove(&m_root); |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 83 | } |
| 84 | |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 85 | static bool canLoadFrame(HTMLFrameOwnerElement&); |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 86 | |
| 87 | private: |
akling@apple.com | 670437f | 2014-02-17 03:52:02 +0000 | [diff] [blame] | 88 | static HashCountedSet<ContainerNode*>& disabledSubtreeRoots() |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 89 | { |
svillar@igalia.com | 5b31eef | 2014-03-14 08:30:55 +0000 | [diff] [blame] | 90 | DEPRECATED_DEFINE_STATIC_LOCAL(HashCountedSet<ContainerNode*>, nodes, ()); |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 91 | return nodes; |
| 92 | } |
| 93 | |
weinig@apple.com | 2e06721 | 2013-09-23 03:40:47 +0000 | [diff] [blame] | 94 | ContainerNode& m_root; |
commit-queue@webkit.org | 5cbb9f8 | 2012-11-14 04:25:11 +0000 | [diff] [blame] | 95 | }; |
| 96 | |
weinig | 6d162e7 | 2007-07-17 17:46:39 +0000 | [diff] [blame] | 97 | } // namespace WebCore |
darin | cb3524a | 2006-12-11 23:40:47 +0000 | [diff] [blame] | 98 | |
cdumez@apple.com | 3e58f0f | 2014-09-30 21:32:55 +0000 | [diff] [blame] | 99 | SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLFrameOwnerElement) |
| 100 | static bool isType(const WebCore::Node& node) { return node.isFrameOwnerElement(); } |
| 101 | SPECIALIZE_TYPE_TRAITS_END() |
| 102 | |
weinig | 6d162e7 | 2007-07-17 17:46:39 +0000 | [diff] [blame] | 103 | #endif // HTMLFrameOwnerElement_h |