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, 2009 Apple Inc. All rights reserved.
8 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
9 *
10 * This library is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU Library General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
14 *
15 * This library is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18 * Library General Public License for more details.
19 *
20 * You should have received a copy of the GNU Library General Public License
21 * along with this library; see the file COPYING.LIB.  If not, write to
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA.
24 */
25
26#ifndef RenderTableCol_h
27#define RenderTableCol_h
28
29#include "RenderBox.h"
30
31namespace WebCore {
32
33class RenderTable;
34
35class RenderTableCol : public RenderBox {
36public:
37    explicit RenderTableCol(Node*);
38
39    const RenderObjectChildList* children() const { return &m_children; }
40    RenderObjectChildList* children() { return &m_children; }
41
42    virtual void computePreferredLogicalWidths();
43
44    int span() const { return m_span; }
45    void setSpan(int span) { m_span = span; }
46
47private:
48    virtual RenderObjectChildList* virtualChildren() { return children(); }
49    virtual const RenderObjectChildList* virtualChildren() const { return children(); }
50
51    virtual const char* renderName() const { return "RenderTableCol"; }
52    virtual bool isTableCol() const { return true; }
53    virtual void updateFromElement();
54
55    virtual bool isChildAllowed(RenderObject*, RenderStyle*) const;
56    virtual bool canHaveChildren() const;
57    virtual bool requiresLayer() const { return false; }
58
59    virtual IntRect clippedOverflowRectForRepaint(RenderBoxModelObject* repaintContainer);
60    virtual void imageChanged(WrappedImagePtr, const IntRect* = 0);
61
62    RenderTable* table() const;
63
64    RenderObjectChildList m_children;
65    int m_span;
66};
67
68inline RenderTableCol* toRenderTableCol(RenderObject* object)
69{
70    ASSERT(!object || object->isTableCol());
71    return static_cast<RenderTableCol*>(object);
72}
73
74inline const RenderTableCol* toRenderTableCol(const RenderObject* object)
75{
76    ASSERT(!object || object->isTableCol());
77    return static_cast<const RenderTableCol*>(object);
78}
79
80// This will catch anyone doing an unnecessary cast.
81void toRenderTableCol(const RenderTableCol*);
82
83}
84
85#endif
86