Chromium Code Reviews| 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(); | 92 ALLOW_ONLY_INLINE_ALLOCATION(); |
|
haraken
2015/02/04 05:48:56
You can drop ALLOW_ONLY_INLINE_ALLOCATION().
sof
2015/02/04 08:44:31
Done, but does it add value to do so?
| |
| 94 public: | 93 public: |
| 95 WillBeHeapVector<RawPtrWillBeMember<LayoutTableCell>, 1> cells; | 94 Vector<LayoutTableCell*, 1> cells; |
| 96 bool inColSpan; // true for columns after the first in a colspan | 95 bool inColSpan; // true for columns after the first in a colspan |
| 97 | 96 |
| 98 CellStruct() | 97 CellStruct() |
| 99 : inColSpan(false) | 98 : inColSpan(false) |
| 100 { | 99 { |
| 101 } | 100 } |
| 102 void trace(Visitor*); | |
| 103 | 101 |
| 104 LayoutTableCell* primaryCell() | 102 LayoutTableCell* primaryCell() |
| 105 { | 103 { |
| 106 return hasCells() ? cells[cells.size() - 1].get() : 0; | 104 return hasCells() ? cells[cells.size() - 1] : 0; |
| 107 } | 105 } |
| 108 | 106 |
| 109 const LayoutTableCell* primaryCell() const | 107 const LayoutTableCell* primaryCell() const |
| 110 { | 108 { |
| 111 return hasCells() ? cells[cells.size() - 1].get() : 0; | 109 return hasCells() ? cells[cells.size() - 1] : 0; |
| 112 } | 110 } |
| 113 | 111 |
| 114 bool hasCells() const { return cells.size() > 0; } | 112 bool hasCells() const { return cells.size() > 0; } |
| 115 }; | 113 }; |
| 116 | 114 |
| 117 typedef WillBeHeapVector<CellStruct> Row; | 115 typedef Vector<CellStruct> Row; |
| 118 | 116 |
| 119 struct RowStruct { | 117 struct RowStruct { |
| 120 ALLOW_ONLY_INLINE_ALLOCATION(); | 118 ALLOW_ONLY_INLINE_ALLOCATION(); |
|
haraken
2015/02/04 05:48:56
You can drop ALLOW_ONLY_INLINE_ALLOCATION().
sof
2015/02/04 08:44:31
Done.
| |
| 121 public: | 119 public: |
| 122 RowStruct() | 120 RowStruct() |
| 123 : rowRenderer(nullptr) | 121 : rowRenderer(nullptr) |
| 124 , baseline() | 122 , baseline() |
| 125 { | 123 { |
| 126 } | 124 } |
| 127 void trace(Visitor*); | |
| 128 | 125 |
| 129 Row row; | 126 Row row; |
| 130 RawPtrWillBeMember<LayoutTableRow> rowRenderer; | 127 LayoutTableRow* rowRenderer; |
| 131 LayoutUnit baseline; | 128 LayoutUnit baseline; |
| 132 Length logicalHeight; | 129 Length logicalHeight; |
| 133 }; | 130 }; |
| 134 | 131 |
| 135 struct SpanningRowsHeight { | 132 struct SpanningRowsHeight { |
| 136 WTF_MAKE_NONCOPYABLE(SpanningRowsHeight); | 133 WTF_MAKE_NONCOPYABLE(SpanningRowsHeight); |
| 137 | 134 |
| 138 public: | 135 public: |
| 139 SpanningRowsHeight() | 136 SpanningRowsHeight() |
| 140 : totalRowsHeight(0) | 137 : totalRowsHeight(0) |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 225 return createAnonymousWithParentRenderer(parent); | 222 return createAnonymousWithParentRenderer(parent); |
| 226 } | 223 } |
| 227 | 224 |
| 228 virtual void paint(const PaintInfo&, const LayoutPoint&) override; | 225 virtual void paint(const PaintInfo&, const LayoutPoint&) override; |
| 229 | 226 |
| 230 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors. | 227 // Flip the rect so it aligns with the coordinates used by the rowPos and co lumnPos vectors. |
| 231 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; | 228 LayoutRect logicalRectForWritingModeAndDirection(const LayoutRect&) const; |
| 232 | 229 |
| 233 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const; | 230 CellSpan dirtiedRows(const LayoutRect& paintInvalidationRect) const; |
| 234 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const; | 231 CellSpan dirtiedColumns(const LayoutRect& paintInvalidationRect) const; |
| 235 WillBeHeapHashSet<RawPtrWillBeMember<LayoutTableCell> >& overflowingCells() { return m_overflowingCells; } | 232 HashSet<LayoutTableCell*>& overflowingCells() { return m_overflowingCells; } |
| 236 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; } | 233 bool hasMultipleCellLevels() { return m_hasMultipleCellLevels; } |
| 237 | 234 |
| 238 protected: | 235 protected: |
| 239 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) ov erride; | 236 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; | 237 virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTes tLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAct ion) override; |
| 241 | 238 |
| 242 private: | 239 private: |
| 243 virtual RenderObjectChildList* virtualChildren() override { return children( ); } | 240 virtual RenderObjectChildList* virtualChildren() override { return children( ); } |
| 244 virtual const RenderObjectChildList* virtualChildren() const override { retu rn children(); } | 241 virtual const RenderObjectChildList* virtualChildren() const override { retu rn children(); } |
| 245 | 242 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 285 | 282 |
| 286 // These two functions take a rectangle as input that has been flipped by lo gicalRectForWritingModeAndDirection. | 283 // 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. | 284 // The returned span of rows or columns is end-exclusive, and empty if start ==end. |
| 288 CellSpan spannedRows(const LayoutRect& flippedRect) const; | 285 CellSpan spannedRows(const LayoutRect& flippedRect) const; |
| 289 CellSpan spannedColumns(const LayoutRect& flippedRect) const; | 286 CellSpan spannedColumns(const LayoutRect& flippedRect) const; |
| 290 | 287 |
| 291 void setLogicalPositionForCell(LayoutTableCell*, unsigned effectiveColumn) c onst; | 288 void setLogicalPositionForCell(LayoutTableCell*, unsigned effectiveColumn) c onst; |
| 292 | 289 |
| 293 RenderObjectChildList m_children; | 290 RenderObjectChildList m_children; |
| 294 | 291 |
| 295 WillBeHeapVector<RowStruct> m_grid; | 292 Vector<RowStruct> m_grid; |
| 296 Vector<int> m_rowPos; | 293 Vector<int> m_rowPos; |
| 297 | 294 |
| 298 // the current insertion position | 295 // the current insertion position |
| 299 unsigned m_cCol; | 296 unsigned m_cCol; |
| 300 unsigned m_cRow; | 297 unsigned m_cRow; |
| 301 | 298 |
| 302 int m_outerBorderStart; | 299 int m_outerBorderStart; |
| 303 int m_outerBorderEnd; | 300 int m_outerBorderEnd; |
| 304 int m_outerBorderBefore; | 301 int m_outerBorderBefore; |
| 305 int m_outerBorderAfter; | 302 int m_outerBorderAfter; |
| 306 | 303 |
| 307 bool m_needsCellRecalc; | 304 bool m_needsCellRecalc; |
| 308 | 305 |
| 309 // This HashSet holds the overflowing cells for faster painting. | 306 // This HashSet holds the overflowing cells for faster painting. |
| 310 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it wi ll be empty | 307 // If we have more than gMaxAllowedOverflowingCellRatio * total cells, it wi ll be empty |
| 311 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. | 308 // and m_forceSlowPaintPathWithOverflowingCell will be set to save memory. |
| 312 WillBeHeapHashSet<RawPtrWillBeMember<LayoutTableCell> > m_overflowingCells; | 309 HashSet<LayoutTableCell*> m_overflowingCells; |
| 313 bool m_forceSlowPaintPathWithOverflowingCell; | 310 bool m_forceSlowPaintPathWithOverflowingCell; |
| 314 | 311 |
| 315 bool m_hasMultipleCellLevels; | 312 bool m_hasMultipleCellLevels; |
| 316 | 313 |
| 317 // This map holds the collapsed border values for cells with collapsed borde rs. | 314 // 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. | 315 // 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; | 316 HashMap<pair<const LayoutTableCell*, int>, CollapsedBorderValue> m_cellsColl apsedBorders; |
| 320 }; | 317 }; |
| 321 | 318 |
| 322 DEFINE_RENDER_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); | 319 DEFINE_RENDER_OBJECT_TYPE_CASTS(LayoutTableSection, isTableSection()); |
| 323 | 320 |
| 324 } // namespace blink | 321 } // namespace blink |
| 325 | 322 |
| 326 #if ENABLE(OILPAN) | 323 #if ENABLE(OILPAN) |
|
tkent
2015/02/04 00:50:44
We can remove this block.
sof
2015/02/04 08:44:31
Thanks, removed.
| |
| 327 namespace WTF { | 324 namespace WTF { |
| 328 | 325 |
| 329 template<> struct VectorTraits<blink::LayoutTableSection::CellStruct> : VectorTr aitsBase<blink::LayoutTableSection::CellStruct> { | 326 template<> struct VectorTraits<blink::LayoutTableSection::CellStruct> : VectorTr aitsBase<blink::LayoutTableSection::CellStruct> { |
| 330 static const bool needsDestruction = false; | 327 static const bool needsDestruction = false; |
| 331 }; | 328 }; |
| 332 | 329 |
| 333 template<> struct VectorTraits<blink::LayoutTableSection::RowStruct> : VectorTra itsBase<blink::LayoutTableSection::RowStruct> { | 330 template<> struct VectorTraits<blink::LayoutTableSection::RowStruct> : VectorTra itsBase<blink::LayoutTableSection::RowStruct> { |
| 334 static const bool needsDestruction = false; | 331 static const bool needsDestruction = false; |
| 335 }; | 332 }; |
| 336 | 333 |
| 337 } // namespace WTF | 334 } // namespace WTF |
| 338 #endif | 335 #endif |
| 339 | 336 |
| 340 #endif // LayoutTableSection_h | 337 #endif // LayoutTableSection_h |
| OLD | NEW |