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

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

Issue 2358663003: [css-tables] Set needsLayout on cells when table border width changes (Closed)
Patch Set: refactor some code into LayoutTable::markAllCellsWidthsDirty... Created 4 years, 2 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, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved. 7 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2013 Apple Inc. All rights reserved.
8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com) 8 * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 // explicit width is specified on the table. Auto width implies auto ta ble layout. 94 // explicit width is specified on the table. Auto width implies auto ta ble layout.
95 if (style()->isFixedTableLayout()) 95 if (style()->isFixedTableLayout())
96 m_tableLayout = wrapUnique(new TableLayoutAlgorithmFixed(this)); 96 m_tableLayout = wrapUnique(new TableLayoutAlgorithmFixed(this));
97 else 97 else
98 m_tableLayout = wrapUnique(new TableLayoutAlgorithmAuto(this)); 98 m_tableLayout = wrapUnique(new TableLayoutAlgorithmAuto(this));
99 } 99 }
100 100
101 // If border was changed, invalidate collapsed borders cache. 101 // If border was changed, invalidate collapsed borders cache.
102 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border()) 102 if (!needsLayout() && oldStyle && oldStyle->border() != style()->border())
103 invalidateCollapsedBorders(); 103 invalidateCollapsedBorders();
104 if (LayoutTableBoxComponent::doCellsHaveDirtyWidth(*this, *this, diff, *oldS tyle))
105 markAllCellsWidthsDirtyAndOrNeedsLayout(MarkDirtyAndNeedsLayout);
104 } 106 }
105 107
106 static inline void resetSectionPointerIfNotBefore(LayoutTableSection*& ptr, Layo utObject* before) 108 static inline void resetSectionPointerIfNotBefore(LayoutTableSection*& ptr, Layo utObject* before)
107 { 109 {
108 if (!before || !ptr) 110 if (!before || !ptr)
109 return; 111 return;
110 LayoutObject* o = before->previousSibling(); 112 LayoutObject* o = before->previousSibling();
111 while (o && o != ptr) 113 while (o && o != ptr)
112 o = o->previousSibling(); 114 o = o->previousSibling();
113 if (!o) 115 if (!o)
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 if (captionIsBefore) 697 if (captionIsBefore)
696 rect.move(LayoutUnit(), captionLogicalHeight); 698 rect.move(LayoutUnit(), captionLogicalHeight);
697 } else { 699 } else {
698 rect.setWidth(rect.width() - captionLogicalHeight); 700 rect.setWidth(rect.width() - captionLogicalHeight);
699 if (captionIsBefore) 701 if (captionIsBefore)
700 rect.move(captionLogicalHeight, LayoutUnit()); 702 rect.move(captionLogicalHeight, LayoutUnit());
701 } 703 }
702 } 704 }
703 } 705 }
704 706
707 void LayoutTable::markAllCellsWidthsDirtyAndOrNeedsLayout(WhatToMarkAllCells wha tToMark)
708 {
709 for (LayoutObject* child = children()->firstChild(); child; child = child->n extSibling()) {
710 if (!child->isTableSection())
711 continue;
712 LayoutTableSection* section = toLayoutTableSection(child);
713 section->markAllCellsWidthsDirtyAndOrNeedsLayout(whatToMark);
714 }
715 }
716
705 void LayoutTable::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const 717 void LayoutTable::paintBoxDecorationBackground(const PaintInfo& paintInfo, const LayoutPoint& paintOffset) const
706 { 718 {
707 TablePainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset); 719 TablePainter(*this).paintBoxDecorationBackground(paintInfo, paintOffset);
708 } 720 }
709 721
710 void LayoutTable::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paint Offset) const 722 void LayoutTable::paintMask(const PaintInfo& paintInfo, const LayoutPoint& paint Offset) const
711 { 723 {
712 TablePainter(*this).paintMask(paintInfo, paintOffset); 724 TablePainter(*this).paintMask(paintInfo, paintOffset);
713 } 725 }
714 726
(...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 1488
1477 LayoutUnit LayoutTable::paddingRight() const 1489 LayoutUnit LayoutTable::paddingRight() const
1478 { 1490 {
1479 if (collapseBorders()) 1491 if (collapseBorders())
1480 return LayoutUnit(); 1492 return LayoutUnit();
1481 1493
1482 return LayoutBlock::paddingRight(); 1494 return LayoutBlock::paddingRight();
1483 } 1495 }
1484 1496
1485 } // namespace blink 1497 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCol.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698