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)
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.
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.
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.
26 #ifndef RenderTableCol_h
27 #define RenderTableCol_h
29 #include "core/rendering/RenderBox.h"
34 class RenderTableCell;
36 class RenderTableCol final : public RenderBox {
38 explicit RenderTableCol(Element*);
39 virtual void trace(Visitor*) override;
41 RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); }
43 // If you have a RenderTableCol, use firstChild or lastChild instead.
44 void slowFirstChild() const WTF_DELETED_FUNCTION;
45 void slowLastChild() const WTF_DELETED_FUNCTION;
47 const RenderObjectChildList* children() const { return &m_children; }
48 RenderObjectChildList* children() { return &m_children; }
50 void clearPreferredLogicalWidthsDirtyBits();
52 unsigned span() const { return m_span; }
54 bool isTableColumnGroupWithColumnChildren() { return firstChild(); }
55 bool isTableColumn() const { return style()->display() == TABLE_COLUMN; }
56 bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; }
58 RenderTableCol* enclosingColumnGroup() const;
59 RenderTableCol* enclosingColumnGroupIfAdjacentBefore() const
61 if (previousSibling())
63 return enclosingColumnGroup();
66 RenderTableCol* enclosingColumnGroupIfAdjacentAfter() const
70 return enclosingColumnGroup();
74 // Returns the next column or column-group.
75 RenderTableCol* nextColumn() const;
77 const BorderValue& borderAdjoiningCellStartBorder(const RenderTableCell*) const;
78 const BorderValue& borderAdjoiningCellEndBorder(const RenderTableCell*) const;
79 const BorderValue& borderAdjoiningCellBefore(const RenderTableCell*) const;
80 const BorderValue& borderAdjoiningCellAfter(const RenderTableCell*) const;
83 virtual RenderObjectChildList* virtualChildren() override { return children(); }
84 virtual const RenderObjectChildList* virtualChildren() const override { return children(); }
86 virtual const char* renderName() const override { return "RenderTableCol"; }
87 virtual bool isOfType(RenderObjectType type) const override { return type == RenderObjectRenderTableCol || RenderBox::isOfType(type); }
88 virtual void updateFromElement() override;
89 virtual void computePreferredLogicalWidths() override { ASSERT_NOT_REACHED(); }
91 virtual void insertedIntoTree() override;
92 virtual void willBeRemovedFromTree() override;
94 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const override;
95 virtual bool canHaveChildren() const override;
96 virtual LayerType layerTypeRequired() const override { return NoLayer; }
98 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) const override;
99 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) override;
101 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
103 RenderTable* table() const;
105 RenderObjectChildList m_children;
109 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol());