Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Side by Side Diff: Source/core/layout/LayoutTable.h

Issue 1319453009: Start adding some documentation to LayoutTable (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed inline-table. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Source/core/layout/LayoutTableSection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
45 // display: table or inline-table.
46 //
47 // LayoutTable is the master coordinator for determining the overall table
48 // structure. The reason is that LayoutTableSection children have a local
49 // view over what their structure is but don't account for other
50 // LayoutTableSection. Thus LayoutTable helps keep consistency across
51 // LayoutTableSection. See e.g. m_column below.
52 //
53 // TODO(jchaffraix): Explain more of the class structure.
44 class CORE_EXPORT LayoutTable final : public LayoutBlock { 54 class CORE_EXPORT LayoutTable final : public LayoutBlock {
45 public: 55 public:
46 explicit LayoutTable(Element*); 56 explicit LayoutTable(Element*);
47 ~LayoutTable() override; 57 ~LayoutTable() override;
48 58
49 // Per CSS 3 writing-mode: "The first and second values of the 'border-spaci ng' property represent spacing between columns 59 // 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". 60 // and rows respectively, not necessarily the horizontal and vertical spacin g respectively".
51 int hBorderSpacing() const { return m_hSpacing; } 61 int hBorderSpacing() const { return m_hSpacing; }
52 int vBorderSpacing() const { return m_vSpacing; } 62 int vBorderSpacing() const { return m_vSpacing; }
53 63
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 void addOverflowFromChildren() override; 326 void addOverflowFromChildren() override;
317 327
318 void recalcSections() const; 328 void recalcSections() const;
319 void layoutCaption(LayoutTableCaption&); 329 void layoutCaption(LayoutTableCaption&);
320 330
321 void distributeExtraLogicalHeight(int extraLogicalHeight); 331 void distributeExtraLogicalHeight(int extraLogicalHeight);
322 332
323 void recalcCollapsedBordersIfNeeded(); 333 void recalcCollapsedBordersIfNeeded();
324 334
325 mutable Vector<int> m_columnPos; 335 mutable Vector<int> m_columnPos;
336
337 // This Vector holds the columns counts over the entire table.
338 //
339 // To save memory at the expense of massive code complexity, the code tries
340 // to coalesce columns. This means that we try to the wider column grouping
341 // seen over the LayoutTableSections.
342 //
343 // Note that this is also a defensive pattern as <td colspan="6666666666">
344 // only allocates a single entry in this Vector. This argument is weak
345 // though as we cap colspans in HTMLTableCellElement.
346 //
347 // The following example would have 2 ColumnStruct [ 3, 2 ]:
348 // <table>
349 // <tr>
350 // <td colspan="3"></td>
351 // <td colspan="2"></td>
352 // </tr>
353 // </table>
354 //
355 // Columns can be split if we add a row with a different colspan structure.
356 // See splitColumn and appendColumn for operations over |m_columns|.
357 //
358 // See colToEffCol for converting an absolute column index into an
359 // index into |m_columns|.
326 mutable Vector<ColumnStruct> m_columns; 360 mutable Vector<ColumnStruct> m_columns;
327 mutable Vector<LayoutTableCaption*> m_captions; 361 mutable Vector<LayoutTableCaption*> m_captions;
328 mutable Vector<LayoutTableCol*> m_columnLayoutObjects; 362 mutable Vector<LayoutTableCol*> m_columnLayoutObjects;
329 363
330 mutable LayoutTableSection* m_head; 364 mutable LayoutTableSection* m_head;
331 mutable LayoutTableSection* m_foot; 365 mutable LayoutTableSection* m_foot;
332 mutable LayoutTableSection* m_firstBody; 366 mutable LayoutTableSection* m_firstBody;
333 367
368 // The layout algorithm used by this table.
369 //
370 // CSS 2.1 defines 2 types of table layouts toggled with 'table-layout':
371 // fixed (TableLayoutAlgorithmFixed) and auto (TableLayoutAlgorithmAuto).
372 // See http://www.w3.org/TR/CSS21/tables.html#width-layout.
373 //
374 // The layout algorithm is delegated to TableLayoutAlgorithm. This enables
375 // changing 'table-layout' without having to reattach the <table>.
376 //
377 // As the algorithm is dependent on the style, this field is nullptr before
378 // the first style is applied in styleDidChange().
334 OwnPtr<TableLayoutAlgorithm> m_tableLayout; 379 OwnPtr<TableLayoutAlgorithm> m_tableLayout;
335 380
336 // A sorted list of all unique border values that we want to paint. 381 // A sorted list of all unique border values that we want to paint.
337 CollapsedBorderValues m_collapsedBorders; 382 CollapsedBorderValues m_collapsedBorders;
338 const CollapsedBorderValue* m_currentBorder; 383 const CollapsedBorderValue* m_currentBorder;
339 bool m_collapsedBordersValid : 1; 384 bool m_collapsedBordersValid : 1;
340 385
341 mutable bool m_hasColElements : 1; 386 mutable bool m_hasColElements : 1;
342 mutable bool m_needsSectionRecalc : 1; 387 mutable bool m_needsSectionRecalc : 1;
343 388
(...skipping 23 matching lines...) Expand all
367 if (m_firstBody) 412 if (m_firstBody)
368 return m_firstBody; 413 return m_firstBody;
369 return m_foot; 414 return m_foot;
370 } 415 }
371 416
372 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); 417 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable());
373 418
374 } // namespace blink 419 } // namespace blink
375 420
376 #endif // LayoutTable_h 421 #endif // LayoutTable_h
OLDNEW
« no previous file with comments | « no previous file | Source/core/layout/LayoutTableSection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698