Changeset 50869 in webkit
- Timestamp:
- Nov 12, 2009 12:15:48 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r50868 r50869 1 2009-11-12 Yuta Kitamura <yutak@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Prevent text inside a multi-column block from being split into columns. 6 7 If the tentative height of a multi-column block was too small, we need to 8 expand the block height and try to layout again, in order to prevent text 9 from being split into different columns. 10 11 CSS Multicolumn text is split awkwardly 12 https://bugs.webkit.org/show_bug.cgi?id=22249 13 14 * fast/multicol/single-line.html: Added. 15 * fast/multicol/single-line-expected.checksum: Added. 16 * fast/multicol/single-line-expected.png: Added. 17 * fast/multicol/single-line-expected.txt: Added. 18 1 19 2009-11-11 Kent Tamura <tkent@chromium.org> 2 20 -
trunk/WebCore/ChangeLog
r50868 r50869 1 2009-11-12 Yuta Kitamura <yutak@chromium.org> 2 3 Reviewed by Eric Seidel. 4 5 Prevent text inside a multi-column block from being split into columns. 6 7 If the tentative height of a multi-column block was too small, we need to 8 expand the block height and try to layout again, in order to prevent text 9 from being split into different columns. 10 11 CSS Multicolumn text is split awkwardly 12 https://bugs.webkit.org/show_bug.cgi?id=22249 13 14 Test: fast/multicol/single-line.html 15 16 * rendering/RenderBlock.cpp: 17 (WebCore::RenderBlock::layoutColumns): 18 * rendering/RenderBlock.h: 19 * rendering/RenderLineBoxList.cpp: 20 (WebCore::RenderLineBoxList::paint): 21 * rendering/RenderView.h: 22 (WebCore::RenderView::setTruncatedAt): 23 (WebCore::RenderView::setMinimumColumnHeight): 24 (WebCore::RenderView::minimumColumnHeight): 25 1 26 2009-11-11 Kent Tamura <tkent@chromium.org> 2 27 -
trunk/WebCore/rendering/RenderBlock.cpp
r50760 r50869 3618 3618 } 3619 3619 3620 int RenderBlock::layoutColumns(int endOfContent )3620 int RenderBlock::layoutColumns(int endOfContent, int requestedColumnHeight) 3621 3621 { 3622 3622 // Don't do anything if we have no columns … … 3631 3631 bool computeIntrinsicHeight = (endOfContent == -1); 3632 3632 3633 // Fill the columns in to the available height. Attempt to balance the height of the columns 3634 int availableHeight = contentHeight(); 3635 int colHeight = computeIntrinsicHeight ? availableHeight / desiredColumnCount : availableHeight; 3636 3633 // Fill the columns in to the available height. Attempt to balance the height of the columns. 3637 3634 // Add in half our line-height to help with best-guess initial balancing. 3638 3635 int columnSlop = lineHeight(false) / 2; 3639 3636 int remainingSlopSpace = columnSlop * desiredColumnCount; 3640 3641 if (computeIntrinsicHeight) 3642 colHeight += columnSlop; 3643 3637 int availableHeight = contentHeight(); 3638 int colHeight; 3639 if (computeIntrinsicHeight && requestedColumnHeight >= 0) 3640 colHeight = requestedColumnHeight; 3641 else if (computeIntrinsicHeight) 3642 colHeight = availableHeight / desiredColumnCount + columnSlop; 3643 else 3644 colHeight = availableHeight; 3645 int originalColHeight = colHeight; 3646 3644 3647 int colGap = columnGap(); 3645 3648 … … 3657 3660 unsigned colCount = desiredColumnCount; 3658 3661 int maxColBottom = borderTop() + paddingTop(); 3659 int contentBottom = top + availableHeight; 3662 int contentBottom = top + availableHeight; 3663 int minimumColumnHeight = -1; 3660 3664 for (unsigned i = 0; i < colCount; i++) { 3661 3665 // If we aren't constrained, then the last column can just get all the remaining space. … … 3676 3680 paintObject(paintInfo, 0, 0); 3677 3681 setHasColumns(true); 3682 3683 if (computeIntrinsicHeight && v->minimumColumnHeight() > originalColHeight) { 3684 // The initial column height was too small to contain one line of text. 3685 minimumColumnHeight = max(minimumColumnHeight, v->minimumColumnHeight()); 3686 } 3678 3687 3679 3688 int adjustedBottom = v->bestTruncatedAt(); … … 3711 3720 if (currY < endOfContent && i == colCount - 1 && (computeIntrinsicHeight || contentHeight())) 3712 3721 colCount++; 3722 } 3723 3724 if (minimumColumnHeight >= 0) { 3725 // If originalColHeight was too small, we need to try to layout again. 3726 return layoutColumns(endOfContent, minimumColumnHeight); 3713 3727 } 3714 3728 -
trunk/WebCore/rendering/RenderBlock.h
r50397 r50869 369 369 370 370 void calcColumnWidth(); 371 int layoutColumns(int endOfContent = -1 );371 int layoutColumns(int endOfContent = -1, int requestedColumnHeight = -1); 372 372 373 373 bool expandsToEncloseOverhangingFloats() const; -
trunk/WebCore/rendering/RenderLineBoxList.cpp
r47590 r50869 200 200 h = bottom - top; 201 201 yPos = ty + top; 202 v->setMinimumColumnHeight(h); 202 203 if (yPos < info.rect.bottom() && yPos + h > info.rect.y()) 203 204 curr->paint(info, tx, ty); -
trunk/WebCore/rendering/RenderView.h
r50583 r50869 76 76 void setPrintImages(bool enable) { m_printImages = enable; } 77 77 bool printImages() const { return m_printImages; } 78 void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_ forcedPageBreak = false; }78 void setTruncatedAt(int y) { m_truncatedAt = y; m_bestTruncatedAt = m_truncatorWidth = 0; m_minimumColumnHeight = 0; m_forcedPageBreak = false; } 79 79 void setBestTruncatedAt(int y, RenderBoxModelObject* forRenderer, bool forcedBreak = false); 80 void setMinimumColumnHeight(int height) { m_minimumColumnHeight = height; } 80 81 int bestTruncatedAt() const { return m_bestTruncatedAt; } 82 int minimumColumnHeight() const { return m_minimumColumnHeight; } 81 83 82 84 int truncatedAt() const { return m_truncatedAt; } … … 196 198 int m_bestTruncatedAt; 197 199 int m_truncatorWidth; 200 int m_minimumColumnHeight; 198 201 bool m_forcedPageBreak; 199 202 LayoutState* m_layoutState;
Note: See TracChangeset
for help on using the changeset viewer.