Changeset 94084 in webkit
- Timestamp:
- Aug 30, 2011 9:57:37 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r94081 r94084 1 2011-08-30 David Hyatt <hyatt@apple.com> 2 3 <rdar://problem/8832814> With large line-height, column break can happen anywhere in the 4 inter-line gap, causing staggered lines. 5 6 https://bugs.webkit.org/show_bug.cgi?id=67202 Handle positive leading when paginating lines. 7 8 Technically we should paginate lines based solely off their line top and line bottom with 9 leading included. However there are two issues with always doing so. The first is that overflow 10 can cause lines to overlap, and the second is that negative leading can cause lines to overlap. 11 12 Since we're incapable of dealing with overlap until we stop clipping column boxes and allow them 13 to have a form of specialized overflow, we still have to at least factor in overflow and ignore 14 negative leading for now. However we can at least honor positive leading when the lines don't 15 overlap. This patch provides basic support for paginating when positive leading is involved. 16 17 Reviewed by Dan Bernstein. 18 19 Added fast/multicol/positive-leading.html. 20 21 * fast/multicol/positive-leading.html: Added. 22 * platform/mac/fast/multicol/positive-leading-expected.png: Added. 23 * platform/mac/fast/multicol/positive-leading-expected.txt: Added. 24 1 25 2011-08-30 Young Han Lee <joybro@company100.net> 2 26 -
trunk/Source/WebCore/ChangeLog
r94083 r94084 1 2011-08-30 David Hyatt <hyatt@apple.com> 2 3 <rdar://problem/8832814> With large line-height, column break can happen anywhere in the 4 inter-line gap, causing staggered lines. 5 6 https://bugs.webkit.org/show_bug.cgi?id=67202 Handle positive leading when paginating lines. 7 8 Technically we should paginate lines based solely off their line top and line bottom with 9 leading included. However there are two issues with always doing so. The first is that overflow 10 can cause lines to overlap, and the second is that negative leading can cause lines to overlap. 11 12 Since we're incapable of dealing with overlap until we stop clipping column boxes and allow them 13 to have a form of specialized overflow, we still have to at least factor in overflow and ignore 14 negative leading for now. However we can at least honor positive leading when the lines don't 15 overlap. This patch provides basic support for paginating when positive leading is involved. 16 17 Reviewed by Dan Bernstein. 18 19 Added fast/multicol/positive-leading.html. 20 21 * rendering/RenderBlock.cpp: 22 (WebCore::RenderBlock::markLinesDirtyInBlockRange): 23 Renamed blockLogicalHeight() to lineBottomWithLeading(). The value is the same. 24 25 (WebCore::RenderBlock::adjustLinePositionForPagination): 26 Grow the top and extent of the line to include our leading when deciding how to paginate 27 the line. 28 29 * rendering/RenderBlockLineLayout.cpp: 30 (WebCore::RenderBlock::computeBlockDirectionPositionsForLine): 31 (WebCore::RenderBlock::layoutRunsAndFloatsInRange): 32 (WebCore::RenderBlock::linkToEndLineIfNeeded): 33 (WebCore::RenderBlock::checkFloatsInCleanLine): 34 (WebCore::RenderBlock::determineStartPosition): 35 (WebCore::RenderBlock::determineEndPosition): 36 (WebCore::RenderBlock::matchedEndLine): 37 Renamed blockLogicalHeight() to lineBottomWithLeading(). The value is the same. 38 39 * rendering/RootInlineBox.cpp: 40 (WebCore::RootInlineBox::RootInlineBox): 41 (WebCore::RootInlineBox::adjustPosition): 42 (WebCore::RootInlineBox::alignBoxesInBlockDirection): 43 * rendering/RootInlineBox.h: 44 (WebCore::RootInlineBox::lineTopWithLeading): 45 (WebCore::RootInlineBox::lineBottomWithLeading): 46 (WebCore::RootInlineBox::setLineTopBottomPositions): 47 Instead of one member variable, blockLogicalHeight(), RootInlineBoxes now know both their top and 48 bottom including leading. These values are obtainable using lineTopWithLeading() and lineBottomWithLeading(). 49 Add these two values to the setLineTopBottomPositions setter and remove setBlockLogicalHeight. 50 51 * rendering/svg/SVGRootInlineBox.cpp: 52 (WebCore::SVGRootInlineBox::layoutRootBox): 53 Renamed blockLogicalHeight() to lineBottomWithLeading(). The value is the same. 54 1 55 2011-08-29 Chris Marrin <cmarrin@apple.com> 2 56 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r93943 r94084 3650 3650 RootInlineBox* lowestDirtyLine = lastRootBox(); 3651 3651 RootInlineBox* afterLowest = lowestDirtyLine; 3652 while (lowestDirtyLine && lowestDirtyLine-> blockLogicalHeight() >= logicalBottom && logicalBottom < numeric_limits<LayoutUnit>::max()) {3652 while (lowestDirtyLine && lowestDirtyLine->lineBottomWithLeading() >= logicalBottom && logicalBottom < numeric_limits<LayoutUnit>::max()) { 3653 3653 afterLowest = lowestDirtyLine; 3654 3654 lowestDirtyLine = lowestDirtyLine->prevRootBox(); 3655 3655 } 3656 3656 3657 while (afterLowest && afterLowest != highest && (afterLowest-> blockLogicalHeight() >= logicalTop || afterLowest->blockLogicalHeight() < 0)) {3657 while (afterLowest && afterLowest != highest && (afterLowest->lineBottomWithLeading() >= logicalTop || afterLowest->lineBottomWithLeading() < 0)) { 3658 3658 afterLowest->markDirty(); 3659 3659 afterLowest = afterLowest->prevRootBox(); … … 6192 6192 // of the first column. 6193 6193 // 6194 // The rendering we would like to see is one where the lineTop is at the top of the column, and any line overflow6194 // The rendering we would like to see is one where the lineTopWithLeading is at the top of the column, and any line overflow 6195 6195 // simply spills out above the top of the column. This effect would match what happens at the top of the first column. 6196 6196 // We can't achieve this rendering, however, until we stop columns from clipping to the column bounds (thus allowing … … 6200 6200 // content that paints in a previous column (and content that paints in the following column). 6201 6201 // 6202 // For now we'll at least honor the lineTopWithLeading when paginating if it is above the logical top overflow. This will 6203 // at least make positive leading work in typical cases. 6204 // 6202 6205 // FIXME: Another problem with simply moving lines is that the available line width may change (because of floats). 6203 6206 // Technically if the location we move the line to has a different line width than our old position, then we need to dirty the … … 6206 6209 LayoutUnit pageLogicalHeight = layoutState->m_pageLogicalHeight; 6207 6210 LayoutRect logicalVisualOverflow = lineBox->logicalVisualOverflowRect(lineBox->lineTop(), lineBox->lineBottom()); 6208 LayoutUnit logicalOffset = logicalVisualOverflow.y();6209 LayoutUnit lineHeight = logicalVisualOverflow.maxY() - logicalOffset;6211 LayoutUnit logicalOffset = min(lineBox->lineTopWithLeading(), logicalVisualOverflow.y()); 6212 LayoutUnit lineHeight = max(lineBox->lineBottomWithLeading(), logicalVisualOverflow.maxY()) - logicalOffset; 6210 6213 if (layoutState->m_columnInfo) 6211 6214 layoutState->m_columnInfo->updateMinimumColumnHeight(lineHeight); -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r93820 r94084 666 666 { 667 667 setLogicalHeight(lineBox->alignBoxesInBlockDirection(logicalHeight(), textBoxDataMap, verticalPositionCache)); 668 lineBox->setBlockLogicalHeight(logicalHeight());669 668 670 669 // Now make sure we place replaced render objects correctly. … … 1079 1078 } 1080 1079 1081 setLogicalHeight(lineBox-> blockLogicalHeight());1080 setLogicalHeight(lineBox->lineBottomWithLeading()); 1082 1081 } 1083 1082 } … … 1146 1145 } 1147 1146 } 1148 setLogicalHeight(lastRootBox()-> blockLogicalHeight());1147 setLogicalHeight(lastRootBox()->lineBottomWithLeading()); 1149 1148 } else { 1150 1149 // Delete all the remaining lines. … … 1170 1169 IntRect logicalVisualOverflow(0, blockLogicalHeight, 1, bottomVisualOverflow - blockLogicalHeight); 1171 1170 trailingFloatsLineBox->setOverflowFromLogicalRects(logicalLayoutOverflow, logicalVisualOverflow, trailingFloatsLineBox->lineTop(), trailingFloatsLineBox->lineBottom()); 1172 trailingFloatsLineBox->setBlockLogicalHeight(logicalHeight());1173 1171 } 1174 1172 … … 1312 1310 floatHeight = min(floatHeight, numeric_limits<int>::max() - floatTop); 1313 1311 line->markDirty(); 1314 markLinesDirtyInBlockRange(line-> blockLogicalHeight(), floatTop + floatHeight, line);1312 markLinesDirtyInBlockRange(line->lineBottomWithLeading(), floatTop + floatHeight, line); 1315 1313 floats[floatIndex].rect.setSize(newSize); 1316 1314 dirtiedByFloat = true; … … 1423 1421 1424 1422 if (last) { 1425 setLogicalHeight(last-> blockLogicalHeight());1423 setLogicalHeight(last->lineBottomWithLeading()); 1426 1424 resolver.setPosition(InlineIterator(this, last->lineBreakObj(), last->lineBreakPos())); 1427 1425 resolver.setStatus(last->lineBreakBidiStatus()); … … 1466 1464 cleanLineStart = InlineIterator(this, prev->lineBreakObj(), prev->lineBreakPos()); 1467 1465 cleanLineBidiStatus = prev->lineBreakBidiStatus(); 1468 layoutState.setEndLineLogicalTop(prev-> blockLogicalHeight());1466 layoutState.setEndLineLogicalTop(prev->lineBottomWithLeading()); 1469 1467 1470 1468 for (RootInlineBox* line = last; line; line = line->nextRootBox()) … … 1492 1490 lastLine = nextLine; 1493 1491 1494 int logicalBottom = lastLine-> blockLogicalHeight() + abs(delta);1492 int logicalBottom = lastLine->lineBottomWithLeading() + abs(delta); 1495 1493 1496 1494 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); … … 1518 1516 // Set our logical top to be the block height of endLine. 1519 1517 if (result) 1520 layoutState.setEndLineLogicalTop(line-> blockLogicalHeight());1518 layoutState.setEndLineLogicalTop(line->lineBottomWithLeading()); 1521 1519 1522 1520 int delta = logicalHeight() - layoutState.endLineLogicalTop(); … … 1529 1527 lastLine = nextLine; 1530 1528 1531 int logicalBottom = lastLine-> blockLogicalHeight() + abs(delta);1529 int logicalBottom = lastLine->lineBottomWithLeading() + abs(delta); 1532 1530 1533 1531 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r91417 r94084 49 49 , m_lineTop(0) 50 50 , m_lineBottom(0) 51 , m_lineTopWithLeading(0) 52 , m_lineBottomWithLeading(0) 51 53 , m_paginationStrut(0) 52 , m_blockLogicalHeight(0)53 54 , m_baselineType(AlphabeticBaseline) 54 55 , m_hasAnnotationsBefore(false) … … 204 205 { 205 206 InlineFlowBox::adjustPosition(dx, dy); 206 int blockDirectionDelta = isHorizontal() ? dy : dx; // The block direction delta will always be integral.207 LayoutUnit blockDirectionDelta = isHorizontal() ? dy : dx; // The block direction delta is a LayoutUnit. 207 208 m_lineTop += blockDirectionDelta; 208 209 m_lineBottom += blockDirectionDelta; 209 m_blockLogicalHeight += blockDirectionDelta; 210 m_lineTopWithLeading += blockDirectionDelta; 211 m_lineBottomWithLeading += blockDirectionDelta; 210 212 } 211 213 … … 259 261 m_hasAnnotationsBefore = hasAnnotationsBefore; 260 262 m_hasAnnotationsAfter = hasAnnotationsAfter; 261 setLineTopBottomPositions(lineTop, lineBottom); 263 264 maxHeight = max<LayoutUnit>(0, maxHeight); // FIXME: Is this really necessary? 265 266 setLineTopBottomPositions(lineTop, lineBottom, heightOfBlock, heightOfBlock + maxHeight); 262 267 263 268 int annotationsAdjustment = beforeAnnotationsAdjustment(); … … 268 273 heightOfBlock += annotationsAdjustment; 269 274 } 270 271 maxHeight = max<LayoutUnit>(0, maxHeight);272 275 273 276 return heightOfBlock + maxHeight; -
trunk/Source/WebCore/rendering/RootInlineBox.h
r93014 r94084 51 51 LayoutUnit lineBottom() const { return m_lineBottom; } 52 52 53 LayoutUnit lineTopWithLeading() const { return m_lineTopWithLeading; } 54 LayoutUnit lineBottomWithLeading() const { return m_lineBottomWithLeading; } 55 53 56 int paginationStrut() const { return m_paginationStrut; } 54 57 void setPaginationStrut(int s) { m_paginationStrut = s; } … … 61 64 62 65 LayoutUnit alignBoxesInBlockDirection(LayoutUnit heightOfBlock, GlyphOverflowAndFallbackFontsMap&, VerticalPositionCache&); 63 void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom )66 void setLineTopBottomPositions(LayoutUnit top, LayoutUnit bottom, LayoutUnit topWithLeading, LayoutUnit bottomWithLeading) 64 67 { 65 68 m_lineTop = top; 66 m_lineBottom = bottom; 69 m_lineBottom = bottom; 70 m_lineTopWithLeading = topWithLeading; 71 m_lineBottomWithLeading = bottomWithLeading; 67 72 } 68 73 … … 75 80 unsigned lineBreakPos() const { return m_lineBreakPos; } 76 81 void setLineBreakPos(unsigned p) { m_lineBreakPos = p; } 77 78 int blockLogicalHeight() const { return m_blockLogicalHeight; }79 void setBlockLogicalHeight(int h) { m_blockLogicalHeight = h; }80 82 81 83 bool endsWithBreak() const { return m_endsWithBreak; } … … 187 189 LayoutUnit m_lineBottom; 188 190 191 LayoutUnit m_lineTopWithLeading; 192 LayoutUnit m_lineBottomWithLeading; 193 189 194 int m_paginationStrut; 190 195 … … 192 197 // good for as long as the line has not been marked dirty. 193 198 OwnPtr<Vector<RenderBox*> > m_floats; 194 195 // The logical height of the block at the end of this line. This is where the next line starts.196 int m_blockLogicalHeight;197 199 198 200 // Whether or not this line uses alphabetic or ideographic baselines by default. -
trunk/Source/WebCore/rendering/svg/SVGRootInlineBox.cpp
r93050 r94084 197 197 setLogicalWidth(widthBlock); 198 198 setLogicalHeight(heightBlock); 199 setBlockLogicalHeight(heightBlock); 200 setLineTopBottomPositions(0, heightBlock); 199 setLineTopBottomPositions(0, heightBlock, 0, heightBlock); 201 200 } 202 201
Note: See TracChangeset
for help on using the changeset viewer.