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, 2009, 2013 Apple Inc. All rights reserv
ed. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2013 Apple Inc. All rights reserv
ed. |
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 unsigned m_end; | 60 unsigned m_end; |
61 }; | 61 }; |
62 | 62 |
63 class LayoutTableCell; | 63 class LayoutTableCell; |
64 class LayoutTableRow; | 64 class LayoutTableRow; |
65 | 65 |
66 class LayoutTableSection final : public RenderBox { | 66 class LayoutTableSection final : public RenderBox { |
67 public: | 67 public: |
68 LayoutTableSection(Element*); | 68 LayoutTableSection(Element*); |
69 virtual ~LayoutTableSection(); | 69 virtual ~LayoutTableSection(); |
70 virtual void trace(Visitor*) override; | |
71 | 70 |
72 LayoutTableRow* firstRow() const; | 71 LayoutTableRow* firstRow() const; |
73 LayoutTableRow* lastRow() const; | 72 LayoutTableRow* lastRow() const; |
74 | 73 |
75 const RenderObjectChildList* children() const { return &m_children; } | 74 const RenderObjectChildList* children() const { return &m_children; } |
76 RenderObjectChildList* children() { return &m_children; } | 75 RenderObjectChildList* children() { return &m_children; } |
77 | 76 |
78 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) ov
erride; | 77 virtual void addChild(RenderObject* child, RenderObject* beforeChild = 0) ov
erride; |
79 | 78 |
80 virtual int firstLineBoxBaseline() const override; | 79 virtual int firstLineBoxBaseline() const override; |
81 | 80 |
82 void addCell(LayoutTableCell*, LayoutTableRow*); | 81 void addCell(LayoutTableCell*, LayoutTableRow*); |
83 | 82 |
84 int calcRowLogicalHeight(); | 83 int calcRowLogicalHeight(); |
85 void layoutRows(); | 84 void layoutRows(); |
86 void computeOverflowFromCells(); | 85 void computeOverflowFromCells(); |
87 | 86 |
88 LayoutTable* table() const { return toLayoutTable(parent()); } | 87 LayoutTable* table() const { return toLayoutTable(parent()); } |
89 | 88 |
90 typedef WillBeHeapVector<RawPtrWillBeMember<LayoutTableCell>, 2> SpanningLay
outTableCells; | 89 typedef Vector<LayoutTableCell*, 2> SpanningLayoutTableCells; |
91 | 90 |
92 struct CellStruct { | 91 struct CellStruct { |
93 ALLOW_ONLY_INLINE_ALLOCATION(); | |
94 public: | 92 public: |
95 WillBeHeapVector<RawPtrWillBeMember<LayoutTableCell>, 1> cells; | 93 Vector<LayoutTableCell*, 1> cells; |
96 bool inColSpan; // true for columns after the first in a colspan | 94 bool inColSpan; // true for columns after the first in a colspan |
97 | 95 |
98 CellStruct() | 96 CellStruct() |
99 : inColSpan(false) | 97 : inColSpan(false) |
100 { | 98 { |
101 } | 99 } |
102 void trace(Visitor*); | |
103 | 100 |
104 LayoutTableCell* primaryCell() | 101 LayoutTableCell* primaryCell() |
105 { | 102 { |
106 return hasCells() ? cells[cells.size() - 1].get() : 0; | 103 return hasCells() ? cells[cells.size() - 1] : 0; |
107 } | 104 } |
108 | 105 |
109 const LayoutTableCell* primaryCell() const | 106 const LayoutTableCell* primaryCell() const |
110 { | 107 { |
111 return hasCells() ? cells[cells.size() - 1].get() : 0; | 108 return hasCells() ? cells[cells.size() - 1] : 0; |
112 } | 109 } |
113 | 110 |
114 bool hasCells() const { return cells.size() > 0; } | 111 bool hasCells() const { return cells.size() > 0; } |
115 }; | 112 }; |
116 | 113 |
117 typedef WillBeHeapVector<CellStruct> Row; | 114 typedef Vector<CellStruct> Row; |
118 | 115 |
119 struct RowStruct { | 116 struct RowStruct { |
120 ALLOW_ONLY_INLINE_ALLOCATION(); | |
121 public: | 117 public: |
122 RowStruct() | 118 RowStruct() |
123 : rowRenderer(nullptr) | 119 : rowRenderer(nullptr) |
124 , baseline() | 120 , baseline() |
125 { | 121 { |
126 } | 122 } |
127 void trace(Visitor*); | |
128 | 123 |
129 Row row; | 124 Row row; |
130 RawPtrWillBeMember<LayoutTableRow> rowRenderer; | 125 LayoutTableRow* rowRenderer; |
131 LayoutUnit baseline; | 126 LayoutUnit baseline; |
132 Length logicalHeight; | 127 Length logicalHeight; |
133 }; | 128 }; |
134 | 129 |
135 struct SpanningRowsHeight { | 130 struct SpanningRowsHeight { |
136 WTF_MAKE_NONCOPYABLE(SpanningRowsHeight); | 131 WTF_MAKE_NONCOPYABLE(SpanningRowsHeight); |
137 | 132 |
138 public: | 133 public: |
139 SpanningRowsHeight() | 134 SpanningRowsHeight() |
140 : totalRowsHeight(0) | 135 : totalRowsHeight(0) |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 return createAnonymousWithParentRenderer(parent); | 220 return createAnonymousWithParentRenderer(parent); |
226 } | 221 } |
227 | 222 |
228 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 223 virtual void paint(const PaintInfo&, const LayoutPoint&) override; |
229 | 224 |
230 // Flip the rect so it aligns with the coordinates used by the rowPos and co
lumnPos vectors. | 225 // Flip the rect so it aligns with the coordinates used by the rowPos and co
lumnPos vectors. |
231 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; | 226 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; |
232 | 227 |
233 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const; | 228 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const; |
234 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const; | 229 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const; |
235 WillBeHeapHashSet<RawPtrWillBeMember<LayoutTableCell> >& overflowingCells()
{ return m_overflowingCells; } | 230 HashSet<LayoutTableCell*>& overflowingCells() { return m_overflowingCells; } |
236 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; } | 231 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; } |
237 | 232 |
238 protected: | 233 protected: |
239 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; | 234 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov
erride; |
240 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override; | 235 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes
tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct
ion) override; |
241 | 236 |
242 private: | 237 private: |
243 virtual RenderObjectChildList* virtualChildren() override { return children(
); } | 238 virtual RenderObjectChildList* virtualChildren() override { return children(
); } |
244 virtual const RenderObjectChildList* virtualChildren() const override { retu
rn children(); } | 239 virtual const RenderObjectChildList* virtualChildren() const override { retu
rn children(); } |
245 | 240 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 280 |
286 // These two functions take a rectangle as input that has been flipped by lo
gicalRectForWritingModeAndDirection. | 281 // These two functions take a rectangle as input that has been flipped by lo
gicalRectForWritingModeAndDirection. |
287 // The returned span of rows or columns is end-exclusive, and empty if start
==end. | 282 // The returned span of rows or columns is end-exclusive, and empty if start
==end. |
288 CellSpan spannedRows(const LayoutRect& flippedRect) const; | 283 CellSpan spannedRows(const LayoutRect& flippedRect) const; |
289 CellSpan spannedColumns(const LayoutRect& flippedRect) const; | 284 CellSpan spannedColumns(const LayoutRect& flippedRect) const; |
290 | 285 |
291 void setLogicalPositionForCell(LayoutTableCell*, unsigned effectiveColumn) c
onst; | 286 void setLogicalPositionForCell(LayoutTableCell*, unsigned effectiveColumn) c
onst; |
292 | 287 |
293 RenderObjectChildList m_children; | 288 RenderObjectChildList m_children; |
294 | 289 |
295 WillBeHeapVector<RowStruct> m_grid; | 290 Vector<RowStruct> m_grid; |
296 Vector<int> m_rowPos; | 291 Vector<int> m_rowPos; |
297 | 292 |
298 // the current insertion position | 293 // the current insertion position |
299 unsigned m_cCol; | 294 unsigned m_cCol; |
300 unsigned m_cRow; | 295 unsigned m_cRow; |
301 | 296 |
302 int m_outerBorderStart; | 297 int m_outerBorderStart; |
303 int m_outerBorderEnd; | 298 int m_outerBorderEnd; |
304 int m_outerBorderBefore; | 299 int m_outerBorderBefore; |
305 int m_outerBorderAfter; | 300 int m_outerBorderAfter; |
306 | 301 |
307 bool m_needsCellRecalc; | 302 bool m_needsCellRecalc; |
308 | 303 |
309 // This HashSet holds the overflowing cells for faster painting. | 304 // This HashSet holds the overflowing cells for faster painting. |
310 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it wi
ll be empty | 305 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it wi
ll be empty |
311 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. | 306 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. |
312 WillBeHeapHashSet<RawPtrWillBeMember<LayoutTableCell> > m_overflowingCells; | 307 HashSet<LayoutTableCell*> m_overflowingCells; |
313 bool m_forceSlowPaintPathWithOverflowingCell; | 308 bool m_forceSlowPaintPathWithOverflowingCell; |
314 | 309 |
315 bool m_hasMultipleCellLevels; | 310 bool m_hasMultipleCellLevels; |
316 | 311 |
317 // This map holds the collapsed border values for cells with collapsed borde
rs. | 312 // This map holds the collapsed border values for cells with collapsed borde
rs. |
318 // It is held at LayoutTableSection level to spare memory consumption by tab
le cells. | 313 // It is held at LayoutTableSection level to spare memory consumption by tab
le cells. |
319 WillBeHeapHashMap<pair<RawPtrWillBeMember<const LayoutTableCell>, int>, Coll
apsedBorderValue > m_cellsCollapsedBorders; | 314 HashMap<pair<const LayoutTableCell*, int>, CollapsedBorderValue> m_cellsColl
apsedBorders; |
320 }; | 315 }; |
321 | 316 |
322 DEFINE_RENDER_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); | 317 DEFINE_RENDER_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); |
323 | 318 |
324 } // namespace blink | 319 } // namespace blink |
325 | 320 |
326 #if ENABLE(OILPAN) | |
327 namespace WTF { | |
328 | |
329 template<> struct VectorTraits<blink::LayoutTableSection::CellStruct> : VectorTr
aitsBase<blink::LayoutTableSection::CellStruct> { | |
330 static const bool needsDestruction = false; | |
331 }; | |
332 | |
333 template<> struct VectorTraits<blink::LayoutTableSection::RowStruct> : VectorTra
itsBase<blink::LayoutTableSection::RowStruct> { | |
334 static const bool needsDestruction = false; | |
335 }; | |
336 | |
337 } // namespace WTF | |
338 #endif | |
339 | |
340 #endif // LayoutTableSection_h | 321 #endif // LayoutTableSection_h |
OLD | NEW |