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 "core/rendering/RenderBox.h" 30 31 namespace WebCore { 32 33 class RenderTable; 34 class RenderTableCell; 35 36 class RenderTableCol FINAL : public RenderBox { 37 public: 38 explicit RenderTableCol(Element*); 39 firstChild()40 RenderObject* firstChild() const { ASSERT(children() == virtualChildren()); return children()->firstChild(); } lastChild()41 RenderObject* lastChild() const { ASSERT(children() == virtualChildren()); return children()->lastChild(); } 42 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; 46 children()47 const RenderObjectChildList* children() const { return &m_children; } children()48 RenderObjectChildList* children() { return &m_children; } 49 50 void clearPreferredLogicalWidthsDirtyBits(); 51 span()52 unsigned span() const { return m_span; } setSpan(unsigned span)53 void setSpan(unsigned span) { m_span = span; } 54 isTableColumnGroupWithColumnChildren()55 bool isTableColumnGroupWithColumnChildren() { return firstChild(); } isTableColumn()56 bool isTableColumn() const { return style()->display() == TABLE_COLUMN; } isTableColumnGroup()57 bool isTableColumnGroup() const { return style()->display() == TABLE_COLUMN_GROUP; } 58 59 RenderTableCol* enclosingColumnGroup() const; enclosingColumnGroupIfAdjacentBefore()60 RenderTableCol* enclosingColumnGroupIfAdjacentBefore() const 61 { 62 if (previousSibling()) 63 return 0; 64 return enclosingColumnGroup(); 65 } 66 enclosingColumnGroupIfAdjacentAfter()67 RenderTableCol* enclosingColumnGroupIfAdjacentAfter() const 68 { 69 if (nextSibling()) 70 return 0; 71 return enclosingColumnGroup(); 72 } 73 74 75 // Returns the next column or column-group. 76 RenderTableCol* nextColumn() const; 77 78 const BorderValue& borderAdjoiningCellStartBorder(const RenderTableCell*) const; 79 const BorderValue& borderAdjoiningCellEndBorder(const RenderTableCell*) const; 80 const BorderValue& borderAdjoiningCellBefore(const RenderTableCell*) const; 81 const BorderValue& borderAdjoiningCellAfter(const RenderTableCell*) const; 82 83 private: virtualChildren()84 virtual RenderObjectChildList* virtualChildren() OVERRIDE { return children(); } virtualChildren()85 virtual const RenderObjectChildList* virtualChildren() const OVERRIDE { return children(); } 86 renderName()87 virtual const char* renderName() const OVERRIDE { return "RenderTableCol"; } isRenderTableCol()88 virtual bool isRenderTableCol() const OVERRIDE { return true; } 89 virtual void updateFromElement() OVERRIDE; computePreferredLogicalWidths()90 virtual void computePreferredLogicalWidths() OVERRIDE { ASSERT_NOT_REACHED(); } 91 92 virtual void insertedIntoTree() OVERRIDE; 93 virtual void willBeRemovedFromTree() OVERRIDE; 94 95 virtual bool isChildAllowed(RenderObject*, RenderStyle*) const OVERRIDE; 96 virtual bool canHaveChildren() const OVERRIDE; layerTypeRequired()97 virtual LayerType layerTypeRequired() const OVERRIDE { return NoLayer; } 98 99 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayerModelObject* paintInvalidationContainer) const OVERRIDE; 100 virtual void imageChanged(WrappedImagePtr, const IntRect* = 0) OVERRIDE; 101 102 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OVERRIDE; 103 104 RenderTable* table() const; 105 106 RenderObjectChildList m_children; 107 unsigned m_span; 108 }; 109 110 DEFINE_RENDER_OBJECT_TYPE_CASTS(RenderTableCol, isRenderTableCol()); 111 112 } 113 114 #endif 115