1 | /* |
2 | * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 | * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 | * (C) 2000 Simon Hausmann <hausmann@kde.org> |
5 | * Copyright (C) 2004, 2006, 2008, 2009 Apple Inc. All rights reserved. |
6 | * |
7 | * This library is free software; you can redistribute it and/or |
8 | * modify it under the terms of the GNU Library General Public |
9 | * License as published by the Free Software Foundation; either |
10 | * version 2 of the License, or (at your option) any later version. |
11 | * |
12 | * This library is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
15 | * Library General Public License for more details. |
16 | * |
17 | * You should have received a copy of the GNU Library General Public License |
18 | * along with this library; see the file COPYING.LIB. If not, write to |
19 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
20 | * Boston, MA 02110-1301, USA. |
21 | * |
22 | */ |
23 | |
24 | #pragma once |
25 | |
26 | #include "FrameLoaderTypes.h" |
27 | #include "HTMLFrameOwnerElement.h" |
28 | |
29 | namespace JSC { |
30 | class ExecState; |
31 | } |
32 | |
33 | namespace WebCore { |
34 | |
35 | class HTMLFrameElementBase : public HTMLFrameOwnerElement { |
36 | WTF_MAKE_ISO_ALLOCATED(HTMLFrameElementBase); |
37 | public: |
38 | WEBCORE_EXPORT URL location() const; |
39 | WEBCORE_EXPORT void setLocation(const String&); |
40 | void setLocation(JSC::ExecState&, const String&); |
41 | |
42 | ScrollbarMode scrollingMode() const final { return m_scrolling; } |
43 | |
44 | int marginWidth() const { return m_marginWidth; } |
45 | int marginHeight() const { return m_marginHeight; } |
46 | |
47 | WEBCORE_EXPORT int width(); |
48 | WEBCORE_EXPORT int height(); |
49 | |
50 | bool canContainRangeEndPoint() const final { return false; } |
51 | |
52 | bool isURLAllowed(const URL&) const override; |
53 | |
54 | protected: |
55 | HTMLFrameElementBase(const QualifiedName&, Document&); |
56 | |
57 | bool isURLAllowed() const; |
58 | |
59 | void parseAttribute(const QualifiedName&, const AtomicString&) override; |
60 | InsertedIntoAncestorResult insertedIntoAncestor(InsertionType, ContainerNode&) final; |
61 | void didFinishInsertingNode() final; |
62 | void didAttachRenderers() override; |
63 | |
64 | private: |
65 | bool supportsFocus() const final; |
66 | void setFocus(bool) final; |
67 | |
68 | bool isURLAttribute(const Attribute&) const final; |
69 | bool isHTMLContentAttribute(const Attribute&) const final; |
70 | |
71 | bool isFrameElementBase() const final { return true; } |
72 | |
73 | void openURL(LockHistory = LockHistory::Yes, LockBackForwardList = LockBackForwardList::Yes); |
74 | |
75 | AtomicString m_URL; |
76 | |
77 | ScrollbarMode m_scrolling; |
78 | |
79 | int m_marginWidth; |
80 | int m_marginHeight; |
81 | }; |
82 | |
83 | } // namespace WebCore |
84 | |
85 | SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::HTMLFrameElementBase) |
86 | static bool isType(const WebCore::HTMLElement& element) { return is<WebCore::HTMLFrameElement>(element) || is<WebCore::HTMLIFrameElement>(element); } |
87 | static bool isType(const WebCore::Node& node) { return is<WebCore::HTMLElement>(node) && isType(downcast<WebCore::HTMLElement>(node)); } |
88 | SPECIALIZE_TYPE_TRAITS_END() |
89 | |