Changeset 182702 in webkit
- Timestamp:
- Apr 13, 2015, 3:34:45 AM (10 years ago)
- Location:
- releases/WebKitGTK/webkit-2.8/Source/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog
r182701 r182702 1 2015-04-01 Zalan Bujtas <zalan@apple.com> 2 3 Lots of time spent querying table cell borders, when there are none. 4 https://bugs.webkit.org/show_bug.cgi?id=143277 5 6 Reviewed by Simon Fraser. 7 8 This patch speeds up collapsed border queries by using existing collapsed border 9 cache to calculate repaint rects and by introducing a fast path for zero width collapsed borders. 10 11 It reduces the number of calls to recompute collapsed borders from 36 000 to 1 600, while loading a page with a table of 400 rows (1 cell per row). 12 When scrolling the same page all the way down to the bottom, the number of calls to recompute collapsed borders falls from 290 000 to 0. 13 14 Covered by existing tests. 15 16 * rendering/RenderTable.cpp: 17 (WebCore::RenderTable::styleDidChange): This moves invalidation time from RenderTable::layout() to styleDidChange(). 18 (WebCore::RenderTable::invalidateCollapsedBorders): 19 (WebCore::RenderTable::recalcCollapsedBorders): 20 * rendering/RenderTable.h: 21 (WebCore::RenderTable::collapsedBordersAreValid): 22 (WebCore::RenderTable::invalidateCollapsedBorders): Deleted. 23 * rendering/RenderTableCell.cpp: 24 (WebCore::RenderTableCell::RenderTableCell): 25 (WebCore::RenderTableCell::willBeRemovedFromTree): Invalidate caches so that when repaint rect is calculated, we don't end up using stale values. 26 (WebCore::RenderTableCell::styleDidChange): Same as willBeRemovedFromTree. 27 (WebCore::RenderTableCell::collapsedStartBorder): Check if collapsed border is zero -also query cache. 28 (WebCore::RenderTableCell::collapsedEndBorder): 29 (WebCore::RenderTableCell::collapsedBeforeBorder): 30 (WebCore::RenderTableCell::collapsedAfterBorder): 31 (WebCore::RenderTableCell::cachedCollapsedLeftBorder): 32 (WebCore::RenderTableCell::cachedCollapsedRightBorder): 33 (WebCore::RenderTableCell::cachedCollapsedTopBorder): 34 (WebCore::RenderTableCell::cachedCollapsedBottomBorder): 35 (WebCore::RenderTableCell::paintCollapsedBorders): 36 (WebCore::RenderTableCell::cellAtLeft): Deleted. 37 (WebCore::RenderTableCell::cellAtRight): Deleted. 38 (WebCore::RenderTableCell::cellAtTop): Deleted. 39 (WebCore::RenderTableCell::cellAtBottom): Deleted. 40 * rendering/RenderTableCell.h: 41 (WebCore::RenderTableCell::invalidateHasEmptyCollapsedBorders): 42 * rendering/RenderTableCol.cpp: 43 (WebCore::RenderTableCol::styleDidChange): 44 * rendering/RenderTableRow.cpp: 45 (WebCore::RenderTableRow::styleDidChange): 46 (WebCore::RenderTableRow::addChild): 47 * rendering/RenderTableSection.cpp: 48 (WebCore::RenderTableSection::styleDidChange): 49 (WebCore::RenderTableSection::clearCachedCollapsedBorders): This is just an extra safety to invalidate collapsed border cache. This is always 50 called together with RenderTable::invalidateCollapsedBorders() -and that should prevent the RenderCells to use the cache. 51 (WebCore::RenderTableSection::removeCachedCollapsedBorders): 52 (WebCore::RenderTableSection::setCachedCollapsedBorder): 53 (WebCore::RenderTableSection::cachedCollapsedBorder): 54 * rendering/RenderTableSection.h: 55 1 56 2015-02-17 Zalan Bujtas <zalan@apple.com> 2 57 -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.cpp
r182696 r182702 58 58 , m_currentBorder(nullptr) 59 59 , m_collapsedBordersValid(false) 60 , m_collapsedEmptyBorderIsPresent(false) 60 61 , m_hasColElements(false) 61 62 , m_needsSectionRecalc(false) … … 81 82 , m_currentBorder(nullptr) 82 83 , m_collapsedBordersValid(false) 84 , m_collapsedEmptyBorderIsPresent(false) 83 85 , m_hasColElements(false) 84 86 , m_needsSectionRecalc(false) … … 121 123 122 124 // If border was changed, invalidate collapsed borders cache. 123 if ( !needsLayout() &&oldStyle && oldStyle->border() != style().border())125 if (oldStyle && oldStyle->border() != style().border()) 124 126 invalidateCollapsedBorders(); 125 127 } … … 587 589 } 588 590 591 void RenderTable::invalidateCollapsedBorders() 592 { 593 m_collapsedBordersValid = false; 594 m_collapsedBorders.clear(); 595 for (auto& section : childrenOfType<RenderTableSection>(*this)) { 596 section.clearCachedCollapsedBorders(); 597 if (!m_collapsedEmptyBorderIsPresent) 598 continue; 599 for (auto* row = section.firstRow(); row; row = row->nextRow()) { 600 for (auto* cell = row->firstCell(); cell; cell = cell->nextCell()) { 601 ASSERT(cell->table() == this); 602 cell->invalidateHasEmptyCollapsedBorders(); 603 } 604 } 605 } 606 m_collapsedEmptyBorderIsPresent = false; 607 } 608 589 609 // Collect all the unique border values that we want to paint in a sorted list. 590 610 void RenderTable::recalcCollapsedBorders() … … 592 612 if (m_collapsedBordersValid) 593 613 return; 594 m_collapsedBordersValid = true;595 614 m_collapsedBorders.clear(); 596 597 615 for (auto& section : childrenOfType<RenderTableSection>(*this)) { 598 616 for (RenderTableRow* row = section.firstRow(); row; row = row->nextRow()) { … … 604 622 } 605 623 RenderTableCell::sortBorderValues(m_collapsedBorders); 606 } 607 624 m_collapsedBordersValid = true; 625 } 608 626 609 627 void RenderTable::addOverflowFromChildren() -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTable.h
r179627 r182702 243 243 244 244 typedef Vector<CollapsedBorderValue> CollapsedBorderValues; 245 void invalidateCollapsedBorders() 246 { 247 m_collapsedBordersValid = false; 248 m_collapsedBorders.clear(); 249 } 245 bool collapsedBordersAreValid() const { return m_collapsedBordersValid; } 246 void invalidateCollapsedBorders(); 247 void collapsedEmptyBorderIsPresent() { m_collapsedEmptyBorderIsPresent = true; } 250 248 const CollapsedBorderValue* currentBorderValue() const { return m_currentBorder; } 251 249 … … 349 347 const CollapsedBorderValue* m_currentBorder; 350 348 bool m_collapsedBordersValid : 1; 349 bool m_collapsedEmptyBorderIsPresent : 1; 351 350 352 351 mutable bool m_hasColElements : 1; -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.cpp
r182701 r182702 61 61 , m_hasColSpan(false) 62 62 , m_hasRowSpan(false) 63 , m_hasEmptyCollapsedBeforeBorder(false) 64 , m_hasEmptyCollapsedAfterBorder(false) 65 , m_hasEmptyCollapsedStartBorder(false) 66 , m_hasEmptyCollapsedEndBorder(false) 63 67 { 64 68 // We only update the flags when notified of DOM changes in colSpanOrRowSpanChanged() … … 73 77 , m_hasColSpan(false) 74 78 , m_hasRowSpan(false) 79 , m_hasEmptyCollapsedBeforeBorder(false) 80 , m_hasEmptyCollapsedAfterBorder(false) 81 , m_hasEmptyCollapsedStartBorder(false) 82 , m_hasEmptyCollapsedEndBorder(false) 75 83 { 76 84 } … … 79 87 { 80 88 RenderBlockFlow::willBeRemovedFromTree(); 81 82 section()->setNeedsCellRecalc(); 83 section()->removeCachedCollapsedBorders(this); 89 if (!table() || !section()) 90 return; 91 RenderTableSection* section = this->section(); 92 table()->invalidateCollapsedBorders(); 93 section->setNeedsCellRecalc(); 84 94 } 85 95 … … 266 276 layoutBlock(cellWidthChanged()); 267 277 } 268 278 invalidateHasEmptyCollapsedBorders(); 269 279 setCellWidthChanged(false); 270 280 } … … 417 427 418 428 // If border was changed, notify table. 419 if (parent()) { 420 RenderTable* table = this->table(); 421 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout()&& oldStyle && oldStyle->border() != style().border()) 422 table->invalidateCollapsedBorders(); 423 } 429 RenderTable* table = this->table(); 430 if (table && oldStyle && oldStyle->border() != style().border()) 431 table->invalidateCollapsedBorders(); 424 432 } 425 433 … … 508 516 } 509 517 518 static CollapsedBorderValue emptyBorder() 519 { 520 return CollapsedBorderValue(BorderValue(), Color(), BCELL); 521 } 522 510 523 CollapsedBorderValue RenderTableCell::collapsedStartBorder(IncludeBorderColorOrNot includeColor) const 511 524 { 525 if (!table() || !section()) 526 return emptyBorder(); 527 528 if (m_hasEmptyCollapsedStartBorder) 529 return emptyBorder(); 530 531 if (table()->collapsedBordersAreValid()) 532 return section()->cachedCollapsedBorder(*this, CBSStart); 533 512 534 CollapsedBorderValue result = computeCollapsedStartBorder(includeColor); 513 if (includeColor) 514 section()->setCachedCollapsedBorder(this, CBSStart, result); 535 setHasEmptyCollapsedBorder(CBSStart, !result.width()); 536 if (includeColor && !m_hasEmptyCollapsedStartBorder) 537 section()->setCachedCollapsedBorder(*this, CBSStart, result); 515 538 return result; 516 539 } … … 610 633 CollapsedBorderValue RenderTableCell::collapsedEndBorder(IncludeBorderColorOrNot includeColor) const 611 634 { 635 if (!table() || !section()) 636 return emptyBorder(); 637 638 if (m_hasEmptyCollapsedEndBorder) 639 return emptyBorder(); 640 641 if (table()->collapsedBordersAreValid()) 642 return section()->cachedCollapsedBorder(*this, CBSEnd); 643 612 644 CollapsedBorderValue result = computeCollapsedEndBorder(includeColor); 613 if (includeColor) 614 section()->setCachedCollapsedBorder(this, CBSEnd, result); 645 setHasEmptyCollapsedBorder(CBSEnd, !result.width()); 646 if (includeColor && !m_hasEmptyCollapsedEndBorder) 647 section()->setCachedCollapsedBorder(*this, CBSEnd, result); 615 648 return result; 616 649 } … … 712 745 CollapsedBorderValue RenderTableCell::collapsedBeforeBorder(IncludeBorderColorOrNot includeColor) const 713 746 { 747 if (!table() || !section()) 748 return emptyBorder(); 749 750 if (m_hasEmptyCollapsedBeforeBorder) 751 return emptyBorder(); 752 753 if (table()->collapsedBordersAreValid()) 754 return section()->cachedCollapsedBorder(*this, CBSBefore); 755 714 756 CollapsedBorderValue result = computeCollapsedBeforeBorder(includeColor); 715 if (includeColor) 716 section()->setCachedCollapsedBorder(this, CBSBefore, result); 757 setHasEmptyCollapsedBorder(CBSBefore, !result.width()); 758 if (includeColor && !m_hasEmptyCollapsedBeforeBorder) 759 section()->setCachedCollapsedBorder(*this, CBSBefore, result); 717 760 return result; 718 761 } … … 798 841 CollapsedBorderValue RenderTableCell::collapsedAfterBorder(IncludeBorderColorOrNot includeColor) const 799 842 { 843 if (!table() || !section()) 844 return emptyBorder(); 845 846 if (m_hasEmptyCollapsedAfterBorder) 847 return emptyBorder(); 848 849 if (table()->collapsedBordersAreValid()) 850 return section()->cachedCollapsedBorder(*this, CBSAfter); 851 800 852 CollapsedBorderValue result = computeCollapsedAfterBorder(includeColor); 801 if (includeColor) 802 section()->setCachedCollapsedBorder(this, CBSAfter, result); 853 setHasEmptyCollapsedBorder(CBSAfter, !result.width()); 854 if (includeColor && !m_hasEmptyCollapsedAfterBorder) 855 section()->setCachedCollapsedBorder(*this, CBSAfter, result); 803 856 return result; 804 857 } … … 873 926 } 874 927 875 inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle* styleForCellFlow) const 876 { 877 if (styleForCellFlow->isHorizontalWritingMode()) 878 return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); 879 return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); 880 } 881 882 inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle* styleForCellFlow) const 883 { 884 if (styleForCellFlow->isHorizontalWritingMode()) 885 return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); 886 return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); 887 } 888 889 inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle* styleForCellFlow) const 890 { 891 if (styleForCellFlow->isHorizontalWritingMode()) 892 return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSAfter) : section()->cachedCollapsedBorder(this, CBSBefore); 893 return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSStart) : section()->cachedCollapsedBorder(this, CBSEnd); 894 } 895 896 inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle* styleForCellFlow) const 897 { 898 if (styleForCellFlow->isHorizontalWritingMode()) 899 return styleForCellFlow->isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(this, CBSBefore) : section()->cachedCollapsedBorder(this, CBSAfter); 900 return styleForCellFlow->isLeftToRightDirection() ? section()->cachedCollapsedBorder(this, CBSEnd) : section()->cachedCollapsedBorder(this, CBSStart); 901 } 902 903 inline RenderTableCell* RenderTableCell::cellAtLeft(const RenderStyle* styleForCellFlow) const 904 { 905 if (styleForCellFlow->isHorizontalWritingMode()) 906 return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this); 907 return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this); 908 } 909 910 inline RenderTableCell* RenderTableCell::cellAtRight(const RenderStyle* styleForCellFlow) const 911 { 912 if (styleForCellFlow->isHorizontalWritingMode()) 913 return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this); 914 return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this); 915 } 916 917 inline RenderTableCell* RenderTableCell::cellAtTop(const RenderStyle* styleForCellFlow) const 918 { 919 if (styleForCellFlow->isHorizontalWritingMode()) 920 return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellBelow(this) : table()->cellAbove(this); 921 return styleForCellFlow->isLeftToRightDirection() ? table()->cellBefore(this) : table()->cellAfter(this); 922 } 923 924 inline RenderTableCell* RenderTableCell::cellAtBottom(const RenderStyle* styleForCellFlow) const 925 { 926 if (styleForCellFlow->isHorizontalWritingMode()) 927 return styleForCellFlow->isFlippedBlocksWritingMode() ? table()->cellAbove(this) : table()->cellBelow(this); 928 return styleForCellFlow->isLeftToRightDirection() ? table()->cellAfter(this) : table()->cellBefore(this); 928 inline CollapsedBorderValue RenderTableCell::cachedCollapsedLeftBorder(const RenderStyle& styleForCellFlow) const 929 { 930 if (styleForCellFlow.isHorizontalWritingMode()) 931 return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSStart) : section()->cachedCollapsedBorder(*this, CBSEnd); 932 return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSAfter) : section()->cachedCollapsedBorder(*this, CBSBefore); 933 } 934 935 inline CollapsedBorderValue RenderTableCell::cachedCollapsedRightBorder(const RenderStyle& styleForCellFlow) const 936 { 937 if (styleForCellFlow.isHorizontalWritingMode()) 938 return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSEnd) : section()->cachedCollapsedBorder(*this, CBSStart); 939 return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSBefore) : section()->cachedCollapsedBorder(*this, CBSAfter); 940 } 941 942 inline CollapsedBorderValue RenderTableCell::cachedCollapsedTopBorder(const RenderStyle& styleForCellFlow) const 943 { 944 if (styleForCellFlow.isHorizontalWritingMode()) 945 return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSAfter) : section()->cachedCollapsedBorder(*this, CBSBefore); 946 return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSStart) : section()->cachedCollapsedBorder(*this, CBSEnd); 947 } 948 949 inline CollapsedBorderValue RenderTableCell::cachedCollapsedBottomBorder(const RenderStyle& styleForCellFlow) const 950 { 951 if (styleForCellFlow.isHorizontalWritingMode()) 952 return styleForCellFlow.isFlippedBlocksWritingMode() ? section()->cachedCollapsedBorder(*this, CBSBefore) : section()->cachedCollapsedBorder(*this, CBSAfter); 953 return styleForCellFlow.isLeftToRightDirection() ? section()->cachedCollapsedBorder(*this, CBSEnd) : section()->cachedCollapsedBorder(*this, CBSStart); 929 954 } 930 955 … … 1181 1206 1182 1207 const RenderStyle& styleForCellFlow = this->styleForCellFlow(); 1183 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder( &styleForCellFlow);1184 CollapsedBorderValue rightVal = cachedCollapsedRightBorder( &styleForCellFlow);1185 CollapsedBorderValue topVal = cachedCollapsedTopBorder( &styleForCellFlow);1186 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder( &styleForCellFlow);1208 CollapsedBorderValue leftVal = cachedCollapsedLeftBorder(styleForCellFlow); 1209 CollapsedBorderValue rightVal = cachedCollapsedRightBorder(styleForCellFlow); 1210 CollapsedBorderValue topVal = cachedCollapsedTopBorder(styleForCellFlow); 1211 CollapsedBorderValue bottomVal = cachedCollapsedBottomBorder(styleForCellFlow); 1187 1212 1188 1213 // Adjust our x/y/width/height so that we paint the collapsed borders at the correct location. -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCell.h
r182701 r182702 32 32 namespace WebCore { 33 33 34 static const unsigned unsetColumnIndex = 0x1FFFFFFF; 35 static const unsigned maxColumnIndex = 0x1FFFFFFE; // 536,870,910 34 // These is limited by the size of RenderTableCell::m_column bitfield. 35 static const unsigned unsetColumnIndex = 0x1FFFFFF; 36 static const unsigned maxColumnIndex = 0x1FFFFFE; // 33554430 36 37 37 38 enum IncludeBorderColorOrNot { DoNotIncludeBorderColor, IncludeBorderColor }; … … 131 132 virtual LayoutRect clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const override; 132 133 134 void invalidateHasEmptyCollapsedBorders(); 135 void setHasEmptyCollapsedBorder(CollapsedBorderSide, bool empty) const; 136 133 137 protected: 134 138 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; … … 174 178 CollapsedBorderValue collapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; 175 179 176 CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle *) const;177 CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle *) const;178 CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle *) const;179 CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle *) const;180 CollapsedBorderValue cachedCollapsedLeftBorder(const RenderStyle&) const; 181 CollapsedBorderValue cachedCollapsedRightBorder(const RenderStyle&) const; 182 CollapsedBorderValue cachedCollapsedTopBorder(const RenderStyle&) const; 183 CollapsedBorderValue cachedCollapsedBottomBorder(const RenderStyle&) const; 180 184 181 185 CollapsedBorderValue computeCollapsedStartBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; … … 184 188 CollapsedBorderValue computeCollapsedAfterBorder(IncludeBorderColorOrNot = IncludeBorderColor) const; 185 189 186 RenderTableCell* cellAtLeft(const RenderStyle*) const;187 RenderTableCell* cellAtRight(const RenderStyle*) const;188 RenderTableCell* cellAtTop(const RenderStyle*) const;189 RenderTableCell* cellAtBottom(const RenderStyle*) const;190 191 190 Length logicalWidthFromColumns(RenderTableCol* firstColForThisCell, Length widthFromStyle) const; 192 191 … … 200 199 201 200 // Note MSVC will only pack members if they have identical types, hence we use unsigned instead of bool here. 202 unsigned m_column : 2 9;201 unsigned m_column : 25; 203 202 unsigned m_cellWidthChanged : 1; 204 203 unsigned m_hasColSpan: 1; 205 204 unsigned m_hasRowSpan: 1; 205 mutable unsigned m_hasEmptyCollapsedBeforeBorder: 1; 206 mutable unsigned m_hasEmptyCollapsedAfterBorder: 1; 207 mutable unsigned m_hasEmptyCollapsedStartBorder: 1; 208 mutable unsigned m_hasEmptyCollapsedEndBorder: 1; 206 209 int m_intrinsicPaddingBefore { 0 }; 207 210 int m_intrinsicPaddingAfter { 0 }; … … 338 341 } 339 342 343 inline void RenderTableCell::setHasEmptyCollapsedBorder(CollapsedBorderSide side, bool empty) const 344 { 345 switch (side) { 346 case CBSAfter: { 347 m_hasEmptyCollapsedAfterBorder = empty; 348 break; 349 } 350 case CBSBefore: { 351 m_hasEmptyCollapsedBeforeBorder = empty; 352 break; 353 } 354 case CBSStart: { 355 m_hasEmptyCollapsedStartBorder = empty; 356 break; 357 } 358 case CBSEnd: { 359 m_hasEmptyCollapsedEndBorder = empty; 360 break; 361 } 362 } 363 if (empty) 364 table()->collapsedEmptyBorderIsPresent(); 365 } 366 367 inline void RenderTableCell::invalidateHasEmptyCollapsedBorders() 368 { 369 m_hasEmptyCollapsedBeforeBorder = false; 370 m_hasEmptyCollapsedAfterBorder = false; 371 m_hasEmptyCollapsedStartBorder = false; 372 m_hasEmptyCollapsedEndBorder = false; 373 } 374 340 375 } // namespace WebCore 341 376 -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableCol.cpp
r182701 r182702 49 49 { 50 50 RenderBox::styleDidChange(diff, oldStyle); 51 51 RenderTable* table = this->table(); 52 if (!table) 53 return; 52 54 // If border was changed, notify table. 53 if (parent()) { 54 RenderTable* table = this->table(); 55 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() && oldStyle && oldStyle->border() != style().border()) 56 table->invalidateCollapsedBorders(); 57 else if (oldStyle->width() != style().width()) { 58 table->recalcSectionsIfNeeded(); 59 for (auto& section : childrenOfType<RenderTableSection>(*table)) { 60 unsigned nEffCols = table->numEffCols(); 61 for (unsigned j = 0; j < nEffCols; j++) { 62 unsigned rowCount = section.numRows(); 63 for (unsigned i = 0; i < rowCount; i++) { 64 RenderTableCell* cell = section.primaryCellAt(i, j); 65 if (!cell) 66 continue; 67 cell->setPreferredLogicalWidthsDirty(true); 68 } 55 if (oldStyle && oldStyle->border() != style().border()) 56 table->invalidateCollapsedBorders(); 57 else if (oldStyle->width() != style().width()) { 58 table->recalcSectionsIfNeeded(); 59 for (auto& section : childrenOfType<RenderTableSection>(*table)) { 60 unsigned nEffCols = table->numEffCols(); 61 for (unsigned j = 0; j < nEffCols; j++) { 62 unsigned rowCount = section.numRows(); 63 for (unsigned i = 0; i < rowCount; i++) { 64 RenderTableCell* cell = section.primaryCellAt(i, j); 65 if (!cell) 66 continue; 67 cell->setPreferredLogicalWidthsDirty(true); 69 68 } 70 69 } -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableRow.cpp
r180190 r182702 80 80 // If border was changed, notify table. 81 81 if (RenderTable* table = this->table()) { 82 if ( !table->selfNeedsLayout() && !table->normalChildNeedsLayout() &&oldStyle && oldStyle->border() != style().border())82 if (oldStyle && oldStyle->border() != style().border()) 83 83 table->invalidateCollapsedBorders(); 84 84 85 85 if (oldStyle && diff == StyleDifferenceLayout && needsLayout() && table->collapseBorders() && borderWidthChanged(oldStyle, &style())) { 86 86 // If the border width changes on a row, we need to make sure the cells in the row know to lay out again. … … 155 155 if (beforeChild || nextRow()) 156 156 section()->setNeedsCellRecalc(); 157 if (RenderTable* table = this->table()) 158 table->invalidateCollapsedBorders(); 157 159 } 158 160 -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.cpp
r182701 r182702 106 106 // If border was changed, notify table. 107 107 RenderTable* table = this->table(); 108 if (table && !table->selfNeedsLayout() && !table->normalChildNeedsLayout() &&oldStyle && oldStyle->border() != style().border())108 if (table && oldStyle && oldStyle->border() != style().border()) 109 109 table->invalidateCollapsedBorders(); 110 110 } … … 1547 1547 } 1548 1548 1549 void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell* cell) 1549 void RenderTableSection::clearCachedCollapsedBorders() 1550 { 1551 if (!table()->collapseBorders()) 1552 return; 1553 m_cellsCollapsedBorders.clear(); 1554 } 1555 1556 void RenderTableSection::removeCachedCollapsedBorders(const RenderTableCell& cell) 1550 1557 { 1551 1558 if (!table()->collapseBorders()) … … 1553 1560 1554 1561 for (int side = CBSBefore; side <= CBSEnd; ++side) 1555 m_cellsCollapsedBorders.remove(std::make_pair( cell, side));1556 } 1557 1558 void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell *cell, CollapsedBorderSide side, CollapsedBorderValue border)1562 m_cellsCollapsedBorders.remove(std::make_pair(&cell, side)); 1563 } 1564 1565 void RenderTableSection::setCachedCollapsedBorder(const RenderTableCell& cell, CollapsedBorderSide side, CollapsedBorderValue border) 1559 1566 { 1560 1567 ASSERT(table()->collapseBorders()); 1561 m_cellsCollapsedBorders.set(std::make_pair(cell, side), border); 1562 } 1563 1564 CollapsedBorderValue& RenderTableSection::cachedCollapsedBorder(const RenderTableCell* cell, CollapsedBorderSide side) 1565 { 1566 ASSERT(table()->collapseBorders()); 1567 HashMap<std::pair<const RenderTableCell*, int>, CollapsedBorderValue>::iterator it = m_cellsCollapsedBorders.find(std::make_pair(cell, side)); 1568 ASSERT(it != m_cellsCollapsedBorders.end()); 1568 ASSERT(border.width()); 1569 m_cellsCollapsedBorders.set(std::make_pair(&cell, side), border); 1570 } 1571 1572 CollapsedBorderValue RenderTableSection::cachedCollapsedBorder(const RenderTableCell& cell, CollapsedBorderSide side) 1573 { 1574 ASSERT(table()->collapseBorders() && table()->collapsedBordersAreValid()); 1575 auto it = m_cellsCollapsedBorders.find(std::make_pair(&cell, side)); 1576 // Only non-empty collapsed borders are in the hashmap. 1577 if (it == m_cellsCollapsedBorders.end()) 1578 return CollapsedBorderValue(BorderValue(), Color(), BCELL); 1569 1579 return it->value; 1570 1580 } -
releases/WebKitGTK/webkit-2.8/Source/WebCore/rendering/RenderTableSection.h
r182701 r182702 135 135 void rowLogicalHeightChanged(unsigned rowIndex); 136 136 137 void removeCachedCollapsedBorders(const RenderTableCell*); 138 void setCachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide, CollapsedBorderValue); 139 CollapsedBorderValue& cachedCollapsedBorder(const RenderTableCell*, CollapsedBorderSide); 137 void clearCachedCollapsedBorders(); 138 void removeCachedCollapsedBorders(const RenderTableCell&); 139 void setCachedCollapsedBorder(const RenderTableCell&, CollapsedBorderSide, CollapsedBorderValue); 140 CollapsedBorderValue cachedCollapsedBorder(const RenderTableCell&, CollapsedBorderSide); 140 141 141 142 // distributeExtraLogicalHeightToRows methods return the *consumed* extra logical height.
Note:
See TracChangeset
for help on using the changeset viewer.