New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 682999 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Jan 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 2
Type: Bug



Sign in to add a comment

Text is rendered with other page's webfont with the same family name

Reported by wilf...@gmail.com, Jan 20 2017

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce the problem:
1. unzip chrome-fontbug2.zip
2. start static web server. document root is chrome-fontbug2 folder.
3. open secret windown and access to chrome-fontbug2/index.html via this web server.
4. click "ipafont" link and see a text in canvas.
5. click browser back.
6. click "mplus" link and see a text in canvas.
7. click browser back.
8. do 4 to 6 agein.

What is the expected behavior?
"mplus" page set "mplus-1m-regular.ttf" font for rendering, not "ipa ex mincho" font.
So the page will render "mplus-1m-regular.ttf" font or default font text.

What went wrong?
"mplus" page render "ipa ex mincho" font text at second time the page opened.
Font-face style settings passed over pages.

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 55.0.2883.87  Channel: stable
OS Version: 6.1 (Windows 7)
Flash Version: Shockwave Flash 24.0 r0
 
chrome-fontbug2.zip
6.2 MB Download
Cc: hajimehoshi@chromium.org kojii@chromium.org kouhei@chromium.org
Labels: OS-Linux OS-Mac
Status: Untriaged (was: Unconfirmed)
This bug can be reproduced on Linux and macOS, right?

Comment 2 by wilf...@gmail.com, Jan 20 2017

Yes.
Cc: ksakamoto@chromium.org
Cc: -ksakamoto@chromium.org
Owner: ksakamoto@chromium.org
+ksakamoto: Could you take a look?
Components: Blink>WebFonts
Status: Assigned (was: Untriaged)
Looking.
Cc: e...@chromium.org drott@chromium.org
Components: -Blink>Canvas Blink>Fonts
Cached shaping result created by previous document was used.

The global FallbackListShapeCache is keyed by FallbackListCompositeKey which is created from family names and FontDescription.  In this case, the new document has the same custom font-family name as previous document (but source urls are different), so it generates the same cache key as previous document.

ShapeCache has logic to clear cached entries if FontSelector version has changed, but in this case, the two document has the same FontSelector version (1), because they both have one @font-face rule.

Summary: Text is rendered with other page's webfont with the same family name (was: CanvasRenderingContext2D#fillText render text with other pages font)
This is not canvas specific.

Comment 9 by drott@chromium.org, Jan 24 2017

Cc: sashab@chromium.org

Comment 10 by drott@chromium.org, Jan 24 2017

Re #6, very good analysis, thanks for fixing this.
Project Member

Comment 11 by bugdroid1@chromium.org, Jan 24 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f2bb61c5104755025adb0f1c5327de420311d32e

commit f2bb61c5104755025adb0f1c5327de420311d32e
Author: ksakamoto <ksakamoto@chromium.org>
Date: Tue Jan 24 16:55:34 2017

Make FontFaceCache::version return unique number across all instances

The global FallbackListShapeCache may contain entries created in
multiple documents that have different @font-face rules. Those entries
are versioned by FontFaceCache version, but entries from different
FontFaceCache instances can have same version number.

This patch makes sure that ShapeCache is invalidated when cached data is
created within the context of different FontFaceCache instance.

BUG= 682999 

Review-Url: https://codereview.chromium.org/2653773006
Cr-Commit-Position: refs/heads/master@{#445744}

[add] https://crrev.com/f2bb61c5104755025adb0f1c5327de420311d32e/third_party/WebKit/LayoutTests/fast/css/font-face-cache-version.html
[add] https://crrev.com/f2bb61c5104755025adb0f1c5327de420311d32e/third_party/WebKit/LayoutTests/fast/css/resources/font-face-cache-version-frame1.html
[add] https://crrev.com/f2bb61c5104755025adb0f1c5327de420311d32e/third_party/WebKit/LayoutTests/fast/css/resources/font-face-cache-version-frame2.html
[modify] https://crrev.com/f2bb61c5104755025adb0f1c5327de420311d32e/third_party/WebKit/Source/core/css/FontFaceCache.cpp
[modify] https://crrev.com/f2bb61c5104755025adb0f1c5327de420311d32e/third_party/WebKit/Source/core/css/FontFaceCache.h

Comment 12 by e...@chromium.org, Jan 24 2017

Status: Fixed (was: Assigned)
Thank you ksakamoto!

Sign in to add a comment