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 <table>. | |
|
mstensho (USE GERRIT)
2015/09/04 13:06:53
I'd prefer to say something about CSS rather than
Julien - ping for review
2015/09/04 14:36:16
Makes sense changed to:
// LayoutTable is the Lay
| |
| 45 // | |
| 46 // LayoutTable is the master coordinator for determining the overall table | |
| 47 // structure. The reason is that LayoutTableSection has a local views over | |
|
mstensho (USE GERRIT)
2015/09/04 13:06:53
"... is that LayoutTableSection children have a lo
Julien - ping for review
2015/09/04 14:36:16
Done!
| |
| 48 // what its structure is but doesn't account for other LayoutTableSection. | |
| 49 // Thus LayoutTable helps keep consistency across LayoutTableSection. | |
| 50 // 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 sizes over the entire table. | |
|
mstensho (USE GERRIT)
2015/09/04 13:06:53
More like column *count*.
This member had so far
Julien - ping for review
2015/09/04 14:36:16
Updated.
| |
| 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 // The following example would have 2 ColumnStruct [ 3, 2 ]: | |
| 343 // <table> | |
| 344 // <tr> | |
| 345 // <td colspan="3"></td> | |
| 346 // <td colspan="2"></td> | |
| 347 // </tr> | |
| 348 // </table> | |
| 349 // | |
| 350 // Columns can be split if we add a row with a different colspan structure. | |
| 351 // See splitColumn and appendColumn for operations over |m_columns|. | |
| 352 // | |
| 353 // See colToEffCol for converting an absolute column index into an | |
| 354 // index into |m_columns|. | |
| 326 mutable Vector<ColumnStruct> m_columns; | 355 mutable Vector<ColumnStruct> m_columns; |
| 327 mutable Vector<LayoutTableCaption*> m_captions; | 356 mutable Vector<LayoutTableCaption*> m_captions; |
| 328 mutable Vector<LayoutTableCol*> m_columnLayoutObjects; | 357 mutable Vector<LayoutTableCol*> m_columnLayoutObjects; |
| 329 | 358 |
| 330 mutable LayoutTableSection* m_head; | 359 mutable LayoutTableSection* m_head; |
| 331 mutable LayoutTableSection* m_foot; | 360 mutable LayoutTableSection* m_foot; |
| 332 mutable LayoutTableSection* m_firstBody; | 361 mutable LayoutTableSection* m_firstBody; |
| 333 | 362 |
| 363 // The layout algorithm used by this table. | |
| 364 // | |
| 365 // CSS 2.1 defines 2 types of table layouts toggled with 'table-layout': | |
| 366 // fixed (TableLayoutAlgorithmFixed) and auto (TableLayoutAlgorithmAuto). | |
| 367 // See http://www.w3.org/TR/CSS21/tables.html#width-layout. | |
| 368 // | |
| 369 // The layout algorithm is delegated to TableLayoutAlgorithm. This enables | |
| 370 // changing 'table-layout' without having to reattach the <table>. | |
| 371 // | |
| 372 // As the algorithm is dependent on the style, this field is nullptr before | |
| 373 // the first style is applied in styleDidChange(). | |
| 334 OwnPtr<TableLayoutAlgorithm> m_tableLayout; | 374 OwnPtr<TableLayoutAlgorithm> m_tableLayout; |
| 335 | 375 |
| 336 // A sorted list of all unique border values that we want to paint. | 376 // A sorted list of all unique border values that we want to paint. |
| 337 CollapsedBorderValues m_collapsedBorders; | 377 CollapsedBorderValues m_collapsedBorders; |
| 338 const CollapsedBorderValue* m_currentBorder; | 378 const CollapsedBorderValue* m_currentBorder; |
| 339 bool m_collapsedBordersValid : 1; | 379 bool m_collapsedBordersValid : 1; |
| 340 | 380 |
| 341 mutable bool m_hasColElements : 1; | 381 mutable bool m_hasColElements : 1; |
| 342 mutable bool m_needsSectionRecalc : 1; | 382 mutable bool m_needsSectionRecalc : 1; |
| 343 | 383 |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 367 if (m_firstBody) | 407 if (m_firstBody) |
| 368 return m_firstBody; | 408 return m_firstBody; |
| 369 return m_foot; | 409 return m_foot; |
| 370 } | 410 } |
| 371 | 411 |
| 372 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); | 412 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); |
| 373 | 413 |
| 374 } // namespace blink | 414 } // namespace blink |
| 375 | 415 |
| 376 #endif // LayoutTable_h | 416 #endif // LayoutTable_h |
| OLD | NEW |