1/* 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. 5 * 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. 10 * 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. 15 * 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. 20 * 21 */ 22 23#ifndef HTMLObjectElement_h 24#define HTMLObjectElement_h 25 26#include "FormAssociatedElement.h" 27#include "HTMLPlugInImageElement.h" 28 29namespace WebCore { 30 31class HTMLFormElement; 32 33class HTMLObjectElement final : public HTMLPlugInImageElement, public FormAssociatedElement { 34public: 35 static PassRefPtr<HTMLObjectElement> create(const QualifiedName&, Document&, HTMLFormElement*, bool createdByParser); 36 virtual ~HTMLObjectElement(); 37 38 bool isDocNamedItem() const { return m_docNamedItem; } 39 bool containsJavaApplet() const; 40 41 bool hasFallbackContent() const; 42 virtual bool useFallbackContent() const override { return m_useFallbackContent; } 43 void renderFallbackContent(); 44 45 // Implementation of constraint validation API. 46 // Note that the object elements are always barred from constraint validation. 47 static bool checkValidity() { return true; } 48 virtual void setCustomValidity(const String&) override { } 49 virtual String validationMessage() const override { return String(); } 50 51 using HTMLPlugInImageElement::ref; 52 using HTMLPlugInImageElement::deref; 53 54 using FormAssociatedElement::form; 55 56private: 57 HTMLObjectElement(const QualifiedName&, Document&, HTMLFormElement*, bool createdByParser); 58 59 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override; 60 virtual bool isPresentationAttribute(const QualifiedName&) const override; 61 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStyleProperties&) override; 62 63 virtual InsertionNotificationRequest insertedInto(ContainerNode&) override; 64 virtual void removedFrom(ContainerNode&) override; 65 66 virtual void didMoveToNewDocument(Document* oldDocument) override; 67 68 virtual void childrenChanged(const ChildChange&) override; 69 70 virtual bool isURLAttribute(const Attribute&) const override; 71 virtual const AtomicString& imageSourceURL() const override; 72 73 virtual RenderWidget* renderWidgetForJSBindings() const override; 74 75 virtual void addSubresourceAttributeURLs(ListHashSet<URL>&) const override; 76 77 virtual void updateWidget(PluginCreationOption) override; 78 void updateDocNamedItem(); 79 80 // FIXME: This function should not deal with url or serviceType 81 // so that we can better share code between <object> and <embed>. 82 void parametersForPlugin(Vector<String>& paramNames, Vector<String>& paramValues, String& url, String& serviceType); 83 84 bool shouldAllowQuickTimeClassIdQuirk(); 85 bool hasValidClassId(); 86 87 virtual void refFormAssociatedElement() override { ref(); } 88 virtual void derefFormAssociatedElement() override { deref(); } 89 virtual HTMLFormElement* virtualForm() const override; 90 91 virtual FormNamedItem* asFormNamedItem() override final { return this; } 92 virtual HTMLObjectElement& asHTMLElement() override final { return *this; } 93 virtual const HTMLObjectElement& asHTMLElement() const override final { return *this; } 94 95 virtual bool isFormControlElement() const override { return false; } 96 97 virtual bool isEnumeratable() const override { return true; } 98 virtual bool appendFormData(FormDataList&, bool) override; 99 100 virtual bool canContainRangeEndPoint() const override; 101 102 bool m_docNamedItem : 1; 103 bool m_useFallbackContent : 1; 104}; 105 106NODE_TYPE_CASTS(HTMLObjectElement) 107 108} 109 110#endif 111