Changeset 146630 in webkit
- Timestamp:
- Mar 22, 2013 10:51:11 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r146626 r146630 1 2013-03-22 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 [Qt] New fast/text/word-space-with-kerning-3.html fails on Qt. 4 https://bugs.webkit.org/show_bug.cgi?id=112668 5 6 Reviewed by Jocelyn Turcotte. 7 8 * platform/qt/TestExpectations: 9 1 10 2013-03-22 Nate Chapin <japhet@chromium.org> 2 11 -
trunk/LayoutTests/platform/qt/TestExpectations
r146579 r146630 1824 1824 fast/text/international/spaces-combined-in-vertical-text.html 1825 1825 1826 webkit.org/b/112668 fast/text/word-space-with-kerning-3.html [ Skip ]1827 1828 1826 fast/writing-mode/border-styles-vertical-lr.html 1829 1827 fast/writing-mode/border-styles-vertical-rl.html -
trunk/Source/WebCore/ChangeLog
r146629 r146630 1 2013-03-22 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 3 [Qt] New fast/text/word-space-with-kerning-3.html fails on Qt. 4 https://bugs.webkit.org/show_bug.cgi?id=112668 5 6 Reviewed by Jocelyn Turcotte. 7 8 Qt adds word-spacing to leading spaces, but WebCore only expects 9 us to add for trailing spaces. We only corrected for this in width 10 calculation but do need to also do it for drawing. 11 12 Instead of subtracting the extra word-spacing we now configure the 13 FormatRange not to apply to leading spaces. This means this behavior 14 will be applied everywhere reliably. 15 16 * platform/graphics/Font.h: 17 (Font): 18 * platform/graphics/qt/FontQt.cpp: 19 (WebCore::Font::drawComplexText): 20 (WebCore::Font::floatWidthForComplexText): 21 (WebCore::Font::offsetForPositionForComplexText): 22 (WebCore::Font::selectionRectForComplexText): 23 (WebCore::Font::initFormatForTextLayout): 24 1 25 2013-03-22 Joshua Bell <jsbell@chromium.org> 2 26 -
trunk/Source/WebCore/platform/graphics/Font.h
r135888 r146630 298 298 299 299 #if PLATFORM(QT) 300 void initFormatForTextLayout(QTextLayout* ) const;300 void initFormatForTextLayout(QTextLayout*, const TextRun&) const; 301 301 #endif 302 302 -
trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp
r146334 r146630 183 183 QTextLayout layout(string); 184 184 layout.setRawFont(rawFont()); 185 initFormatForTextLayout(&layout );185 initFormatForTextLayout(&layout, run); 186 186 QTextLine line = setupLayout(&layout, run); 187 187 const QPointF adjustedPoint(point.x(), point.y() - line.ascent()); … … 207 207 QTextLayout layout(string); 208 208 layout.setRawFont(rawFont()); 209 initFormatForTextLayout(&layout );209 initFormatForTextLayout(&layout, run); 210 210 QTextLine line = setupLayout(&layout, run); 211 211 float x1 = line.cursorToX(0); 212 212 float x2 = line.cursorToX(run.length()); 213 213 float width = qAbs(x2 - x1); 214 // RenderBlockLineLayout expects us to only add word-spacing for trailing spaces, not for leading spaces.215 if (treatAsSpace(run[0]))216 width -= m_wordSpacing;217 214 218 215 return width + run.expansion(); … … 226 223 QTextLayout layout(string); 227 224 layout.setRawFont(rawFont()); 228 initFormatForTextLayout(&layout );225 initFormatForTextLayout(&layout, run); 229 226 QTextLine line = setupLayout(&layout, run); 230 227 return line.xToCursor(position); … … 238 235 QTextLayout layout(string); 239 236 layout.setRawFont(rawFont()); 240 initFormatForTextLayout(&layout );237 initFormatForTextLayout(&layout, run); 241 238 QTextLine line = setupLayout(&layout, run); 242 239 … … 249 246 } 250 247 251 void Font::initFormatForTextLayout(QTextLayout* layout ) const248 void Font::initFormatForTextLayout(QTextLayout* layout, const TextRun& run) const 252 249 { 253 250 QTextLayout::FormatRange range; 254 range.start = 0; 255 range.length = layout->text().length(); 251 // WebCore expects word-spacing to be ignored on leading spaces contrary to what Qt does. 252 // To avoid word-spacing on any leading spaces, we exclude them from FormatRange which 253 // word-spacing along with other options would be applied to. This is safe since the other 254 // formatting options does not affect spaces. 255 unsigned length = layout->text().length(); 256 for (range.start = 0; treatAsSpace(run[range.start]) && range.start < length; ++range.start) { } 257 range.length = length - range.start; 258 256 259 if (m_wordSpacing) 257 260 range.format.setFontWordSpacing(m_wordSpacing); … … 263 266 range.format.setFontCapitalization(QFont::SmallCaps); 264 267 265 if (range.format.propertyCount() )268 if (range.format.propertyCount() && range.length) 266 269 layout->setAdditionalFormats(QList<QTextLayout::FormatRange>() << range); 267 270 }
Note: See TracChangeset
for help on using the changeset viewer.