Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,47 @@
+2021-04-22 Chris Lord <[email protected]>
+
+ Implement FontFace in Workers for OffscreenCanvas
+ https://bugs.webkit.org/show_bug.cgi?id=224178
+ <rdar://problem/76529024>
+
+ Reviewed by Darin Adler.
+
+ FontFace is now available for Workers, rebaseline related tests.
+
+ * web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt:
+ * web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt:
+
2021-04-22 Imanol Fernandez <[email protected]>
Implement WebXR Input Sources
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-font-loading/fontfaceset-load-css-wide-keywords-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,13 +1,10 @@
-CONSOLE MESSAGE: TypeError: undefined is not an object (evaluating 'self.fonts.load')
-Harness Error (FAIL), message = TypeError: undefined is not an object (evaluating 'self.fonts.load')
-
PASS Loading CSS-wide keyword "initial" causes SyntaxError (document)
PASS Loading CSS-wide keyword "inherit" causes SyntaxError (document)
PASS Loading CSS-wide keyword "unset" causes SyntaxError (document)
PASS Loading CSS-wide keyword "revert" causes SyntaxError (document)
-TIMEOUT Loading CSS-wide keyword "initial" causes SyntaxError (worker) Test timed out
-NOTRUN Loading CSS-wide keyword "inherit" causes SyntaxError (worker)
-NOTRUN Loading CSS-wide keyword "unset" causes SyntaxError (worker)
-NOTRUN Loading CSS-wide keyword "revert" causes SyntaxError (worker)
+PASS Loading CSS-wide keyword "initial" causes SyntaxError (worker)
+PASS Loading CSS-wide keyword "inherit" causes SyntaxError (worker)
+PASS Loading CSS-wide keyword "unset" causes SyntaxError (worker)
+PASS Loading CSS-wide keyword "revert" causes SyntaxError (worker)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.center.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign center is the center of the em squares (not the bounding box) Can't find variable: FontFace
+PASS textAlign center is the center of the em squares (not the bounding box)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.ltr.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign end with ltr is the right edge Can't find variable: FontFace
+PASS textAlign end with ltr is the right edge
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.end.rtl.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign end with rtl is the left edge Can't find variable: FontFace
+PASS textAlign end with rtl is the left edge
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.left.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign left is the left of the first em square (not the bounding box) Can't find variable: FontFace
+PASS textAlign left is the left of the first em square (not the bounding box)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.right.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign right is the right of the last em square (not the bounding box) Can't find variable: FontFace
+PASS textAlign right is the right of the last em square (not the bounding box)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.ltr.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign start with ltr is the left edge Can't find variable: FontFace
+PASS textAlign start with ltr is the left edge
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.align.start.rtl.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textAlign start with rtl is the right edge Can't find variable: FontFace
+PASS textAlign start with rtl is the right edge
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.alphabetic.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL 2d Can't find variable: FontFace
+PASS 2d
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.bottom.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textBaseline bottom is the bottom of the em square (not the bounding box) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.hanging.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL 2d Can't find variable: FontFace
+FAIL 2d assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.ideographic.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL 2d Can't find variable: FontFace
+FAIL 2d assert_approx_equals: Red channel of the pixel at (5, 5) expected 0 +/- 2 but got 255
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.middle.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textBaseline middle is the middle of the em square (not the bounding box) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.baseline.top.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL textBaseline top is the top of the em square (not the bounding box) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.bound.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL fillText handles maxWidth based on line size, not bounding box size Can't find variable: FontFace
+PASS fillText handles maxWidth based on line size, not bounding box size
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fill.maxWidth.fontface.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL fillText works on @font-face fonts Can't find variable: FontFace
+PASS fillText works on @font-face fonts
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.notinpage.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL @font-face fonts should work even if they are not used in the page Can't find variable: FontFace
+PASS @font-face fonts should work even if they are not used in the page
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.repeat.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-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
+PASS Draw with the font immediately, then wait a bit until and draw again. (This crashes some version of WebKit.)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.fontface.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL 2d Can't find variable: FontFace
+PASS 2d
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.basic.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL U+0020 is rendered the correct size (1em wide) Can't find variable: FontFace
+PASS U+0020 is rendered the correct size (1em wide)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.end.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Space characters at the end of a line are collapsed (per CSS) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.nonspace.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Non-space characters are not converted to U+0020 and collapsed Can't find variable: FontFace
+PASS Non-space characters are not converted to U+0020 and collapsed
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.other.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Space characters are converted to U+0020, and collapsed (per CSS) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.space.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Space characters are converted to U+0020, and collapsed (per CSS) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.draw.space.collapse.start.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Space characters at the start of a line are collapsed (per CSS) Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.actualBoundingBox.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Testing actualBoundingBox for OffscreenCanvas Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.advances.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Testing width advances for OffscreenCanvas Can't find variable: FontFace
+FAIL Testing width advances for OffscreenCanvas undefined is not an object (evaluating 'ctx.measureText('Hello').advances[0]')
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.baselines.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Testing baselines for OffscreenCanvas Can't find variable: FontFace
+FAIL Testing baselines for OffscreenCanvas ctx.measureText('A').getBaselines is not a function. (In 'ctx.measureText('A').getBaselines()', 'ctx.measureText('A').getBaselines' is undefined)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.emHeights.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Testing emHeights for OffscreenCanvas Can't find variable: FontFace
+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
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.fontBoundingBox.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Testing fontBoundingBox for OffscreenCanvas Can't find variable: FontFace
+PASS Testing fontBoundingBox for OffscreenCanvas
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.basic.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL The width of character is same as font used for OffscreenCanvas Can't find variable: FontFace
+PASS The width of character is same as font used for OffscreenCanvas
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.empty.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL The empty string has zero width for OffscreenCanvas Can't find variable: FontFace
+PASS The empty string has zero width for OffscreenCanvas
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt (276449 => 276450)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/canvas/offscreen/text/2d.text.measure.width.space.worker-expected.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,3 @@
-FAIL Space characters are converted to U+0020 and collapsed (per CSS) for OffscreenCanvas Can't find variable: FontFace
+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
Modified: trunk/Source/WebCore/ChangeLog (276449 => 276450)
--- trunk/Source/WebCore/ChangeLog 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/ChangeLog 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1,3 +1,122 @@
+2021-04-22 Chris Lord <[email protected]>
+
+ Implement FontFace in Workers for OffscreenCanvas
+ https://bugs.webkit.org/show_bug.cgi?id=224178
+ <rdar://problem/76529024>
+
+ Reviewed by Darin Adler.
+
+ To comply with spec and complete the OffscreenCanvas implementation,
+ FontFace needs to be made available on WorkerGlobalScope. This patch
+ makes it available and fixes crashes using it due to accessing
+ main-thread only singletons.
+
+ No new tests, rebaselined existing tests.
+
+ * Headers.cmake:
+ * Sources.txt:
+ * WebCore.xcodeproj/project.pbxproj:
+ Add new files WorkerFontLoadRequest.cpp, WorkerFontLoadRequest.h
+
+ * css/CSSFontFace.cpp:
+ (WebCore::CSSFontFace::fontCacheFallingBackToSingleton):
+ (WebCore::CSSFontFace::font):
+ * css/CSSFontFace.h:
+ Use the ScriptExecutionContext's FontCache if possible when loading fonts.
+
+ * css/CSSFontFaceSet.cpp:
+ (WebCore::CSSFontFaceSet::ensureLocalFontFacesForFamilyRegistered):
+ (WebCore::CSSFontFaceSet::matchingFacesExcludingPreinstalledFonts):
+ Use the correct CSSValuePool and FontCache in
+ ensureLocalFontFacesForFamilyRegistered. Also clarify a vaguely-named
+ variable.
+
+ * css/CSSFontFaceSource.cpp:
+ (WebCore::CSSFontFaceSource::CSSFontFaceSource):
+ Use FontLoadRequest::isPending instead of making assumptions about the
+ request state on construction.
+
+ * css/FontFace.cpp:
+ (WebCore::FontFace::create):
+ (WebCore::FontFace::display const):
+ * css/FontFace.h:
+ * css/FontFace.idl:
+ Construct with a ScriptExecutionContext instead of a Document and
+ make available for Workers.
+
+ * css/FontFaceSet.idl:
+ Expose to Workers.
+
+ * loader/FontLoadRequest.h:
+ (WebCore::FontLoadRequest::isWorkerFontLoadRequest const):
+ Add isPending function and new type WorkerFontLoadRequest.
+
+ * loader/cache/CachedFont.cpp:
+ (WebCore::CachedFont::createCustomFontData):
+ Use convertWOFFToSfntIfNecessary().
+
+ * loader/cache/CachedFontLoadRequest.h:
+ Implement FontLoadRequest::isPending.
+
+ * platform/graphics/Font.cpp:
+ (WebCore::Font::create):
+ (WebCore::Font::Font):
+ (WebCore::Font::systemFallbackFontForCharacter const):
+ * platform/graphics/Font.h:
+ Add an optional FontCache parameter for use with vertical font data
+ retrieval and add a FontCache parameter to
+ systemFallbackFontForCharacter instead of using the singleton.
+
+ * platform/graphics/FontCache.cpp:
+ (WebCore::FontCache::fontForPlatformData):
+ Pass FontCache parameter when creating fonts.
+
+ * platform/graphics/FontCache.h:
+ (WebCore::FontCache::fontCacheFallingBackToSingleton):
+ * platform/graphics/FontCascade.cpp:
+ (WebCore::FontCascade::update const):
+ * platform/graphics/cairo/FontCairoHarfbuzzNG.cpp:
+ (WebCore::FontCascade::fontForCombiningCharacterSequence const):
+ Rename fontCacheFallbackToSingleton -> fontCacheFallingBackToSingleton
+
+ * platform/graphics/FontCascadeFonts.cpp:
+ (WebCore::FontCascadeFonts::realizeFallbackRangesAt):
+ (WebCore::FontCascadeFonts::glyphDataForSystemFallback):
+ Use familyNamesData instead of familyNames and pass the FontCache
+ parameter when calling glyphDataForSystemFallback to make this safe
+ to use in a Worker.
+
+ * platform/graphics/FontTaggedSettings.h:
+ Add missing wtf/Hasher.h include.
+
+ * platform/graphics/WOFFFileFormat.cpp:
+ (WebCore::convertWOFFToSfntIfNecessary):
+ * platform/graphics/WOFFFileFormat.h:
+ Add utility function to convert WOFF fonts on non-Cocoa platforms.
+
+ * workers/WorkerFontLoadRequest.cpp: Added.
+ (WebCore::WorkerFontLoadRequest::WorkerFontLoadRequest):
+ (WebCore::WorkerFontLoadRequest::load):
+ (WebCore::WorkerFontLoadRequest::ensureCustomFontData):
+ (WebCore::WorkerFontLoadRequest::createFont):
+ (WebCore::WorkerFontLoadRequest::setClient):
+ (WebCore::WorkerFontLoadRequest::didReceiveResponse):
+ (WebCore::WorkerFontLoadRequest::didReceiveData):
+ (WebCore::WorkerFontLoadRequest::didFinishLoading):
+ (WebCore::WorkerFontLoadRequest::didFail):
+ * workers/WorkerFontLoadRequest.h: Added.
+ Implement FontLoadRequest for Workers.
+
+ * workers/WorkerGlobalScope.cpp:
+ (WebCore::WorkerGlobalScope::fonts):
+ (WebCore::WorkerGlobalScope::fontLoadRequest):
+ (WebCore::WorkerGlobalScope::beginLoadingFontSoon):
+ * workers/WorkerGlobalScope.h:
+ Implement ScriptExecutionContext font-loading related functions.
+
+ * workers/WorkerGlobalScope.idl:
+ Include FontFaceSource.
+
2021-04-22 Martin Robinson <[email protected]>
[GTK] Turn on editable <input type=date> and <input type=time> fields
Modified: trunk/Source/WebCore/Headers.cmake (276449 => 276450)
--- trunk/Source/WebCore/Headers.cmake 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/Headers.cmake 2021-04-22 18:44:49 UTC (rev 276450)
@@ -1657,6 +1657,7 @@
workers/ScriptBuffer.h
workers/WorkerAnimationController.h
workers/WorkerDebuggerProxy.h
+ workers/WorkerFontLoadRequest.h
workers/WorkerLoaderProxy.h
workers/WorkerOrWorkletThread.h
workers/WorkerRunLoop.h
Modified: trunk/Source/WebCore/Sources.txt (276449 => 276450)
--- trunk/Source/WebCore/Sources.txt 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/Sources.txt 2021-04-22 18:44:49 UTC (rev 276450)
@@ -2656,6 +2656,7 @@
workers/WorkerAnimationController.cpp
workers/WorkerConsoleClient.cpp
workers/WorkerEventLoop.cpp
+workers/WorkerFontLoadRequest.cpp
workers/WorkerGlobalScope.cpp
workers/WorkerInspectorProxy.cpp
workers/WorkerLocation.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (276449 => 276450)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2021-04-22 18:44:49 UTC (rev 276450)
@@ -3436,6 +3436,7 @@
A7CFB3D20B7ED10A0070C32D /* DragImage.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CFB3D00B7ED10A0070C32D /* DragImage.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */; };
A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */; };
+ A7D6B3490F61104500FF9FD1 /* WorkerFontLoadRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7D6B3490F61104500B79FD1 /* WorkerScriptLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */; settings = {ATTRIBUTES = (Private, ); }; };
A7DBF8DE1276919C006B6008 /* TextCheckingHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7DBF8DC1276919C006B6008 /* TextCheckingHelper.h */; };
A80D67080E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h in Headers */ = {isa = PBXBuildFile; fileRef = A80D67070E9E9DEB00E420F0 /* GraphicsContextPlatformPrivateCG.h */; };
@@ -12856,6 +12857,8 @@
A7D20F60107F406900A80392 /* JSWebGLActiveInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLActiveInfo.cpp; sourceTree = "<group>"; };
A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLActiveInfo.h; sourceTree = "<group>"; };
A7D20F6B107F438B00A80392 /* WebGLActiveInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebGLActiveInfo.h; sourceTree = "<group>"; };
+ A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerFontLoadRequest.h; sourceTree = "<group>"; };
+ A7D6B3480F61104500FF9FD1 /* WorkerFontLoadRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerFontLoadRequest.cpp; sourceTree = "<group>"; };
A7D6B3470F61104500B79FD1 /* WorkerScriptLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WorkerScriptLoader.h; sourceTree = "<group>"; };
A7D6B3480F61104500B79FD1 /* WorkerScriptLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WorkerScriptLoader.cpp; sourceTree = "<group>"; };
A7DBF8DB1276919C006B6008 /* TextCheckingHelper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCheckingHelper.cpp; sourceTree = "<group>"; };
@@ -19427,6 +19430,8 @@
A52B349C1FA416F8008B6246 /* WorkerDebuggerProxy.h */,
9B0ABCA323679ACF00B45085 /* WorkerEventLoop.cpp */,
9B0ABCA423679ACF00B45085 /* WorkerEventLoop.h */,
+ A7D6B3480F61104500FF9FD1 /* WorkerFontLoadRequest.cpp */,
+ A7D6B3470F61104500FF9FD1 /* WorkerFontLoadRequest.h */,
2E4346360F546A8200B0F1BA /* WorkerGlobalScope.cpp */,
2E4346370F546A8200B0F1BA /* WorkerGlobalScope.h */,
2E4346380F546A8200B0F1BA /* WorkerGlobalScope.idl */,
@@ -35845,6 +35850,7 @@
A5B81CCE1FAA44DE0037D1E6 /* WorkerDebuggerAgent.h in Headers */,
A52B349E1FA41703008B6246 /* WorkerDebuggerProxy.h in Headers */,
91E0DDC4230B41F10019E1E3 /* WorkerDOMDebuggerAgent.h in Headers */,
+ A7D6B3490F61104500FF9FD1 /* WorkerFontLoadRequest.h in Headers */,
2E4346490F546A8200B0F1BA /* WorkerGlobalScope.h in Headers */,
41D129CE1F3D0EF600D15E47 /* WorkerGlobalScopeCaches.h in Headers */,
2E43464B0F546A8200B0F1BA /* WorkerGlobalScopeProxy.h in Headers */,
Modified: trunk/Source/WebCore/css/CSSFontFace.cpp (276449 => 276450)
--- trunk/Source/WebCore/css/CSSFontFace.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/CSSFontFace.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -396,6 +396,13 @@
return nullptr;
}
+FontCache& CSSFontFace::fontCacheFallingBackToSingleton()
+{
+ if (m_wrapper && m_wrapper->scriptExecutionContext())
+ return m_wrapper->scriptExecutionContext()->fontCache();
+ return FontCache::singleton();
+}
+
bool CSSFontFace::computeFailureState() const
{
if (status() == Status::Failure)
@@ -669,8 +676,9 @@
switch (source->status()) {
case CSSFontFaceSource::Status::Pending:
case CSSFontFaceSource::Status::Loading: {
+ auto& fontCache = fontCacheFallingBackToSingleton();
Font::Visibility visibility = WebCore::visibility(status(), fontLoadTiming());
- return Font::create(FontCache::singleton().lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, Font::Interstitial::Yes, visibility);
+ return Font::create(fontCache.lastResortFallbackFont(fontDescription)->platformData(), Font::Origin::Local, &fontCache, Font::Interstitial::Yes, visibility);
}
case CSSFontFaceSource::Status::Success:
if (auto result = source->font(fontDescription, syntheticBold, syntheticItalic, m_featureSettings, m_fontSelectionCapabilities))
Modified: trunk/Source/WebCore/css/CSSFontFace.h (276449 => 276450)
--- trunk/Source/WebCore/css/CSSFontFace.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/CSSFontFace.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -46,6 +46,7 @@
class CSSSegmentedFontFace;
class CSSValue;
class CSSValueList;
+class FontCache;
class FontDescription;
class Font;
class FontFace;
@@ -172,6 +173,7 @@
void timeoutFired();
Document* document();
+ FontCache& fontCacheFallingBackToSingleton();
RefPtr<CSSValueList> m_families;
Vector<UnicodeRange> m_ranges;
Modified: trunk/Source/WebCore/css/CSSFontFaceSet.cpp (276449 => 276450)
--- trunk/Source/WebCore/css/CSSFontFaceSet.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/CSSFontFaceSet.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -112,7 +112,7 @@
AllowUserInstalledFonts allowUserInstalledFonts = AllowUserInstalledFonts::Yes;
if (m_owningFontSelector->scriptExecutionContext())
allowUserInstalledFonts = m_owningFontSelector->scriptExecutionContext()->settingsValues().shouldAllowUserInstalledFonts ? AllowUserInstalledFonts::Yes : AllowUserInstalledFonts::No;
- Vector<FontSelectionCapabilities> capabilities = FontCache::singleton().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);
+ Vector<FontSelectionCapabilities> capabilities = m_owningFontSelector->scriptExecutionContext()->fontCache().getFontSelectionCapabilitiesInFamily(familyName, allowUserInstalledFonts);
if (capabilities.isEmpty())
return;
@@ -121,7 +121,7 @@
Ref<CSSFontFace> face = CSSFontFace::create(m_owningFontSelector.get(), nullptr, nullptr, true);
Ref<CSSValueList> familyList = CSSValueList::createCommaSeparated();
- familyList->append(CSSValuePool::singleton().createFontFamilyValue(familyName));
+ familyList->append(m_owningFontSelector->scriptExecutionContext()->cssValuePool().createFontFamilyValue(familyName));
face->setFamilies(familyList.get());
face->setFontSelectionCapabilities(item);
face->adoptSource(makeUnique<CSSFontFaceSource>(face.get(), familyName));
@@ -376,9 +376,9 @@
Vector<AtomString> familyOrder;
for (auto& familyRaw : font->family) {
AtomString familyAtom;
- WTF::switchOn(familyRaw, [&] (CSSValueID ident) {
- if (ident != CSSValueWebkitBody)
- familyAtom = familyNamesData->at(CSSPropertyParserHelpers::genericFontFamilyIndex(ident));
+ WTF::switchOn(familyRaw, [&] (CSSValueID familyKeyword) {
+ if (familyKeyword != CSSValueWebkitBody)
+ familyAtom = familyNamesData->at(CSSPropertyParserHelpers::genericFontFamilyIndex(familyKeyword));
else {
ASSERT(m_owningFontSelector && m_owningFontSelector->scriptExecutionContext());
familyAtom = m_owningFontSelector->scriptExecutionContext()->settingsValues().fontGenericFamilies.standardFontFamily();
Modified: trunk/Source/WebCore/css/CSSFontFaceSource.cpp (276449 => 276450)
--- trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/CSSFontFaceSource.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -81,7 +81,7 @@
// This may synchronously call fontLoaded().
m_fontRequest->setClient(this);
- if (status() == Status::Pending && !m_fontRequest->isLoading()) {
+ if (status() == Status::Pending && !m_fontRequest->isPending()) {
setStatus(Status::Loading);
if (!shouldIgnoreFontLoadCompletions()) {
if (m_fontRequest->errorOccurred())
Modified: trunk/Source/WebCore/css/FontFace.cpp (276449 => 276450)
--- trunk/Source/WebCore/css/FontFace.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/FontFace.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -62,14 +62,15 @@
m_backing->setErrorState();
}
-Ref<FontFace> FontFace::create(Document& document, const String& family, Source&& source, const Descriptors& descriptors)
+Ref<FontFace> FontFace::create(ScriptExecutionContext& context, const String& family, Source&& source, const Descriptors& descriptors)
{
- auto result = adoptRef(*new FontFace(document.fontSelector()));
+ ASSERT(context.cssFontSelector());
+ auto result = adoptRef(*new FontFace(*context.cssFontSelector()));
result->suspendIfNeeded();
bool dataRequiresAsynchronousLoading = true;
- auto setFamilyResult = result->setFamily(document, family);
+ auto setFamilyResult = result->setFamily(context, family);
if (setFamilyResult.hasException()) {
result->setErrorState();
return result;
@@ -77,10 +78,10 @@
auto sourceConversionResult = WTF::switchOn(source,
[&] (String& string) -> ExceptionOr<void> {
- auto value = CSSPropertyParserWorkerSafe::parseFontFaceSrc(string, CSSParserContext(document));
+ auto value = CSSPropertyParserWorkerSafe::parseFontFaceSrc(string, is<Document>(context) ? CSSParserContext(downcast<Document>(context)) : HTMLStandardMode);
if (!value)
return Exception { SyntaxError };
- CSSFontFace::appendSources(result->backing(), *value, &document, false);
+ CSSFontFace::appendSources(result->backing(), *value, &context, false);
return { };
},
[&] (RefPtr<ArrayBufferView>& arrayBufferView) -> ExceptionOr<void> {
@@ -101,32 +102,32 @@
}
// These ternaries match the default strings inside the FontFaceDescriptors dictionary inside FontFace.idl.
- auto setStyleResult = result->setStyle(document, descriptors.style.isEmpty() ? "normal"_s : descriptors.style);
+ auto setStyleResult = result->setStyle(context, descriptors.style.isEmpty() ? "normal"_s : descriptors.style);
if (setStyleResult.hasException()) {
result->setErrorState();
return result;
}
- auto setWeightResult = result->setWeight(document, descriptors.weight.isEmpty() ? "normal"_s : descriptors.weight);
+ auto setWeightResult = result->setWeight(context, descriptors.weight.isEmpty() ? "normal"_s : descriptors.weight);
if (setWeightResult.hasException()) {
result->setErrorState();
return result;
}
- auto setStretchResult = result->setStretch(document, descriptors.stretch.isEmpty() ? "normal"_s : descriptors.stretch);
+ auto setStretchResult = result->setStretch(context, descriptors.stretch.isEmpty() ? "normal"_s : descriptors.stretch);
if (setStretchResult.hasException()) {
result->setErrorState();
return result;
}
- auto setUnicodeRangeResult = result->setUnicodeRange(document, descriptors.unicodeRange.isEmpty() ? "U+0-10FFFF"_s : descriptors.unicodeRange);
+ auto setUnicodeRangeResult = result->setUnicodeRange(context, descriptors.unicodeRange.isEmpty() ? "U+0-10FFFF"_s : descriptors.unicodeRange);
if (setUnicodeRangeResult.hasException()) {
result->setErrorState();
return result;
}
- auto setFeatureSettingsResult = result->setFeatureSettings(document, descriptors.featureSettings.isEmpty() ? "normal"_s : descriptors.featureSettings);
+ auto setFeatureSettingsResult = result->setFeatureSettings(context, descriptors.featureSettings.isEmpty() ? "normal"_s : descriptors.featureSettings);
if (setFeatureSettingsResult.hasException()) {
result->setErrorState();
return result;
}
- auto setDisplayResult = result->setDisplay(document, descriptors.display.isEmpty() ? "auto"_s : descriptors.display);
+ auto setDisplayResult = result->setDisplay(context, descriptors.display.isEmpty() ? "auto"_s : descriptors.display);
if (setDisplayResult.hasException()) {
result->setErrorState();
return result;
@@ -399,13 +400,13 @@
return list->cssText();
}
-String FontFace::display() const
+String FontFace::display(ScriptExecutionContext& context) const
{
m_backing->updateStyleIfNeeded();
const auto& loadingBehaviorWrapped = m_backing->loadingBehavior();
if (!loadingBehaviorWrapped.hasValue())
return "auto"_s;
- return CSSValuePool::singleton().createValue(loadingBehaviorWrapped.value())->cssText();
+ return context.cssValuePool().createValue(loadingBehaviorWrapped.value())->cssText();
}
auto FontFace::status() const -> LoadStatus
Modified: trunk/Source/WebCore/css/FontFace.h (276449 => 276450)
--- trunk/Source/WebCore/css/FontFace.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/FontFace.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -54,7 +54,7 @@
};
using Source = Variant<String, RefPtr<JSC::ArrayBuffer>, RefPtr<JSC::ArrayBufferView>>;
- static Ref<FontFace> create(Document&, const String& family, Source&&, const Descriptors&);
+ static Ref<FontFace> create(ScriptExecutionContext&, const String& family, Source&&, const Descriptors&);
static Ref<FontFace> create(ScriptExecutionContext*, CSSFontFace&);
virtual ~FontFace();
@@ -72,7 +72,7 @@
String stretch() const;
String unicodeRange() const;
String featureSettings() const;
- String display() const;
+ String display(ScriptExecutionContext&) const;
enum class LoadStatus { Unloaded, Loading, Loaded, Error };
LoadStatus status() const;
Modified: trunk/Source/WebCore/css/FontFace.idl (276449 => 276450)
--- trunk/Source/WebCore/css/FontFace.idl 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/FontFace.idl 2021-04-22 18:44:49 UTC (rev 276450)
@@ -43,9 +43,9 @@
[
ActiveDOMObject,
- Exposed=Window
+ Exposed=(Window,Worker)
] interface FontFace {
- [CallWith=Document] constructor(DOMString family, (DOMString or BinaryData) source, optional FontFaceDescriptors descriptors);
+ [CallWith=ScriptExecutionContext] constructor(DOMString family, (DOMString or BinaryData) source, optional FontFaceDescriptors descriptors);
[SetterCallWith=ScriptExecutionContext] attribute DOMString family;
[SetterCallWith=ScriptExecutionContext] attribute DOMString style;
@@ -53,7 +53,7 @@
[SetterCallWith=ScriptExecutionContext] attribute DOMString stretch;
[SetterCallWith=ScriptExecutionContext] attribute DOMString unicodeRange;
[SetterCallWith=ScriptExecutionContext] attribute DOMString featureSettings;
- [SetterCallWith=ScriptExecutionContext] attribute DOMString display;
+ [CallWith=ScriptExecutionContext] attribute DOMString display;
readonly attribute FontFaceLoadStatus status;
Modified: trunk/Source/WebCore/css/FontFaceSet.idl (276449 => 276450)
--- trunk/Source/WebCore/css/FontFaceSet.idl 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/css/FontFaceSet.idl 2021-04-22 18:44:49 UTC (rev 276450)
@@ -30,7 +30,7 @@
[
ActiveDOMObject,
- Exposed=Window
+ Exposed=(Window,Worker)
] interface FontFaceSet : EventTarget {
[CallWith=ScriptExecutionContext] constructor(sequence<FontFace> initialFaces);
Modified: trunk/Source/WebCore/loader/FontLoadRequest.h (276449 => 276450)
--- trunk/Source/WebCore/loader/FontLoadRequest.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/loader/FontLoadRequest.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -35,9 +35,6 @@
class FontLoadRequest;
struct FontSelectionSpecifiedCapabilities;
-template <typename T> class FontTaggedSettings;
-using FontFeatureSettings = FontTaggedSettings<int>;
-
class FontLoadRequestClient {
public:
virtual ~FontLoadRequestClient() = default;
@@ -49,6 +46,7 @@
virtual ~FontLoadRequest() = default;
virtual const URL& url() const = 0;
+ virtual bool isPending() const = 0;
virtual bool isLoading() const = 0;
virtual bool errorOccurred() const = 0;
@@ -58,6 +56,7 @@
virtual void setClient(FontLoadRequestClient*) = 0;
virtual bool isCachedFontLoadRequest() const { return false; }
+ virtual bool isWorkerFontLoadRequest() const { return false; }
};
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/cache/CachedFont.cpp (276449 => 276450)
--- trunk/Source/WebCore/loader/cache/CachedFont.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/loader/cache/CachedFont.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -104,21 +104,9 @@
std::unique_ptr<FontCustomPlatformData> CachedFont::createCustomFontData(SharedBuffer& bytes, const String& itemInCollection, bool& wrapping)
{
- wrapping = true;
-
-#if !PLATFORM(COCOA)
- if (isWOFF(bytes)) {
- wrapping = false;
- Vector<char> convertedFont;
- if (!convertWOFFToSfnt(bytes, convertedFont))
- return nullptr;
-
- auto buffer = SharedBuffer::create(WTFMove(convertedFont));
- return createFontCustomPlatformData(buffer, itemInCollection);
- }
-#endif
-
- return createFontCustomPlatformData(bytes, itemInCollection);
+ auto buffer = makeRefPtr(bytes);
+ wrapping = !convertWOFFToSfntIfNecessary(buffer);
+ return buffer ? createFontCustomPlatformData(*buffer, itemInCollection) : nullptr;
}
RefPtr<Font> CachedFont::createFont(const FontDescription& fontDescription, const AtomString&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, FontSelectionSpecifiedCapabilities fontFaceCapabilities)
Modified: trunk/Source/WebCore/loader/cache/CachedFontLoadRequest.h (276449 => 276450)
--- trunk/Source/WebCore/loader/cache/CachedFontLoadRequest.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/loader/cache/CachedFontLoadRequest.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -51,6 +51,7 @@
private:
const URL& url() const final { return m_font->url(); }
+ bool isPending() const final { return m_font->status() == CachedResource::Status::Pending; }
bool isLoading() const final { return m_font->isLoading(); }
bool errorOccurred() const final { return m_font->errorOccurred(); }
Modified: trunk/Source/WebCore/platform/graphics/Font.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/Font.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/Font.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -58,16 +58,26 @@
DEFINE_ALLOCATOR_WITH_HEAP_IDENTIFIER(Font);
-Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic)
+Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> identifier)
{
+ return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, nullptr));
+}
+
+Ref<Font> Font::create(const FontPlatformData& platformData, Origin origin, FontCache* fontCacheForVerticalData, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> identifier)
+{
+ return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier, fontCacheForVerticalData));
+}
+
+Ref<Font> Font::create(Ref<SharedBuffer>&& fontFaceData, Font::Origin origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* fontCacheForVerticalData)
+{
bool wrapping;
auto customFontData = CachedFont::createCustomFontData(fontFaceData.get(), { }, wrapping);
FontDescription description;
description.setComputedSize(fontSize);
- return Font::create(CachedFont::platformDataFromCustomData(*customFontData, description, syntheticBold, syntheticItalic, { }, { }), origin);
+ return Font::create(CachedFont::platformDataFromCustomData(*customFontData, description, syntheticBold, syntheticItalic, { }, { }), origin, fontCacheForVerticalData);
}
-Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> renderingResourceIdentifier)
+Font::Font(const FontPlatformData& platformData, Origin origin, Interstitial interstitial, Visibility visibility, OrientationFallback orientationFallback, Optional<RenderingResourceIdentifier> renderingResourceIdentifier, FontCache* fontCacheForVerticalData)
: m_platformData(platformData)
, m_renderingResourceIdentifier(renderingResourceIdentifier)
, m_origin(origin)
@@ -88,9 +98,11 @@
platformCharWidthInit();
#if ENABLE(OPENTYPE_VERTICAL)
if (platformData.orientation() == FontOrientation::Vertical && orientationFallback == OrientationFallback::No) {
- m_verticalData = FontCache::singleton().verticalData(platformData);
+ m_verticalData = fontCacheForVerticalData ? fontCacheForVerticalData->verticalData(platformData) : FontCache::singleton().verticalData(platformData);
m_hasVerticalGlyphs = m_verticalData.get() && m_verticalData->hasVerticalMetrics();
}
+#else
+ UNUSED_PARAM(fontCacheForVerticalData);
#endif
}
@@ -568,13 +580,13 @@
return map.get();
}
-RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont) const
+RefPtr<Font> Font::systemFallbackFontForCharacter(UChar32 character, const FontDescription& description, IsForPlatformFont isForPlatformFont, FontCache& fontCache) const
{
auto fontAddResult = systemFallbackCache().add(this, CharacterFallbackMap());
if (!character) {
UChar codeUnit = 0;
- return FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1);
+ return fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, &codeUnit, 1);
}
auto key = CharacterFallbackMapKey { description.computedLocale(), character, isForPlatformFont != IsForPlatformFont::No };
@@ -589,7 +601,7 @@
codeUnits[1] = U16_TRAIL(character);
codeUnitsLength = 2;
}
- auto font = FontCache::singleton().systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get();
+ auto font = fontCache.systemFallbackForCharacters(description, this, isForPlatformFont, FontCache::PreferColoredFont::No, codeUnits, codeUnitsLength).get();
if (font)
font->m_isUsedInSystemFallbackCache = true;
return font;
Modified: trunk/Source/WebCore/platform/graphics/Font.h (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/Font.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/Font.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -57,6 +57,7 @@
namespace WebCore {
+class FontCache;
class GlyphPage;
class FontDescription;
class SharedBuffer;
@@ -92,12 +93,11 @@
Yes,
No
};
- static Ref<Font> create(const FontPlatformData& platformData, Origin origin = Origin::Local, Interstitial interstitial = Interstitial::No,
- Visibility visibility = Visibility::Visible, OrientationFallback orientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> identifier = WTF::nullopt)
- {
- return adoptRef(*new Font(platformData, origin, interstitial, visibility, orientationFallback, identifier));
- }
- WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic);
+ WEBCORE_EXPORT static Ref<Font> create(const FontPlatformData&, Origin = Origin::Local, Interstitial = Interstitial::No,
+ Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> = WTF::nullopt);
+ static Ref<Font> create(const FontPlatformData&, Origin, FontCache* fontCacheForVerticalData, Interstitial = Interstitial::No,
+ Visibility = Visibility::Visible, OrientationFallback = OrientationFallback::No, Optional<RenderingResourceIdentifier> = WTF::nullopt);
+ WEBCORE_EXPORT static Ref<Font> create(Ref<SharedBuffer>&& fontFaceData, Font::Origin, float fontSize, bool syntheticBold, bool syntheticItalic, FontCache* = nullptr);
WEBCORE_EXPORT ~Font();
@@ -189,7 +189,7 @@
bool supportsCodePoint(UChar32) const;
bool platformSupportsCodePoint(UChar32, Optional<UChar32> variation = WTF::nullopt) const;
- RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont) const;
+ RefPtr<Font> systemFallbackFontForCharacter(UChar32, const FontDescription&, IsForPlatformFont, FontCache&) const;
const GlyphPage* glyphPage(unsigned pageNumber) const;
@@ -232,7 +232,7 @@
#endif
private:
- WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, Optional<RenderingResourceIdentifier>);
+ WEBCORE_EXPORT Font(const FontPlatformData&, Origin, Interstitial, Visibility, OrientationFallback, Optional<RenderingResourceIdentifier>, FontCache*);
void platformInit();
void platformGlyphInit();
Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/FontCache.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -280,7 +280,7 @@
#endif
auto addResult = m_fontDataCaches->data.ensure(platformData, [&] {
- return Font::create(platformData);
+ return Font::create(platformData, Font::Origin::Local, this);
});
ASSERT(addResult.iterator->value->platformData() == platformData);
Modified: trunk/Source/WebCore/platform/graphics/FontCache.h (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/FontCache.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/FontCache.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -220,7 +220,7 @@
public:
static Ref<FontCache> create();
WEBCORE_EXPORT static FontCache& singleton();
- static FontCache& fontCacheFallbackToSingleton(RefPtr<FontSelector>);
+ static FontCache& fontCacheFallingBackToSingleton(RefPtr<FontSelector>);
~FontCache();
@@ -378,7 +378,7 @@
return prewarmInformation;
}
-inline FontCache& FontCache::fontCacheFallbackToSingleton(RefPtr<FontSelector> fontSelector)
+inline FontCache& FontCache::fontCacheFallingBackToSingleton(RefPtr<FontSelector> fontSelector)
{
return fontSelector ? fontSelector->fontCache() : FontCache::singleton();
}
Modified: trunk/Source/WebCore/platform/graphics/FontCascade.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/FontCascade.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -170,7 +170,7 @@
void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const
{
- FontCache::fontCacheFallbackToSingleton(fontSelector).updateFontCascade(*this, WTFMove(fontSelector));
+ FontCache::fontCacheFallingBackToSingleton(fontSelector).updateFontCascade(*this, WTFMove(fontSelector));
}
GlyphBuffer FontCascade::layoutText(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, ForTextEmphasisOrNot forTextEmphasis) const
Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -102,7 +102,7 @@
: m_cachedPrimaryFont(nullptr)
, m_fontSelector(fontSelector)
, m_fontSelectorVersion(m_fontSelector ? m_fontSelector->version() : 0)
- , m_generation(FontCache::fontCacheFallbackToSingleton(m_fontSelector).generation())
+ , m_generation(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).generation())
{
#if ASSERT_ENABLED
if (!isMainThread())
@@ -144,7 +144,7 @@
{
ASSERT(index < description.effectiveFamilyCount());
- auto& fontCache = FontCache::fontCacheFallbackToSingleton(fontSelector);
+ auto& fontCache = FontCache::fontCacheFallingBackToSingleton(fontSelector);
while (index < description.effectiveFamilyCount()) {
auto visitor = WTF::makeVisitor([&](const AtomString& family) -> FontRanges {
if (family.isEmpty())
@@ -181,7 +181,7 @@
return m_realizedFallbackRanges[index];
ASSERT(index == m_realizedFallbackRanges.size());
- ASSERT(FontCache::fontCacheFallbackToSingleton(m_fontSelector).generation() == m_generation);
+ ASSERT(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).generation() == m_generation);
m_realizedFallbackRanges.append(FontRanges());
auto& fontRanges = m_realizedFallbackRanges.last();
@@ -189,9 +189,9 @@
if (!index) {
fontRanges = realizeNextFallback(description, m_lastRealizedFallbackIndex, m_fontSelector.get());
if (fontRanges.isNull() && m_fontSelector)
- fontRanges = m_fontSelector->fontRangesForFamily(description, standardFamily);
+ fontRanges = m_fontSelector->fontRangesForFamily(description, familyNamesData->at(FamilyNamesIndex::StandardFamily));
if (fontRanges.isNull())
- fontRanges = FontRanges(FontCache::fontCacheFallbackToSingleton(m_fontSelector).lastResortFallbackFont(description));
+ fontRanges = FontRanges(FontCache::fontCacheFallingBackToSingleton(m_fontSelector).lastResortFallbackFont(description));
return fontRanges;
}
@@ -351,7 +351,7 @@
if (!font)
font = &realizeFallbackRangesAt(description, 0).fontForFirstRange();
- auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No);
+ auto systemFallbackFont = font->systemFallbackFontForCharacter(character, description, m_isForPlatformFont ? IsForPlatformFont::Yes : IsForPlatformFont::No, FontCache::fontCacheFallingBackToSingleton(m_fontSelector));
if (!systemFallbackFont)
return GlyphData();
Modified: trunk/Source/WebCore/platform/graphics/WOFFFileFormat.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/WOFFFileFormat.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/WOFFFileFormat.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -282,5 +282,24 @@
return sfnt.size() == totalSfntSize;
}
-
+
+bool convertWOFFToSfntIfNecessary(RefPtr<SharedBuffer>& buffer)
+{
+#if PLATFORM(COCOA)
+ UNUSED_PARAM(buffer);
+ return false;
+#else
+ if (!buffer || !isWOFF(*buffer))
+ return false;
+
+ Vector<char> convertedFont;
+ if (convertWOFFToSfnt(*buffer, convertedFont))
+ buffer = SharedBuffer::create(WTFMove(convertedFont));
+ else
+ buffer = nullptr;
+
+ return true;
+#endif
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/WOFFFileFormat.h (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/WOFFFileFormat.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/WOFFFileFormat.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -39,6 +39,11 @@
// if conversion ran out of memory). Otherwise returns true and writes the sfnt payload into sfnt.
bool convertWOFFToSfnt(SharedBuffer& woff, Vector<char>& sfnt);
+// If the given buffer is a WOFF file and the current platform has no native support for WOFF
+// fonts, convert it to sfnt. Returns true if the given buffer was converted. If conversion fails,
+// the buffer will be set to nullptr.
+bool convertWOFFToSfntIfNecessary(RefPtr<SharedBuffer>&);
+
} // namespace WebCore
#endif // WOFFFileFormat_h
Modified: trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp (276449 => 276450)
--- trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/platform/graphics/cairo/FontCairoHarfbuzzNG.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -138,7 +138,7 @@
return fallbackFont;
}
- if (auto systemFallback = FontCache::fontCacheFallbackToSingleton(fontSelector()).systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) {
+ if (auto systemFallback = FontCache::fontCacheFallingBackToSingleton(fontSelector()).systemFallbackForCharacters(m_fontDescription, baseFont, IsForPlatformFont::No, preferColoredFont ? FontCache::PreferColoredFont::Yes : FontCache::PreferColoredFont::No, characters, length)) {
if (systemFallback->canRenderCombiningCharacterSequence(characters, length) && (!preferColoredFont || systemFallback->platformData().isColorBitmapFont()))
return systemFallback.get();
Added: trunk/Source/WebCore/workers/WorkerFontLoadRequest.cpp (0 => 276450)
--- trunk/Source/WebCore/workers/WorkerFontLoadRequest.cpp (rev 0)
+++ trunk/Source/WebCore/workers/WorkerFontLoadRequest.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -0,0 +1,142 @@
+/*
+ * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2009 Torch Mobile, Inc.
+ * Copyright (C) 2021 Metrological Group B.V.
+ * Copyright (C) 2021 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "WorkerFontLoadRequest.h"
+
+#include "Font.h"
+#include "FontCustomPlatformData.h"
+#include "FontSelectionAlgorithm.h"
+#include "ResourceLoaderOptions.h"
+#include "ServiceWorker.h"
+#include "SharedBuffer.h"
+#include "WOFFFileFormat.h"
+#include "WorkerGlobalScope.h"
+#include "WorkerThreadableLoader.h"
+
+namespace WebCore {
+
+WorkerFontLoadRequest::WorkerFontLoadRequest(URL&& url, LoadedFromOpaqueSource loadedFromOpaqueSource)
+ : m_url(WTFMove(url))
+ , m_loadedFromOpaqueSource(loadedFromOpaqueSource)
+{
+}
+
+void WorkerFontLoadRequest::load(WorkerGlobalScope& workerGlobalScope)
+{
+ m_context = makeWeakPtr(static_cast<ScriptExecutionContext*>(&workerGlobalScope));
+
+ ResourceRequest request { m_url };
+ ASSERT(request.httpMethod() == "GET");
+
+ FetchOptions fetchOptions;
+ fetchOptions.mode = FetchOptions::Mode::SameOrigin;
+ fetchOptions.credentials = workerGlobalScope.credentials();
+ fetchOptions.cache = FetchOptions::Cache::Default;
+ fetchOptions.redirect = FetchOptions::Redirect::Follow;
+ fetchOptions.destination = FetchOptions::Destination::Worker;
+
+ ThreadableLoaderOptions options { WTFMove(fetchOptions) };
+ options.sendLoadCallbacks = SendCallbackPolicy::SendCallbacks;
+ options.contentSecurityPolicyEnforcement = m_context->shouldBypassMainWorldContentSecurityPolicy() ? ContentSecurityPolicyEnforcement::DoNotEnforce : ContentSecurityPolicyEnforcement::EnforceChildSrcDirective;
+ options.loadedFromOpaqueSource = m_loadedFromOpaqueSource;
+
+ options.serviceWorkersMode = ServiceWorkersMode::All;
+#if ENABLE(SERVICE_WORKER)
+ if (auto* activeServiceWorker = workerGlobalScope.activeServiceWorker())
+ options.serviceWorkerRegistrationIdentifier = activeServiceWorker->registrationIdentifier();
+#endif
+
+ WorkerThreadableLoader::loadResourceSynchronously(workerGlobalScope, WTFMove(request), *this, options);
+}
+
+bool WorkerFontLoadRequest::ensureCustomFontData(const AtomString&)
+{
+ if (!m_fontCustomPlatformData && !m_errorOccurred && !m_isLoading) {
+ convertWOFFToSfntIfNecessary(m_data);
+ if (m_data) {
+ m_fontCustomPlatformData = createFontCustomPlatformData(*m_data, m_url.fragmentIdentifier().toString());
+ if (!m_fontCustomPlatformData)
+ m_errorOccurred = true;
+ }
+ }
+
+ return m_fontCustomPlatformData.get();
+}
+
+RefPtr<Font> WorkerFontLoadRequest::createFont(const FontDescription& fontDescription, const AtomString&, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings& fontFaceFeatures, FontSelectionSpecifiedCapabilities fontFaceCapabilities)
+{
+ ASSERT(m_fontCustomPlatformData);
+ ASSERT(m_context);
+ return Font::create(m_fontCustomPlatformData->fontPlatformData(fontDescription, syntheticBold, syntheticItalic, fontFaceFeatures, fontFaceCapabilities), Font::Origin::Remote, &m_context->fontCache());
+}
+
+void WorkerFontLoadRequest::setClient(FontLoadRequestClient* client)
+{
+ m_fontLoadRequestClient = client;
+
+ if (m_notifyOnClientSet) {
+ m_notifyOnClientSet = false;
+ m_fontLoadRequestClient->fontLoaded(*this);
+ }
+}
+
+void WorkerFontLoadRequest::didReceiveResponse(unsigned long, const ResourceResponse& response)
+{
+ if (response.httpStatusCode() / 100 != 2 && response.httpStatusCode())
+ m_errorOccurred = true;
+}
+
+void WorkerFontLoadRequest::didReceiveData(const char* data, int dataLength)
+{
+ if (m_errorOccurred)
+ return;
+
+ if (!m_data)
+ m_data = SharedBuffer::create();
+
+ m_data->append(data, dataLength);
+}
+
+void WorkerFontLoadRequest::didFinishLoading(unsigned long)
+{
+ m_isLoading = false;
+
+ if (!m_errorOccurred) {
+ if (m_fontLoadRequestClient)
+ m_fontLoadRequestClient->fontLoaded(*this);
+ else
+ m_notifyOnClientSet = true;
+ }
+}
+
+void WorkerFontLoadRequest::didFail(const ResourceError&)
+{
+ m_errorOccurred = true;
+}
+
+} // namespace WebCore
Added: trunk/Source/WebCore/workers/WorkerFontLoadRequest.h (0 => 276450)
--- trunk/Source/WebCore/workers/WorkerFontLoadRequest.h (rev 0)
+++ trunk/Source/WebCore/workers/WorkerFontLoadRequest.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 Metrological Group B.V.
+ * Copyright (C) 2021 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include "FontLoadRequest.h"
+#include "ResourceLoaderOptions.h"
+#include "ThreadableLoaderClient.h"
+#include <wtf/URL.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+class ScriptExecutionContext;
+class SharedBuffer;
+class WorkerGlobalScope;
+
+struct FontCustomPlatformData;
+
+class WorkerFontLoadRequest : public FontLoadRequest, public ThreadableLoaderClient {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ WorkerFontLoadRequest(URL&&, LoadedFromOpaqueSource);
+ ~WorkerFontLoadRequest() = default;
+
+ void load(WorkerGlobalScope&);
+
+private:
+ const URL& url() const final { return m_url; }
+ bool isPending() const final { return !m_isLoading && !m_errorOccurred && !m_data; }
+ bool isLoading() const final { return m_isLoading; }
+ bool errorOccurred() const final { return m_errorOccurred; }
+
+ bool ensureCustomFontData(const AtomString& remoteURI) final;
+ RefPtr<Font> createFont(const FontDescription&, const AtomString& remoteURI, bool syntheticBold, bool syntheticItalic, const FontFeatureSettings&, FontSelectionSpecifiedCapabilities) final;
+
+ void setClient(FontLoadRequestClient*) final;
+
+ bool isWorkerFontLoadRequest() const final { return true; }
+
+ void didReceiveResponse(unsigned long identifier, const ResourceResponse&) final;
+ void didReceiveData(const char* data, int dataLength) final;
+ void didFinishLoading(unsigned long identifier) final;
+ void didFail(const ResourceError&) final;
+
+ URL m_url;
+ LoadedFromOpaqueSource m_loadedFromOpaqueSource;
+
+ bool m_isLoading { false };
+ bool m_notifyOnClientSet { false };
+ bool m_errorOccurred { false };
+ FontLoadRequestClient* m_fontLoadRequestClient { nullptr };
+
+ WeakPtr<ScriptExecutionContext> m_context;
+ RefPtr<SharedBuffer> m_data;
+ std::unique_ptr<FontCustomPlatformData> m_fontCustomPlatformData;
+};
+
+} // namespace WebCore
+
+SPECIALIZE_TYPE_TRAITS_FONTLOADREQUEST(WebCore::WorkerFontLoadRequest, isWorkerFontLoadRequest())
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.cpp (276449 => 276450)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.cpp 2021-04-22 18:44:49 UTC (rev 276450)
@@ -34,6 +34,7 @@
#include "ContentSecurityPolicy.h"
#include "Crypto.h"
#include "FontCache.h"
+#include "FontFaceSet.h"
#include "IDBConnectionProxy.h"
#include "ImageBitmapOptions.h"
#include "InspectorInstrumentation.h"
@@ -45,6 +46,7 @@
#include "SecurityOriginPolicy.h"
#include "ServiceWorkerGlobalScope.h"
#include "SocketProvider.h"
+#include "WorkerFontLoadRequest.h"
#include "WorkerLoaderProxy.h"
#include "WorkerLocation.h"
#include "WorkerMessagingProxy.h"
@@ -521,6 +523,23 @@
return *m_fontCache;
}
+Ref<FontFaceSet> WorkerGlobalScope::fonts()
+{
+ ASSERT(cssFontSelector());
+ return cssFontSelector()->fontFaceSet();
+}
+
+std::unique_ptr<FontLoadRequest> WorkerGlobalScope::fontLoadRequest(String& url, bool, bool, LoadedFromOpaqueSource loadedFromOpaqueSource)
+{
+ return makeUnique<WorkerFontLoadRequest>(completeURL(url), loadedFromOpaqueSource);
+}
+
+void WorkerGlobalScope::beginLoadingFontSoon(FontLoadRequest& request)
+{
+ ASSERT(is<WorkerFontLoadRequest>(request));
+ downcast<WorkerFontLoadRequest>(request).load(*this);
+}
+
ReferrerPolicy WorkerGlobalScope::referrerPolicy() const
{
return m_referrerPolicy;
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.h (276449 => 276450)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.h 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.h 2021-04-22 18:44:49 UTC (rev 276450)
@@ -51,6 +51,7 @@
class CSSValuePool;
class ContentSecurityPolicyResponseHeaders;
class Crypto;
+class FontFaceSet;
class Performance;
class ScheduledAction;
class WorkerLocation;
@@ -124,6 +125,9 @@
CSSValuePool& cssValuePool() final;
CSSFontSelector* cssFontSelector() final;
FontCache& fontCache() final;
+ Ref<FontFaceSet> fonts();
+ std::unique_ptr<FontLoadRequest> fontLoadRequest(String& url, bool isSVG, bool isInitiatingElementInUserAgentShadowTree, LoadedFromOpaqueSource) final;
+ void beginLoadingFontSoon(FontLoadRequest&) final;
ReferrerPolicy referrerPolicy() const final;
Modified: trunk/Source/WebCore/workers/WorkerGlobalScope.idl (276449 => 276450)
--- trunk/Source/WebCore/workers/WorkerGlobalScope.idl 2021-04-22 18:41:56 UTC (rev 276449)
+++ trunk/Source/WebCore/workers/WorkerGlobalScope.idl 2021-04-22 18:44:49 UTC (rev 276450)
@@ -48,3 +48,4 @@
};
WorkerGlobalScope includes WindowOrWorkerGlobalScope;
+WorkerGlobalScope includes FontFaceSource;