https://bugs.webkit.org/show_bug.cgi?id=38402, paginate columns at layout time rather...
authorhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Sep 2010 20:20:02 +0000 (20:20 +0000)
committerhyatt@apple.com <hyatt@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Sep 2010 20:20:02 +0000 (20:20 +0000)
commit9466a2c5bced6ff086be5b8bd1bd7cacf7df3f39
treefd13172748bf34938df8086722af58f8e690d851
parent77a937e6421876f532fe8ad7b0f14413e089ec87
https://bugs.webkit.org/show_bug.cgi?id=38402, paginate columns at layout time rather than at paint time.

Reviewed by Darin Adler.

WebCore:

This patch adds support for column breaking at layout time rather than at paint time.  New variables have been
added to LayoutState and to ColumnInfo to track column information while laying out.

The basic idea behind this patch is to retain the columns' paint-time hackery of transforming one long vertical strip
into multiple columns.  Now, however, layout is aware of the columns and will move objects up and down vertically in order
to ensure they don't intersect a break.

Many new tests added in fast/multicol and new results added for existing fast/multicol tests.

* rendering/ColumnInfo.h:
(WebCore::ColumnInfo::ColumnInfo):
(WebCore::ColumnInfo::columnCount):
(WebCore::ColumnInfo::columnHeight):
(WebCore::ColumnInfo::setColumnCountAndHeight):
(WebCore::ColumnInfo::setColumnHeight):
(WebCore::ColumnInfo::updateMinimumColumnHeight):
(WebCore::ColumnInfo::minimumColumnHeight):
(WebCore::ColumnInfo::forcedBreaks):
(WebCore::ColumnInfo::forcedBreakOffset):
(WebCore::ColumnInfo::maximumDistanceBetweenForcedBreaks):
(WebCore::ColumnInfo::clearForcedBreaks):
(WebCore::ColumnInfo::addForcedBreak):
* rendering/LayoutState.cpp:
(WebCore::LayoutState::LayoutState):
(WebCore::LayoutState::clearPaginationInformation):
(WebCore::LayoutState::pageY):
(WebCore::LayoutState::addForcedColumnBreak):
* rendering/LayoutState.h:
(WebCore::LayoutState::LayoutState):
(WebCore::LayoutState::paginatingColumns):
(WebCore::LayoutState::paginated):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::RenderBlock):
(WebCore::RenderBlock::~RenderBlock):
(WebCore::RenderBlock::layoutBlock):
(WebCore::RenderBlock::collapseMargins):
(WebCore::RenderBlock::estimateVerticalPosition):
(WebCore::RenderBlock::layoutBlockChild):
(WebCore::RenderBlock::layoutPositionedObjects):
(WebCore::RenderBlock::paintColumnRules):
(WebCore::RenderBlock::paintColumnContents):
(WebCore::RenderBlock::paintChildren):
(WebCore::RenderBlock::insertFloatingObject):
(WebCore::RenderBlock::removeFloatingObjects):
(WebCore::RenderBlock::positionNewFloats):
(WebCore::RenderBlock::positionNewFloatOnLine):
(WebCore::RenderBlock::lowestPosition):
(WebCore::RenderBlock::rightmostPosition):
(WebCore::RenderBlock::leftmostPosition):
(WebCore::RenderBlock::markAllDescendantsWithFloatsForLayout):
(WebCore::RenderBlock::markDescendantBlocksAndLinesForLayout):
(WebCore::RenderBlock::hitTestColumns):
(WebCore::RenderBlock::setDesiredColumnCountAndWidth):
(WebCore::RenderBlock::columnCount):
(WebCore::RenderBlock::columnRectAt):
(WebCore::RenderBlock::layoutColumns):
(WebCore::RenderBlock::adjustPointToColumnContents):
(WebCore::RenderBlock::adjustRectForColumns):
(WebCore::RenderBlock::adjustForColumns):
(WebCore::RenderBlock::setMaxTopMargins):
(WebCore::RenderBlock::setMaxBottomMargins):
(WebCore::RenderBlock::setPaginationStrut):
(WebCore::RenderBlock::setPageY):
(WebCore::RenderBlock::nextPageTop):
(WebCore::inNormalFlow):
(WebCore::RenderBlock::applyBeforeBreak):
(WebCore::RenderBlock::applyAfterBreak):
(WebCore::RenderBlock::adjustForUnsplittableChild):
(WebCore::RenderBlock::adjustLinePositionForPagination):
* rendering/RenderBlock.h:
(WebCore::RenderBlock::paginationStrut):
(WebCore::RenderBlock::pageY):
(WebCore::RenderBlock::maxTopPosMargin):
(WebCore::RenderBlock::maxTopNegMargin):
(WebCore::RenderBlock::maxBottomPosMargin):
(WebCore::RenderBlock::maxBottomNegMargin):
(WebCore::RenderBlock::initMaxMarginValues):
(WebCore::RenderBlock::FloatingObject::FloatingObject):
(WebCore::RenderBlock::FloatingObject::type):
(WebCore::RenderBlock::RenderBlockRareData::RenderBlockRareData):
* rendering/RenderBlockLineLayout.cpp:
(WebCore::RenderBlock::layoutInlineChildren):
(WebCore::RenderBlock::determineStartPosition):
(WebCore::RenderBlock::skipLeadingWhitespace):
(WebCore::RenderBlock::findNextLineBreak):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::mapLocalToContainer):
(WebCore::RenderBox::computeRectForRepaint):
(WebCore::RenderBox::markDescendantBlocksAndLinesForLayout):
* rendering/RenderBox.h:
* rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::layoutBlock):
(WebCore::RenderFlexibleBox::layoutHorizontalBox):
(WebCore::RenderFlexibleBox::layoutVerticalBox):
* rendering/RenderFlexibleBox.h:
* rendering/RenderInline.cpp:
(WebCore::RenderInline::computeRectForRepaint):
(WebCore::RenderInline::mapLocalToContainer):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updatePagination):
(WebCore::RenderLayer::paintChildLayerIntoColumns):
(WebCore::RenderLayer::hitTestChildLayerColumns):
* rendering/RenderLineBoxList.cpp:
(WebCore::RenderLineBoxList::paint):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::RenderTable):
(WebCore::RenderTable::layout):
* rendering/RenderTable.h:
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::layout):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layoutRows):
* rendering/RenderView.cpp:
(WebCore::RenderView::RenderView):
(WebCore::RenderView::pushLayoutState):
* rendering/RenderView.h:
(WebCore::RenderView::setTruncatedAt):
(WebCore::RenderView::pushLayoutState):
(WebCore::RenderView::popLayoutState):
(WebCore::LayoutStateMaintainer::LayoutStateMaintainer):
(WebCore::LayoutStateMaintainer::push):
* rendering/RootInlineBox.h:
(WebCore::RootInlineBox::RootInlineBox):
(WebCore::RootInlineBox::paginationStrut):
(WebCore::RootInlineBox::setPaginationStrut):

LayoutTests:

Add many new multicol layout tests that demonstrate new pagination features.

* fast/multicol/border-padding-pagination.html: Added.
* fast/multicol/client-rects-expected.checksum:
* fast/multicol/client-rects-expected.png:
* fast/multicol/client-rects-expected.txt:
* fast/multicol/column-break-with-balancing.html: Added.
* fast/multicol/float-paginate-complex.html: Added.
* fast/multicol/float-paginate.html:
* fast/multicol/float-truncation.html:
* fast/multicol/margin-collapse.html: Added.
* fast/multicol/max-height-columns-block.html: Added.
* fast/multicol/positioned-split.html: Added.
* fast/multicol/shadow-breaking.html: Added.
* fast/multicol/single-line-expected.checksum:
* fast/multicol/single-line-expected.png:
* fast/multicol/table-margin-collapse.html: Added.
* fast/multicol/table-vertical-align.html: Added.
* fast/multicol/unsplittable-inline-block.html: Added.
* platform/mac/fast/multicol/border-padding-pagination-expected.checksum: Added.
* platform/mac/fast/multicol/border-padding-pagination-expected.png: Added.
* platform/mac/fast/multicol/border-padding-pagination-expected.txt: Added.
* platform/mac/fast/multicol/column-break-with-balancing-expected.checksum: Added.
* platform/mac/fast/multicol/column-break-with-balancing-expected.png: Added.
* platform/mac/fast/multicol/column-break-with-balancing-expected.txt: Added.
* platform/mac/fast/multicol/column-count-with-rules-expected.checksum: Added.
* platform/mac/fast/multicol/column-count-with-rules-expected.png: Added.
* platform/mac/fast/multicol/column-count-with-rules-expected.txt:
* platform/mac/fast/multicol/column-rules-expected.checksum:
* platform/mac/fast/multicol/column-rules-expected.png:
* platform/mac/fast/multicol/column-rules-expected.txt:
* platform/mac/fast/multicol/column-rules-stacking-expected.checksum:
* platform/mac/fast/multicol/column-rules-stacking-expected.png:
* platform/mac/fast/multicol/columns-shorthand-parsing-expected.checksum:
* platform/mac/fast/multicol/columns-shorthand-parsing-expected.png:
* platform/mac/fast/multicol/float-avoidance-expected.checksum:
* platform/mac/fast/multicol/float-avoidance-expected.png:
* platform/mac/fast/multicol/float-avoidance-expected.txt:
* platform/mac/fast/multicol/float-multicol-expected.checksum:
* platform/mac/fast/multicol/float-multicol-expected.png:
* platform/mac/fast/multicol/float-multicol-expected.txt:
* platform/mac/fast/multicol/float-paginate-complex-expected.checksum: Added.
* platform/mac/fast/multicol/float-paginate-complex-expected.png: Added.
* platform/mac/fast/multicol/float-paginate-complex-expected.txt: Added.
* platform/mac/fast/multicol/float-paginate-expected.txt:
* platform/mac/fast/multicol/layers-in-multicol-expected.checksum:
* platform/mac/fast/multicol/layers-in-multicol-expected.png:
* platform/mac/fast/multicol/layers-in-multicol-expected.txt:
* platform/mac/fast/multicol/margin-collapse-expected.checksum: Added.
* platform/mac/fast/multicol/margin-collapse-expected.png: Added.
* platform/mac/fast/multicol/margin-collapse-expected.txt: Added.
* platform/mac/fast/multicol/max-height-columns-block-expected.checksum: Added.
* platform/mac/fast/multicol/max-height-columns-block-expected.png: Added.
* platform/mac/fast/multicol/max-height-columns-block-expected.txt: Added.
* platform/mac/fast/multicol/nested-columns-expected.checksum:
* platform/mac/fast/multicol/nested-columns-expected.png:
* platform/mac/fast/multicol/nested-columns-expected.txt:
* platform/mac/fast/multicol/paginate-block-replaced-expected.txt:
* platform/mac/fast/multicol/positioned-split-expected.checksum: Added.
* platform/mac/fast/multicol/positioned-split-expected.png: Added.
* platform/mac/fast/multicol/positioned-split-expected.txt: Added.
* platform/mac/fast/multicol/positioned-with-constrained-height-expected.checksum:
* platform/mac/fast/multicol/positioned-with-constrained-height-expected.png:
* platform/mac/fast/multicol/positioned-with-constrained-height-expected.txt:
* platform/mac/fast/multicol/shadow-breaking-expected.checksum: Added.
* platform/mac/fast/multicol/shadow-breaking-expected.png: Added.
* platform/mac/fast/multicol/shadow-breaking-expected.txt: Added.
* platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.checksum:
* platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.png:
* platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.txt:
* platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.checksum:
* platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.png:
* platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.txt:
* platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.checksum:
* platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png:
* platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.txt:
* platform/mac/fast/multicol/span/span-as-immediate-columns-child-expected.txt:
* platform/mac/fast/multicol/span/span-as-immediate-columns-child-removal-expected.txt:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.checksum:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.png:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.txt:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.checksum:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.png:
* platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.txt:
* platform/mac/fast/multicol/table-margin-collapse-expected.checksum: Added.
* platform/mac/fast/multicol/table-margin-collapse-expected.png: Added.
* platform/mac/fast/multicol/table-margin-collapse-expected.txt: Added.
* platform/mac/fast/multicol/table-vertical-align-expected.checksum: Added.
* platform/mac/fast/multicol/table-vertical-align-expected.png: Added.
* platform/mac/fast/multicol/table-vertical-align-expected.txt: Added.
* platform/mac/fast/multicol/unsplittable-inline-block-expected.checksum: Added.
* platform/mac/fast/multicol/unsplittable-inline-block-expected.png: Added.
* platform/mac/fast/multicol/unsplittable-inline-block-expected.txt: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@67660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
116 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/dom/Element/getBoundingClientRect-expected.txt
LayoutTests/fast/dom/Element/getBoundingClientRect.html
LayoutTests/fast/multicol/border-padding-pagination.html [new file with mode: 0644]
LayoutTests/fast/multicol/client-rects-expected.checksum
LayoutTests/fast/multicol/client-rects-expected.png
LayoutTests/fast/multicol/client-rects-expected.txt
LayoutTests/fast/multicol/column-break-with-balancing.html [new file with mode: 0644]
LayoutTests/fast/multicol/float-paginate-complex.html [new file with mode: 0644]
LayoutTests/fast/multicol/float-paginate.html
LayoutTests/fast/multicol/float-truncation.html
LayoutTests/fast/multicol/margin-collapse.html [new file with mode: 0644]
LayoutTests/fast/multicol/max-height-columns-block.html [new file with mode: 0644]
LayoutTests/fast/multicol/positioned-split.html [new file with mode: 0644]
LayoutTests/fast/multicol/shadow-breaking.html [new file with mode: 0644]
LayoutTests/fast/multicol/single-line-expected.checksum
LayoutTests/fast/multicol/single-line-expected.png
LayoutTests/fast/multicol/table-margin-collapse.html [new file with mode: 0644]
LayoutTests/fast/multicol/table-vertical-align.html [new file with mode: 0644]
LayoutTests/fast/multicol/unsplittable-inline-block.html [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/border-padding-pagination-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/border-padding-pagination-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/border-padding-pagination-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-break-with-balancing-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-break-with-balancing-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-break-with-balancing-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-count-with-rules-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-count-with-rules-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/column-count-with-rules-expected.txt
LayoutTests/platform/mac/fast/multicol/column-rules-expected.checksum
LayoutTests/platform/mac/fast/multicol/column-rules-expected.png
LayoutTests/platform/mac/fast/multicol/column-rules-expected.txt
LayoutTests/platform/mac/fast/multicol/column-rules-stacking-expected.checksum
LayoutTests/platform/mac/fast/multicol/column-rules-stacking-expected.png
LayoutTests/platform/mac/fast/multicol/columns-shorthand-parsing-expected.checksum
LayoutTests/platform/mac/fast/multicol/columns-shorthand-parsing-expected.png
LayoutTests/platform/mac/fast/multicol/float-avoidance-expected.checksum
LayoutTests/platform/mac/fast/multicol/float-avoidance-expected.png
LayoutTests/platform/mac/fast/multicol/float-avoidance-expected.txt
LayoutTests/platform/mac/fast/multicol/float-multicol-expected.checksum
LayoutTests/platform/mac/fast/multicol/float-multicol-expected.png
LayoutTests/platform/mac/fast/multicol/float-multicol-expected.txt
LayoutTests/platform/mac/fast/multicol/float-paginate-complex-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/float-paginate-complex-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/float-paginate-complex-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/float-paginate-expected.txt
LayoutTests/platform/mac/fast/multicol/layers-in-multicol-expected.checksum
LayoutTests/platform/mac/fast/multicol/layers-in-multicol-expected.png
LayoutTests/platform/mac/fast/multicol/layers-in-multicol-expected.txt
LayoutTests/platform/mac/fast/multicol/margin-collapse-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/margin-collapse-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/margin-collapse-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/max-height-columns-block-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/max-height-columns-block-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/max-height-columns-block-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/nested-columns-expected.checksum
LayoutTests/platform/mac/fast/multicol/nested-columns-expected.png
LayoutTests/platform/mac/fast/multicol/nested-columns-expected.txt
LayoutTests/platform/mac/fast/multicol/paginate-block-replaced-expected.txt
LayoutTests/platform/mac/fast/multicol/positioned-split-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/positioned-split-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/positioned-split-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/positioned-with-constrained-height-expected.checksum
LayoutTests/platform/mac/fast/multicol/positioned-with-constrained-height-expected.png
LayoutTests/platform/mac/fast/multicol/positioned-with-constrained-height-expected.txt
LayoutTests/platform/mac/fast/multicol/shadow-breaking-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/shadow-breaking-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/shadow-breaking-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.checksum
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.png
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-generated-content-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.checksum
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.png
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-child-property-removal-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.checksum
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.png
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-dynamic-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-immediate-columns-child-removal-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.checksum
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.png
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-dynamic-expected.txt
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.checksum
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.png
LayoutTests/platform/mac/fast/multicol/span/span-as-nested-columns-child-expected.txt
LayoutTests/platform/mac/fast/multicol/table-margin-collapse-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/table-margin-collapse-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/table-margin-collapse-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/table-vertical-align-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/table-vertical-align-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/table-vertical-align-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/unsplittable-inline-block-expected.checksum [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/unsplittable-inline-block-expected.png [new file with mode: 0644]
LayoutTests/platform/mac/fast/multicol/unsplittable-inline-block-expected.txt [new file with mode: 0644]
LayoutTests/platform/mac/fast/repaint/multicol-repaint-expected.txt
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/rendering/ColumnInfo.h
WebCore/rendering/LayoutState.cpp
WebCore/rendering/LayoutState.h
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderBlock.h
WebCore/rendering/RenderBlockLineLayout.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RenderBox.h
WebCore/rendering/RenderFlexibleBox.cpp
WebCore/rendering/RenderFlexibleBox.h
WebCore/rendering/RenderInline.cpp
WebCore/rendering/RenderLayer.cpp
WebCore/rendering/RenderLineBoxList.cpp
WebCore/rendering/RenderTable.cpp
WebCore/rendering/RenderTableRow.cpp
WebCore/rendering/RenderTableSection.cpp
WebCore/rendering/RenderView.cpp
WebCore/rendering/RenderView.h
WebCore/rendering/RootInlineBox.h