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, 2010 Apple Inc. All rights reserv ed. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 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 23 matching lines...) Expand all Loading... | |
| 34 namespace blink { | 34 namespace blink { |
| 35 | 35 |
| 36 class LayoutTableCol; | 36 class LayoutTableCol; |
| 37 class LayoutTableCaption; | 37 class LayoutTableCaption; |
| 38 class LayoutTableCell; | 38 class LayoutTableCell; |
| 39 class LayoutTableSection; | 39 class LayoutTableSection; |
| 40 class TableLayoutAlgorithm; | 40 class TableLayoutAlgorithm; |
| 41 | 41 |
| 42 enum SkipEmptySectionsValue { DoNotSkipEmptySections, SkipEmptySections }; | 42 enum SkipEmptySectionsValue { DoNotSkipEmptySections, SkipEmptySections }; |
| 43 | 43 |
| 44 // LayoutTable is the LayoutObject associated with display: table. | |
|
mstensho (USE GERRIT)
2015/09/04 15:09:10
or inline-table :-P
Julien - ping for review
2015/09/04 16:39:21
!!!!!!
| |
| 45 // | |
| 46 // LayoutTable is the master coordinator for determining the overall table | |
| 47 // structure. The reason is that LayoutTableSection children have a local | |
| 48 // view over what their structure is but don't account for other | |
| 49 // LayoutTableSection. Thus LayoutTable helps keep consistency across | |
| 50 // LayoutTableSection. See e.g. m_column below. | |
| 51 // | |
| 52 // TODO(jchaffraix): Explain more of the class structure. | |
| 44 class CORE_EXPORT LayoutTable final : public LayoutBlock { | 53 class CORE_EXPORT LayoutTable final : public LayoutBlock { |
| 45 public: | 54 public: |
| 46 explicit LayoutTable(Element*); | 55 explicit LayoutTable(Element*); |
| 47 ~LayoutTable() override; | 56 ~LayoutTable() override; |
| 48 | 57 |
| 49 // Per CSS 3 writing-mode: "The first and second values of the 'border-spaci ng' property represent spacing between columns | 58 // Per CSS 3 writing-mode: "The first and second values of the 'border-spaci ng' property represent spacing between columns |
| 50 // and rows respectively, not necessarily the horizontal and vertical spacin g respectively". | 59 // and rows respectively, not necessarily the horizontal and vertical spacin g respectively". |
| 51 int hBorderSpacing() const { return m_hSpacing; } | 60 int hBorderSpacing() const { return m_hSpacing; } |
| 52 int vBorderSpacing() const { return m_vSpacing; } | 61 int vBorderSpacing() const { return m_vSpacing; } |
| 53 | 62 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 316 void addOverflowFromChildren() override; | 325 void addOverflowFromChildren() override; |
| 317 | 326 |
| 318 void recalcSections() const; | 327 void recalcSections() const; |
| 319 void layoutCaption(LayoutTableCaption&); | 328 void layoutCaption(LayoutTableCaption&); |
| 320 | 329 |
| 321 void distributeExtraLogicalHeight(int extraLogicalHeight); | 330 void distributeExtraLogicalHeight(int extraLogicalHeight); |
| 322 | 331 |
| 323 void recalcCollapsedBordersIfNeeded(); | 332 void recalcCollapsedBordersIfNeeded(); |
| 324 | 333 |
| 325 mutable Vector<int> m_columnPos; | 334 mutable Vector<int> m_columnPos; |
| 335 | |
| 336 // This Vector holds the columns counts over the entire table. | |
| 337 // | |
| 338 // To save memory at the expense of massive code complexity, the code tries | |
| 339 // to coalesce columns. This means that we try to the wider column grouping | |
| 340 // seen over the LayoutTableSections. | |
| 341 // | |
| 342 // Note that this is also a defensive pattern as <td colspan="6666666666"> | |
| 343 // only allocates a single entry in this Vector. This argument is weak | |
| 344 // though as we cap colspans in HTMLTableCellElement. | |
| 345 // | |
| 346 // The following example would have 2 ColumnStruct [ 3, 2 ]: | |
| 347 // <table> | |
| 348 // <tr> | |
| 349 // <td colspan="3"></td> | |
| 350 // <td colspan="2"></td> | |
| 351 // </tr> | |
| 352 // </table> | |
| 353 // | |
| 354 // Columns can be split if we add a row with a different colspan structure. | |
| 355 // See splitColumn and appendColumn for operations over |m_columns|. | |
| 356 // | |
| 357 // See colToEffCol for converting an absolute column index into an | |
| 358 // index into |m_columns|. | |
| 326 mutable Vector<ColumnStruct> m_columns; | 359 mutable Vector<ColumnStruct> m_columns; |
| 327 mutable Vector<LayoutTableCaption*> m_captions; | 360 mutable Vector<LayoutTableCaption*> m_captions; |
| 328 mutable Vector<LayoutTableCol*> m_columnLayoutObjects; | 361 mutable Vector<LayoutTableCol*> m_columnLayoutObjects; |
| 329 | 362 |
| 330 mutable LayoutTableSection* m_head; | 363 mutable LayoutTableSection* m_head; |
| 331 mutable LayoutTableSection* m_foot; | 364 mutable LayoutTableSection* m_foot; |
| 332 mutable LayoutTableSection* m_firstBody; | 365 mutable LayoutTableSection* m_firstBody; |
| 333 | 366 |
| 367 // The layout algorithm used by this table. | |
| 368 // | |
| 369 // CSS 2.1 defines 2 types of table layouts toggled with 'table-layout': | |
| 370 // fixed (TableLayoutAlgorithmFixed) and auto (TableLayoutAlgorithmAuto). | |
| 371 // See http://www.w3.org/TR/CSS21/tables.html#width-layout. | |
| 372 // | |
| 373 // The layout algorithm is delegated to TableLayoutAlgorithm. This enables | |
| 374 // changing 'table-layout' without having to reattach the <table>. | |
| 375 // | |
| 376 // As the algorithm is dependent on the style, this field is nullptr before | |
| 377 // the first style is applied in styleDidChange(). | |
| 334 OwnPtr<TableLayoutAlgorithm> m_tableLayout; | 378 OwnPtr<TableLayoutAlgorithm> m_tableLayout; |
| 335 | 379 |
| 336 // A sorted list of all unique border values that we want to paint. | 380 // A sorted list of all unique border values that we want to paint. |
| 337 CollapsedBorderValues m_collapsedBorders; | 381 CollapsedBorderValues m_collapsedBorders; |
| 338 const CollapsedBorderValue* m_currentBorder; | 382 const CollapsedBorderValue* m_currentBorder; |
| 339 bool m_collapsedBordersValid : 1; | 383 bool m_collapsedBordersValid : 1; |
| 340 | 384 |
| 341 mutable bool m_hasColElements : 1; | 385 mutable bool m_hasColElements : 1; |
| 342 mutable bool m_needsSectionRecalc : 1; | 386 mutable bool m_needsSectionRecalc : 1; |
| 343 | 387 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 367 if (m_firstBody) | 411 if (m_firstBody) |
| 368 return m_firstBody; | 412 return m_firstBody; |
| 369 return m_foot; | 413 return m_foot; |
| 370 } | 414 } |
| 371 | 415 |
| 372 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); | 416 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); |
| 373 | 417 |
| 374 } // namespace blink | 418 } // namespace blink |
| 375 | 419 |
| 376 #endif // LayoutTable_h | 420 #endif // LayoutTable_h |
| OLD | NEW |