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/CoreExport.h"
30 #include "core/html/HTMLElement.h"
36 class HTMLTableCaptionElement
;
37 class HTMLTableRowsCollection
;
38 class HTMLTableSectionElement
;
40 class CORE_EXPORT HTMLTableElement final
: public HTMLElement
{
41 DEFINE_WRAPPERTYPEINFO();
43 DECLARE_NODE_FACTORY(HTMLTableElement
);
45 HTMLTableCaptionElement
* caption() const;
46 void setCaption(PassRefPtrWillBeRawPtr
<HTMLTableCaptionElement
>, ExceptionState
&);
48 HTMLTableSectionElement
* tHead() const;
49 void setTHead(PassRefPtrWillBeRawPtr
<HTMLTableSectionElement
>, ExceptionState
&);
51 HTMLTableSectionElement
* tFoot() const;
52 void setTFoot(PassRefPtrWillBeRawPtr
<HTMLTableSectionElement
>, ExceptionState
&);
54 PassRefPtrWillBeRawPtr
<HTMLElement
> createTHead();
56 PassRefPtrWillBeRawPtr
<HTMLElement
> createTFoot();
58 PassRefPtrWillBeRawPtr
<HTMLElement
> createTBody();
59 PassRefPtrWillBeRawPtr
<HTMLElement
> createCaption();
61 PassRefPtrWillBeRawPtr
<HTMLElement
> insertRow(int index
, ExceptionState
&);
62 void deleteRow(int index
, ExceptionState
&);
64 PassRefPtrWillBeRawPtr
<HTMLTableRowsCollection
> rows();
65 PassRefPtrWillBeRawPtr
<HTMLCollection
> tBodies();
67 const AtomicString
& rules() const;
68 const AtomicString
& summary() const;
70 const StylePropertySet
* additionalCellStyle();
71 const StylePropertySet
* additionalGroupStyle(bool rows
);
73 DECLARE_VIRTUAL_TRACE();
76 explicit HTMLTableElement(Document
&);
79 void parseAttribute(const QualifiedName
&, const AtomicString
&) override
;
80 bool isPresentationAttribute(const QualifiedName
&) const override
;
81 void collectStyleForPresentationAttribute(const QualifiedName
&, const AtomicString
&, MutableStylePropertySet
*) override
;
82 bool isURLAttribute(const Attribute
&) const override
;
83 bool hasLegalLinkAttribute(const QualifiedName
&) const override
;
84 const QualifiedName
& subResourceAttributeName() const override
;
86 // Used to obtain either a solid or outset border decl and to deal with the frame and rules attributes.
87 const StylePropertySet
* additionalPresentationAttributeStyle() override
;
89 enum TableRules
{ UnsetRules
, NoneRules
, GroupsRules
, RowsRules
, ColsRules
, AllRules
};
90 enum CellBorders
{ NoBorders
, SolidBorders
, InsetBorders
, SolidBordersColsOnly
, SolidBordersRowsOnly
};
92 CellBorders
cellBorders() const;
94 PassRefPtrWillBeRawPtr
<StylePropertySet
> createSharedCellStyle();
96 HTMLTableSectionElement
* lastBody() const;
98 void setNeedsTableStyleRecalc() const;
100 bool m_borderAttr
; // Sets a precise border width and creates an outset border for the table and for its cells.
101 bool m_borderColorAttr
; // Overrides the outset border and makes it solid for the table and cells instead.
102 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.
103 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
104 // are present, to none otherwise).
106 unsigned short m_padding
;
107 RefPtrWillBeMember
<StylePropertySet
> m_sharedCellStyle
;
112 #endif // HTMLTableElement_h