2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * Copyright (C) 2004, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
23 #ifndef HTMLObjectElement_h
24 #define HTMLObjectElement_h
26 #include "FormAssociatedElement.h"
27 #include "HTMLPlugInImageElement.h"
31 class HTMLFormElement;
33 class HTMLObjectElement : public HTMLPlugInImageElement, public FormAssociatedElement {
35 static PassRefPtr<HTMLObjectElement> create(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
36 virtual ~HTMLObjectElement();
38 bool isDocNamedItem() const { return m_docNamedItem; }
40 const String& classId() const { return m_classId; }
42 bool containsJavaApplet() const;
44 virtual bool useFallbackContent() const { return m_useFallbackContent; }
45 void renderFallbackContent();
47 // Implementations of FormAssociatedElement
48 HTMLFormElement* form() const { return FormAssociatedElement::form(); }
50 virtual bool isFormControlElement() const { return false; }
52 virtual bool isEnumeratable() const { return true; }
53 virtual bool isResettable() const { return false; }
54 virtual bool appendFormData(FormDataList&, bool);
56 // Implementations of constraint validation API.
57 // Note that the object elements are always barred from constraint validation.
58 String validationMessage() { return String(); }
59 bool checkValidity() { return true; }
60 void setCustomValidity(const String&) { }
62 virtual void attributeChanged(Attribute*, bool preserveDecls = false);
64 using TreeShared<ContainerNode>::ref;
65 using TreeShared<ContainerNode>::deref;
68 HTMLObjectElement(const QualifiedName&, Document*, HTMLFormElement*, bool createdByParser);
70 virtual void parseMappedAttribute(Attribute*);
71 virtual void insertedIntoTree(bool deep);
72 virtual void removedFromTree(bool deep);
74 virtual bool rendererIsNeeded(RenderStyle*);
75 virtual void insertedIntoDocument();
76 virtual void removedFromDocument();
77 virtual void willMoveToNewOwnerDocument();
79 virtual void childrenChanged(bool changedByParser = false, Node* beforeChange = 0, Node* afterChange = 0, int childCountDelta = 0);
81 virtual bool isURLAttribute(Attribute*) const;
82 virtual const QualifiedName& imageSourceAttributeName() const;
84 virtual RenderWidget* renderWidgetForJSBindings() const;
86 virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
88 virtual void updateWidget(bool onlyCreateNonNetscapePlugins);
89 void updateDocNamedItem();
91 bool hasFallbackContent() const;
93 // FIXME: This function should not deal with url or serviceType
94 // so that we can better share code between <object> and <embed>.
95 void parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType);
97 bool hasValidClassId();
99 virtual void refFormAssociatedElement() { ref(); }
100 virtual void derefFormAssociatedElement() { deref(); }
102 virtual const AtomicString& formControlName() const;
106 bool m_docNamedItem : 1;
107 bool m_useFallbackContent : 1;