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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTable.h

Issue 2639223002: [DO NOT COMMIT] Don't keep pointers to table sections when told to recalculate sections. (Closed)
Patch Set: Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTable.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h
index 6b68432118cd1658fbedf42c5c95750b3033574f..ee1281ca0d5fc438db9f6946a423d80ca75dc293 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTable.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
@@ -252,9 +252,18 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
m_effectiveColumnPositions[index] = position;
}
- LayoutTableSection* header() const { return m_head; }
- LayoutTableSection* footer() const { return m_foot; }
- LayoutTableSection* firstBody() const { return m_firstBody; }
+ LayoutTableSection* header() const {
+ DCHECK(!needsSectionRecalc());
+ return m_head;
+ }
+ LayoutTableSection* footer() const {
+ DCHECK(!needsSectionRecalc());
+ return m_foot;
+ }
+ LayoutTableSection* firstBody() const {
+ DCHECK(!needsSectionRecalc());
+ return m_firstBody;
+ }
void setRowOffsetFromRepeatingHeader(LayoutUnit offset) {
m_rowOffsetFromRepeatingHeader = offset;
@@ -367,6 +376,12 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
void setNeedsSectionRecalc() {
if (documentBeingDestroyed())
return;
+ // For all we know, sections may have been deleted at this point. Don't
+ // keep pointers dangling around.
+ m_head = nullptr;
+ m_foot = nullptr;
+ m_firstBody = nullptr;
+
m_needsSectionRecalc = true;
setNeedsLayoutAndFullPaintInvalidation(
LayoutInvalidationReason::TableChanged);
@@ -387,7 +402,7 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
void invalidateCollapsedBorders();
- bool hasSections() const { return m_head || m_foot || m_firstBody; }
+ bool hasSections() const { return header() || footer() || firstBody(); }
void recalcSectionsIfNeeded() const {
if (m_needsSectionRecalc)
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutObject.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableSection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698