Changeset 191195 in webkit
- Timestamp:
- Oct 16, 2015 12:53:04 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r191192 r191195 1 2015-10-16 Zalan Bujtas <zalan@apple.com> 2 3 First line box in paragraph using initial-letter overflows. 4 https://bugs.webkit.org/show_bug.cgi?id=147977 5 <rdar://problem/22901553> 6 7 Reviewed by David Hyatt. 8 9 When initial-letter float is present, we should shrink the first 10 line even if it's not intersected with the block's current height. 11 This is because of the sunken behaviour of initial-letter. 12 13 * fast/css-generated-content/initial-letter-first-line-wrapping-expected.html: Added. 14 * fast/css-generated-content/initial-letter-first-line-wrapping.html: Added. 15 * platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt: progression. 16 1 17 2015-10-16 Youenn Fablet <youenn.fablet@crf.canon.fr> 2 18 -
trunk/LayoutTests/platform/mac/fast/css-generated-content/initial-letter-basic-expected.txt
r177774 r191195 8 8 RenderText {#text} at (0,-17) size 51x82 9 9 text run at (0,-17) width 51: "A" 10 RenderText {#text} at (54,0) size 454x9011 text run at (54,0) width 400: "n example of first-letter. This letter should span 3 lines of text,"12 text run at (54,18) width 3 12: "and so it should align itself cleanly with the cap-"13 text run at (54,36) width 3 26: "height of the A lining up with the cap-height of the"14 text run at (0,54) width 3 94: "first line, and the baseline of the A lining up with the baseline"15 text run at (0,72) width 1 04: "of the third line."10 RenderText {#text} at (54,0) size 394x90 11 text run at (54,0) width 316: "n example of first-letter. This letter should span 3" 12 text run at (54,18) width 340: "lines of text, and so it should align itself cleanly with" 13 text run at (54,36) width 337: "the cap-height of the A lining up with the cap-height" 14 text run at (0,54) width 378: "of the first line, and the baseline of the A lining up with the" 15 text run at (0,72) width 160: "baseline of the third line." 16 16 RenderBlock {SPAN} at (0,106) size 784x90 17 17 RenderBlock {DIV} at (368,0) size 400x90 … … 19 19 RenderText {#text} at (0,-17) size 51x82 20 20 text run at (0,-17) width 51: "A" 21 RenderText {#text} at ( -53,0) size 454x9022 text run at ( -53,0) width 399: "n RTL example of first-letter. This letter should span 3 lines of"23 text run at (2 ,18) width 344: "text, and so it should align itself cleanly with the cap-"24 text run at ( 20,36) width 326: "height of the A lining up with the cap-height of the"25 text run at ( 6,54) width 394: "first line, and the baseline of the A lining up with the baseline"26 text run at (2 96,72) width 5 RTL: "."27 text run at ( 300,72) width 100: "of the third line"21 RenderText {#text} at (9,0) size 399x90 22 text run at (9,0) width 337: "n RTL example of first-letter. This letter should span" 23 text run at (26,18) width 320: "3 lines of text, and so it should align itself cleanly" 24 text run at (17,36) width 329: "with the cap-height of the A lining up with the cap-" 25 text run at (1,54) width 399: "height of the first line, and the baseline of the A lining up with" 26 text run at (216,72) width 5 RTL: "." 27 text run at (220,72) width 180: "the baseline of the third line" -
trunk/Source/WebCore/ChangeLog
r191188 r191195 1 2015-10-16 Zalan Bujtas <zalan@apple.com> 2 3 First line box in paragraph using initial-letter overflows. 4 https://bugs.webkit.org/show_bug.cgi?id=147977 5 <rdar://problem/22901553> 6 7 Reviewed by David Hyatt. 8 9 When initial-letter float is present, we should shrink the first 10 line even if it's not intersected with the block's current height. 11 This is because of the sunken behaviour of initial-letter. 12 13 Test: fast/css-generated-content/initial-letter-first-line-wrapping.html 14 15 * rendering/RenderBlockFlow.h: 16 * rendering/RenderBlockLineLayout.cpp: 17 (WebCore::RenderBlockFlow::positionNewFloatOnLine): 18 * rendering/line/BreakingContext.h: 19 (WebCore::BreakingContext::handleFloat): 20 * rendering/line/LineBreaker.cpp: 21 (WebCore::LineBreaker::skipLeadingWhitespace): 22 * rendering/line/LineBreaker.h: 23 (WebCore::LineBreaker::positionNewFloatOnLine): 24 * rendering/line/LineWidth.cpp: 25 (WebCore::newFloatShrinksLine): 26 (WebCore::LineWidth::shrinkAvailableWidthForNewFloatIfNeeded): 27 * rendering/line/LineWidth.h: 28 1 29 2015-10-16 Keith Rollin <krollin@apple.com> 2 30 -
trunk/Source/WebCore/rendering/RenderBlockFlow.h
r189817 r191195 583 583 // Positions new floats and also adjust all floats encountered on the line if any of them 584 584 // have to move to the next page/column. 585 bool positionNewFloatOnLine( FloatingObject*newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&);585 bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo&, LineWidth&); 586 586 // This function is called to test a line box that has moved in the block direction to see if it has ended up in a new 587 587 // region/page/column that has a different available line width than the old one. Used to know when you have to dirty a -
trunk/Source/WebCore/rendering/RenderBlockLineLayout.cpp
r191014 r191195 2060 2060 } 2061 2061 2062 bool RenderBlockFlow::positionNewFloatOnLine( FloatingObject*newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)2062 bool RenderBlockFlow::positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) 2063 2063 { 2064 2064 if (!positionNewFloats()) … … 2070 2070 // the line and the previous line had a hard break (so this line is either the first in the block 2071 2071 // or follows a <br>). 2072 if (!newFloat ->paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty())2072 if (!newFloat.paginationStrut() || !lineInfo.previousLineBrokeCleanly() || !lineInfo.isEmpty()) 2073 2073 return true; 2074 2074 2075 2075 const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); 2076 ASSERT(floatingObjectSet.last().get() == newFloat);2077 2078 LayoutUnit floatLogicalTop = logicalTopForFloat( newFloat);2079 LayoutUnit paginationStrut = newFloat ->paginationStrut();2076 ASSERT(floatingObjectSet.last().get() == &newFloat); 2077 2078 LayoutUnit floatLogicalTop = logicalTopForFloat(&newFloat); 2079 LayoutUnit paginationStrut = newFloat.paginationStrut(); 2080 2080 2081 2081 if (floatLogicalTop - paginationStrut != logicalHeight() + lineInfo.floatPaginationStrut()) -
trunk/Source/WebCore/rendering/line/BreakingContext.h
r191014 r191195 450 450 // it after moving to next line (in clearFloats() func) 451 451 if (m_floatsFitOnLine && m_width.fitsOnLineExcludingTrailingWhitespace(m_block.logicalWidthForFloat(floatingObject))) { 452 m_lineBreaker.positionNewFloatOnLine( floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width);452 m_lineBreaker.positionNewFloatOnLine(*floatingObject, m_lastFloatFromPreviousLine, m_lineInfo, m_width); 453 453 if (m_lineBreakHistory.renderer() == m_current.renderer()) { 454 454 ASSERT(!m_lineBreakHistory.offset()); -
trunk/Source/WebCore/rendering/line/LineBreaker.cpp
r189817 r191195 67 67 } 68 68 } else if (object.isFloating()) 69 m_block.positionNewFloatOnLine( m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width);69 m_block.positionNewFloatOnLine(*m_block.insertFloatingObject(downcast<RenderBox>(object)), lastFloatFromPreviousLine, lineInfo, width); 70 70 else if (object.style().hasTextCombine() && is<RenderCombineText>(object)) { 71 71 downcast<RenderCombineText>(object).combineText(); -
trunk/Source/WebCore/rendering/line/LineBreaker.h
r189817 r191195 66 66 67 67 FloatingObject* insertFloatingObject(RenderBox& floatBox) { return m_block.insertFloatingObject(floatBox); } 68 bool positionNewFloatOnLine( FloatingObject*newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width)68 bool positionNewFloatOnLine(const FloatingObject& newFloat, FloatingObject* lastFloatFromPreviousLine, LineInfo& lineInfo, LineWidth& width) 69 69 { 70 70 return m_block.positionNewFloatOnLine(newFloat, lastFloatFromPreviousLine, lineInfo, width); -
trunk/Source/WebCore/rendering/line/LineWidth.cpp
r189540 r191195 77 77 } 78 78 79 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(FloatingObject* newFloat) 80 { 81 LayoutUnit height = m_block.logicalHeight(); 82 if (height < m_block.logicalTopForFloat(newFloat) || height >= m_block.logicalBottomForFloat(newFloat)) 79 static bool newFloatShrinksLine(const FloatingObject& newFloat, const RenderBlockFlow& block, bool isFirstLine) 80 { 81 LayoutUnit blockOffset = block.logicalHeight(); 82 if (blockOffset >= block.logicalTopForFloat(&newFloat) && blockOffset < block.logicalBottomForFloat(&newFloat)) 83 return true; 84 85 // initial-letter float always shrinks the first line. 86 const auto& style = newFloat.renderer().style(); 87 if (isFirstLine && style.styleType() == FIRST_LETTER && !style.initialLetter().isEmpty()) 88 return true; 89 return false; 90 } 91 92 void LineWidth::shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject& newFloat) 93 { 94 if (!newFloatShrinksLine(newFloat, m_block, m_isFirstLine)) 83 95 return; 84 85 96 #if ENABLE(CSS_SHAPES) 86 97 ShapeOutsideDeltas shapeDeltas; 87 if (ShapeOutsideInfo* shapeOutsideInfo = newFloat ->renderer().shapeOutsideInfo()) {98 if (ShapeOutsideInfo* shapeOutsideInfo = newFloat.renderer().shapeOutsideInfo()) { 88 99 LayoutUnit lineHeight = m_block.lineHeight(m_isFirstLine, m_block.isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes); 89 shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_block, *newFloat, m_block.logicalHeight(), lineHeight);90 } 91 #endif 92 93 if (newFloat ->type() == FloatingObject::FloatLeft) {94 float newLeft = m_block.logicalRightForFloat( newFloat);100 shapeDeltas = shapeOutsideInfo->computeDeltasForContainingBlockLine(m_block, newFloat, m_block.logicalHeight(), lineHeight); 101 } 102 #endif 103 104 if (newFloat.type() == FloatingObject::FloatLeft) { 105 float newLeft = m_block.logicalRightForFloat(&newFloat); 95 106 if (shouldIndentText() && m_block.style().isLeftToRightDirection()) 96 107 newLeft += floorToInt(m_block.textIndentOffset()); … … 105 116 m_left = std::max<float>(m_left, newLeft); 106 117 } else { 107 float newRight = m_block.logicalLeftForFloat( newFloat);118 float newRight = m_block.logicalLeftForFloat(&newFloat); 108 119 if (shouldIndentText() && !m_block.style().isLeftToRightDirection()) 109 120 newRight -= floorToInt(m_block.textIndentOffset()); -
trunk/Source/WebCore/rendering/line/LineWidth.h
r189540 r191195 63 63 64 64 void updateAvailableWidth(LayoutUnit minimumHeight = 0); 65 void shrinkAvailableWidthForNewFloatIfNeeded( FloatingObject*);65 void shrinkAvailableWidthForNewFloatIfNeeded(const FloatingObject&); 66 66 void addUncommittedWidth(float delta) 67 67 {
Note: See TracChangeset
for help on using the changeset viewer.