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

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

Issue 2840723005: Don't always invalidate collapsed borders during table layout (Closed)
Patch Set: Created 3 years, 8 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
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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 return; 385 return;
386 // For all we know, sections may have been deleted at this point. Don't 386 // For all we know, sections may have been deleted at this point. Don't
387 // keep pointers dangling around. 387 // keep pointers dangling around.
388 head_ = nullptr; 388 head_ = nullptr;
389 foot_ = nullptr; 389 foot_ = nullptr;
390 first_body_ = nullptr; 390 first_body_ = nullptr;
391 391
392 needs_section_recalc_ = true; 392 needs_section_recalc_ = true;
393 SetNeedsLayoutAndFullPaintInvalidation( 393 SetNeedsLayoutAndFullPaintInvalidation(
394 LayoutInvalidationReason::kTableChanged); 394 LayoutInvalidationReason::kTableChanged);
395
396 // Grid structure affects cell adjacence relationships which affect
397 // conflict resolution of collapsed borders.
398 InvalidateCollapsedBorders();
395 } 399 }
396 400
397 LayoutTableSection* SectionAbove( 401 LayoutTableSection* SectionAbove(
398 const LayoutTableSection*, 402 const LayoutTableSection*,
399 SkipEmptySectionsValue = kDoNotSkipEmptySections) const; 403 SkipEmptySectionsValue = kDoNotSkipEmptySections) const;
400 LayoutTableSection* SectionBelow( 404 LayoutTableSection* SectionBelow(
401 const LayoutTableSection*, 405 const LayoutTableSection*,
402 SkipEmptySectionsValue = kDoNotSkipEmptySections) const; 406 SkipEmptySectionsValue = kDoNotSkipEmptySections) const;
403 407
404 LayoutTableCell* CellAbove(const LayoutTableCell*) const; 408 LayoutTableCell* CellAbove(const LayoutTableCell*) const;
405 LayoutTableCell* CellBelow(const LayoutTableCell*) const; 409 LayoutTableCell* CellBelow(const LayoutTableCell*) const;
406 LayoutTableCell* CellBefore(const LayoutTableCell*) const; 410 LayoutTableCell* CellBefore(const LayoutTableCell*) const;
407 LayoutTableCell* CellAfter(const LayoutTableCell*) const; 411 LayoutTableCell* CellAfter(const LayoutTableCell*) const;
408 412
409 typedef Vector<CollapsedBorderValue> CollapsedBorderValues; 413 using CollapsedBorderValues = Vector<CollapsedBorderValue>;
414 const CollapsedBorderValues& CollapsedBorders() const {
415 DCHECK(collapsed_borders_valid_);
416 return collapsed_borders_;
417 }
410 void InvalidateCollapsedBorders(); 418 void InvalidateCollapsedBorders();
411 419
412 bool HasSections() const { return Header() || Footer() || FirstBody(); } 420 bool HasSections() const { return Header() || Footer() || FirstBody(); }
413 421
414 void RecalcSectionsIfNeeded() const { 422 void RecalcSectionsIfNeeded() const {
415 if (needs_section_recalc_) 423 if (needs_section_recalc_)
416 RecalcSections(); 424 RecalcSections();
417 } 425 }
418 426
419 static LayoutTable* CreateAnonymousWithParent(const LayoutObject*); 427 static LayoutTable* CreateAnonymousWithParent(const LayoutObject*);
420 LayoutBox* CreateAnonymousBoxWithSameTypeAs( 428 LayoutBox* CreateAnonymousBoxWithSameTypeAs(
421 const LayoutObject* parent) const override { 429 const LayoutObject* parent) const override {
422 return CreateAnonymousWithParent(parent); 430 return CreateAnonymousWithParent(parent);
423 } 431 }
424 432
425 const BorderValue& TableStartBorderAdjoiningCell( 433 const BorderValue& TableStartBorderAdjoiningCell(
426 const LayoutTableCell*) const; 434 const LayoutTableCell*) const;
427 const BorderValue& TableEndBorderAdjoiningCell(const LayoutTableCell*) const; 435 const BorderValue& TableEndBorderAdjoiningCell(const LayoutTableCell*) const;
428 436
429 void AddCaption(const LayoutTableCaption*); 437 void AddCaption(const LayoutTableCaption*);
430 void RemoveCaption(const LayoutTableCaption*); 438 void RemoveCaption(const LayoutTableCaption*);
431 void AddColumn(const LayoutTableCol*); 439 void AddColumn(const LayoutTableCol*);
432 void RemoveColumn(const LayoutTableCol*); 440 void RemoveColumn(const LayoutTableCol*);
433 441
434 void PaintBoxDecorationBackground(const PaintInfo&, 442 void PaintBoxDecorationBackground(const PaintInfo&,
435 const LayoutPoint&) const final; 443 const LayoutPoint&) const final;
436 444
437 void PaintMask(const PaintInfo&, const LayoutPoint&) const final; 445 void PaintMask(const PaintInfo&, const LayoutPoint&) const final;
438 446
439 const CollapsedBorderValues& CollapsedBorders() const {
440 DCHECK(collapsed_borders_valid_);
441 return collapsed_borders_;
442 }
443
444 void SubtractCaptionRect(LayoutRect&) const; 447 void SubtractCaptionRect(LayoutRect&) const;
445 448
446 bool IsLogicalWidthAuto() const; 449 bool IsLogicalWidthAuto() const;
447 450
448 // When table headers are repeated, we need to know the offset from the block 451 // When table headers are repeated, we need to know the offset from the block
449 // start of the fragmentation context to the first occurrence of the table 452 // start of the fragmentation context to the first occurrence of the table
450 // header. 453 // header.
451 LayoutUnit BlockOffsetToFirstRepeatableHeader() const { 454 LayoutUnit BlockOffsetToFirstRepeatableHeader() const {
452 return block_offset_to_first_repeatable_header_; 455 return block_offset_to_first_repeatable_header_;
453 } 456 }
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (first_body_) 620 if (first_body_)
618 return first_body_; 621 return first_body_;
619 return foot_; 622 return foot_;
620 } 623 }
621 624
622 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable()); 625 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, IsTable());
623 626
624 } // namespace blink 627 } // namespace blink
625 628
626 #endif // LayoutTable_h 629 #endif // LayoutTable_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698