Граф коммитов

68 Коммитов

Автор SHA1 Сообщение Дата
Jonathan Kew 6bbbf58763 Bug 1756468 - Add locking to gfxFont, to allow worker threads to do text shaping. r=lsalzman
We protect the shaped-word cache in each font with a RWLock, so that multiple threads can
shape in parallel using cached data; only when a new entry needs to be cached will we need
to take a write lock.

(To improve clarity, this patch also constifys a bunch of methods that do not mutate the
font instance.)

Differential Revision: https://phabricator.services.mozilla.com/D141473
2022-03-24 18:58:00 +00:00
Butkovits Atila 131dd31758 Backed out changeset f26f836c1575 (bug 1756468) for causing leakes. CLOSED TREE 2022-03-24 03:28:12 +02:00
Jonathan Kew 5a3bb65719 Bug 1756468 - Add locking to gfxFont, to allow worker threads to do text shaping. r=lsalzman
We protect the shaped-word cache in each font with a RWLock, so that multiple threads can
shape in parallel using cached data; only when a new entry needs to be cached will we need
to take a write lock.

(To improve clarity, this patch also constifys a bunch of methods that do not mutate the
font instance.)

Differential Revision: https://phabricator.services.mozilla.com/D141473
2022-03-23 23:17:34 +00:00
Lee Salzman 49eee343af Bug 1742896 - Pass TextRunDrawParams to GetScaledFont. r=jfkthame
This tries to clean up some of the awkwardness from bug 1730772 so that we can
do further fixes more easily if necessary.

Differential Revision: https://phabricator.services.mozilla.com/D133353
2021-12-09 22:16:17 +00:00
Simon Giesecke ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Jonathan Kew 16eb1dba68 Bug 1674340 - Separate out language from gfxFontStyle and pass it separately to shaping processes that need it. r=lsalzman
This allows us to avoid instantiating separate gfxFont objects when content is tagged
with different 'lang' attributes, yet ends up using the same fonts (e.g. Wikipedia may
use a default font such as Arial for language names/links that are tagged with several
dozen different languages).

Differential Revision: https://phabricator.services.mozilla.com/D96978
2020-11-13 13:15:39 +00:00
Jonathan Kew be14974fec Bug 1617596 - Move mSpaceGlyph to gfxFont instead of defining it separately in each subclass, and de-virtualize gfxFont::GetSpaceGlyph(). r=lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D63855

--HG--
extra : moz-landing-system : lando
2020-02-24 14:36:52 +00:00
Lee Salzman 2b03a82ba0 Bug 1584268 - only instantiate Cairo fonts when drawing to Cairo target. r=jfkthame
This removes a lot of old cruft in thebes to instantiate Cairo scaled fonts.
Instead, we only instantiate the Cairo scaled font inside Moz2D when we actually
need it for DrawTargetCairo. This thus gets rid of the duplicated code we had
inside both Moz2D and thebes to deal with Cairo scaled fonts.

Differential Revision: https://phabricator.services.mozilla.com/D47297

--HG--
extra : moz-landing-system : lando
2019-10-01 21:56:30 +00:00
Lee Salzman 2770b6301a Bug 1582231 - remove Moz2D dependency on Cairo glyph extents. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D46332

--HG--
extra : moz-landing-system : lando
2019-09-20 16:30:21 +00:00
Lee Salzman 44eb8379af Bug 1547063 - Use FreeType metrics directly instead of querying Cairo. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44497

--HG--
extra : moz-landing-system : lando
2019-09-16 17:15:10 +00:00
Cosmin Sabou 8113720646 Backed out 8 changesets (bug 1547063) for causing bug 1581466. a=backout
Backed out changeset c969a93b0ca7 (bug 1547063)
Backed out changeset 003f5a79c6a7 (bug 1547063)
Backed out changeset 2c7032b4d022 (bug 1547063)
Backed out changeset 23892ecc6ef8 (bug 1547063)
Backed out changeset af6e6807ece7 (bug 1547063)
Backed out changeset ebc71e607938 (bug 1547063)
Backed out changeset 772c3427c791 (bug 1547063)
Backed out changeset e74a67e2afe3 (bug 1547063)
2019-09-16 10:44:20 +03:00
Lee Salzman 0d6ebe2503 Bug 1547063 - Use FreeType metrics directly instead of querying Cairo. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D44497

--HG--
extra : moz-landing-system : lando
2019-09-15 03:01:19 +00:00
Sylvestre Ledru e226046cb8 Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan
# ignore-this-changeset

Depends on D28954

Differential Revision: https://phabricator.services.mozilla.com/D28956

--HG--
extra : moz-landing-system : lando
2019-05-01 08:47:10 +00:00
Jean-Yves Avenard 11ac9e9cf8 Bug 1540581 - P6. Tidy some C++ declarations in gfx/. r=gerald,jrmuizel
* Remove redundant virtual keywords
* Mark all destructors of inheriting classes as virtual for clarity
* Mark all classes without virtual destructor as final (exposed errors)
* Make destructor virtual where it needed to be (some were missing)
* Replace empty ({}) code declaration in header with = default
* Remove virtual unused methods

I probably missed some, it quickly became a rabbit hole.

Differential Revision: https://phabricator.services.mozilla.com/D26060

--HG--
extra : moz-landing-system : lando
2019-04-11 12:36:51 +00:00
Jeff Muizelaar 6bf19bfac4 Bug 1516677. Remove unused drawtarget parameter. r=jfkthame
With bug 1509358 having landed we don't need a draw target in a bunch of
places.  This removes it from those places.

Differential Revision: https://phabricator.services.mozilla.com/D15481

--HG--
extra : moz-landing-system : lando
2018-12-31 11:43:27 +00:00
Tooru Fujisawa 7983faeb5d Bug 1511393 - Use c-basic-offset: 2 in Emacs mode line for C/C++ code. r=nbp 2018-12-01 04:52:05 +09:00
Sylvestre Ledru 265e672179 Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format
# ignore-this-changeset

--HG--
extra : amend_source : 4d301d3b0b8711c4692392aa76088ba7fd7d1022
2018-11-30 11:46:48 +01:00
Jonathan Watt b6f1371d94 Bug 1458218 - Rename gfxGDIFont::mNeedsBold to mNeedsSyntheticBold. r=jfkthame 2018-04-26 12:46:18 +01:00
Jonathan Kew e92b9e44cf Bug 1449605 - part 1 - Rearrange thebes font code so that the decision whether to apply synthetic-bold is deferred until actually instantiating a font, not made during the font-matching process. r=jwatt
This rearranges how synthetic-bold use is determined in the font selection
& rendering code. Previously, we would decide during the font-selection
algorithm whether we need to apply synthetic-bold to the chosen face, and
then pass that decision through the fontgroup (storing it in the FamilyFace
entries of the mFonts array there) down to the actual rendering code that
instantiates fonts from the faces (font entries) we've selected.

That became a problem for variation fonts because in the case of a user
font, we may not have downloaded the resource yet, so we just have a "user
font container" entry, which carries the descriptors from the @font-face
rule and will fetch the actual resource when needed. But in the case of a
@font-face rule without a weight descriptor, we don't actually know at
font-selection time whether the face will support "true" bold (via a
variation axis) or not, so we can't reliably make the right decision about
applying synthetic bold.

So we now defer that decision until we actually instantiate a platform font
object to shape/measure/draw text. At that point, we have the requested
style and we also have the real font resource, so we can easily determine
whether fake-bold is required.

(This patch should not result in any visible behavior change; that will
come in a second patch now that the architecture supports it.)
2018-05-01 10:30:50 +01:00
Jonathan Kew 620b5d3c57 Bug 1419615 - Remove old synthetic-italic support from the GDI font code, so we don't double-slant text now that we have generic support in gfxFont. r=lsalzman 2017-11-23 19:38:17 +00:00
Lee Salzman a21ad6d19e Bug 1385029 - require implementation of gfxFont::GetScaledFont and remove unnecessary gfxPlatform::GetScaledFontForFont. r=jfkthame
MozReview-Commit-ID: GP1Aekecb0s
2017-08-07 16:20:44 -04:00
Lee Salzman 2276117381 Bug 1385029 - remove redundant CairoScaledFont accessor from gfxFont subclasses. r=jfkthame
MozReview-Commit-ID: BjcKkCgSZdG
2017-08-07 16:20:40 -04:00
Jonathan Kew 4b5525bbf7 Bug 1362167 - Use strongly-typed enum classes instead of generic uint16_t fields for the gfxShapedText and gfxTextRun flags. r=jrmuizel 2017-05-04 22:27:05 +01:00
Jonathan Kew 6f0d451756 Bug 1352528 - Hoist call to GetRoundOffsetsToPixels out of the inner loop of text shaping. r=jrmuizel 2017-04-03 17:49:17 +01:00
Daniel Holbert eb14ae51cf Bug 1329670: Change gfxFont::CopyWithAntialiasOption to return UniquePtr instead of raw pointer. r=jfkthame
MozReview-Commit-ID: B5UNazyXPL2
2017-01-09 09:41:35 -08:00
Jonathan Kew 993ba1a742 Bug 1296742 - Initialize gfxGDIFont's metrics at construction time, like other platform font subclasses, and remove its no-longer-needed support for init-on-first-use pattern. r=jrmuizel 2016-08-22 21:39:19 +01:00
Jonathan Kew 48c59f0c3d Bug 1282248 - Declare a bunch of gfxTextRun measurement/drawing methods and related helpers as const. r=m_kato 2016-06-27 17:41:55 +01:00
Jonathan Kew c60f6a1ae4 Bug 1266391 - Introduce an enum class mozilla::unicode::Script, and use this instead of bare integers to specify script codes for better type checking. r=masayuki 2016-04-21 18:58:59 +01:00
Jonathan Kew 28a9e2cf14 Bug 1265452 - Remove use of nsAutoPtr from gfx/thebes. r=jrmuizel 2016-04-15 20:45:37 +01:00
Nicholas Nethercote 06e901cb9f Bug 1231550 - Use DrawTarget instead of gfxContext and/or nsRenderingContext in many places in font/text code. r=jfkthame.
AutoTextRun now only needs a DrawTarget instead of an nsRenderingContext, and
similar nsRenderingContext/gfxContext-to-DrawTarget replacements can be
propagated a long way up the call graph. This patch replaces 93 occurrences of
nsRenderingContext and 135 occurrences of gfxContext with DrawTarget; that's
13% of them.

The patch is mostly plumbing changes. A couple of not-entirely-plumbing
changes:

- It adds a comment about the null check in
  gfxGlyphExtents::GetTightGlyphExtentsAppUnits().

- A couple of functions simply had an unused gfxContext or nsRenderingContext
  parameter removed, e.g. SetLineBreaks().

--HG--
extra : rebase_source : 8f56994bb4d254a86788b17ab2864ebc758a7e6b
2015-12-15 13:56:41 -08:00
Nicholas Nethercote 2a8e0225ac Bug 1232822 (part 1) - Moz2Dify SetupCairoFont(). r=jfkthame.
This is now trivial.
2015-12-15 13:56:40 -08:00
Ehsan Akhgari 883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Jonathan Kew 43167d1667 Bug 1097615 - Add MOZ_OVERRIDE annotations to subclasses of gfxFont. r=jdaggett 2014-11-17 09:59:50 +00:00
Jonathan Watt d6d15a2f78 Bug 1093811 - Convert the gfxFont::GetGlyphWidth() virtual method to take a Moz2D DrawTarget instead of a Thebes gfxContext. r=jfkthame 2014-11-10 21:41:41 +00:00
Jonathan Kew 0e773b6fc0 Bug 1081867 - Convert textrun metrics to physical coordinates before merging with visual-overflow region. r=smontagu 2014-10-16 09:40:19 +01:00
Jonathan Kew b2c88c5dfe Bug 902762 pt 1 - Pass a 'vertical' flag to font shapers, and support vertical shaping through harfbuzz. r=jdaggett 2014-10-01 20:25:48 +01:00
Jonathan Kew 55f3a61af3 Bug 1065002 pt 1.1 - Rename gfxFont::GetMetrics to GetHorizontalMetrics, and add a GetMetrics wrapper to access it. r=jdaggett 2014-09-30 07:37:40 +01:00
Jonathan Kew 68d2010cfd bug 1018551 - clean up redundancy in the font/shaper code. r=jdaggett 2014-05-31 08:12:40 +01:00
Jonathan Kew 9d9eaef84f bug 985220 pt 2 - replace the use of GetGlyphIndicesW with ScriptGetCMap in gfxGDIFont::GetGlyph. r=jdaggett 2014-06-09 16:43:16 +01:00
Jonathan Kew 088699795b bug 985220 - remove the old GDI, Uniscribe and DWrite text-shaping code paths, as we now use HarfBuzz or Graphite for all shaping on Windows. r=jdaggett 2014-06-09 15:47:31 +01:00
Jonathan Kew fbe8c6fe21 backout changeset 59b2dd6b5048 (bug 985220) due to MS Sans Serif regression with Thai system locale (see bug 1020826). 2014-06-06 22:41:09 +01:00
Jonathan Kew f3e4b38e26 backout changeset 3e9d9aa535c7 (bug 1018551) due to MS Sans Serif regression with Thai system locale (see bug 1020826). 2014-06-06 22:41:04 +01:00
Jonathan Kew 38068abbd8 bug 1018551 - clean up redundancy in the font/shaper code. r=jdaggett on a CLOSED TREE 2014-05-31 08:12:40 +01:00
Carsten "Tomcat" Book 82f1d58585 Backed out changeset fd9518344a23 (bug 1018551) for crashes 2014-06-02 10:40:57 +02:00
Jonathan Kew ed41d90a09 bug 1018551 - clean up redundancy in the font/shaper code. r=jdaggett 2014-06-02 07:51:34 +01:00
Jonathan Kew 0d94ebb7d2 bug 985220: remove the old GDI, Uniscribe and DWrite text-shaping code paths, as we now use HarfBuzz or Graphite for all shaping on Windows. r=jdaggett 2014-03-19 12:27:44 +00:00
Ehsan Akhgari 1b83407ce9 Bug 927728 - Part 1: Replace PRUnichar with char16_t; r=roc
This patch was automatically generated by the following script:

#!/bin/bash
# Command to convert PRUnichar to char16_t

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*modules/libmar*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name prtypes.h \
       ! -name Char16.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRUnichar char16_t
2014-01-04 10:02:17 -05:00
Nicholas Nethercote 70723692af Bug 921923 (part 4) - Make multi-output sizeOfFoo() functions more consistent in gfx/thebes/. r=jkew.
--HG--
extra : rebase_source : 02ddce0e34ec6619fcaf92aa30addc77bdd8b80f
2013-10-14 19:19:47 -07:00
Robert O'Callahan 03e7828db2 Bug 910989. Remove nsTHashtable::Init, fallible allocation, and MT hashtables. r=ehsan,bsmedberg
--HG--
extra : rebase_source : 0787130b1814c74bfb38dc178de94022f0b2e64e
2013-09-02 20:41:57 +12:00
Catalin Iacob 6f4758d23e Bug 798914 (part 5) - Use newly introduced mozilla::MallocSizeOf instead of nsMallocSizeOfFun. r=njn.
--HG--
extra : rebase_source : fc472490dd978d165f02f77ed37f07aed6e5bb61
2013-06-23 14:03:39 +02:00