Commit 56aec4bd authored by Fredrik Söderquist's avatar Fredrik Söderquist Committed by Commit Bot

Handle word-spacing for leading white space on SVG text

SVGTextLayoutEngineSpacing checking if the current and last characters
were non-nuls before attempting to apply word-spacing. This would mean
that we'd never add word-spacing at the beginning of a text box.
Remove the checks for non-nuls.

Bug: 902839
Change-Id: I751e1bd1317f7411960d137b7e55a3b83e8cb0df
Reviewed-on: https://chromium-review.googlesource.com/c/1326156Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Fredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#606528}
parent b01bada3
<!DOCTYPE html>
<div style="width: 100px; height: 100px; background-color: green"></div>
<!DOCTYPE html>
<script src="../../resources/ahem.js"></script>
<svg>
<rect width="100" height="100" fill="red"/>
<g fill="green" style="font-size: 50px; font-family: Ahem; word-spacing: 50px">
<text x="-100" y="40" style="white-space: pre"> XX</text>
<text x="-100" y="90" style="white-space: pre"><tspan> XX</tspan></text>
</g>
</svg>
......@@ -39,8 +39,7 @@ float SVGTextLayoutEngineSpacing::CalculateCSSSpacing(UChar current_character) {
return 0;
float spacing = font_.GetFontDescription().LetterSpacing();
if (current_character && last_character &&
font_.GetFontDescription().WordSpacing()) {
if (font_.GetFontDescription().WordSpacing()) {
if (Character::TreatAsSpace(current_character) &&
!Character::TreatAsSpace(last_character))
spacing += font_.GetFontDescription().WordSpacing();
......
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