Skip to content
This repository was archived by the owner on Apr 3, 2020. It is now read-only.

Commit 43d6830

Browse files
committed
Merge 183104 "Force ComplexPath if any part of the node requires it"
> Force ComplexPath if any part of the node requires it > > Change our font measurement/rendering logic to force the ComplexPath for > the entire RenderText if any part of it requires it. This ensures > consistency between preferred width and line break calculations. > Also change FontCacheSkiaWin to use the subpixel settings from the > primary font in case of character based fallback. > > TEST=fast/text/international/complex-text-with-default-font-spaces.html > BUG=412758 > [email protected] > > Review URL: https://codereview.chromium.org/622653002 [email protected] Review URL: https://codereview.chromium.org/616703004 git-svn-id: svn://svn.chromium.org/blink/branches/chromium/2171@183160 bbb929c8-8fbe-4397-9dbb-9b2b20218538
1 parent 91ac9c3 commit 43d6830

9 files changed

+88
-3
lines changed

Diff for: LayoutTests/NeverFixTests

+1
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ fast/canvas/canvas-lost-gpu-context.html [ WontFix ]
135135
[ XP Mac ] fast/text/sub-pixel/text-scaling-rtl.html [ WontFix ]
136136
[ XP Mac ] fast/text/sub-pixel/text-scaling-vertical.html [ WontFix ]
137137
[ XP Mac ] fast/text/sub-pixel/text-scaling-webfont.html [ WontFix ]
138+
[ Mac ] fast/text/mixed-direction-bidi-wrap.html [ WontFix ]
138139

139140
# We don't have full plane2 support on XP.
140141
[ XP ] fast/text/international/plane2.html [ WontFix ]

Diff for: LayoutTests/TestExpectations

+26-1
Original file line numberDiff line numberDiff line change
@@ -749,6 +749,31 @@ crbug.com/352856 [ Mac ] svg/batik/text/xmlSpace.svg [ Failure Pass ]
749749
crbug.com/352856 [ Mac ] svg/batik/text/textPosition.svg [ Pass Failure NeedsManualRebaseline ]
750750
crbug.com/352856 [ Mac ] svg/batik/text/textPosition2.svg [ Pass Failure NeedsManualRebaseline ]
751751

752+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/decorations-with-text-combine.html [ NeedsRebaseline ]
753+
crbug.com/412758 [ Win ] fast/text/decorations-with-text-combine.html [ NeedsRebaseline ]
754+
crbug.com/412758 [ Win ] media/track/track-cue-rendering-vertical.html [ NeedsRebaseline ]
755+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/justify-ideograph-complex.html [ NeedsRebaseline ]
756+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/emphasis.html [ NeedsRebaseline ]
757+
crbug.com/412758 [ Win ] svg/batik/text/verticalText.svg [ NeedsRebaseline ]
758+
crbug.com/412758 [ Win ] fast/text/justify-ideograph-complex.html [ NeedsRebaseline ]
759+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/international/wrap-CJK-001.html [ NeedsRebaseline ]
760+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/justify-ideograph-vertical.html [ NeedsRebaseline ]
761+
crbug.com/412758 [ Win ] fast/text/international/hindi-spacing.html [ NeedsRebaseline ]
762+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/emphasis-vertical.html [ NeedsRebaseline ]
763+
crbug.com/412758 [ Win ] fast/text/emphasis-vertical.html [ NeedsRebaseline ]
764+
crbug.com/412758 [ Win ] fast/text/justify-ideograph-vertical.html [ NeedsRebaseline ]
765+
crbug.com/412758 [ Win ] fast/writing-mode/Kusa-Makura-background-canvas.html [ NeedsRebaseline ]
766+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/international/hindi-spacing.html [ NeedsRebaseline ]
767+
crbug.com/412758 [ Win ] fast/text/emphasis.html [ NeedsRebaseline ]
768+
crbug.com/412758 [ Win ] fast/ruby/nested-ruby.html [ NeedsRebaseline ]
769+
crbug.com/412758 [ Win ] fast/text/international/wrap-CJK-001.html [ NeedsRebaseline ]
770+
crbug.com/412758 [ Win ] fast/forms/month/month-appearance-l10n.html [ NeedsRebaseline ]
771+
crbug.com/412758 [ Win ] fast/forms/datetimelocal/datetimelocal-appearance-l10n.html [ NeedsRebaseline ]
772+
crbug.com/412758 [ Win ] svg/W3C-SVG-1.1/text-intro-04-t.svg [ Crash NeedsManualRebaseline ]
773+
crbug.com/412758 [ Win ] virtual/antialiasedtext/fast/text/justify-ideograph-simple.html [ NeedsRebaseline ]
774+
crbug.com/412758 [ Mac ] virtual/antialiasedtext/fast/text/emphasis-complex.html [ NeedsRebaseline ]
775+
crbug.com/412758 [ Mac ] fast/text/emphasis-complex.html [ NeedsRebaseline ]
776+
752777
crbug.com/353186 [ Win Debug ] http/tests/security/webgl-remote-read-remote-image-allowed-with-credentials.html [ Pass Timeout ]
753778
crbug.com/353208 fast/files/workers/worker-read-blob-async-crash.html [ Pass Crash Timeout ]
754779
crbug.com/353301 svg/custom/js-late-gradient-and-object-creation.svg [ Pass Failure ]
@@ -1288,7 +1313,7 @@ crbug.com/407993 [ Mac Win Release ] media/encrypted-media/encrypted-media-playb
12881313
crbug.com/407993 [ Win Release ] media/encrypted-media/encrypted-media-playback-setmediakeys-before-src.html [ Timeout Pass ]
12891314
crbug.com/407993 [ Win ] media/encrypted-media/prefixed/encrypted-media-events.html [ Crash Pass ]
12901315
crbug.com/409579 http/tests/security/javascriptURL/xss-DENIED-to-javascript-url-in-foreign-domain-subframe.html [ Pass Timeout ]
1291-
crbug.com/409715 [ Win ] svg/W3C-SVG-1.1/text-intro-04-t.svg [ Crash Pass ]
1316+
#crbug.com/409715 [ Win ] svg/W3C-SVG-1.1/text-intro-04-t.svg [ Crash Pass ]
12921317
crbug.com/409713 [ Linux Win Release ] fast/dom/Window/window-early-properties-xhr.html [ Pass Timeout ]
12931318
crbug.com/409712 http/tests/filesystem/workers/resolve-url.html [ Pass Timeout ]
12941319
crbug.com/409767 crypto/worker-subtle-crypto-concurrent.html [ Crash Pass Timeout ]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
button {
7+
font-family: Arial;
8+
font-size: 12px;
9+
white-space: nowrap;
10+
}
11+
</style>
12+
</head>
13+
<body>
14+
<button>सभी को डिफ़ॉल्ट पर रीसेट करें</button>
15+
<p>
16+
The button above should not wrap.
17+
</p>
18+
</body>
19+
</html>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<style>
6+
button {
7+
font-family: Arial;
8+
font-size: 12px;
9+
}
10+
</style>
11+
</head>
12+
<body>
13+
<button>सभी को डिफ़ॉल्ट पर रीसेट करें</button>
14+
<p>
15+
The button above should not wrap.
16+
</p>
17+
</body>
18+
</html>

Diff for: Source/core/rendering/RenderText.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,6 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
928928

929929
TextRun textRun(text());
930930
BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
931-
932931
BidiCharacterRun* run;
933932
TextDirection textDirection = styleToUse->direction();
934933
if (isOverride(styleToUse->unicodeBidi())) {
@@ -1107,6 +1106,7 @@ void RenderText::computePreferredLogicalWidths(float leadWidth, HashSet<const Si
11071106
} else {
11081107
TextRun run = constructTextRun(this, f, this, i, 1, styleToUse, textDirection);
11091108
run.setCharactersLength(len - i);
1109+
run.setUseComplexCodePath(!canUseSimpleFontCodePath());
11101110
ASSERT(run.charactersLength() >= run.length());
11111111
run.setTabSize(!style()->collapseWhiteSpace(), style()->tabSize());
11121112
run.setXPos(leadWidth + currMaxWidth);

Diff for: Source/core/rendering/line/BreakingContextInlineHeaders.h

+1
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,7 @@ ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, con
521521

522522
TextRun run = constructTextRun(text, font, text, from, len, text->style());
523523
run.setCharacterScanForCodePath(!text->canUseSimpleFontCodePath());
524+
run.setUseComplexCodePath(!text->canUseSimpleFontCodePath());
524525
run.setTabSize(!collapseWhiteSpace, text->style()->tabSize());
525526
run.setXPos(xPos);
526527
return font.width(run, fallbackFonts, &glyphOverflow);

Diff for: Source/platform/fonts/Font.cpp

+3
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,9 @@ CodePath Font::codePath(const TextRun& run) const
292292
if (run.length() > 1 && fontDescription().typesettingFeatures())
293293
return ComplexPath;
294294

295+
if (run.useComplexCodePath())
296+
return ComplexPath;
297+
295298
if (!run.characterScanForCodePath())
296299
return SimplePath;
297300

Diff for: Source/platform/fonts/win/FontCacheSkiaWin.cpp

+12-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ FontCache::FontCache()
7676

7777
// Given the desired base font, this will create a SimpleFontData for a specific
7878
// font that can be used to render the given range of characters.
79-
PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescription& fontDescription, UChar32 character, const SimpleFontData*)
79+
PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(
80+
const FontDescription& fontDescription, UChar32 character,
81+
const SimpleFontData* originalFontData)
8082
{
8183
// First try the specified font with standard style & weight.
8284
if (fontDescription.style() == FontStyleItalic
@@ -161,6 +163,15 @@ PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter(const FontDescrip
161163
data = getFontPlatformData(fontDescription, createByFamily);
162164
}
163165

166+
// For font fallback we want to match the subpixel behavior of the original
167+
// font. Mixing subpixel and non-subpixel in the same text run looks really
168+
// odd and causes problems with preferred width calculations.
169+
if (data && originalFontData) {
170+
const FontPlatformData& platformData = originalFontData->platformData();
171+
data->setMinSizeForAntiAlias(platformData.minSizeForAntiAlias());
172+
data->setMinSizeForSubpixel(platformData.minSizeForSubpixel());
173+
}
174+
164175
// When i-th font (0-base) in |panUniFonts| contains a character and
165176
// we get out of the loop, |i| will be |i + 1|. That is, if only the
166177
// last font in the array covers the character, |i| will be numFonts.

Diff for: Source/platform/text/TextRun.h

+7
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class PLATFORM_EXPORT TextRun {
6666
, m_direction(direction)
6767
, m_directionalOverride(directionalOverride)
6868
, m_characterScanForCodePath(characterScanForCodePath)
69+
, m_useComplexCodePath(false)
6970
, m_disableSpacing(false)
7071
, m_tabSize(0)
7172
, m_normalizeSpace(false)
@@ -85,6 +86,7 @@ class PLATFORM_EXPORT TextRun {
8586
, m_direction(direction)
8687
, m_directionalOverride(directionalOverride)
8788
, m_characterScanForCodePath(characterScanForCodePath)
89+
, m_useComplexCodePath(false)
8890
, m_disableSpacing(false)
8991
, m_tabSize(0)
9092
, m_normalizeSpace(false)
@@ -103,6 +105,7 @@ class PLATFORM_EXPORT TextRun {
103105
, m_direction(direction)
104106
, m_directionalOverride(directionalOverride)
105107
, m_characterScanForCodePath(characterScanForCodePath)
108+
, m_useComplexCodePath(false)
106109
, m_disableSpacing(false)
107110
, m_tabSize(0)
108111
, m_normalizeSpace(normalizeSpace)
@@ -130,6 +133,7 @@ class PLATFORM_EXPORT TextRun {
130133
, m_direction(direction)
131134
, m_directionalOverride(directionalOverride)
132135
, m_characterScanForCodePath(characterScanForCodePath)
136+
, m_useComplexCodePath(false)
133137
, m_disableSpacing(false)
134138
, m_tabSize(0)
135139
, m_normalizeSpace(normalizeSpace)
@@ -196,12 +200,14 @@ class PLATFORM_EXPORT TextRun {
196200
bool ltr() const { return m_direction == LTR; }
197201
bool directionalOverride() const { return m_directionalOverride; }
198202
bool characterScanForCodePath() const { return m_characterScanForCodePath; }
203+
bool useComplexCodePath() const { return m_useComplexCodePath; }
199204
bool spacingDisabled() const { return m_disableSpacing; }
200205

201206
void disableSpacing() { m_disableSpacing = true; }
202207
void setDirection(TextDirection direction) { m_direction = direction; }
203208
void setDirectionalOverride(bool override) { m_directionalOverride = override; }
204209
void setCharacterScanForCodePath(bool scan) { m_characterScanForCodePath = scan; }
210+
void setUseComplexCodePath(bool useComplex) { m_useComplexCodePath = useComplex; }
205211

206212
class RenderingContext : public RefCounted<RenderingContext> {
207213
public:
@@ -236,6 +242,7 @@ class PLATFORM_EXPORT TextRun {
236242
unsigned m_direction : 1;
237243
unsigned m_directionalOverride : 1; // Was this direction set by an override character.
238244
unsigned m_characterScanForCodePath : 1;
245+
unsigned m_useComplexCodePath : 1;
239246
unsigned m_disableSpacing : 1;
240247
unsigned m_tabSize;
241248
bool m_normalizeSpace;

0 commit comments

Comments
 (0)