Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / core / html / HTMLTableElement.h
1 /*
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.
8  *
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.
13  *
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.
18  *
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.
23  *
24  */
25
26 #ifndef HTMLTableElement_h
27 #define HTMLTableElement_h
28
29 #include "core/html/HTMLElement.h"
30
31 namespace blink {
32
33 class ExceptionState;
34 class HTMLCollection;
35 class HTMLTableCaptionElement;
36 class HTMLTableRowsCollection;
37 class HTMLTableSectionElement;
38
39 class HTMLTableElement final : public HTMLElement {
40     DEFINE_WRAPPERTYPEINFO();
41 public:
42     DECLARE_NODE_FACTORY(HTMLTableElement);
43
44     HTMLTableCaptionElement* caption() const;
45     void setCaption(PassRefPtrWillBeRawPtr<HTMLTableCaptionElement>, ExceptionState&);
46
47     HTMLTableSectionElement* tHead() const;
48     void setTHead(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>, ExceptionState&);
49
50     HTMLTableSectionElement* tFoot() const;
51     void setTFoot(PassRefPtrWillBeRawPtr<HTMLTableSectionElement>, ExceptionState&);
52
53     PassRefPtrWillBeRawPtr<HTMLElement> createTHead();
54     void deleteTHead();
55     PassRefPtrWillBeRawPtr<HTMLElement> createTFoot();
56     void deleteTFoot();
57     PassRefPtrWillBeRawPtr<HTMLElement> createTBody();
58     PassRefPtrWillBeRawPtr<HTMLElement> createCaption();
59     void deleteCaption();
60     PassRefPtrWillBeRawPtr<HTMLElement> insertRow(int index, ExceptionState&);
61     void deleteRow(int index, ExceptionState&);
62
63     PassRefPtrWillBeRawPtr<HTMLTableRowsCollection> rows();
64     PassRefPtrWillBeRawPtr<HTMLCollection> tBodies();
65
66     const AtomicString& rules() const;
67     const AtomicString& summary() const;
68
69     const StylePropertySet* additionalCellStyle();
70     const StylePropertySet* additionalGroupStyle(bool rows);
71
72     virtual void trace(Visitor*) override;
73
74 private:
75     explicit HTMLTableElement(Document&);
76
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;
83
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;
86
87     enum TableRules { UnsetRules, NoneRules, GroupsRules, RowsRules, ColsRules, AllRules };
88     enum CellBorders { NoBorders, SolidBorders, InsetBorders, SolidBordersColsOnly, SolidBordersRowsOnly };
89
90     CellBorders cellBorders() const;
91
92     PassRefPtrWillBeRawPtr<StylePropertySet> createSharedCellStyle();
93
94     HTMLTableSectionElement* lastBody() const;
95
96     void setNeedsTableStyleRecalc() const;
97
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).
103
104     unsigned short m_padding;
105     RefPtrWillBeMember<StylePropertySet> m_sharedCellStyle;
106 };
107
108 } // namespace blink
109
110 #endif // HTMLTableElement_h