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

Side by Side 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 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 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 DCHECK(!needsSectionRecalc());
257 LayoutTableSection* firstBody() const { return m_firstBody; } 257 return m_head;
258 }
259 LayoutTableSection* footer() const {
260 DCHECK(!needsSectionRecalc());
261 return m_foot;
262 }
263 LayoutTableSection* firstBody() const {
264 DCHECK(!needsSectionRecalc());
265 return m_firstBody;
266 }
258 267
259 void setRowOffsetFromRepeatingHeader(LayoutUnit offset) { 268 void setRowOffsetFromRepeatingHeader(LayoutUnit offset) {
260 m_rowOffsetFromRepeatingHeader = offset; 269 m_rowOffsetFromRepeatingHeader = offset;
261 } 270 }
262 LayoutUnit rowOffsetFromRepeatingHeader() const { 271 LayoutUnit rowOffsetFromRepeatingHeader() const {
263 return m_rowOffsetFromRepeatingHeader; 272 return m_rowOffsetFromRepeatingHeader;
264 } 273 }
265 274
266 // This function returns 0 if the table has no section. 275 // This function returns 0 if the table has no section.
267 LayoutTableSection* topSection() const; 276 LayoutTableSection* topSection() const;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // fast. 369 // fast.
361 if (!m_hasColElements) 370 if (!m_hasColElements)
362 return ColAndColGroup(); 371 return ColAndColGroup();
363 return slowColElementAtAbsoluteColumn(absoluteColumnIndex); 372 return slowColElementAtAbsoluteColumn(absoluteColumnIndex);
364 } 373 }
365 374
366 bool needsSectionRecalc() const { return m_needsSectionRecalc; } 375 bool needsSectionRecalc() const { return m_needsSectionRecalc; }
367 void setNeedsSectionRecalc() { 376 void setNeedsSectionRecalc() {
368 if (documentBeingDestroyed()) 377 if (documentBeingDestroyed())
369 return; 378 return;
379 // For all we know, sections may have been deleted at this point. Don't
380 // keep pointers dangling around.
381 m_head = nullptr;
382 m_foot = nullptr;
383 m_firstBody = nullptr;
384
370 m_needsSectionRecalc = true; 385 m_needsSectionRecalc = true;
371 setNeedsLayoutAndFullPaintInvalidation( 386 setNeedsLayoutAndFullPaintInvalidation(
372 LayoutInvalidationReason::TableChanged); 387 LayoutInvalidationReason::TableChanged);
373 } 388 }
374 389
375 LayoutTableSection* sectionAbove( 390 LayoutTableSection* sectionAbove(
376 const LayoutTableSection*, 391 const LayoutTableSection*,
377 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 392 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
378 LayoutTableSection* sectionBelow( 393 LayoutTableSection* sectionBelow(
379 const LayoutTableSection*, 394 const LayoutTableSection*,
380 SkipEmptySectionsValue = DoNotSkipEmptySections) const; 395 SkipEmptySectionsValue = DoNotSkipEmptySections) const;
381 396
382 LayoutTableCell* cellAbove(const LayoutTableCell*) const; 397 LayoutTableCell* cellAbove(const LayoutTableCell*) const;
383 LayoutTableCell* cellBelow(const LayoutTableCell*) const; 398 LayoutTableCell* cellBelow(const LayoutTableCell*) const;
384 LayoutTableCell* cellBefore(const LayoutTableCell*) const; 399 LayoutTableCell* cellBefore(const LayoutTableCell*) const;
385 LayoutTableCell* cellAfter(const LayoutTableCell*) const; 400 LayoutTableCell* cellAfter(const LayoutTableCell*) const;
386 401
387 typedef Vector<CollapsedBorderValue> CollapsedBorderValues; 402 typedef Vector<CollapsedBorderValue> CollapsedBorderValues;
388 void invalidateCollapsedBorders(); 403 void invalidateCollapsedBorders();
389 404
390 bool hasSections() const { return m_head || m_foot || m_firstBody; } 405 bool hasSections() const { return header() || footer() || firstBody(); }
391 406
392 void recalcSectionsIfNeeded() const { 407 void recalcSectionsIfNeeded() const {
393 if (m_needsSectionRecalc) 408 if (m_needsSectionRecalc)
394 recalcSections(); 409 recalcSections();
395 } 410 }
396 411
397 static LayoutTable* createAnonymousWithParent(const LayoutObject*); 412 static LayoutTable* createAnonymousWithParent(const LayoutObject*);
398 LayoutBox* createAnonymousBoxWithSameTypeAs( 413 LayoutBox* createAnonymousBoxWithSameTypeAs(
399 const LayoutObject* parent) const override { 414 const LayoutObject* parent) const override {
400 return createAnonymousWithParent(parent); 415 return createAnonymousWithParent(parent);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 if (m_firstBody) 607 if (m_firstBody)
593 return m_firstBody; 608 return m_firstBody;
594 return m_foot; 609 return m_foot;
595 } 610 }
596 611
597 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable()); 612 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTable, isTable());
598 613
599 } // namespace blink 614 } // namespace blink
600 615
601 #endif // LayoutTable_h 616 #endif // LayoutTable_h
OLDNEW
« 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