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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 { | 114 { |
115 // FIXME: This function does too much work, and is very hot during table
layout! | 115 // FIXME: This function does too much work, and is very hot during table
layout! |
116 int adjustedLogicalHeight = pixelSnappedLogicalHeight() - (intrinsicPadd
ingBefore() + intrinsicPaddingAfter()); | 116 int adjustedLogicalHeight = pixelSnappedLogicalHeight() - (intrinsicPadd
ingBefore() + intrinsicPaddingAfter()); |
117 int styleLogicalHeight = logicalHeightFromStyle(); | 117 int styleLogicalHeight = logicalHeightFromStyle(); |
118 return max(styleLogicalHeight, adjustedLogicalHeight); | 118 return max(styleLogicalHeight, adjustedLogicalHeight); |
119 } | 119 } |
120 | 120 |
121 | 121 |
122 void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); | 122 void setCellLogicalWidth(int constrainedLogicalWidth, SubtreeLayoutScope&); |
123 | 123 |
124 virtual int borderLeft() const override; | 124 int borderLeft() const override; |
125 virtual int borderRight() const override; | 125 int borderRight() const override; |
126 virtual int borderTop() const override; | 126 int borderTop() const override; |
127 virtual int borderBottom() const override; | 127 int borderBottom() const override; |
128 virtual int borderStart() const override; | 128 int borderStart() const override; |
129 virtual int borderEnd() const override; | 129 int borderEnd() const override; |
130 virtual int borderBefore() const override; | 130 int borderBefore() const override; |
131 virtual int borderAfter() const override; | 131 int borderAfter() const override; |
132 | 132 |
133 void collectBorderValues(LayoutTable::CollapsedBorderValues&); | 133 void collectBorderValues(LayoutTable::CollapsedBorderValues&); |
134 static void sortBorderValues(LayoutTable::CollapsedBorderValues&); | 134 static void sortBorderValues(LayoutTable::CollapsedBorderValues&); |
135 | 135 |
136 virtual void layout() override; | 136 void layout() override; |
137 | 137 |
138 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 138 void paint(const PaintInfo&, const LayoutPoint&) override; |
139 | 139 |
140 LayoutUnit cellBaselinePosition() const; | 140 LayoutUnit cellBaselinePosition() const; |
141 bool isBaselineAligned() const | 141 bool isBaselineAligned() const |
142 { | 142 { |
143 EVerticalAlign va = style()->verticalAlign(); | 143 EVerticalAlign va = style()->verticalAlign(); |
144 return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SU
PER || va == SUB || va == LENGTH; | 144 return va == BASELINE || va == TEXT_BOTTOM || va == TEXT_TOP || va == SU
PER || va == SUB || va == LENGTH; |
145 } | 145 } |
146 | 146 |
147 void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); | 147 void computeIntrinsicPadding(int rowHeight, SubtreeLayoutScope&); |
148 void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } | 148 void clearIntrinsicPadding() { setIntrinsicPadding(0, 0); } |
149 | 149 |
150 int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } | 150 int intrinsicPaddingBefore() const { return m_intrinsicPaddingBefore; } |
151 int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; } | 151 int intrinsicPaddingAfter() const { return m_intrinsicPaddingAfter; } |
152 | 152 |
153 virtual LayoutUnit paddingTop() const override; | 153 LayoutUnit paddingTop() const override; |
154 virtual LayoutUnit paddingBottom() const override; | 154 LayoutUnit paddingBottom() const override; |
155 virtual LayoutUnit paddingLeft() const override; | 155 LayoutUnit paddingLeft() const override; |
156 virtual LayoutUnit paddingRight() const override; | 156 LayoutUnit paddingRight() const override; |
157 | 157 |
158 // FIXME: For now we just assume the cell has the same block flow direction
as the table. It's likely we'll | 158 // FIXME: For now we just assume the cell has the same block flow direction
as the table. It's likely we'll |
159 // create an extra anonymous LayoutBlock to handle mixing directionality any
way, in which case we can lock | 159 // create an extra anonymous LayoutBlock to handle mixing directionality any
way, in which case we can lock |
160 // the block flow directionality of the cells to the table's directionality. | 160 // the block flow directionality of the cells to the table's directionality. |
161 virtual LayoutUnit paddingBefore() const override; | 161 LayoutUnit paddingBefore() const override; |
162 virtual LayoutUnit paddingAfter() const override; | 162 LayoutUnit paddingAfter() const override; |
163 | 163 |
164 void setOverrideLogicalContentHeightFromRowHeight(LayoutUnit); | 164 void setOverrideLogicalContentHeightFromRowHeight(LayoutUnit); |
165 | 165 |
166 virtual void scrollbarsChanged(bool horizontalScrollbarChanged, bool vertica
lScrollbarChanged) override; | 166 void scrollbarsChanged(bool horizontalScrollbarChanged, bool verticalScrollb
arChanged) override; |
167 | 167 |
168 bool cellWidthChanged() const { return m_cellWidthChanged; } | 168 bool cellWidthChanged() const { return m_cellWidthChanged; } |
169 void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; } | 169 void setCellWidthChanged(bool b = true) { m_cellWidthChanged = b; } |
170 | 170 |
171 static LayoutTableCell* createAnonymous(Document*); | 171 static LayoutTableCell* createAnonymous(Document*); |
172 static LayoutTableCell* createAnonymousWithParent(const LayoutObject*); | 172 static LayoutTableCell* createAnonymousWithParent(const LayoutObject*); |
173 virtual LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* pare
nt) const override | 173 LayoutBox* createAnonymousBoxWithSameTypeAs(const LayoutObject* parent) cons
t override |
174 { | 174 { |
175 return createAnonymousWithParent(parent); | 175 return createAnonymousWithParent(parent); |
176 } | 176 } |
177 | 177 |
178 // This function is used to unify which table part's style we use for comput
ing direction and | 178 // This function is used to unify which table part's style we use for comput
ing direction and |
179 // writing mode. Writing modes are not allowed on row group and row but dire
ction is. | 179 // writing mode. Writing modes are not allowed on row group and row but dire
ction is. |
180 // This means we can safely use the same style in all cases to simplify our
code. | 180 // This means we can safely use the same style in all cases to simplify our
code. |
181 // FIXME: Eventually this function should replaced by style() once we suppor
t direction | 181 // FIXME: Eventually this function should replaced by style() once we suppor
t direction |
182 // on all table parts and writing-mode on cells. | 182 // on all table parts and writing-mode on cells. |
183 const ComputedStyle& styleForCellFlow() const | 183 const ComputedStyle& styleForCellFlow() const |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 return style()->borderEnd(); | 217 return style()->borderEnd(); |
218 } | 218 } |
219 | 219 |
220 #if ENABLE(ASSERT) | 220 #if ENABLE(ASSERT) |
221 bool isFirstOrLastCellInRow() const | 221 bool isFirstOrLastCellInRow() const |
222 { | 222 { |
223 return !table()->cellAfter(this) || !table()->cellBefore(this); | 223 return !table()->cellAfter(this) || !table()->cellBefore(this); |
224 } | 224 } |
225 #endif | 225 #endif |
226 | 226 |
227 virtual const char* name() const override { return "LayoutTableCell"; } | 227 const char* name() const override { return "LayoutTableCell"; } |
228 | 228 |
229 protected: | 229 protected: |
230 virtual void styleDidChange(StyleDifference, const ComputedStyle* oldStyle)
override; | 230 void styleDidChange(StyleDifference, const ComputedStyle* oldStyle) override
; |
231 virtual void computePreferredLogicalWidths() override; | 231 void computePreferredLogicalWidths() override; |
232 | 232 |
233 virtual void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintL
ayer* currentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect&
containerRect) const override; | 233 void addLayerHitTestRects(LayerHitTestRects&, const DeprecatedPaintLayer* cu
rrentCompositedLayer, const LayoutPoint& layerOffset, const LayoutRect& containe
rRect) const override; |
234 | 234 |
235 private: | 235 private: |
236 virtual bool isOfType(LayoutObjectType type) const override { return type ==
LayoutObjectTableCell || LayoutBlockFlow::isOfType(type); } | 236 bool isOfType(LayoutObjectType type) const override { return type == LayoutO
bjectTableCell || LayoutBlockFlow::isOfType(type); } |
237 | 237 |
238 virtual void willBeRemovedFromTree() override; | 238 void willBeRemovedFromTree() override; |
239 | 239 |
240 virtual void updateLogicalWidth() override; | 240 void updateLogicalWidth() override; |
241 | 241 |
242 virtual void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoin
t&) override; | 242 void paintBoxDecorationBackground(const PaintInfo&, const LayoutPoint&) over
ride; |
243 virtual void paintMask(const PaintInfo&, const LayoutPoint&) override; | 243 void paintMask(const PaintInfo&, const LayoutPoint&) override; |
244 | 244 |
245 virtual bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance,
InlineFlowBox*) const override; | 245 bool boxShadowShouldBeAppliedToBackground(BackgroundBleedAvoidance, InlineFl
owBox*) const override; |
246 | 246 |
247 virtual LayoutSize offsetFromContainer(const LayoutObject*, const LayoutPoin
t&, bool* offsetDependsOnPoint = nullptr) const override; | 247 LayoutSize offsetFromContainer(const LayoutObject*, const LayoutPoint&, bool
* offsetDependsOnPoint = nullptr) const override; |
248 virtual LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxMo
delObject* paintInvalidationContainer, const PaintInvalidationState* = nullptr)
const override; | 248 LayoutRect clippedOverflowRectForPaintInvalidation(const LayoutBoxModelObjec
t* paintInvalidationContainer, const PaintInvalidationState* = nullptr) const ov
erride; |
249 virtual void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* p
aintInvalidationContainer, LayoutRect&, const PaintInvalidationState*) const ove
rride; | 249 void mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* paintInva
lidationContainer, LayoutRect&, const PaintInvalidationState*) const override; |
250 | 250 |
251 int borderHalfLeft(bool outer) const; | 251 int borderHalfLeft(bool outer) const; |
252 int borderHalfRight(bool outer) const; | 252 int borderHalfRight(bool outer) const; |
253 int borderHalfTop(bool outer) const; | 253 int borderHalfTop(bool outer) const; |
254 int borderHalfBottom(bool outer) const; | 254 int borderHalfBottom(bool outer) const; |
255 | 255 |
256 int borderHalfStart(bool outer) const; | 256 int borderHalfStart(bool outer) const; |
257 int borderHalfEnd(bool outer) const; | 257 int borderHalfEnd(bool outer) const; |
258 int borderHalfBefore(bool outer) const; | 258 int borderHalfBefore(bool outer) const; |
259 int borderHalfAfter(bool outer) const; | 259 int borderHalfAfter(bool outer) const; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 | 309 |
310 inline LayoutTableCell* LayoutTableRow::lastCell() const | 310 inline LayoutTableCell* LayoutTableRow::lastCell() const |
311 { | 311 { |
312 ASSERT(children() == virtualChildren()); | 312 ASSERT(children() == virtualChildren()); |
313 return toLayoutTableCell(children()->lastChild()); | 313 return toLayoutTableCell(children()->lastChild()); |
314 } | 314 } |
315 | 315 |
316 } // namespace blink | 316 } // namespace blink |
317 | 317 |
318 #endif // LayoutTableCell_h | 318 #endif // LayoutTableCell_h |
OLD | NEW |