HTMLElement.h revision cad810f21b803229eb11403f9209855525a25d57
1/* 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 4 * Copyright (C) 2004, 2005, 2006, 2007, 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 HTMLElement_h 24#define HTMLElement_h 25 26#include "StyledElement.h" 27 28namespace WebCore { 29 30class DocumentFragment; 31class HTMLCollection; 32class HTMLFormElement; 33 34class HTMLElement : public StyledElement { 35public: 36 static PassRefPtr<HTMLElement> create(const QualifiedName& tagName, Document*); 37 38 PassRefPtr<HTMLCollection> children(); 39 40 virtual String title() const; 41 42 virtual short tabIndex() const; 43 void setTabIndex(int); 44 45 String innerHTML() const; 46 String outerHTML() const; 47 // deprecatedCreateContextualFragment logic should be moved into Range::createContextualFragment 48 PassRefPtr<DocumentFragment> deprecatedCreateContextualFragment(const String&, FragmentScriptingPermission = FragmentScriptingAllowed); 49 void setInnerHTML(const String&, ExceptionCode&); 50 void setOuterHTML(const String&, ExceptionCode&); 51 void setInnerText(const String&, ExceptionCode&); 52 void setOuterText(const String&, ExceptionCode&); 53 54 Element* insertAdjacentElement(const String& where, Element* newChild, ExceptionCode&); 55 void insertAdjacentHTML(const String& where, const String& html, ExceptionCode&); 56 void insertAdjacentText(const String& where, const String& text, ExceptionCode&); 57 58 virtual bool supportsFocus() const; 59 60 virtual bool isContentEditable() const; 61 virtual bool isContentRichlyEditable() const; 62 63 String contentEditable() const; 64 void setContentEditable(const String&); 65 66 virtual bool draggable() const; 67 void setDraggable(bool); 68 69 bool spellcheck() const; 70 void setSpellcheck(bool); 71 72 void click(); 73 74 virtual void accessKeyAction(bool sendToAnyElement); 75 76 bool ieForbidsInsertHTML() const; 77 78 virtual bool rendererIsNeeded(RenderStyle*); 79 virtual RenderObject* createRenderer(RenderArena*, RenderStyle*); 80 81 HTMLFormElement* form() const { return virtualForm(); } 82 83 static void addHTMLAlignmentToStyledElement(StyledElement*, Attribute*); 84 85 HTMLFormElement* findFormAncestor() const; 86 87protected: 88 HTMLElement(const QualifiedName& tagName, Document*); 89 90 void addHTMLAlignment(Attribute*); 91 92 virtual bool mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const; 93 virtual void parseMappedAttribute(Attribute*); 94 95private: 96 virtual String nodeName() const; 97 98 void setContentEditable(Attribute*); 99 100 virtual HTMLFormElement* virtualForm() const; 101 102 Node* insertAdjacent(const String& where, Node* newChild, ExceptionCode&); 103}; 104 105inline HTMLElement::HTMLElement(const QualifiedName& tagName, Document* document) 106 : StyledElement(tagName, document, CreateHTMLElement) 107{ 108 ASSERT(tagName.localName().impl()); 109} 110 111} // namespace WebCore 112 113#endif // HTMLElement_h 114