Commit Graph

436 Commits

Author SHA1 Message Date
Jonathan Kew
e817e48777 Bug 1849010 - Implement the font-synthesis-position property. r=devtools-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D186448
2023-08-17 17:29:30 +00:00
Cosmin Sabou
737e83bb1a Backed out changeset 66c374acc3fb (bug 1849010) for causing font-synthesis failures. 2023-08-17 18:55:57 +03:00
Jonathan Kew
4adcc08ba9 Bug 1849010 - Implement the font-synthesis-position property. r=devtools-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D186448
2023-08-17 14:54:01 +00:00
Jonathan Kew
260aac0062 Bug 1847529 - Provide typed versions of Pointer::ToPtr. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D185564
2023-08-11 10:47:49 +00:00
Butkovits Atila
f6b7599a3d Backed out changeset ad43d22e453c (bug 1847529) for causing reftest failures. CLOSED TREE 2023-08-11 01:26:07 +03:00
Jonathan Kew
46b3bb2a07 Bug 1847529 - Provide typed versions of Pointer::ToPtr. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D185564
2023-08-10 20:35:24 +00:00
Jonathan Kew
109e873db8 Bug 1844830 - patch 3 - gfxFontGroup::GetFontAt should take an unsigned index. r=gfx-reviewers,lsalzman
There's no reason for this to be signed, and the callers are using an unsigned index already.

(Won't make any difference, especially once the optimizer has had a look at it; this is just
a bit of cleanup noticed in passing.)

Differential Revision: https://phabricator.services.mozilla.com/D184313
2023-07-24 08:37:20 +00:00
Jonathan Kew
8109de8531 Bug 1253840 - patch 2 - When justifying, the full advance of any trimmable end-of-line whitespace needs to be hung into the margin. r=emilio
Depends on D178210

Differential Revision: https://phabricator.services.mozilla.com/D178211
2023-05-21 13:17:42 +00:00
Stanca Serban
403e698e38 Backed out 4 changesets (bug 1253840) for causing multiple failures in nsLineLayout.cpp. CLOSED TREE
Backed out changeset 1a47c4ddf44c (bug 1253840)
Backed out changeset 816a9266d111 (bug 1253840)
Backed out changeset 7ce24f83240a (bug 1253840)
Backed out changeset cf6eff426d61 (bug 1253840)
2023-05-20 00:49:29 +03:00
Jonathan Kew
8b24f65b6e Bug 1253840 - patch 2 - When justifying, the full advance of any trimmable end-of-line whitespace needs to be hung into the margin. r=emilio
Depends on D178210

Differential Revision: https://phabricator.services.mozilla.com/D178211
2023-05-19 16:44:10 +00:00
Robert Longson
a1b7878e33 Bug 1833616 - Use RAII to manage Push/Pop of gfxContext Clip r=emilio,gfx-reviewers,lsalzman
Take care to restore only the parts of the gfxContext that we need to because saving and restoring the complete gfxContext is expensive.

Differential Revision: https://phabricator.services.mozilla.com/D178304
2023-05-17 15:08:28 +00:00
Jonathan Kew
a3e321b11d Bug 1589778 - Ensure cluster boundaries are set up even in blank textruns. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175960
2023-04-20 08:38:38 +00:00
Jonathan Kew
045b620d20 Bug 1826013 - Tidy up BreakAndMeasureText params, and replace some never-NULL pointers with references. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D174383
2023-04-03 08:19:49 +00:00
Jonathan Kew
dccd8a928e Bug 1825983 - Refactor handling of trailing trimmable whitespace. r=emilio
This slightly simplifies gfxTextRun::BreakAndMeasureText, and should make it less confusing
to reason about trailing whitespace in nsTextFrame/nsLineLayout.

Differential Revision: https://phabricator.services.mozilla.com/D174377
2023-04-03 06:41:22 +00:00
Jonathan Kew
b69e6563fc Bug 1823644 - Optimize textrun initialization by merging SanitizeGlyphRuns and SortGlyphRuns. r=gfx-reviewers,lsalzman
No change in behavior, just a marginal optimization when creating large/complex textruns.

Differential Revision: https://phabricator.services.mozilla.com/D173140
2023-03-21 18:44:12 +00:00
Jonathan Kew
c9c9aef089 Bug 1823270 - Rewrite gfxTextRun::SortGlyphRuns to use RemoveElementsBy instead of RemoveElementAt when merging adjacent runs, to minimize array-data shifting. r=gfx-reviewers,lsalzman
In the patches for bug 1823215, we eliminated the use of a local copy of the glyph runs array
during SortGlyphRuns; but we call RemoveElementAt individually for each run to be coalesced,
which means potentially moving all the rest of the array multiple times. Instrumentation shows
that we sometimes end up with dozens of glyphruns to be coalesced (or even hundreds/thousands,
in pathological cases), which becomes quite inefficient.

Using RemoveElementsBy(predicate) instead will minimize the copying/moving of the remaining
array elements.

Differential Revision: https://phabricator.services.mozilla.com/D172945
2023-03-19 18:41:30 +00:00
Jonathan Kew
73d344d188 Bug 1823215 - Use ElementOrArray<T> to simplify the management of glyphrun(s) in gfxTextRun. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D172940
2023-03-19 16:36:06 +00:00
Jonathan Kew
4d44c5aa6d Bug 1820988 - Templatize the 8- and 16-bit versions of gfxFontGroup::MakeTextRun for convenience. r=gfx-reviewers,aosmond
No functional change, just a drive-by cleanup noticed when looking over the text-rendering APIs.

Differential Revision: https://phabricator.services.mozilla.com/D171984
2023-03-09 12:48:42 +00:00
Norisz Fay
d51def9e85 Backed out changeset 6fdd0782eb8d (bug 1820988) for causing build bustage CLOSED TREE 2023-03-08 23:11:46 +02:00
Jonathan Kew
b5e33edcbb Bug 1820988 - Templatize the 8- and 16-bit versions of gfxFontGroup::MakeTextRun for convenience. r=gfx-reviewers,aosmond
No functional change, just a drive-by cleanup noticed when looking over the text-rendering APIs.

Differential Revision: https://phabricator.services.mozilla.com/D171984
2023-03-08 18:28:07 +00:00
Jonathan Kew
d1c5009e61 Bug 1818488 - Hoist access to gfxContext::GetTextDrawer() out of the glyph-rendering inner loop. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D170749
2023-02-23 21:44:34 +00:00
Jonathan Kew
c487d17dbb Bug 1818149 - Hoist access to textDrawer->GeckoClipRect() out of the inner DrawOneGlyph method. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D170578
2023-02-22 08:40:18 +00:00
Jonathan Kew
7d98300d55 Bug 1817184 - Don't send glyphs to webrender if they're going to be entirely outside the clip rect. r=gfx-reviewers,lsalzman
This reverts the per-glyph-run optimization landed in bug 1816299, and replaces it with a per-glyph version
that will work within a long run of glyphs in a single font, as well as across the glyph runs in a mixed-font textrun.
To minimize the cost of the check, rather than retrieving individual glyph bounds, we use the overall font extents.

(Note that this uses the bounding box min/max coordinates from the 'head' table, which may exceed the typographic
ascent/descent of the font, and the advances of the glyphs; we care about the ink extents, not typographic size.)

Differential Revision: https://phabricator.services.mozilla.com/D170058
2023-02-16 17:43:21 +00:00
Jonathan Kew
cbfad50a4f Bug 1816299 - Try to avoid sending entirely-clipped glyph runs to a TextDrawTarget. r=gfx-reviewers,lsalzman
Now passes reftests on try:
https://treeherder.mozilla.org/jobs?repo=try&revision=7070b443cce9740358f12b4343c438a28c5808ac

Differential Revision: https://phabricator.services.mozilla.com/D169729
2023-02-14 08:10:14 +00:00
Jonathan Kew
55ad8c60ec Bug 1322437 - Ensure that gfxFontGroup::GetDefaultFont tries the platform list's GetDefaultFontEntry() as a last resort in all cases. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D168782
2023-02-03 17:19:33 +00:00
Jonathan Kew
e0c4a32c6e Bug 1794298 - Improve font-selection heuristics so that Twemoji-Mozilla keycaps (in emoji style) work as expected. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D168401
2023-02-01 13:25:39 +00:00
Jonathan Kew
7585dcd59a Bug 1813987 - Remove direct ICU usage from gfxFontGroup; rely on intl::String API instead. r=platform-i18n-reviewers,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D168359
2023-01-31 18:56:53 +00:00
Jonathan Kew
f956fb8c4d Bug 1810815 - Properly account for cases where CSS units ch or ic are based on a different font than the first, due to character coverage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D167070
2023-01-18 14:22:11 +00:00
Jonathan Kew
d2868f8c9e Bug 1810709 - Make GetFirstValidFont() check whether the required character is supported by the font. r=emilio
Except in the case of <space>, which is not required to be present for the font to be used
as the "first available font" in CSS (https://drafts.csswg.org/css-fonts-4/#first-available-font);
for that, only unicode-range coverage is applicable.

Differential Revision: https://phabricator.services.mozilla.com/D167006
2023-01-18 09:58:59 +00:00
Andrew Osmond
b8b20f1afe Bug 1798591. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D163295
2022-12-14 17:50:54 +00:00
Cristian Tuns
da50134a78 Backed out changeset d647be139836 (bug 1798591) for causing build bustages on FontFaceSetImpl.cpp CLOSED TREE 2022-12-14 10:26:07 -05:00
Andrew Osmond
fcb0efab8b Bug 1798591. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D163295
2022-12-14 14:31:20 +00:00
Jonathan Kew
2678fa0ec6 Bug 1801521 - Try to avoid using an emoji font that lacks support for subregion flags. r=m_kato
Differential Revision: https://phabricator.services.mozilla.com/D162571
2022-11-24 10:23:54 +00:00
Jonathan Kew
5c7ab9c2eb Bug 1801248 - Fix up pointer arithmetic. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D162496
2022-11-21 10:07:03 +00:00
Razvan Cojocaru
1629218702 Bug 1060421 - Change the type of [Int]PointTyped::[x|y] back to [Int]CoordTyped. r=botond
[Int]CoordTyped no longer inherits Units because otherwise
instances of [Int]IntPointTyped may get one Base subobject because
it inherits Units, and others because of BasePoint's Coord members,
which end up increasing the [Int]CoordTyped's objects size (since
according to the ISO C++ standard, different Base subobject are
required to have different addresses).

Differential Revision: https://phabricator.services.mozilla.com/D160713
2022-11-04 18:29:35 +00:00
Jonathan Kew
8888937e07 Bug 1461589 - Handle font-variant-emoji during font matching. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D147495
2022-10-22 09:43:49 +00:00
Jonathan Kew
d811a2820d Bug 1791780 - Support custom color font palettes in the COLR-font rendering code. r=gfx-reviewers,lsalzman
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.

Differential Revision: https://phabricator.services.mozilla.com/D157958
2022-10-07 23:00:45 +00:00
Noemi Erli
5b0216e320 Backed out 9 changesets (bug 1791778, bug 1791782, bug 1791780, bug 1791777) for causing build bustages in TestCOLRv1.cpp CLOSED TREE
Backed out changeset aeb44b79bf31 (bug 1791782)
Backed out changeset 292fd3a1b6dd (bug 1791782)
Backed out changeset 9947218170d0 (bug 1791780)
Backed out changeset 528b4c022a44 (bug 1791778)
Backed out changeset c734ff661a66 (bug 1791778)
Backed out changeset 6585dd386ee3 (bug 1791777)
Backed out changeset af4243189ef1 (bug 1791777)
Backed out changeset a47ae5f76514 (bug 1791777)
Backed out changeset 24ce615e77fd (bug 1791777)
2022-10-08 00:08:57 +03:00
Jonathan Kew
fbe5f32f43 Bug 1791780 - Support custom color font palettes in the COLR-font rendering code. r=gfx-reviewers,lsalzman
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.

Differential Revision: https://phabricator.services.mozilla.com/D157958
2022-10-07 18:58:52 +00:00
Cristian Tuns
18e597b504 Backed out 9 changesets (bug 1791777, bug 1791780, bug 1791778, bug 1791782) for causing build bustages on TestCOLRv1.cpp CLOSED TREE
Backed out changeset f145a34cfbc1 (bug 1791782)
Backed out changeset 2f12216fbeda (bug 1791782)
Backed out changeset 61bd2a4496bf (bug 1791780)
Backed out changeset 4e4eb99a7fd9 (bug 1791778)
Backed out changeset 32d171a28810 (bug 1791778)
Backed out changeset e317795cd27a (bug 1791777)
Backed out changeset 5e32d5a01917 (bug 1791777)
Backed out changeset cf87497dbead (bug 1791777)
Backed out changeset 586c735b005e (bug 1791777)
2022-10-07 13:46:43 -04:00
Jonathan Kew
c860e6c421 Bug 1791780 - Support custom color font palettes in the COLR-font rendering code. r=gfx-reviewers,lsalzman
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.

Differential Revision: https://phabricator.services.mozilla.com/D157958
2022-10-07 16:53:35 +00:00
Norisz Fay
30ef428f43 Backed out 9 changesets (bug 1791780, bug 1791782, bug 1791778, bug 1791777) for causing multiple mochitest failures CLOSED TREE
Backed out changeset 6de1ade5a9b6 (bug 1791782)
Backed out changeset ce96452a38a1 (bug 1791782)
Backed out changeset 7cc8e027f5a7 (bug 1791780)
Backed out changeset 8e023280032c (bug 1791778)
Backed out changeset 26d65d76d02a (bug 1791778)
Backed out changeset a98dd552df64 (bug 1791777)
Backed out changeset 766386309ee5 (bug 1791777)
Backed out changeset 7de66a218ba4 (bug 1791777)
Backed out changeset 1d17c257444e (bug 1791777)
2022-10-07 17:36:38 +03:00
Jonathan Kew
d29b0575d8 Bug 1791780 - Support custom color font palettes in the COLR-font rendering code. r=gfx-reviewers,lsalzman
This creates the gfx support needed to use alternate palettes, though not yet connected
to the CSS rules/properties to define and access them.

Differential Revision: https://phabricator.services.mozilla.com/D157958
2022-10-07 12:16:53 +00:00
Jonathan Kew
501b73a6f1 Bug 1786472 - Acquire/release the glyph-extents locks fewer times in gfxTextRun::FetchGlyphExtents. r=aosmond
Differential Revision: https://phabricator.services.mozilla.com/D155340
2022-09-06 09:20:56 +00:00
Andrew Osmond
f229ed975f Bug 1781177 - Refactor gfxFont::GetShapedWord to use lambdas. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D153634
2022-08-04 10:42:45 +00:00
Andrew Osmond
128c09ccdd Bug 1782710 - Avoid accessing network service or principals on worker threads with font pathways. r=jfkthame
We do some initialization of gfxFontSrcURI and gfxFontFaceSrc that is
main thread only on the DOM worker threads. These portions of the
initialization can easily be deferred to on demand access since they are
only ever used on the main thread itself.

Differential Revision: https://phabricator.services.mozilla.com/D153461
2022-08-03 11:39:34 +00:00
Sandor Molnar
b7bdd0938f Backed out changeset b7b04703f99d (bug 1782710) for causing wpt failure. 2022-08-02 18:16:28 +03:00
Andrew Osmond
37466029fb Bug 1782710 - Avoid accessing network service or principals on worker threads with font pathways. r=jfkthame
We do some initialization of gfxFontSrcURI and gfxFontFaceSrc that is
main thread only on the DOM worker threads. These portions of the
initialization can easily be deferred to on demand access since they are
only ever used on the main thread itself.

Differential Revision: https://phabricator.services.mozilla.com/D153461
2022-08-02 14:26:57 +00:00
Andrew Osmond
a9049b5248 Bug 1779519 - gfxFontCache expiration tracker operations should be more atomic. r=jfkthame
gfxFontCache acquires and releases its mutex during various operations.
In order to keep the state internally consistent, we should only release
the lock after the full operation is complete. This involves moving the
deletion of gfxFont to outside the lock via a temporary discard array.

The expiration state should not be protected by the gfxFont's mutex
since we don't hold it during most operations. Instead we should hold
gfxFontCache's mutex because then we can guarantee the operation is
atomic, particularly when a worker wants a font, and the main thread is
aging the generations.

When a font is returned from gfxFontCache, we now return it already
removed from the tracker, and with its refcount updated. This avoids any
potential races between the expiration timer and a worker accessing the
font, as well as simplying the callers so they don't need to be aware of
addref-ing manually in case the result is to be discarded (so that it
gets readded to the tracker).

Differential Revision: https://phabricator.services.mozilla.com/D151821
2022-07-14 19:53:09 +00:00
criss
ba063e13c6 Backed out changeset e4cd98b5984d (bug 1779519) for causing build bustages. CLOSED TREE 2022-07-14 22:06:53 +03:00