2 * Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 * (C) 1997 Torben Weis (weis@kde.org)
4 * (C) 1998 Waldo Bastian (bastian@kde.org)
5 * (C) 1999 Lars Knoll (knoll@kde.org)
6 * (C) 1999 Antti Koivisto (koivisto@kde.org)
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public License
20 * along with this library; see the file COPYING.LIB. If not, write to
21 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22 * Boston, MA 02110-1301, USA.
26 #ifndef HTMLTableElement_h
27 #define HTMLTableElement_h
29 #include "core/html/HTMLElement.h"
35 class HTMLTableCaptionElement;
36 class HTMLTableRowsCollection;
37 class HTMLTableSectionElement;
39 class HTMLTableElement final : public HTMLElement {
40 DEFINE_WRAPPERTYPEINFO();
42 DECLARE_NODE_FACTORY(HTMLTableElement);
44 HTMLTableCaptionElement* caption() const;
45 void setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement>, ExceptionState&);
47 HTMLTableSectionElement* tHead() const;
48 void setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>, ExceptionState&);
50 HTMLTableSectionElement* tFoot() const;
51 void setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>, ExceptionState&);
53 PassRefPtrWillBeRawPtr<HTMLElement> createTHead();
55 PassRefPtrWillBeRawPtr<HTMLElement> createTFoot();
57 PassRefPtrWillBeRawPtr<HTMLElement> createTBody();
58 PassRefPtrWillBeRawPtr<HTMLElement> createCaption();
60 PassRefPtrWillBeRawPtr<HTMLElement> insertRow(int index, ExceptionState&);
61 void deleteRow(int index, ExceptionState&);
63 PassRefPtrWillBeRawPtr<HTMLTableRowsCollection> rows();
64 PassRefPtrWillBeRawPtr<HTMLCollection> tBodies();
66 const AtomicString& rules() const;
67 const AtomicString& summary() const;
69 const StylePropertySet* additionalCellStyle();
70 const StylePropertySet* additionalGroupStyle(bool rows);
72 virtual void trace(Visitor*) override;
75 explicit HTMLTableElement(Document&);
77 virtual void parseAttribute(const QualifiedName&, const AtomicString&) override;
78 virtual bool isPresentationAttribute(const QualifiedName&) const override;
79 virtual void collectStyleForPresentationAttribute(const QualifiedName&, const AtomicString&, MutableStylePropertySet*) override;
80 virtual bool isURLAttribute(const Attribute&) const override;
81 virtual bool hasLegalLinkAttribute(const QualifiedName&) const override;
82 virtual const QualifiedName& subResourceAttributeName() const override;
84 // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes.
85 virtual const StylePropertySet* additionalPresentationAttributeStyle() override;
87 enum TableRules { UnsetRules, NoneRules, GroupsRules, RowsRules, ColsRules, AllRules };
88 enum CellBorders { NoBorders, SolidBorders, InsetBorders, SolidBordersColsOnly, SolidBordersRowsOnly };
90 CellBorders cellBorders() const;
92 PassRefPtrWillBeRawPtr<StylePropertySet> createSharedCellStyle();
94 HTMLTableSectionElement* lastBody() const;
96 void setNeedsTableStyleRecalc() const;
98 bool m_borderAttr; // Sets a precise border width and creates an outset border for the table and for its cells.
99 bool m_borderColorAttr; // Overrides the outset border and makes it solid for the table and cells instead.
100 bool m_frameAttr; // Implies a thin border width if no border is set and then a certain set of solid/hidden borders based off the value.
101 TableRules m_rulesAttr; // Implies a thin border width, a collapsing border model, and all borders on the table becoming set to hidden (if frame/border
102 // are present, to none otherwise).
104 unsigned short m_padding;
105 RefPtrWillBeMember<StylePropertySet> m_sharedCellStyle;
110 #endif // HTMLTableElement_h