Modified: trunk/LayoutTests/ChangeLog (146629 => 146630)
--- trunk/LayoutTests/ChangeLog 2013-03-22 17:41:26 UTC (rev 146629)
+++ trunk/LayoutTests/ChangeLog 2013-03-22 17:51:11 UTC (rev 146630)
@@ -1,3 +1,12 @@
+2013-03-22 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] New fast/text/word-space-with-kerning-3.html fails on Qt.
+ https://bugs.webkit.org/show_bug.cgi?id=112668
+
+ Reviewed by Jocelyn Turcotte.
+
+ * platform/qt/TestExpectations:
+
2013-03-22 Nate Chapin <[email protected]>
REGRESSION (r146239): Reproducible crash in WebCore::DocumentLoader::responseReceived.
Modified: trunk/LayoutTests/platform/qt/TestExpectations (146629 => 146630)
--- trunk/LayoutTests/platform/qt/TestExpectations 2013-03-22 17:41:26 UTC (rev 146629)
+++ trunk/LayoutTests/platform/qt/TestExpectations 2013-03-22 17:51:11 UTC (rev 146630)
@@ -1823,8 +1823,6 @@
# https://bugs.webkit.org/show_bug.cgi?id=80293
fast/text/international/spaces-combined-in-vertical-text.html
-webkit.org/b/112668 fast/text/word-space-with-kerning-3.html [ Skip ]
-
fast/writing-mode/border-styles-vertical-lr.html
fast/writing-mode/border-styles-vertical-rl.html
Modified: trunk/Source/WebCore/ChangeLog (146629 => 146630)
--- trunk/Source/WebCore/ChangeLog 2013-03-22 17:41:26 UTC (rev 146629)
+++ trunk/Source/WebCore/ChangeLog 2013-03-22 17:51:11 UTC (rev 146630)
@@ -1,3 +1,27 @@
+2013-03-22 Allan Sandfeld Jensen <[email protected]>
+
+ [Qt] New fast/text/word-space-with-kerning-3.html fails on Qt.
+ https://bugs.webkit.org/show_bug.cgi?id=112668
+
+ Reviewed by Jocelyn Turcotte.
+
+ Qt adds word-spacing to leading spaces, but WebCore only expects
+ us to add for trailing spaces. We only corrected for this in width
+ calculation but do need to also do it for drawing.
+
+ Instead of subtracting the extra word-spacing we now configure the
+ FormatRange not to apply to leading spaces. This means this behavior
+ will be applied everywhere reliably.
+
+ * platform/graphics/Font.h:
+ (Font):
+ * platform/graphics/qt/FontQt.cpp:
+ (WebCore::Font::drawComplexText):
+ (WebCore::Font::floatWidthForComplexText):
+ (WebCore::Font::offsetForPositionForComplexText):
+ (WebCore::Font::selectionRectForComplexText):
+ (WebCore::Font::initFormatForTextLayout):
+
2013-03-22 Joshua Bell <[email protected]>
REGRESSION (r146540?): Crashes in storage/indexeddb/factory-basics-workers.html, storage/indexeddb/transaction-error.html
Modified: trunk/Source/WebCore/platform/graphics/Font.h (146629 => 146630)
--- trunk/Source/WebCore/platform/graphics/Font.h 2013-03-22 17:41:26 UTC (rev 146629)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2013-03-22 17:51:11 UTC (rev 146630)
@@ -297,7 +297,7 @@
}
#if PLATFORM(QT)
- void initFormatForTextLayout(QTextLayout*) const;
+ void initFormatForTextLayout(QTextLayout*, const TextRun&) const;
#endif
static TypesettingFeatures s_defaultTypesettingFeatures;
Modified: trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp (146629 => 146630)
--- trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2013-03-22 17:41:26 UTC (rev 146629)
+++ trunk/Source/WebCore/platform/graphics/qt/FontQt.cpp 2013-03-22 17:51:11 UTC (rev 146630)
@@ -182,7 +182,7 @@
const QString string = fromRawDataWithoutRef(sanitized);
QTextLayout layout(string);
layout.setRawFont(rawFont());
- initFormatForTextLayout(&layout);
+ initFormatForTextLayout(&layout, run);
QTextLine line = setupLayout(&layout, run);
const QPointF adjustedPoint(point.x(), point.y() - line.ascent());
@@ -206,14 +206,11 @@
QTextLayout layout(string);
layout.setRawFont(rawFont());
- initFormatForTextLayout(&layout);
+ initFormatForTextLayout(&layout, run);
QTextLine line = setupLayout(&layout, run);
float x1 = line.cursorToX(0);
float x2 = line.cursorToX(run.length());
float width = qAbs(x2 - x1);
- // RenderBlockLineLayout expects us to only add word-spacing for trailing spaces, not for leading spaces.
- if (treatAsSpace(run[0]))
- width -= m_wordSpacing;
return width + run.expansion();
}
@@ -225,7 +222,7 @@
QTextLayout layout(string);
layout.setRawFont(rawFont());
- initFormatForTextLayout(&layout);
+ initFormatForTextLayout(&layout, run);
QTextLine line = setupLayout(&layout, run);
return line.xToCursor(position);
}
@@ -237,7 +234,7 @@
QTextLayout layout(string);
layout.setRawFont(rawFont());
- initFormatForTextLayout(&layout);
+ initFormatForTextLayout(&layout, run);
QTextLine line = setupLayout(&layout, run);
float x1 = line.cursorToX(from);
@@ -248,11 +245,17 @@
return FloatRect(pt.x() + x1, pt.y(), x2 - x1, h);
}
-void Font::initFormatForTextLayout(QTextLayout* layout) const
+void Font::initFormatForTextLayout(QTextLayout* layout, const TextRun& run) const
{
QTextLayout::FormatRange range;
- range.start = 0;
- range.length = layout->text().length();
+ // WebCore expects word-spacing to be ignored on leading spaces contrary to what Qt does.
+ // To avoid word-spacing on any leading spaces, we exclude them from FormatRange which
+ // word-spacing along with other options would be applied to. This is safe since the other
+ // formatting options does not affect spaces.
+ unsigned length = layout->text().length();
+ for (range.start = 0; treatAsSpace(run[range.start]) && range.start < length; ++range.start) { }
+ range.length = length - range.start;
+
if (m_wordSpacing)
range.format.setFontWordSpacing(m_wordSpacing);
if (m_letterSpacing)
@@ -262,7 +265,7 @@
if (isSmallCaps())
range.format.setFontCapitalization(QFont::SmallCaps);
- if (range.format.propertyCount())
+ if (range.format.propertyCount() && range.length)
layout->setAdditionalFormats(QList<QTextLayout::FormatRange>() << range);
}