OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. All rights
reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2009, 2013 Apple Inc. All rights
reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 static const unsigned unsetColumnIndex = 0x1FFFFFFF; | 35 static const unsigned unsetColumnIndex = 0x1FFFFFFF; |
36 static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910 | 36 static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910 |
37 | 37 |
38 enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor }; | 38 enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor }; |
39 | 39 |
40 class SubtreeLayoutScope; | 40 class SubtreeLayoutScope; |
41 | 41 |
42 class RenderTableCell FINAL : public RenderBlockFlow { | 42 class RenderTableCell final : public RenderBlockFlow { |
43 public: | 43 public: |
44 explicit RenderTableCell(Element*); | 44 explicit RenderTableCell(Element*); |
45 | 45 |
46 unsigned colSpan() const | 46 unsigned colSpan() const |
47 { | 47 { |
48 if (!m_hasColSpan) | 48 if (!m_hasColSpan) |
49 return 1; | 49 return 1; |
50 return parseColSpanFromDOM(); | 50 return parseColSpanFromDOM(); |
51 } | 51 } |
52 unsigned rowSpan() const | 52 unsigned rowSpan() const |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 // In strict mode, box-sizing: content-box do the right thing and actual
ly add in the border and padding. | 105 // In strict mode, box-sizing: content-box do the right thing and actual
ly add in the border and padding. |
106 // Call computedCSSPadding* directly to avoid including implicitPadding. | 106 // Call computedCSSPadding* directly to avoid including implicitPadding. |
107 if (!document().inQuirksMode() && style()->boxSizing() != BORDER_BOX) | 107 if (!document().inQuirksMode() && style()->boxSizing() != BORDER_BOX) |
108 styleLogicalHeight += (computedCSSPaddingBefore() + computedCSSPaddi
ngAfter()).floor() + borderBefore() + borderAfter(); | 108 styleLogicalHeight += (computedCSSPaddingBefore() + computedCSSPaddi
ngAfter()).floor() + borderBefore() + borderAfter(); |
109 return max(styleLogicalHeight, adjustedLogicalHeight); | 109 return max(styleLogicalHeight, adjustedLogicalHeight); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); | 113 void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); |
114 | 114 |
115 virtual int borderLeft() const OVERRIDE; | 115 virtual int borderLeft() const override; |
116 virtual int borderRight() const OVERRIDE; | 116 virtual int borderRight() const override; |
117 virtual int borderTop() const OVERRIDE; | 117 virtual int borderTop() const override; |
118 virtual int borderBottom() const OVERRIDE; | 118 virtual int borderBottom() const override; |
119 virtual int borderStart() const OVERRIDE; | 119 virtual int borderStart() const override; |
120 virtual int borderEnd() const OVERRIDE; | 120 virtual int borderEnd() const override; |
121 virtual int borderBefore() const OVERRIDE; | 121 virtual int borderBefore() const override; |
122 virtual int borderAfter() const OVERRIDE; | 122 virtual int borderAfter() const override; |
123 | 123 |
124 void collectBorderValues(RenderTable::CollapsedBorderValues&) const; | 124 void collectBorderValues(RenderTable::CollapsedBorderValues&) const; |
125 static void sortBorderValues(RenderTable::CollapsedBorderValues&); | 125 static void sortBorderValues(RenderTable::CollapsedBorderValues&); |
126 | 126 |
127 virtual void layout() OVERRIDE; | 127 virtual void layout() override; |
128 | 128 |
129 virtual void paint(PaintInfo&, const LayoutPoint&) OVERRIDE; | 129 virtual void paint(PaintInfo&, const LayoutPoint&) override; |
130 | 130 |
131 void paintCollapsedBorders(PaintInfo&, const LayoutPoint&); | 131 void paintCollapsedBorders(PaintInfo&, const LayoutPoint&); |
132 void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject
* backgroundObject); | 132 void paintBackgroundsBehindCell(PaintInfo&, const LayoutPoint&, RenderObject
* backgroundObject); |
133 | 133 |
134 LayoutUnit cellBaselinePosition() const; | 134 LayoutUnit cellBaselinePosition() const; |
135 bool isBaselineAligned() const | 135 bool isBaselineAligned() const |
136 { | 136 { |
137 EVerticalAlign va = style()->verticalAlign(); | 137 EVerticalAlign va = style()->verticalAlign(); |
138 return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SU
PER || va == SUB || va == LENGTH; | 138 return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SU
PER || va == SUB || va == LENGTH; |
139 } | 139 } |
140 | 140 |
141 void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); | 141 void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); |
142 void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } | 142 void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } |
143 | 143 |
144 int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } | 144 int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } |
145 int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; } | 145 int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; } |
146 | 146 |
147 virtual LayoutUnit paddingTop() const OVERRIDE; | 147 virtual LayoutUnit paddingTop() const override; |
148 virtual LayoutUnit paddingBottom() const OVERRIDE; | 148 virtual LayoutUnit paddingBottom() const override; |
149 virtual LayoutUnit paddingLeft() const OVERRIDE; | 149 virtual LayoutUnit paddingLeft() const override; |
150 virtual LayoutUnit paddingRight() const OVERRIDE; | 150 virtual LayoutUnit paddingRight() const override; |
151 | 151 |
152 // FIXME: For now we just assume the cell has the same block flow direction
as the table. It's likely we'll | 152 // FIXME: For now we just assume the cell has the same block flow direction
as the table. It's likely we'll |
153 // create an extra anonymous RenderBlock to handle mixing directionality any
way, in which case we can lock | 153 // create an extra anonymous RenderBlock to handle mixing directionality any
way, in which case we can lock |
154 // the block flow directionality of the cells to the table's directionality. | 154 // the block flow directionality of the cells to the table's directionality. |
155 virtual LayoutUnit paddingBefore() const OVERRIDE; | 155 virtual LayoutUnit paddingBefore() const override; |
156 virtual LayoutUnit paddingAfter() const OVERRIDE; | 156 virtual LayoutUnit paddingAfter() const override; |
157 | 157 |
158 void setOverrideLogicalContentHeightFromRowHeight(LayoutUnit); | 158 void setOverrideLogicalContentHeightFromRowHeight(LayoutUnit); |
159 | 159 |
160 virtual void scrollbarsChanged(bool horizontalScrollbarChanged, bool vertica
lScrollbarChanged) OVERRIDE; | 160 virtual void scrollbarsChanged(bool horizontalScrollbarChanged, bool vertica
lScrollbarChanged) override; |
161 | 161 |
162 bool cellWidthChanged() const { return m_cellWidthChanged; } | 162 bool cellWidthChanged() const { return m_cellWidthChanged; } |
163 void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; } | 163 void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; } |
164 | 164 |
165 static RenderTableCell* createAnonymous(Document*); | 165 static RenderTableCell* createAnonymous(Document*); |
166 static RenderTableCell* createAnonymousWithParentRenderer(const RenderObject
*); | 166 static RenderTableCell* createAnonymousWithParentRenderer(const RenderObject
*); |
167 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const OVERRIDE | 167 virtual RenderBox* createAnonymousBoxWithSameTypeAs(const RenderObject* pare
nt) const override |
168 { | 168 { |
169 return createAnonymousWithParentRenderer(parent); | 169 return createAnonymousWithParentRenderer(parent); |
170 } | 170 } |
171 | 171 |
172 // This function is used to unify which table part's style we use for comput
ing direction and | 172 // This function is used to unify which table part's style we use for comput
ing direction and |
173 // writing mode. Writing modes are not allowed on row group and row but dire
ction is. | 173 // writing mode. Writing modes are not allowed on row group and row but dire
ction is. |
174 // This means we can safely use the same style in all cases to simplify our
code. | 174 // This means we can safely use the same style in all cases to simplify our
code. |
175 // FIXME: Eventually this function should replaced by style() once we suppor
t direction | 175 // FIXME: Eventually this function should replaced by style() once we suppor
t direction |
176 // on all table parts and writing-mode on cells. | 176 // on all table parts and writing-mode on cells. |
177 const RenderStyle* styleForCellFlow() const | 177 const RenderStyle* styleForCellFlow() const |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return style()->borderEnd(); | 211 return style()->borderEnd(); |
212 } | 212 } |
213 | 213 |
214 #if ENABLE(ASSERT) | 214 #if ENABLE(ASSERT) |
215 bool isFirstOrLastCellInRow() const | 215 bool isFirstOrLastCellInRow() const |
216 { | 216 { |
217 return !table()->cellAfter(this) || !table()->cellBefore(this); | 217 return !table()->cellAfter(this) || !table()->cellBefore(this); |
218 } | 218 } |
219 #endif | 219 #endif |
220 protected: | 220 protected: |
221 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) OV
ERRIDE; | 221 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
222 virtual void computePreferredLogicalWidths() OVERRIDE; | 222 virtual void computePreferredLogicalWidths() override; |
223 | 223 |
224 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur
rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container
Rect) const OVERRIDE; | 224 virtual void addLayerHitTestRects(LayerHitTestRects&, const RenderLayer* cur
rentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& container
Rect) const override; |
225 | 225 |
226 private: | 226 private: |
227 virtual const char* renderName() const OVERRIDE { return (isAnonymous() || i
sPseudoElement()) ? "RenderTableCell (anonymous)" : "RenderTableCell"; } | 227 virtual const char* renderName() const override { return (isAnonymous() || i
sPseudoElement()) ? "RenderTableCell (anonymous)" : "RenderTableCell"; } |
228 | 228 |
229 virtual bool isTableCell() const OVERRIDE { return true; } | 229 virtual bool isTableCell() const override { return true; } |
230 | 230 |
231 virtual void willBeRemovedFromTree() OVERRIDE; | 231 virtual void willBeRemovedFromTree() override; |
232 | 232 |
233 virtual void updateLogicalWidth() OVERRIDE; | 233 virtual void updateLogicalWidth() override; |
234 | 234 |
235 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) OV
ERRIDE; | 235 virtual void paintBoxDecorationBackground(PaintInfo&, const LayoutPoint&) ov
erride; |
236 virtual void paintMask(PaintInfo&, const LayoutPoint&) OVERRIDE; | 236 virtual void paintMask(PaintInfo&, const LayoutPoint&) override; |
237 | 237 |
238 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const OVERRIDE; | 238 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override; |
239 | 239 |
240 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = 0) const OVERRIDE; | 240 virtual LayoutSize offsetFromContainer(const RenderObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = 0) const override; |
241 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t OVERRIDE; | 241 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const RenderLayer
ModelObject* paintInvalidationContainer, const PaintInvalidationState* = 0) cons
t override; |
242 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const O
VERRIDE; | 242 virtual void mapRectToPaintInvalidationBacking(const RenderLayerModelObject*
paintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const o
verride; |
243 | 243 |
244 int borderHalfLeft(bool outer) const; | 244 int borderHalfLeft(bool outer) const; |
245 int borderHalfRight(bool outer) const; | 245 int borderHalfRight(bool outer) const; |
246 int borderHalfTop(bool outer) const; | 246 int borderHalfTop(bool outer) const; |
247 int borderHalfBottom(bool outer) const; | 247 int borderHalfBottom(bool outer) const; |
248 | 248 |
249 int borderHalfStart(bool outer) const; | 249 int borderHalfStart(bool outer) const; |
250 int borderHalfEnd(bool outer) const; | 250 int borderHalfEnd(bool outer) const; |
251 int borderHalfBefore(bool outer) const; | 251 int borderHalfBefore(bool outer) const; |
252 int borderHalfAfter(bool outer) const; | 252 int borderHalfAfter(bool outer) const; |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 | 312 |
313 inline RenderTableCell* RenderTableRow::lastCell() const | 313 inline RenderTableCell* RenderTableRow::lastCell() const |
314 { | 314 { |
315 ASSERT(children() == virtualChildren()); | 315 ASSERT(children() == virtualChildren()); |
316 return toRenderTableCell(children()->lastChild()); | 316 return toRenderTableCell(children()->lastChild()); |
317 } | 317 } |
318 | 318 |
319 } // namespace blink | 319 } // namespace blink |
320 | 320 |
321 #endif // RenderTableCell_h | 321 #endif // RenderTableCell_h |
OLD | NEW |