Fix incorrect indices for emphasis marks drawing in InlineTextBox::paint

The assertion failure in HarfBuzzShaper is triggered because the TextRun
passed to paintTextWithShadows is replaced with
objectReplacementCharacterTextRun which only has a length of 1.
Previously, we did not have an implementation of emphasis mark
drawing for complex text with HarfBuzz, so instead of running into the
assertion, those paint calls were not doing anything.  The indices have
been wrong since the emphasis marks drawing for RenderCombineText
elements was fixed in 7565e3bbdccf98450271 (in 2011).  I updated the
test case to be equivalent to the original fuzz testing report and so
that it actually combines text that is marked as combined where no
font with narrow digits exists.

BUG=348682

Review URL: https://codereview.chromium.org/187783002

git-svn-id: svn://svn.chromium.org/blink/trunk@168592 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 307ca5d4
......@@ -627,6 +627,7 @@ crbug.com/310992 animations/play-state.html [ Pass Failure ]
crbug.com/327447 [ Linux Win Debug ] animations/combo-transform-translate+scale.html [ Pass Failure ]
crbug.com/348682 fast/text/emphasis-combined-text.html [ NeedsRebaseline ]
crbug.com/337736 [ Linux Win ] fast/forms/time-multiple-fields/time-multiple-fields-stepup-stepdown-from-renderer.html [ Failure Pass ]
crbug.com/337736 [ Linux Win ] fast/forms/time-multiple-fields/time-multiple-fields-spinbutton-click-in-iframe.html [ Failure Pass ]
......
......@@ -2,6 +2,7 @@
<style>
html {
-webkit-writing-mode: vertical-rl;
text-rendering: geometricPrecision;
}
p {
......@@ -15,11 +16,11 @@ p {
</style>
<p>
<span style="-webkit-text-emphasis: sesame red">文字<span class="combine">900</span></span>
<span style="-webkit-text-emphasis: sesame red">文字<span class="combine">90</span></span>
</p>
<p>
<span style="-webkit-text-emphasis: '@' red">文字<span class="combine">900</span></span>
<span style="-webkit-text-emphasis: '@' red">文字<span class="combine">90</span></span>
</p>
<p>
<span style="-webkit-text-emphasis: '年' red">文字<span class="combine">900</span></span>
<span style="-webkit-text-emphasis: '年' red">文字<span class="combine">90</span></span>
</p>
......@@ -705,12 +705,19 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
if (combinedText)
context->concatCTM(rotation(boxRect, Clockwise));
if (!paintSelectedTextSeparately || ePos <= sPos) {
// FIXME: Truncate right-to-left text correctly.
paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, 0, length, length, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
} else {
paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, ePos, sPos, length, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
int startOffset = 0;
int endOffset = length;
int paintRunLength = length;
if (combinedText) {
startOffset = 0;
endOffset = objectReplacementCharacterTextRun.length();
paintRunLength = endOffset;
} else if (paintSelectedTextSeparately && ePos > sPos) {
startOffset = ePos;
endOffset = sPos;
}
// FIXME: Truncate right-to-left text correctly.
paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, textShadow, textStrokeWidth > 0, isHorizontal());
if (combinedText)
context->concatCTM(rotation(boxRect, Counterclockwise));
......@@ -732,7 +739,10 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset,
if (combinedText)
context->concatCTM(rotation(boxRect, Clockwise));
paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, sPos, ePos, length, emphasisMarkTextOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal());
int startOffset = combinedText ? 0 : sPos;
int endOffset = combinedText ? objectReplacementCharacterTextRun.length() : ePos;
int paintRunLength = combinedText ? endOffset : length;
paintTextWithShadows(context, rendererToUse, combinedText ? combinedText->originalFont() : font, emphasisMarkTextRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, paintRunLength, emphasisMarkTextOrigin, boxRect, selectionShadow, selectionStrokeWidth > 0, isHorizontal());
if (combinedText)
context->concatCTM(rotation(boxRect, Counterclockwise));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment