Changeset 219291 in webkit
- Timestamp:
- Jul 10, 2017 9:03:03 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r219284 r219291 1 2017-07-10 Zalan Bujtas <zalan@apple.com> 2 3 Block of text is missing in iBooks sample books. 4 https://bugs.webkit.org/show_bug.cgi?id=174295 5 <rdar://problem/32955620> 6 7 Reviewed by Antti Koivisto. 8 9 * fast/multicol/simple-line-layout-line-index-after-strut-2-expected.html: Added. 10 * fast/multicol/simple-line-layout-line-index-after-strut-2.html: Added. 11 1 12 2017-07-08 John Wilander <wilander@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r219290 r219291 1 2017-07-10 Zalan Bujtas <zalan@apple.com> 2 3 Block of text is missing in iBooks sample books. 4 https://bugs.webkit.org/show_bug.cgi?id=174295 5 <rdar://problem/32955620> 6 7 Reviewed by Antti Koivisto. 8 9 In the simple line layout context, translating y coordinate to a line index is 10 normally just a (y / line height) operation. However in case of strut offsets (pagination) 11 we need to take these extra paddings into account while resolving the line index. 12 This patch fixes the boundary checking for a given line by using the font size only 13 when the font is taller than the line. 14 15 * rendering/SimpleLineLayoutResolver.cpp: 16 (WebCore::SimpleLineLayout::RunResolver::adjustLineIndexForStruts): 17 1 18 2017-07-10 Carlos Garcia Campos <cgarcia@igalia.com> 2 19 -
trunk/Source/WebCore/rendering/SimpleLineLayoutResolver.cpp
r215054 r219291 142 142 unsigned strutIndex = 0; 143 143 std::optional<unsigned> lastIndexCandidate; 144 float topPosition = strut.lineBreak * m_lineHeight + (m_baseline - m_ascent); 144 auto top = strut.lineBreak * m_lineHeight; 145 auto lineHeightWithOverflow = m_lineHeight; 146 // If font is larger than the line height (glyphs overflow), use the font size when checking line boundaries. 147 if (m_ascent + m_descent > m_lineHeight) { 148 lineHeightWithOverflow = m_ascent + m_descent; 149 top += m_baseline - m_ascent; 150 } 151 auto bottom = top + lineHeightWithOverflow; 145 152 for (auto lineIndex = strut.lineBreak; lineIndex < m_layout.lineCount(); ++lineIndex) { 146 153 float strutOffset = 0; 147 154 if (strutIndex < struts.size() && struts.at(strutIndex).lineBreak == lineIndex) 148 155 strutOffset = struts.at(strutIndex++).offset; 149 if (y >= topPosition && y < (topPosition + m_ascent + m_descent + strutOffset)) { 156 bottom = top + strutOffset + lineHeightWithOverflow; 157 if (y >= top && y < bottom) { 150 158 if (type == IndexType::First) 151 159 return lineIndex; … … 153 161 } else if (lastIndexCandidate) 154 162 return *lastIndexCandidate; 155 topPosition += m_lineHeight + strutOffset; 156 } 157 return m_layout.lineCount() - 1; 163 top += m_lineHeight + strutOffset; 164 } 165 if (lastIndexCandidate || y >= bottom) 166 return m_layout.lineCount() - 1; 167 // We missed the line. 168 ASSERT_NOT_REACHED(); 169 return lineIndexCandidate; 158 170 } 159 171
Note: See TracChangeset
for help on using the changeset viewer.