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

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

Issue 2636153002: Don't keep pointers to table sections when told to recalculate sections. (Closed)
Patch Set: Disable one DCHECK that causes failures on the linux trybot. Created 3 years, 10 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 | no next file » | 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. 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 void setEffectiveColumnPosition(unsigned index, int position) { 246 void setEffectiveColumnPosition(unsigned index, int position) {
247 // Note that if our horizontal border-spacing changed, our position will 247 // Note that if our horizontal border-spacing changed, our position will
248 // change but not our column's width. In practice, horizontal border-spacing 248 // change but not our column's width. In practice, horizontal border-spacing
249 // won't change often. 249 // won't change often.
250 m_columnLogicalWidthChanged |= 250 m_columnLogicalWidthChanged |=
251 m_effectiveColumnPositions[index] != position; 251 m_effectiveColumnPositions[index] != position;
252 m_effectiveColumnPositions[index] = position; 252 m_effectiveColumnPositions[index] = position;
253 } 253 }
254 254
255 LayoutTableSection* header() const { return m_head; } 255 LayoutTableSection* header() const {
256 LayoutTableSection* footer() const { return m_foot; } 256 // TODO(mstensho): We should ideally DCHECK(!needsSectionRecalc()) here, but
257 LayoutTableSection* firstBody() const { return m_firstBody; } 257 // we currently cannot, due to crbug.com/693212
258 return m_head;
259 }
260 LayoutTableSection* footer() const {
261 DCHECK(!needsSectionRecalc());
262 return m_foot;
263 }
264 LayoutTableSection* firstBody() const {
265 DCHECK(!needsSectionRecalc());
266 return m_firstBody;
267 }
258 268
259 void setRowOffsetFromRepeatingHeader(LayoutUnit offset) { 269 void setRowOffsetFromRepeatingHeader(LayoutUnit offset) {
260 m_rowOffsetFromRepeatingHeader = offset; 270 m_rowOffsetFromRepeatingHeader = offset;
261 } 271 }
262 LayoutUnit rowOffsetFromRepeatingHeader() const { 272 LayoutUnit rowOffsetFromRepeatingHeader() const {
263 return m_rowOffsetFromRepeatingHeader; 273 return m_rowOffsetFromRepeatingHeader;
264 } 274 }
265 275
266 // This function returns 0 if the table has no section. 276 // This function returns 0 if the table has no section.
267 LayoutTableSection* topSection() const; 277 LayoutTableSection* topSection() const;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // fast. 370 // fast.
361 if (!m_hasColElements) 371 if (!m_hasColElements)
362 return ColAndColGroup(); 372 return ColAndColGroup();
363 return slowColElementAtAbsoluteColumn(absoluteColumnIndex); 373 return slowColElementAtAbsoluteColumn(absoluteColumnIndex);
364 } 374 }
365 375
366 bool needsSectionRecalc() const { return m_needsSectionRecalc; } 376 bool needsSectionRecalc() const { return m_needsSectionRecalc; }
367 void setNeedsSectionRecalc() { 377 void setNeedsSectionRecalc() {
368 if (documentBeingDestroyed()) 378 if (documentBeingDestroyed())
369 return; 379 return;
380 // For all we know, sections may have been deleted at this point. Don't
381 // keep pointers dangling around.
382 m_head = nullptr;
383 m_foot = nullptr;
384 m_firstBody = nullptr;
385
370 m_needsSectionRecalc = true; 386 m_needsSectionRecalc = true;
371 setNeedsLayoutAndFullPaintInvalidation( 387 setNeedsLayoutAndFullPaintInvalidation(
372 LayoutInvalidationReason::TableChanged); 388 LayoutInvalidationReason::TableChanged);
373 } 389 }
374 390
375 LayoutTableSection* sectionAbove( 391 LayoutTableSection* sectionAbove(
376 const LayoutTableSection*, 392 const LayoutTableSection*,
377 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 393 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
378 LayoutTableSection* sectionBelow( 394 LayoutTableSection* sectionBelow(
379 const LayoutTableSection*, 395 const LayoutTableSection*,
380 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 396 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
381 397
382 LayoutTableCell* cellAbove(const LayoutTableCell*) const; 398 LayoutTableCell* cellAbove(const LayoutTableCell*) const;
383 LayoutTableCell* cellBelow(const LayoutTableCell*) const; 399 LayoutTableCell* cellBelow(const LayoutTableCell*) const;
384 LayoutTableCell* cellBefore(const LayoutTableCell*) const; 400 LayoutTableCell* cellBefore(const LayoutTableCell*) const;
385 LayoutTableCell* cellAfter(const LayoutTableCell*) const; 401 LayoutTableCell* cellAfter(const LayoutTableCell*) const;
386 402
387 typedef Vector<CollapsedBorderValue> CollapsedBorderValues; 403 typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
388 void invalidateCollapsedBorders(); 404 void invalidateCollapsedBorders();
389 405
390 bool hasSections() const { return m_head || m_foot || m_firstBody; } 406 bool hasSections() const { return header() || footer() || firstBody(); }
391 407
392 void recalcSectionsIfNeeded() const { 408 void recalcSectionsIfNeeded() const {
393 if (m_needsSectionRecalc) 409 if (m_needsSectionRecalc)
394 recalcSections(); 410 recalcSections();
395 } 411 }
396 412
397 static LayoutTable* createAnonymousWithParent(const LayoutObject*); 413 static LayoutTable* createAnonymousWithParent(const LayoutObject*);
398 LayoutBox* createAnonymousBoxWithSameTypeAs( 414 LayoutBox* createAnonymousBoxWithSameTypeAs(
399 const LayoutObject* parent) const override { 415 const LayoutObject* parent) const override {
400 return createAnonymousWithParent(parent); 416 return createAnonymousWithParent(parent);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 if (m_firstBody) 608 if (m_firstBody)
593 return m_firstBody; 609 return m_firstBody;
594 return m_foot; 610 return m_foot;
595 } 611 }
596 612
597 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); 613 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable());
598 614
599 } // namespace blink 615 } // namespace blink
600 616
601 #endif // LayoutTable_h 617 #endif // LayoutTable_h
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698