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

250 Коммитов

Автор SHA1 Сообщение Дата
Jonathan Kew b593702fb8 Bug 1791782 - Connect CSS font-palette features to rendering via the presContext. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157959
2022-10-07 23:00:46 +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 1ced95e237 Bug 1791782 - Connect CSS font-palette features to rendering via the presContext. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157959
2022-10-07 18:58:53 +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 c8bc44d595 Bug 1791782 - Connect CSS font-palette features to rendering via the presContext. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157959
2022-10-07 16:53:36 +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 03bc9753c5 Bug 1791782 - Connect CSS font-palette features to rendering via the presContext. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D157959
2022-10-07 12:16:53 +00:00
Emilio Cobos Álvarez d9a694f78f Bug 1791281 - Simplify our setup for font metric queries from style. r=jfkthame
While looking at moving the flag around I realized that the only reason
we have FontMetricsProvider and co is because we didn't have access to
the per-document font-prefs cache. That's trivial to fix tho, so do
that and simplify the setup for font queries even more.

Differential Revision: https://phabricator.services.mozilla.com/D157589
2022-09-20 19:30:45 +00:00
Frederic Wang e65e52a1da Bug 1187682 - Use ScriptPercentScaleDown and ScriptScriptPercentScaleDown constants. r=emilio
The math-depth implementation is refined to take into account the
ScriptPercentScaleDown and ScriptScriptPercentScaleDown constants (if the
parent's first valid font has a MATH table) in order to calculate the
scale factor between math-deth 0 and 1, and between 0 and 2 respectively.

Behavior is unchanged if the legacy scriptsizemultiplier attribute is
specified or if no MATH table is available.

The preference layout.css.math-depth.enabled remains disabled in nightly
until the remaining bit (support for font-size: math) is implemented in
bug 1667090.

Differential Revision: https://phabricator.services.mozilla.com/D91604
2022-08-30 10:16:33 +00:00
Jonathan Kew 5bcdc7cf69 Bug 1786493 - Implement CSS @supports font-format(...) and font-tech(...) functions. r=emilio
These are gated by the same layout.css.font-tech.enabled pref as the
closely-related `tech()` function for the @font-face src descriptor;
once the spec questions are settled, we should enable them all together.

Differential Revision: https://phabricator.services.mozilla.com/D155359
2022-08-25 12:19:21 +00:00
Marian-Vasile Laza 07de1f7c1b Backed out 2 changesets (bug 1786493) for causing build bustages. CLOSED TREE
Backed out changeset 077219c44704 (bug 1786493)
Backed out changeset b1b0464f9bed (bug 1786493)
2022-08-25 14:26:59 +03:00
Jonathan Kew 4642b812a4 Bug 1786493 - Implement CSS @supports font-format(...) and font-tech(...) functions. r=emilio
These are gated by the same layout.css.font-tech.enabled pref as the
closely-related `tech()` function for the @font-face src descriptor;
once the spec questions are settled, we should enable them all together.

Differential Revision: https://phabricator.services.mozilla.com/D155359
2022-08-25 11:09:10 +00:00
Boris Chiou 3897893bd1 Bug 1694741 - Part 6: Map width/height attributes to the style of img elements. r=emilio
This patch will use the width/height attributes from <source> to override
width/height/aspect-ratio CSS property values of <img> elements.

So basically, we need to introduce an extra nsMappedAttribtue member in
HTMLSourceElement (and it only stores width and height attributes).
And then we use it as an extra declarations (which are generated by
Gecko_GetExtraContentStyleDeclarations()) so we can override the
declarations created from presentation attributes of <img>.

Besides, we need to make sure <img> elements get restyled in the
following cases:
1. width/height attributes is changed in <source> elements
2. <source> is inserted as a <picture>'s child
3. <source> is removed from the child list of <picture>
4. <img> is inserted as a <picture>'s child
5. <img> is removed from the child list of <picture>

We make the responsive source synchronously get updated in the previous patch,
so now we can just restyle the image when updating its responsive source.

Note: We fix the reflection of percentages for width/height attributes in
the next patch.

Differential Revision: https://phabricator.services.mozilla.com/D152586
2022-08-22 20:18:39 +00:00
Boris Chiou 0777a55c37 Bug 1694741 - Part 3: Add NS_IMPL_FROMNODE_HELPER() for HTMLTableCellElement. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D154328
2022-08-22 20:18:38 +00:00
Emilio Cobos Álvarez d98aff87e0 Bug 1781140 - Remove nsTimingFunction and ComputedTimingFunction. r=dshin
They're simple wrappers of StyleComputedTimingFunction so we can remove
them.

Differential Revision: https://phabricator.services.mozilla.com/D152700
2022-07-26 14:49:02 +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
Andrew Osmond 9f767ee84a 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 18:35:49 +00:00
Boris Chiou ccc7ef067d Bug 1293490 - Part 3: Support animation-composition in keyframe at rules. r=emilio
So we can specify the keyframe-specific composite operation. However,
these is a spec issue about the default composite for CSS Animations:
https://github.com/w3c/csswg-drafts/issues/7476.

I choose to use auto as the default composite for missing keyframes to match
the definition in web-animations-1 because I think this makes more sense:
> If the keyframe-specific composite operation for a keyframe is not set, the
> composite operation specified for the keyframe effect as a whole is used for
> values specified in that keyframe.

Differential Revision: https://phabricator.services.mozilla.com/D150808
2022-07-12 19:02:04 +00:00
David Shin d360f1fee3 Bug 1766041: Part 3: Migrate C++ `BeforeFlag` to that of Rust's. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150567
2022-07-09 17:33:58 +00:00
Csoregi Natalia 33193d6158 Backed out 5 changesets (bug 1766041) for gtest failures on APZCBasicTester. CLOSED TREE
Backed out changeset 3b0cd4ee7d1e (bug 1766041)
Backed out changeset 5de0ed4fd59b (bug 1766041)
Backed out changeset cc7ffb683e8a (bug 1766041)
Backed out changeset ce5a895e7a06 (bug 1766041)
Backed out changeset 315578c436ca (bug 1766041)
2022-07-08 03:12:42 +03:00
David Shin 07b055639d Bug 1766041: Part 3: Migrate C++ `BeforeFlag` to that of Rust's. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D150567
2022-07-07 22:52:58 +00:00
Emilio Cobos Álvarez 9fc2aa47fc Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-13 00:59:23 +00:00
Noemi Erli 841e350bc4 Backed out changeset 7585591a9bad (bug 1773558) for causing failures in system-fonts.html 2022-06-12 19:02:33 +03:00
Emilio Cobos Álvarez e441089ca0 Bug 1773558 - Move fixed-point font types to Rust. r=layout-reviewers,jfkthame
Now that cbindgen and rust support const generics, it seems more simple.

This centralizes all the relevant font constants etc in rust and avoids
conversions when going from rust to C++ and vice versa.

Differential Revision: https://phabricator.services.mozilla.com/D148847
2022-06-12 10:48:58 +00:00
Emilio Cobos Álvarez 255763ef57 Bug 1773070 - Unify Gecko and Servo EventState/ElementState bits. r=smaug
Add a dom/base/rust crate called just "dom" where we can share these.

Most of the changes are automatic:

  s/mozilla::EventStates/mozilla::dom::ElementState/
  s/EventStates/ElementState/
  s/NS_EVENT_STATE_/ElementState::/
  s/NS_DOCUMENT_STATE_/DocumentState::/

And so on. This requires a new cbindgen version to avoid ugly casts for
large shifts.

Differential Revision: https://phabricator.services.mozilla.com/D148537
2022-06-07 23:09:52 +00:00
David Shin dd82875f18 Bug 1766886 - Use `mozilla::variant` in `ComputedTimingFunction` to contain the function implementation. r=boris
Also minor refactorings:
- Less Init() calls
- Remove unused `Compare` functions
- Add explicit casts to narrowing conversions

Differential Revision: https://phabricator.services.mozilla.com/D145014
2022-05-05 21:10:01 +00:00
Iulian Moraru 5c694a2f48 Backed out changeset a7fae9e0df25 (bug 1766886) for causing build bustages on TimingParams.h. CLOSED TREE 2022-05-03 23:26:20 +03:00
David Shin 30d6445f84 Bug 1766886 - Use `mozilla::variant` in `ComputedTimingFunction` to contain the function implementation. r=boris
Also minor refactorings:
- Less Init() calls
- Remove unused `Compare` functions
- Add explicit casts to narrowing conversions

Differential Revision: https://phabricator.services.mozilla.com/D145014
2022-05-03 19:41:37 +00:00
Emilio Cobos Álvarez 597c2fe947 Bug 1758223 - Use atomic ops to read / write node flags from stylo. r=nika
The flags stylo cares about reading and writing potentially at the same
time are disjoint, so there's no need for any strong memory ordering.

Differential Revision: https://phabricator.services.mozilla.com/D141829
2022-03-24 10:03:12 +00:00
Butkovits Atila 004df17a21 Backed out changeset 8a3be63619de (bug 1758223) for causing bustages. CLOSED TREE 2022-03-24 06:31:29 +02:00
Emilio Cobos Álvarez ec82ced641 Bug 1758223 - Use atomic ops to read / write node flags from stylo. r=nika
The flags stylo cares about reading and writing potentially at the same
time are disjoint, so there's no need for any strong memory ordering.

Differential Revision: https://phabricator.services.mozilla.com/D141829
2022-03-24 04:08:18 +00:00
Jonathan Kew 9477e32f16 Bug 1531223 - Add support for the 'ic' font-relative unit. r=emilio
This is a "simplified" implementation of 'ic', similar to what Safari Preview
currently supports: it only considers the advance of U+6C34 if found in the
first available font, and otherwise falls back to the default of 1em.

(The spec allows for this "in cases where it is impossible or impractical to
determine the ideographic advance measure".)

Differential Revision: https://phabricator.services.mozilla.com/D132818
2021-12-08 17:07:05 +00:00
Jonathan Kew 719dd66863 Bug 1702924 - Add support for the 'cap' font-relative unit. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D133101
2021-12-08 12:20:40 +00:00
Butkovits Atila 21676cf030 Backed out changeset 145c64b7ac17 (bug 1531223) for causing failures at gfxFontEntry.cpp. CLOSED TREE 2021-12-06 14:57:31 +02:00
Jonathan Kew ed3fd395ba Bug 1531223 - Add support for the 'ic' and 'cap' font-relative units. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D132818
2021-12-06 12:22:09 +00:00
Emilio Cobos Álvarez ff07ef7e17 Bug 1739464 - Simplify language-dependent font fallback code. r=jfkthame
.fallback is always the default font for the lang group unless we're a
system font (in which case it's "none").

The only reason we need that is because we need to react to
language changes (which affect the initial font).

Simplify the model a bit doing the language lookup in gfxTextRun (this
should avoid allocating a few nsStyleFont structs too.

Depends on D130732

Differential Revision: https://phabricator.services.mozilla.com/D131312
2021-11-19 16:11:55 +00:00
Emilio Cobos Álvarez 2f4e4df679 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
This seems like more sensible behavior. We have another use of
only_generic(), but that affects font sizing and other browsers agree
with us there:

  <div style="font-family: monospace">Should be 13px</div>
  <div style="font-family: something, monospace">Should be 16px</div>

So not touching that one.

Differential Revision: https://phabricator.services.mozilla.com/D130732
2021-11-19 16:11:54 +00:00
Alexandru Michis ef8f129df5 Backed out changeset 82c80c6c8090 (Bug 1739464) for causing mochitest plain failures in test_bug496275.html
CLOSED TREE
2021-11-12 03:45:59 +02:00
Emilio Cobos Álvarez 3b4c3ed152 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
This seems like more sensible behavior. We have another use of
only_generic(), but that affects font sizing and other browsers agree
with us there:

  <div style="font-family: monospace">Should be 13px</div>
  <div style="font-family: something, monospace">Should be 16px</div>

So not touching that one.

Differential Revision: https://phabricator.services.mozilla.com/D130732
2021-11-11 17:48:55 +00:00
Marian-Vasile Laza 6d3bafd66a Backed out changeset 2ed757d5dd76 (bug 1739464) for causing reftest failures on brackets-3b-rtl.html. CLOSED TREE 2021-11-10 22:54:06 +02:00
Emilio Cobos Álvarez 4dabed3c51 Bug 1739464 - Use first generic rather than only generic to determine fallback font family. r=jfkthame
This seems like more sensible behavior. We have another use of
only_generic(), but that affects font sizing and other browsers agree
with us there:

  <div style="font-family: monospace">Should be 13px</div>
  <div style="font-family: something, monospace">Should be 16px</div>

So not touching that one.

Differential Revision: https://phabricator.services.mozilla.com/D130732
2021-11-10 17:58:18 +00:00
Emilio Cobos Álvarez a3a1b27924 Bug 1740230 - Refactor :-moz-lwtheme pseudo-classes to get invalidated correctly. r=dholbert
Use the same document state mechanism we have for :moz-locale-dir. Also,
simplify the setup of the later to be the same as :dir(), allowing the
matching code to be less repetitive.

This should fix some flakiness in chrome mochitests, but we have no existing
tests for these pseudo-classes more generally and since they're just
chrome-only I'm not super-excited about adding more.

Differential Revision: https://phabricator.services.mozilla.com/D130735
2021-11-09 20:59:11 +00:00
Emilio Cobos Álvarez 484b64d362 Bug 1738693 - Serialize image local refs as local. r=jwatt
As per https://github.com/w3c/csswg-drafts/issues/3195

If we ship this, then we can simplify a bunch of code (we can remove
SpecifiedImageUrl / ComputedImageUrl and co).

Differential Revision: https://phabricator.services.mozilla.com/D130160
2021-11-08 14:30:36 +00:00
Emilio Cobos Álvarez 1421e7f545 Bug 1525107 - Make Canvas/CanvasText and Link colors color-scheme-aware. r=dholbert
For that, add `.dark` version of the browser.display* prefs that control
the light version of these colors.

The default for background/foreground colors are taken from the
GenericDarkColors used in LookAndFeel.

The defaults for links are based on this discussion:

  https://github.com/whatwg/html/issues/5426#issuecomment-904021675

(So they effectively match Chrome).

Whether the dark colors should be exposed in about:preferences (like the
light colors are) is TBD.

With this patch, we pass all the tests in:

  /html/semantics/document-metadata/the-meta-element/color-scheme/

Use the colors to paint the default canvas background and the default
colors.

There are three "regressions", though they are really progressions: we
now render the reference as the test expects (before we rendered a light
canvas background even for the reference).

Apart of these iframe tests (which we should look into, I filed
https://bugzilla.mozilla.org/show_bug.cgi?id=1738380), there are three
remaining test failures.

Two of them are due to `color: initial` not changing based on the
color-scheme. Safari also fails these tests, and the thing they're
really testing is whether system colors are preserved at computed-value
time:

  https://github.com/w3c/csswg-drafts/issues/3847

Regarding that change, I'm not so sure the trade-offs there are worth
it, as that not only complicates interpolation (we wouldn't be able to
use system colors in color-mix among others, see
https://github.com/w3c/csswg-drafts/issues/5780) plus it changes
inheritance behavior in sorta unexpected ways, see:

  https://github.com/w3c/csswg-drafts/issues/6773

Which I just filed because apparently no browser implements this
correctly. So for now will punt on those (keep matching Safari).

There's an svg-as-image test:

  https://searchfox.org/mozilla-central/rev/f8576fec48d866c5f988baaf1fa8d2f8cce2a82f/testing/web-platform/tests/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html

Which isn't using the feature at all and I'm not sure why is it supposed
to pass (why prefers-color-scheme: dark is supposed to match that SVG
image). This test fails in all browsers apparently:

  https://wpt.fyi/results/css/css-color-adjust/rendering/dark-color-scheme/svg-as-image.html?label=master&label=experimental&aligned

I sent https://github.com/web-platform-tests/wpt/pull/31407 to remove
it and hopefully get it reviewed by some Chromium folks.

Differential Revision: https://phabricator.services.mozilla.com/D129746
2021-10-29 19:58:25 +00:00
Emilio Cobos Álvarez 933c5ad884 Bug 1525107 - Move Canvas/Link color computation to C++-land. r=dholbert
This doesn't change behavior but will allow us to deduplicate some
logic given we compute the effective color-scheme in C++.

Differential Revision: https://phabricator.services.mozilla.com/D129744
2021-10-29 19:58:24 +00:00
Andrew McCreight 8c5d7e5ee8 Bug 1736707, part 1 - Get rid of nsContentUtils::NameSpaceManager(). r=peterv
Call nsNameSpaceManager::GetInstance() instead.

Differential Revision: https://phabricator.services.mozilla.com/D129033
2021-10-22 16:15:57 +00:00
Emilio Cobos Álvarez b742f680db Bug 1509931 - Expose titlebar radius as a chrome-only CSS environment variable. r=stransky
Mostly plumbing.

Differential Revision: https://phabricator.services.mozilla.com/D128680
2021-10-18 16:22:13 +00:00
Emilio Cobos Álvarez 445c7b4297 Bug 1734455 - Remove support for -moz-system-color() as chrome code no longer uses it (in favor of color-scheme). r=xidorn
Differential Revision: https://phabricator.services.mozilla.com/D127802
2021-10-07 11:56:17 +00:00
Emilio Cobos Álvarez 48c864f2b1 Bug 1729488 - Refactor shared sheet cache into something more reusable. r=jwatt
This moves the style-specific bits of the shared style sheet cache into
a super-class, and leaves the generic "sub-resource management" bits
inside a base class. In order to implement it you need to provide some
types, mainly:

  * Loader, which implements LoaderPrincipal() and allows you to key per
    principal. The idea is that this would be the
    {CSS,Script,Image}Loader object.

  * Key (self explanatory). We might want to introduce a common key to
    share the cache partitioning logic.

  * Value, which represents the final cached value. This is expected to
    be a StyleSheet / Stencil / imgRequestProxy.

  * LoadingValue, which must inherit from
    SharedSubResourceCacheLoadingValueBase (which contains the linked
    list and the state that the cache manages). It also must provide a
    ValueForCache() and ExpirationTime() members. For style, this is the
    SheetLoadData. For script this will probably be the
    ScriptLoadRequest. For images it might be enough with the
    imgRequestProxy, but we might need something else, haven't looked
    into it too deeply yet.

We move the use counters into the stylesheet since that's both more
similar to how we treat StyleSheetContents and easier (that way we don't
need to add some sort of "extra data" thing to the cache).

Differential Revision: https://phabricator.services.mozilla.com/D124820
2021-10-05 15:15:22 +00:00