Changeset 276450 in webkit
- Timestamp:
- Apr 22, 2021 11:44:49 AM (15 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 61 edited
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt (modified) (2 diffs)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/Headers.cmake (modified) (1 diff)
-
Source/WebCore/Sources.txt (modified) (1 diff)
-
Source/WebCore/WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
Source/WebCore/css/CSSFontFace.cpp (modified) (2 diffs)
-
Source/WebCore/css/CSSFontFace.h (modified) (2 diffs)
-
Source/WebCore/css/CSSFontFaceSet.cpp (modified) (3 diffs)
-
Source/WebCore/css/CSSFontFaceSource.cpp (modified) (1 diff)
-
Source/WebCore/css/FontFace.cpp (modified) (5 diffs)
-
Source/WebCore/css/FontFace.h (modified) (2 diffs)
-
Source/WebCore/css/FontFace.idl (modified) (2 diffs)
-
Source/WebCore/css/FontFaceSet.idl (modified) (1 diff)
-
Source/WebCore/loader/FontLoadRequest.h (modified) (3 diffs)
-
Source/WebCore/loader/cache/CachedFont.cpp (modified) (1 diff)
-
Source/WebCore/loader/cache/CachedFontLoadRequest.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/Font.cpp (modified) (6 diffs)
-
Source/WebCore/platform/graphics/Font.h (modified) (4 diffs)
-
Source/WebCore/platform/graphics/FontCache.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/FontCache.h (modified) (2 diffs)
-
Source/WebCore/platform/graphics/FontCascade.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/FontCascadeFonts.cpp (modified) (5 diffs)
-
Source/WebCore/platform/graphics/WOFFFileFormat.cpp (modified) (1 diff)
-
Source/WebCore/platform/graphics/WOFFFileFormat.h (modified) (1 diff)
-
Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (modified) (1 diff)
-
Source/WebCore/workers/WorkerFontLoadRequest.cpp (added)
-
Source/WebCore/workers/WorkerFontLoadRequest.h (added)
-
Source/WebCore/workers/WorkerGlobalScope.cpp (modified) (3 diffs)
-
Source/WebCore/workers/WorkerGlobalScope.h (modified) (2 diffs)
-
Source/WebCore/workers/WorkerGlobalScope.idl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r276433 r276450 1 2021-04-22 Chris Lord <clord@igalia.com> 2 3 Implement FontFace in Workers for OffscreenCanvas 4 https://bugs.webkit.org/show_bug.cgi?id=224178 5 <rdar://problem/76529024> 6 7 Reviewed by Darin Adler. 8 9 FontFace is now available for Workers, rebaseline related tests. 10 11 * web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt: 12 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt: 13 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt: 14 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt: 15 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt: 16 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt: 17 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt: 18 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt: 19 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt: 20 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt: 21 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt: 22 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt: 23 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt: 24 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt: 25 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt: 26 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt: 27 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt: 28 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt: 29 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt: 30 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt: 31 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt: 32 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt: 33 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt: 34 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt: 35 * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt: 36 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt: 37 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt: 38 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt: 39 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt: 40 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt: 41 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt: 42 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt: 43 * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt: 44 1 45 2021-04-22 Imanol Fernandez <ifernandez@igalia.com> 2 46 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt
r267650 r276450 1 CONSOLE MESSAGE: TypeError: undefined is not an object (evaluating 'self.fonts.load')2 3 Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'self.fonts.load')4 1 5 2 PASS Loading CSS-wide keyword "initial" causes SyntaxError (document) … … 7 4 PASS Loading CSS-wide keyword "unset" causes SyntaxError (document) 8 5 PASS Loading CSS-wide keyword "revert" causes SyntaxError (document) 9 TIMEOUT Loading CSS-wide keyword "initial" causes SyntaxError (worker) Test timed out 10 NOTRUNLoading CSS-wide keyword "inherit" causes SyntaxError (worker)11 NOTRUNLoading CSS-wide keyword "unset" causes SyntaxError (worker)12 NOTRUNLoading CSS-wide keyword "revert" causes SyntaxError (worker)6 PASS Loading CSS-wide keyword "initial" causes SyntaxError (worker) 7 PASS Loading CSS-wide keyword "inherit" causes SyntaxError (worker) 8 PASS Loading CSS-wide keyword "unset" causes SyntaxError (worker) 9 PASS Loading CSS-wide keyword "revert" causes SyntaxError (worker) 13 10 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign center is the center of the em squares (not the bounding box) Can't find variable: FontFace 2 PASS textAlign center is the center of the em squares (not the bounding box) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign end with ltr is the right edge Can't find variable: FontFace2 PASS textAlign end with ltr is the right edge 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign end with rtl is the left edge Can't find variable: FontFace2 PASS textAlign end with rtl is the left edge 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign left is the left of the first em square (not the bounding box) Can't find variable: FontFace 2 PASS textAlign left is the left of the first em square (not the bounding box) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign right is the right of the last em square (not the bounding box) Can't find variable: FontFace 2 PASS textAlign right is the right of the last em square (not the bounding box) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign start with ltr is the left edge Can't find variable: FontFace2 PASS textAlign start with ltr is the left edge 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt
r270102 r276450 1 1 2 FAIL textAlign start with rtl is the right edge Can't find variable: FontFace2 PASS textAlign start with rtl is the right edge 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt
r270102 r276450 1 1 2 FAIL 2d Can't find variable: FontFace 2 PASS 2d 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt
r270102 r276450 1 1 2 FAIL textBaseline bottom is the bottom of the em square (not the bounding box) Can't find variable: FontFace2 FAIL textBaseline bottom is the bottom of the em square (not the bounding box) assert_approx_equals: Red channel of the pixel at (25, 25) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt
r270102 r276450 1 1 2 FAIL 2d Can't find variable: FontFace2 FAIL 2d assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt
r270102 r276450 1 1 2 FAIL 2d Can't find variable: FontFace2 FAIL 2d assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt
r270102 r276450 1 1 2 FAIL textBaseline middle is the middle of the em square (not the bounding box) Can't find variable: FontFace2 FAIL textBaseline middle is the middle of the em square (not the bounding box) assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt
r270102 r276450 1 1 2 FAIL textBaseline top is the top of the em square (not the bounding box) Can't find variable: FontFace2 FAIL textBaseline top is the top of the em square (not the bounding box) assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt
r270102 r276450 1 1 2 FAIL fillText handles maxWidth based on line size, not bounding box size Can't find variable: FontFace2 PASS fillText handles maxWidth based on line size, not bounding box size 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt
r270102 r276450 1 1 2 FAIL fillText works on @font-face fonts Can't find variable: FontFace 2 PASS fillText works on @font-face fonts 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt
r270102 r276450 1 1 2 FAIL @font-face fonts should work even if they are not used in the page Can't find variable: FontFace2 PASS @font-face fonts should work even if they are not used in the page 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt
r270102 r276450 1 1 2 FAIL Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.) Can't find variable: FontFace 2 PASS Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt
r270102 r276450 1 1 2 FAIL 2d Can't find variable: FontFace 2 PASS 2d 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt
r270102 r276450 1 1 2 FAIL U+0020 is rendered the correct size (1em wide) Can't find variable: FontFace 2 PASS U+0020 is rendered the correct size (1em wide) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt
r270102 r276450 1 1 2 FAIL Space characters at the end of a line are collapsed (per CSS) Can't find variable: FontFace2 FAIL Space characters at the end of a line are collapsed (per CSS) assert_approx_equals: Red channel of the pixel at (75, 25) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt
r270102 r276450 1 1 2 FAIL Non-space characters are not converted to U+0020 and collapsed Can't find variable: FontFace 2 PASS Non-space characters are not converted to U+0020 and collapsed 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt
r270102 r276450 1 1 2 FAIL Space characters are converted to U+0020, and collapsed (per CSS) Can't find variable: FontFace2 FAIL Space characters are converted to U+0020, and collapsed (per CSS) assert_approx_equals: Red channel of the pixel at (25, 25) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt
r270102 r276450 1 1 2 FAIL Space characters are converted to U+0020, and collapsed (per CSS) Can't find variable: FontFace2 FAIL Space characters are converted to U+0020, and collapsed (per CSS) assert_approx_equals: Red channel of the pixel at (25, 25) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt
r270102 r276450 1 1 2 FAIL Space characters at the start of a line are collapsed (per CSS) Can't find variable: FontFace2 FAIL Space characters at the start of a line are collapsed (per CSS) assert_approx_equals: Red channel of the pixel at (25, 25) expected 0 +/- 2 but got 255 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt
r270102 r276450 1 1 2 FAIL Testing actualBoundingBox for OffscreenCanvas Can't find variable: FontFace2 FAIL Testing actualBoundingBox for OffscreenCanvas assert_equals: Math.abs(ctx.measureText('A').actualBoundingBoxDescent) === 0 (got 1[number], expected 0[number]) expected 0 but got 1 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt
r270102 r276450 1 1 2 FAIL Testing width advances for OffscreenCanvas Can't find variable: FontFace2 FAIL Testing width advances for OffscreenCanvas undefined is not an object (evaluating 'ctx.measureText('Hello').advances[0]') 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt
r270102 r276450 1 1 2 FAIL Testing baselines for OffscreenCanvas Can't find variable: FontFace2 FAIL Testing baselines for OffscreenCanvas ctx.measureText('A').getBaselines is not a function. (In 'ctx.measureText('A').getBaselines()', 'ctx.measureText('A').getBaselines' is undefined) 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt
r270102 r276450 1 1 2 FAIL Testing emHeights for OffscreenCanvas Can't find variable: FontFace2 FAIL Testing emHeights for OffscreenCanvas assert_equals: ctx.measureText('A').emHeightAscent === 37.5 (got 85[number], expected 37.5[number]) expected 37.5 but got 85 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt
r270102 r276450 1 1 2 FAIL Testing fontBoundingBox for OffscreenCanvas Can't find variable: FontFace 2 PASS Testing fontBoundingBox for OffscreenCanvas 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt
r270102 r276450 1 1 2 FAIL The width of character is same as font used for OffscreenCanvas Can't find variable: FontFace 2 PASS The width of character is same as font used for OffscreenCanvas 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt
r270102 r276450 1 1 2 FAIL The empty string has zero width for OffscreenCanvas Can't find variable: FontFace 2 PASS The empty string has zero width for OffscreenCanvas 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt
r270102 r276450 1 1 2 FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas Can't find variable: FontFace2 FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas assert_equals: ctx.measureText('A \x09\x0a\x0c\x0d \x09\x0a\x0c\x0dB').width === 150 (got 650[number], expected 150[number]) expected 150 but got 650 3 3 -
trunk/Source/WebCore/ChangeLog
r276448 r276450 1 2021-04-22 Chris Lord <clord@igalia.com> 2 3 Implement FontFace in Workers for OffscreenCanvas 4 https://bugs.webkit.org/show_bug.cgi?id=224178 5 <rdar://problem/76529024> 6 7 Reviewed by Darin Adler. 8 9 To comply with spec and complete the OffscreenCanvas implementation, 10 FontFace needs to be made available on WorkerGlobalScope. This patch 11 makes it available and fixes crashes using it due to accessing 12 main-thread only singletons. 13 14 No new tests, rebaselined existing tests. 15 16 * Headers.cmake: 17 * Sources.txt: 18 * WebCore.xcodeproj/project.pbxproj: 19 Add new files WorkerFontLoadRequest.cpp, WorkerFontLoadRequest.h 20 21 * css/CSSFontFace.cpp: 22 (WebCore::CSSFontFace::fontCacheFallingBackToSingleton): 23 (WebCore::CSSFontFace::font): 24 * css/CSSFontFace.h: 25 Use the ScriptExecutionContext's FontCache if possible when loading fonts. 26 27 * css/CSSFontFaceSet.cpp: 28 (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered): 29 (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts): 30 Use the correct CSSValuePool and FontCache in 31 ensureLocalFontFacesForFamilyRegistered. Also clarify a vaguely-named 32 variable. 33 34 * css/CSSFontFaceSource.cpp: 35 (WebCore::CSSFontFaceSource::CSSFontFaceSource): 36 Use FontLoadRequest::isPending instead of making assumptions about the 37 request state on construction. 38 39 * css/FontFace.cpp: 40 (WebCore::FontFace::create): 41 (WebCore::FontFace::display const): 42 * css/FontFace.h: 43 * css/FontFace.idl: 44 Construct with a ScriptExecutionContext instead of a Document and 45 make available for Workers. 46 47 * css/FontFaceSet.idl: 48 Expose to Workers. 49 50 * loader/FontLoadRequest.h: 51 (WebCore::FontLoadRequest::isWorkerFontLoadRequest const): 52 Add isPending function and new type WorkerFontLoadRequest. 53 54 * loader/cache/CachedFont.cpp: 55 (WebCore::CachedFont::createCustomFontData): 56 Use convertWOFFToSfntIfNecessary(). 57 58 * loader/cache/CachedFontLoadRequest.h: 59 Implement FontLoadRequest::isPending. 60 61 * platform/graphics/Font.cpp: 62 (WebCore::Font::create): 63 (WebCore::Font::Font): 64 (WebCore::Font::systemFallbackFontForCharacter const): 65 * platform/graphics/Font.h: 66 Add an optional FontCache parameter for use with vertical font data 67 retrieval and add a FontCache parameter to 68 systemFallbackFontForCharacter instead of using the singleton. 69 70 * platform/graphics/FontCache.cpp: 71 (WebCore::FontCache::fontForPlatformData): 72 Pass FontCache parameter when creating fonts. 73 74 * platform/graphics/FontCache.h: 75 (WebCore::FontCache::fontCacheFallingBackToSingleton): 76 * platform/graphics/FontCascade.cpp: 77 (WebCore::FontCascade::update const): 78 * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp: 79 (WebCore::FontCascade::fontForCombiningCharacterSequence const): 80 Rename fontCacheFallbackToSingleton -> fontCacheFallingBackToSingleton 81 82 * platform/graphics/FontCascadeFonts.cpp: 83 (WebCore::FontCascadeFonts::realizeFallbackRangesAt): 84 (WebCore::FontCascadeFonts::glyphDataForSystemFallback): 85 Use familyNamesData instead of familyNames and pass the FontCache 86 parameter when calling glyphDataForSystemFallback to make this safe 87 to use in a Worker. 88 89 * platform/graphics/FontTaggedSettings.h: 90 Add missing wtf/Hasher.h include. 91 92 * platform/graphics/WOFFFileFormat.cpp: 93 (WebCore::convertWOFFToSfntIfNecessary): 94 * platform/graphics/WOFFFileFormat.h: 95 Add utility function to convert WOFF fonts on non-Cocoa platforms. 96 97 * workers/WorkerFontLoadRequest.cpp: Added. 98 (WebCore::WorkerFontLoadRequest::WorkerFontLoadRequest): 99 (WebCore::WorkerFontLoadRequest::load): 100 (WebCore::WorkerFontLoadRequest::ensureCustomFontData): 101 (WebCore::WorkerFontLoadRequest::createFont): 102 (WebCore::WorkerFontLoadRequest::setClient): 103 (WebCore::WorkerFontLoadRequest::didReceiveResponse): 104 (WebCore::WorkerFontLoadRequest::didReceiveData): 105 (WebCore::WorkerFontLoadRequest::didFinishLoading): 106 (WebCore::WorkerFontLoadRequest::didFail): 107 * workers/WorkerFontLoadRequest.h: Added. 108 Implement FontLoadRequest for Workers. 109 110 * workers/WorkerGlobalScope.cpp: 111 (WebCore::WorkerGlobalScope::fonts): 112 (WebCore::WorkerGlobalScope::fontLoadRequest): 113 (WebCore::WorkerGlobalScope::beginLoadingFontSoon): 114 * workers/WorkerGlobalScope.h: 115 Implement ScriptExecutionContext font-loading related functions. 116 117 * workers/WorkerGlobalScope.idl: 118 Include FontFaceSource. 119 1 120 2021-04-22 Martin Robinson <mrobinson@webkit.org> 2 121 -
trunk/Source/WebCore/Headers.cmake
r276448 r276450 1658 1658 workers/WorkerAnimationController.h 1659 1659 workers/WorkerDebuggerProxy.h 1660 workers/WorkerFontLoadRequest.h 1660 1661 workers/WorkerLoaderProxy.h 1661 1662 workers/WorkerOrWorkletThread.h -
trunk/Source/WebCore/Sources.txt
r276433 r276450 2657 2657 workers/WorkerConsoleClient.cpp 2658 2658 workers/WorkerEventLoop.cpp 2659 workers/WorkerFontLoadRequest.cpp 2659 2660 workers/WorkerGlobalScope.cpp 2660 2661 workers/WorkerInspectorProxy.cpp -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r276433 r276450 3437 3437 A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */; }; 3438 3438 A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */; }; 3439 A7D6B3490F61104500FF9FD1 /* WorkerFontLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3439 3440 A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; settings = {ATTRIBUTES = (Private, ); }; }; 3440 3441 A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */; }; … … 12857 12858 A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLActiveInfo.h; sourceTree = "<group>"; }; 12858 12859 A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLActiveInfo.h; sourceTree = "<group>"; }; 12860 A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerFontLoadRequest.h; sourceTree = "<group>"; }; 12861 A7D6B3480F61104500FF9FD1 /* WorkerFontLoadRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerFontLoadRequest.cpp; sourceTree = "<group>"; }; 12859 12862 A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptLoader.h; sourceTree = "<group>"; }; 12860 12863 A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptLoader.cpp; sourceTree = "<group>"; }; … … 19428 19431 9B0ABCA323679ACF00B45085 /* WorkerEventLoop.cpp */, 19429 19432 9B0ABCA423679ACF00B45085 /* WorkerEventLoop.h */, 19433 A7D6B3480F61104500FF9FD1 /* WorkerFontLoadRequest.cpp */, 19434 A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */, 19430 19435 2E4346360F546A8200B0F1BA /* WorkerGlobalScope.cpp */, 19431 19436 2E4346370F546A8200B0F1BA /* WorkerGlobalScope.h */, … … 35846 35851 A52B349E1FA41703008B6246 /* WorkerDebuggerProxy.h in Headers */, 35847 35852 91E0DDC4230B41F10019E1E3 /* WorkerDOMDebuggerAgent.h in Headers */, 35853 A7D6B3490F61104500FF9FD1 /* WorkerFontLoadRequest.h in Headers */, 35848 35854 2E4346490F546A8200B0F1BA /* WorkerGlobalScope.h in Headers */, 35849 35855 41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */, -
trunk/Source/WebCore/css/CSSFontFace.cpp
r275817 r276450 397 397 } 398 398 399 FontCache& CSSFontFace::fontCacheFallingBackToSingleton() 400 { 401 if (m_wrapper && m_wrapper->scriptExecutionContext()) 402 return m_wrapper->scriptExecutionContext()->fontCache(); 403 return FontCache::singleton(); 404 } 405 399 406 bool CSSFontFace::computeFailureState() const 400 407 { … … 670 677 case CSSFontFaceSource::Status::Pending: 671 678 case CSSFontFaceSource::Status::Loading: { 679 auto& fontCache = fontCacheFallingBackToSingleton(); 672 680 Font::Visibility visibility = WebCore::visibility(status(), fontLoadTiming()); 673 return Font::create( FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, Font::Interstitial::Yes, visibility);681 return Font::create(fontCache.lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, &fontCache, Font::Interstitial::Yes, visibility); 674 682 } 675 683 case CSSFontFaceSource::Status::Success: -
trunk/Source/WebCore/css/CSSFontFace.h
r273726 r276450 47 47 class CSSValue; 48 48 class CSSValueList; 49 class FontCache; 49 50 class FontDescription; 50 51 class Font; … … 173 174 174 175 Document* document(); 176 FontCache& fontCacheFallingBackToSingleton(); 175 177 176 178 RefPtr<CSSValueList> m_families; -
trunk/Source/WebCore/css/CSSFontFaceSet.cpp
r276295 r276450 113 113 if (m_owningFontSelector->scriptExecutionContext()) 114 114 allowUserInstalledFonts = m_owningFontSelector->scriptExecutionContext()->settingsValues().shouldAllowUserInstalledFonts ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No; 115 Vector<FontSelectionCapabilities> capabilities = FontCache::singleton().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);115 Vector<FontSelectionCapabilities> capabilities = m_owningFontSelector->scriptExecutionContext()->fontCache().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts); 116 116 if (capabilities.isEmpty()) 117 117 return; … … 122 122 123 123 Ref<CSSValueList> familyList = CSSValueList::createCommaSeparated(); 124 familyList->append( CSSValuePool::singleton().createFontFamilyValue(familyName));124 familyList->append(m_owningFontSelector->scriptExecutionContext()->cssValuePool().createFontFamilyValue(familyName)); 125 125 face->setFamilies(familyList.get()); 126 126 face->setFontSelectionCapabilities(item); … … 377 377 for (auto& familyRaw : font->family) { 378 378 AtomString familyAtom; 379 WTF::switchOn(familyRaw, [&] (CSSValueID ident) {380 if ( ident!= CSSValueWebkitBody)381 familyAtom = familyNamesData->at(CSSPropertyParserHelpers::genericFontFamilyIndex( ident));379 WTF::switchOn(familyRaw, [&] (CSSValueID familyKeyword) { 380 if (familyKeyword != CSSValueWebkitBody) 381 familyAtom = familyNamesData->at(CSSPropertyParserHelpers::genericFontFamilyIndex(familyKeyword)); 382 382 else { 383 383 ASSERT(m_owningFontSelector && m_owningFontSelector->scriptExecutionContext()); -
trunk/Source/WebCore/css/CSSFontFaceSource.cpp
r275817 r276450 82 82 m_fontRequest->setClient(this); 83 83 84 if (status() == Status::Pending && !m_fontRequest->is Loading()) {84 if (status() == Status::Pending && !m_fontRequest->isPending()) { 85 85 setStatus(Status::Loading); 86 86 if (!shouldIgnoreFontLoadCompletions()) { -
trunk/Source/WebCore/css/FontFace.cpp
r276017 r276450 63 63 } 64 64 65 Ref<FontFace> FontFace::create(Document& document, const String& family, Source&& source, const Descriptors& descriptors) 66 { 67 auto result = adoptRef(*new FontFace(document.fontSelector())); 65 Ref<FontFace> FontFace::create(ScriptExecutionContext& context, const String& family, Source&& source, const Descriptors& descriptors) 66 { 67 ASSERT(context.cssFontSelector()); 68 auto result = adoptRef(*new FontFace(*context.cssFontSelector())); 68 69 result->suspendIfNeeded(); 69 70 70 71 bool dataRequiresAsynchronousLoading = true; 71 72 72 auto setFamilyResult = result->setFamily( document, family);73 auto setFamilyResult = result->setFamily(context, family); 73 74 if (setFamilyResult.hasException()) { 74 75 result->setErrorState(); … … 78 79 auto sourceConversionResult = WTF::switchOn(source, 79 80 [&] (String& string) -> ExceptionOr<void> { 80 auto value = CSSPropertyParserWorkerSafe::parseFontFaceSrc(string, CSSParserContext(document));81 auto value = CSSPropertyParserWorkerSafe::parseFontFaceSrc(string, is<Document>(context) ? CSSParserContext(downcast<Document>(context)) : HTMLStandardMode); 81 82 if (!value) 82 83 return Exception { SyntaxError }; 83 CSSFontFace::appendSources(result->backing(), *value, & document, false);84 CSSFontFace::appendSources(result->backing(), *value, &context, false); 84 85 return { }; 85 86 }, … … 102 103 103 104 // These ternaries match the default strings inside the FontFaceDescriptors dictionary inside FontFace.idl. 104 auto setStyleResult = result->setStyle( document, descriptors.style.isEmpty() ? "normal"_s : descriptors.style);105 auto setStyleResult = result->setStyle(context, descriptors.style.isEmpty() ? "normal"_s : descriptors.style); 105 106 if (setStyleResult.hasException()) { 106 107 result->setErrorState(); 107 108 return result; 108 109 } 109 auto setWeightResult = result->setWeight( document, descriptors.weight.isEmpty() ? "normal"_s : descriptors.weight);110 auto setWeightResult = result->setWeight(context, descriptors.weight.isEmpty() ? "normal"_s : descriptors.weight); 110 111 if (setWeightResult.hasException()) { 111 112 result->setErrorState(); 112 113 return result; 113 114 } 114 auto setStretchResult = result->setStretch( document, descriptors.stretch.isEmpty() ? "normal"_s : descriptors.stretch);115 auto setStretchResult = result->setStretch(context, descriptors.stretch.isEmpty() ? "normal"_s : descriptors.stretch); 115 116 if (setStretchResult.hasException()) { 116 117 result->setErrorState(); 117 118 return result; 118 119 } 119 auto setUnicodeRangeResult = result->setUnicodeRange( document, descriptors.unicodeRange.isEmpty() ? "U+0-10FFFF"_s : descriptors.unicodeRange);120 auto setUnicodeRangeResult = result->setUnicodeRange(context, descriptors.unicodeRange.isEmpty() ? "U+0-10FFFF"_s : descriptors.unicodeRange); 120 121 if (setUnicodeRangeResult.hasException()) { 121 122 result->setErrorState(); 122 123 return result; 123 124 } 124 auto setFeatureSettingsResult = result->setFeatureSettings( document, descriptors.featureSettings.isEmpty() ? "normal"_s : descriptors.featureSettings);125 auto setFeatureSettingsResult = result->setFeatureSettings(context, descriptors.featureSettings.isEmpty() ? "normal"_s : descriptors.featureSettings); 125 126 if (setFeatureSettingsResult.hasException()) { 126 127 result->setErrorState(); 127 128 return result; 128 129 } 129 auto setDisplayResult = result->setDisplay( document, descriptors.display.isEmpty() ? "auto"_s : descriptors.display);130 auto setDisplayResult = result->setDisplay(context, descriptors.display.isEmpty() ? "auto"_s : descriptors.display); 130 131 if (setDisplayResult.hasException()) { 131 132 result->setErrorState(); … … 400 401 } 401 402 402 String FontFace::display( ) const403 String FontFace::display(ScriptExecutionContext& context) const 403 404 { 404 405 m_backing->updateStyleIfNeeded(); … … 406 407 if (!loadingBehaviorWrapped.hasValue()) 407 408 return "auto"_s; 408 return CSSValuePool::singleton().createValue(loadingBehaviorWrapped.value())->cssText();409 return context.cssValuePool().createValue(loadingBehaviorWrapped.value())->cssText(); 409 410 } 410 411 -
trunk/Source/WebCore/css/FontFace.h
r276017 r276450 55 55 56 56 using Source = Variant<String, RefPtr<JSC::ArrayBuffer>, RefPtr<JSC::ArrayBufferView>>; 57 static Ref<FontFace> create( Document&, const String& family, Source&&, const Descriptors&);57 static Ref<FontFace> create(ScriptExecutionContext&, const String& family, Source&&, const Descriptors&); 58 58 static Ref<FontFace> create(ScriptExecutionContext*, CSSFontFace&); 59 59 virtual ~FontFace(); … … 73 73 String unicodeRange() const; 74 74 String featureSettings() const; 75 String display( ) const;75 String display(ScriptExecutionContext&) const; 76 76 77 77 enum class LoadStatus { Unloaded, Loading, Loaded, Error }; -
trunk/Source/WebCore/css/FontFace.idl
r276017 r276450 44 44 [ 45 45 ActiveDOMObject, 46 Exposed= Window46 Exposed=(Window,Worker) 47 47 ] interface FontFace { 48 [CallWith= Document] constructor(DOMString family, (DOMString or BinaryData) source, optional FontFaceDescriptors descriptors);48 [CallWith=ScriptExecutionContext] constructor(DOMString family, (DOMString or BinaryData) source, optional FontFaceDescriptors descriptors); 49 49 50 50 [SetterCallWith=ScriptExecutionContext] attribute DOMString family; … … 54 54 [SetterCallWith=ScriptExecutionContext] attribute DOMString unicodeRange; 55 55 [SetterCallWith=ScriptExecutionContext] attribute DOMString featureSettings; 56 [ SetterCallWith=ScriptExecutionContext] attribute DOMString display;56 [CallWith=ScriptExecutionContext] attribute DOMString display; 57 57 58 58 readonly attribute FontFaceLoadStatus status; -
trunk/Source/WebCore/css/FontFaceSet.idl
r274832 r276450 31 31 [ 32 32 ActiveDOMObject, 33 Exposed= Window33 Exposed=(Window,Worker) 34 34 ] interface FontFaceSet : EventTarget { 35 35 [CallWith=ScriptExecutionContext] constructor(sequence<FontFace> initialFaces); -
trunk/Source/WebCore/loader/FontLoadRequest.h
r275817 r276450 36 36 struct FontSelectionSpecifiedCapabilities; 37 37 38 template <typename T> class FontTaggedSettings;39 using FontFeatureSettings = FontTaggedSettings<int>;40 41 38 class FontLoadRequestClient { 42 39 public: … … 50 47 51 48 virtual const URL& url() const = 0; 49 virtual bool isPending() const = 0; 52 50 virtual bool isLoading() const = 0; 53 51 virtual bool errorOccurred() const = 0; … … 59 57 60 58 virtual bool isCachedFontLoadRequest() const { return false; } 59 virtual bool isWorkerFontLoadRequest() const { return false; } 61 60 }; 62 61 -
trunk/Source/WebCore/loader/cache/CachedFont.cpp
r273094 r276450 105 105 std::unique_ptr<FontCustomPlatformData> CachedFont::createCustomFontData(SharedBuffer& bytes, const String& itemInCollection, bool& wrapping) 106 106 { 107 wrapping = true; 108 109 #if !PLATFORM(COCOA) 110 if (isWOFF(bytes)) { 111 wrapping = false; 112 Vector<char> convertedFont; 113 if (!convertWOFFToSfnt(bytes, convertedFont)) 114 return nullptr; 115 116 auto buffer = SharedBuffer::create(WTFMove(convertedFont)); 117 return createFontCustomPlatformData(buffer, itemInCollection); 118 } 119 #endif 120 121 return createFontCustomPlatformData(bytes, itemInCollection); 107 auto buffer = makeRefPtr(bytes); 108 wrapping = !convertWOFFToSfntIfNecessary(buffer); 109 return buffer ? createFontCustomPlatformData(*buffer, itemInCollection) : nullptr; 122 110 } 123 111 -
trunk/Source/WebCore/loader/cache/CachedFontLoadRequest.h
r276384 r276450 52 52 private: 53 53 const URL& url() const final { return m_font->url(); } 54 bool isPending() const final { return m_font->status() == CachedResource::Status::Pending; } 54 55 bool isLoading() const final { return m_font->isLoading(); } 55 56 bool errorOccurred() const final { return m_font->errorOccurred(); } -
trunk/Source/WebCore/platform/graphics/Font.cpp
r275650 r276450 59 59 DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Font); 60 60 61 Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic) 61 Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> identifier) 62 { 63 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, nullptr)); 64 } 65 66 Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, FontCache* fontCacheForVerticalData, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> identifier) 67 { 68 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, fontCacheForVerticalData)); 69 } 70 71 Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* fontCacheForVerticalData) 62 72 { 63 73 bool wrapping; … … 65 75 FontDescription description; 66 76 description.setComputedSize(fontSize); 67 return Font::create(CachedFont::platformDataFromCustomData(*customFontData, description, syntheticBold, syntheticItalic, { }, { }), origin );68 } 69 70 Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> renderingResourceIdentifier )77 return Font::create(CachedFont::platformDataFromCustomData(*customFontData, description, syntheticBold, syntheticItalic, { }, { }), origin, fontCacheForVerticalData); 78 } 79 80 Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> renderingResourceIdentifier, FontCache* fontCacheForVerticalData) 71 81 : m_platformData(platformData) 72 82 , m_renderingResourceIdentifier(renderingResourceIdentifier) … … 89 99 #if ENABLE(OPENTYPE_VERTICAL) 90 100 if (platformData.orientation() == FontOrientation::Vertical && orientationFallback == OrientationFallback::No) { 91 m_verticalData = FontCache::singleton().verticalData(platformData);101 m_verticalData = fontCacheForVerticalData ? fontCacheForVerticalData->verticalData(platformData) : FontCache::singleton().verticalData(platformData); 92 102 m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVerticalMetrics(); 93 103 } 104 #else 105 UNUSED_PARAM(fontCacheForVerticalData); 94 106 #endif 95 107 } … … 569 581 } 570 582 571 RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont ) const583 RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont, FontCache& fontCache) const 572 584 { 573 585 auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap()); … … 575 587 if (!character) { 576 588 UChar codeUnit = 0; 577 return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1);589 return fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1); 578 590 } 579 591 … … 590 602 codeUnitsLength = 2; 591 603 } 592 auto font = FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get();604 auto font = fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get(); 593 605 if (font) 594 606 font->m_isUsedInSystemFallbackCache = true; -
trunk/Source/WebCore/platform/graphics/Font.h
r275650 r276450 58 58 namespace WebCore { 59 59 60 class FontCache; 60 61 class GlyphPage; 61 62 class FontDescription; … … 93 94 No 94 95 }; 95 static Ref<Font> create(const FontPlatformData& platformData, Origin origin = Origin::Local, Interstitial interstitial = Interstitial::No, 96 Visibility visibility = Visibility::Visible, OrientationFallback orientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> identifier = WTF::nullopt) 97 { 98 return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier)); 99 } 100 WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic); 96 WEBCORE_EXPORT static Ref<Font> create(const FontPlatformData&, Origin = Origin::Local, Interstitial = Interstitial::No, 97 Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> = WTF::nullopt); 98 static Ref<Font> create(const FontPlatformData&, Origin, FontCache* fontCacheForVerticalData, Interstitial = Interstitial::No, 99 Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> = WTF::nullopt); 100 WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* = nullptr); 101 101 102 102 WEBCORE_EXPORT ~Font(); … … 190 190 bool platformSupportsCodePoint(UChar32, Optional<UChar32> variation = WTF::nullopt) const; 191 191 192 RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont ) const;192 RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont, FontCache&) const; 193 193 194 194 const GlyphPage* glyphPage(unsigned pageNumber) const; … … 233 233 234 234 private: 235 WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, Optional<RenderingResourceIdentifier> );235 WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, Optional<RenderingResourceIdentifier>, FontCache*); 236 236 237 237 void platformInit(); -
trunk/Source/WebCore/platform/graphics/FontCache.cpp
r275650 r276450 281 281 282 282 auto addResult = m_fontDataCaches->data.ensure(platformData, [&] { 283 return Font::create(platformData );283 return Font::create(platformData, Font::Origin::Local, this); 284 284 }); 285 285 -
trunk/Source/WebCore/platform/graphics/FontCache.h
r275650 r276450 221 221 static Ref<FontCache> create(); 222 222 WEBCORE_EXPORT static FontCache& singleton(); 223 static FontCache& fontCacheFall backToSingleton(RefPtr<FontSelector>);223 static FontCache& fontCacheFallingBackToSingleton(RefPtr<FontSelector>); 224 224 225 225 ~FontCache(); … … 379 379 } 380 380 381 inline FontCache& FontCache::fontCacheFall backToSingleton(RefPtr<FontSelector> fontSelector)381 inline FontCache& FontCache::fontCacheFallingBackToSingleton(RefPtr<FontSelector> fontSelector) 382 382 { 383 383 return fontSelector ? fontSelector->fontCache() : FontCache::singleton(); -
trunk/Source/WebCore/platform/graphics/FontCascade.cpp
r275639 r276450 171 171 void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const 172 172 { 173 FontCache::fontCacheFall backToSingleton(fontSelector).updateFontCascade(*this, WTFMove(fontSelector));173 FontCache::fontCacheFallingBackToSingleton(fontSelector).updateFontCascade(*this, WTFMove(fontSelector)); 174 174 } 175 175 -
trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp
r275420 r276450 103 103 , m_fontSelector(fontSelector) 104 104 , m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0) 105 , m_generation(FontCache::fontCacheFall backToSingleton(m_fontSelector).generation())105 , m_generation(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).generation()) 106 106 { 107 107 #if ASSERT_ENABLED … … 145 145 ASSERT(index < description.effectiveFamilyCount()); 146 146 147 auto& fontCache = FontCache::fontCacheFall backToSingleton(fontSelector);147 auto& fontCache = FontCache::fontCacheFallingBackToSingleton(fontSelector); 148 148 while (index < description.effectiveFamilyCount()) { 149 149 auto visitor = WTF::makeVisitor([&](const AtomString& family) -> FontRanges { … … 182 182 183 183 ASSERT(index == m_realizedFallbackRanges.size()); 184 ASSERT(FontCache::fontCacheFall backToSingleton(m_fontSelector).generation() == m_generation);184 ASSERT(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).generation() == m_generation); 185 185 186 186 m_realizedFallbackRanges.append(FontRanges()); … … 190 190 fontRanges = realizeNextFallback(description, m_lastRealizedFallbackIndex, m_fontSelector.get()); 191 191 if (fontRanges.isNull() && m_fontSelector) 192 fontRanges = m_fontSelector->fontRangesForFamily(description, standardFamily);192 fontRanges = m_fontSelector->fontRangesForFamily(description, familyNamesData->at(FamilyNamesIndex::StandardFamily)); 193 193 if (fontRanges.isNull()) 194 fontRanges = FontRanges(FontCache::fontCacheFall backToSingleton(m_fontSelector).lastResortFallbackFont(description));194 fontRanges = FontRanges(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).lastResortFallbackFont(description)); 195 195 return fontRanges; 196 196 } … … 352 352 font = &realizeFallbackRangesAt(description, 0).fontForFirstRange(); 353 353 354 auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No );354 auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No, FontCache::fontCacheFallingBackToSingleton(m_fontSelector)); 355 355 if (!systemFallbackFont) 356 356 return GlyphData(); -
trunk/Source/WebCore/platform/graphics/WOFFFileFormat.cpp
r222960 r276450 283 283 return sfnt.size() == totalSfntSize; 284 284 } 285 285 286 bool convertWOFFToSfntIfNecessary(RefPtr<SharedBuffer>& buffer) 287 { 288 #if PLATFORM(COCOA) 289 UNUSED_PARAM(buffer); 290 return false; 291 #else 292 if (!buffer || !isWOFF(*buffer)) 293 return false; 294 295 Vector<char> convertedFont; 296 if (convertWOFFToSfnt(*buffer, convertedFont)) 297 buffer = SharedBuffer::create(WTFMove(convertedFont)); 298 else 299 buffer = nullptr; 300 301 return true; 302 #endif 303 } 304 286 305 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/WOFFFileFormat.h
r222113 r276450 40 40 bool convertWOFFToSfnt(SharedBuffer& woff, Vector<char>& sfnt); 41 41 42 // If the given buffer is a WOFF file and the current platform has no native support for WOFF 43 // fonts, convert it to sfnt. Returns true if the given buffer was converted. If conversion fails, 44 // the buffer will be set to nullptr. 45 bool convertWOFFToSfntIfNecessary(RefPtr<SharedBuffer>&); 46 42 47 } // namespace WebCore 43 48 -
trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp
r275420 r276450 139 139 } 140 140 141 if (auto systemFallback = FontCache::fontCacheFall backToSingleton(fontSelector()).systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) {141 if (auto systemFallback = FontCache::fontCacheFallingBackToSingleton(fontSelector()).systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) { 142 142 if (systemFallback->canRenderCombiningCharacterSequence(characters, length) && (!preferColoredFont || systemFallback->platformData().isColorBitmapFont())) 143 143 return systemFallback.get(); -
trunk/Source/WebCore/workers/WorkerGlobalScope.cpp
r275817 r276450 35 35 #include "Crypto.h" 36 36 #include "FontCache.h" 37 #include "FontFaceSet.h" 37 38 #include "IDBConnectionProxy.h" 38 39 #include "ImageBitmapOptions.h" … … 46 47 #include "ServiceWorkerGlobalScope.h" 47 48 #include "SocketProvider.h" 49 #include "WorkerFontLoadRequest.h" 48 50 #include "WorkerLoaderProxy.h" 49 51 #include "WorkerLocation.h" … … 522 524 } 523 525 526 Ref<FontFaceSet> WorkerGlobalScope::fonts() 527 { 528 ASSERT(cssFontSelector()); 529 return cssFontSelector()->fontFaceSet(); 530 } 531 532 std::unique_ptr<FontLoadRequest> WorkerGlobalScope::fontLoadRequest(String& url, bool, bool, LoadedFromOpaqueSource loadedFromOpaqueSource) 533 { 534 return makeUnique<WorkerFontLoadRequest>(completeURL(url), loadedFromOpaqueSource); 535 } 536 537 void WorkerGlobalScope::beginLoadingFontSoon(FontLoadRequest& request) 538 { 539 ASSERT(is<WorkerFontLoadRequest>(request)); 540 downcast<WorkerFontLoadRequest>(request).load(*this); 541 } 542 524 543 ReferrerPolicy WorkerGlobalScope::referrerPolicy() const 525 544 { -
trunk/Source/WebCore/workers/WorkerGlobalScope.h
r276017 r276450 52 52 class ContentSecurityPolicyResponseHeaders; 53 53 class Crypto; 54 class FontFaceSet; 54 55 class Performance; 55 56 class ScheduledAction; … … 125 126 CSSFontSelector* cssFontSelector() final; 126 127 FontCache& fontCache() final; 128 Ref<FontFaceSet> fonts(); 129 std::unique_ptr<FontLoadRequest> fontLoadRequest(String& url, bool isSVG, bool isInitiatingElementInUserAgentShadowTree, LoadedFromOpaqueSource) final; 130 void beginLoadingFontSoon(FontLoadRequest&) final; 127 131 128 132 ReferrerPolicy referrerPolicy() const final; -
trunk/Source/WebCore/workers/WorkerGlobalScope.idl
r274832 r276450 49 49 50 50 WorkerGlobalScope includes WindowOrWorkerGlobalScope; 51 WorkerGlobalScope includes FontFaceSource;
Note: See TracChangeset
for help on using the changeset viewer.