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

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

Issue 2430313004: Paint collapsed borders of a table as one display item (Closed)
Patch Set: Rebaseline on mac and win Created 4 years, 1 month 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
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. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2009, 2010 Apple Inc.
8 * All rights reserved. 8 * All rights reserved.
9 * 9 *
10 * This library is free software; you can redistribute it and/or 10 * This library is free software; you can redistribute it and/or
(...skipping 11 matching lines...) Expand all
22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 22 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23 * Boston, MA 02110-1301, USA. 23 * Boston, MA 02110-1301, USA.
24 */ 24 */
25 25
26 #ifndef LayoutTable_h 26 #ifndef LayoutTable_h
27 #define LayoutTable_h 27 #define LayoutTable_h
28 28
29 #include "core/CSSPropertyNames.h" 29 #include "core/CSSPropertyNames.h"
30 #include "core/CoreExport.h" 30 #include "core/CoreExport.h"
31 #include "core/layout/LayoutBlock.h" 31 #include "core/layout/LayoutBlock.h"
32 #include "core/paint/PaintResult.h"
32 #include "core/style/CollapsedBorderValue.h" 33 #include "core/style/CollapsedBorderValue.h"
34 #include "platform/graphics/paint/CullRect.h"
33 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
34 #include <memory> 36 #include <memory>
35 37
36 namespace blink { 38 namespace blink {
37 39
38 class LayoutTableCol; 40 class LayoutTableCol;
39 class LayoutTableCaption; 41 class LayoutTableCaption;
40 class LayoutTableCell; 42 class LayoutTableCell;
41 class LayoutTableSection; 43 class LayoutTableSection;
42 class TableLayoutAlgorithm; 44 class TableLayoutAlgorithm;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 370 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
369 LayoutTableSection* sectionBelow( 371 LayoutTableSection* sectionBelow(
370 const LayoutTableSection*, 372 const LayoutTableSection*,
371 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 373 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
372 374
373 LayoutTableCell* cellAbove(const LayoutTableCell*) const; 375 LayoutTableCell* cellAbove(const LayoutTableCell*) const;
374 LayoutTableCell* cellBelow(const LayoutTableCell*) const; 376 LayoutTableCell* cellBelow(const LayoutTableCell*) const;
375 LayoutTableCell* cellBefore(const LayoutTableCell*) const; 377 LayoutTableCell* cellBefore(const LayoutTableCell*) const;
376 LayoutTableCell* cellAfter(const LayoutTableCell*) const; 378 LayoutTableCell* cellAfter(const LayoutTableCell*) const;
377 379
378 typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
379 void invalidateCollapsedBorders(); 380 void invalidateCollapsedBorders();
380 381
381 bool hasSections() const { return m_head || m_foot || m_firstBody; } 382 bool hasSections() const { return m_head || m_foot || m_firstBody; }
382 383
383 void recalcSectionsIfNeeded() const { 384 void recalcSectionsIfNeeded() const {
384 if (m_needsSectionRecalc) 385 if (m_needsSectionRecalc)
385 recalcSections(); 386 recalcSections();
386 } 387 }
387 388
388 static LayoutTable* createAnonymousWithParent(const LayoutObject*); 389 static LayoutTable* createAnonymousWithParent(const LayoutObject*);
389 LayoutBox* createAnonymousBoxWithSameTypeAs( 390 LayoutBox* createAnonymousBoxWithSameTypeAs(
390 const LayoutObject* parent) const override { 391 const LayoutObject* parent) const override {
391 return createAnonymousWithParent(parent); 392 return createAnonymousWithParent(parent);
392 } 393 }
393 394
394 const BorderValue& tableStartBorderAdjoiningCell( 395 const BorderValue& tableStartBorderAdjoiningCell(
395 const LayoutTableCell*) const; 396 const LayoutTableCell*) const;
396 const BorderValue& tableEndBorderAdjoiningCell(const LayoutTableCell*) const; 397 const BorderValue& tableEndBorderAdjoiningCell(const LayoutTableCell*) const;
397 398
398 void addCaption(const LayoutTableCaption*); 399 void addCaption(const LayoutTableCaption*);
399 void removeCaption(const LayoutTableCaption*); 400 void removeCaption(const LayoutTableCaption*);
400 void addColumn(const LayoutTableCol*); 401 void addColumn(const LayoutTableCol*);
401 void removeColumn(const LayoutTableCol*); 402 void removeColumn(const LayoutTableCol*);
402 403
403 void paintBoxDecorationBackground(const PaintInfo&, 404 void paintBoxDecorationBackground(const PaintInfo&,
404 const LayoutPoint&) const final; 405 const LayoutPoint&) const final;
405 406
406 void paintMask(const PaintInfo&, const LayoutPoint&) const final; 407 void paintMask(const PaintInfo&, const LayoutPoint&) const final;
407 408
408 const CollapsedBorderValues& collapsedBorders() const { 409 struct CollapsedBordersInfo {
409 ASSERT(m_collapsedBordersValid); 410 explicit CollapsedBordersInfo(const Vector<CollapsedBorderValue>& values)
410 return m_collapsedBorders; 411 : values(std::move(values)) {}
412
413 PaintResult lastPaintResult = FullyPainted;
414 CullRect lastPaintRect;
415 const Vector<CollapsedBorderValue> values;
416 };
417
418 bool hasCollapsedBorders() const {
419 DCHECK(m_collapsedBordersValid);
420 DCHECK(!m_collapsedBordersInfo || collapseBorders());
421 return !!m_collapsedBordersInfo;
422 }
423 CollapsedBordersInfo& getCollapsedBordersInfo() const {
424 DCHECK(hasCollapsedBorders());
425 return *m_collapsedBordersInfo;
411 } 426 }
412 427
413 void subtractCaptionRect(LayoutRect&) const; 428 void subtractCaptionRect(LayoutRect&) const;
414 429
415 bool isLogicalWidthAuto() const; 430 bool isLogicalWidthAuto() const;
416 431
417 // When table headers are repeated, we need to know the offset from the block 432 // When table headers are repeated, we need to know the offset from the block
418 // start of the fragmentation context to the first occurrence of the table 433 // start of the fragmentation context to the first occurrence of the table
419 // header. 434 // header.
420 LayoutUnit blockOffsetToFirstRepeatableHeader() const { 435 LayoutUnit blockOffsetToFirstRepeatableHeader() const {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 // As the algorithm is dependent on the style, this field is nullptr before 558 // As the algorithm is dependent on the style, this field is nullptr before
544 // the first style is applied in styleDidChange(). 559 // the first style is applied in styleDidChange().
545 std::unique_ptr<TableLayoutAlgorithm> m_tableLayout; 560 std::unique_ptr<TableLayoutAlgorithm> m_tableLayout;
546 561
547 // A sorted list of all unique border values that we want to paint. 562 // A sorted list of all unique border values that we want to paint.
548 // 563 //
549 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we 564 // Collapsed borders are SUPER EXPENSIVE to compute. The reason is that we
550 // need to compare a cells border against all the adjoining cells, rows, 565 // need to compare a cells border against all the adjoining cells, rows,
551 // row groups, column, column groups and table. Thus we cache them in this 566 // row groups, column, column groups and table. Thus we cache them in this
552 // field. 567 // field.
553 CollapsedBorderValues m_collapsedBorders; 568 std::unique_ptr<CollapsedBordersInfo> m_collapsedBordersInfo;
554 bool m_collapsedBordersValid : 1; 569 bool m_collapsedBordersValid : 1;
555 570
556 mutable bool m_hasColElements : 1; 571 mutable bool m_hasColElements : 1;
557 mutable bool m_needsSectionRecalc : 1; 572 mutable bool m_needsSectionRecalc : 1;
558 573
559 bool m_columnLogicalWidthChanged : 1; 574 bool m_columnLogicalWidthChanged : 1;
560 mutable bool m_columnLayoutObjectsValid : 1; 575 mutable bool m_columnLayoutObjectsValid : 1;
561 mutable unsigned m_noCellColspanAtLeast; 576 mutable unsigned m_noCellColspanAtLeast;
562 unsigned calcNoCellColspanAtLeast() const { 577 unsigned calcNoCellColspanAtLeast() const {
563 for (unsigned c = 0; c < numEffectiveColumns(); c++) { 578 for (unsigned c = 0; c < numEffectiveColumns(); c++) {
(...skipping 18 matching lines...) Expand all
582 if (m_firstBody) 597 if (m_firstBody)
583 return m_firstBody; 598 return m_firstBody;
584 return m_foot; 599 return m_foot;
585 } 600 }
586 601
587 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); 602 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable());
588 603
589 } // namespace blink 604 } // namespace blink
590 605
591 #endif // LayoutTable_h 606 #endif // LayoutTable_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/BUILD.gn ('k') | third_party/WebKit/Source/core/layout/LayoutTable.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698