Stylo's Gecko wrapper duplicated some logic from the C++ side so
that the Rust compiler would be able to optimize better. Now that
we have xLTO, this kind of manual inlining should not be neccessary
anymore.
Differential Revision: https://phabricator.services.mozilla.com/D43765
--HG--
extra : moz-landing-system : lando
We are trying to not serialize `text-decoration-line: none` if there are other
non-default values for the longhands.
Differential Revision: https://phabricator.services.mozilla.com/D44908
--HG--
extra : moz-landing-system : lando
For developing properties, we will handle them in an other bug.
Besides, I use an iframe for the test because we create a use counter in
the constructor of Document, which use the prefs to decide what kind of
properties we want to record. So, in the test, we have to reload iframe
to make sure we re-create the document, so does the use counter, to make
sure the prefs work properly.
The two prefs affect the css use counters:
1. layout.css.use-counters.enabled: Allocate use counters, and record
non-custom properties.
2. layout.css.use-counters-unimplemented.enabled: Record all unimplmented
properties into the use counters.
If we disable layout.css.use-counters.enblaed, we don't create use counters
object, so layout.css.use-counters-unimplemented.enabled doesn't work,
either.
Differential Revision: https://phabricator.services.mozilla.com/D43860
--HG--
extra : moz-landing-system : lando
This also fixes some of the issues with -moz-image-region, where we just minted
an auto out of the blue.
Depends on D43472
Differential Revision: https://phabricator.services.mozilla.com/D43474
--HG--
extra : moz-landing-system : lando
This is consistent with the `order` property anyhow, and allows to simplify some
code.
Negatives are still not parsed, but rust uses a similar representation for all
CSS <integer> values and so should C++.
Differential Revision: https://phabricator.services.mozilla.com/D42912
--HG--
extra : moz-landing-system : lando
Updating parking_lot would allow us to avoid dependency duplication when WebGPU tree is vendored.
Differential Revision: https://phabricator.services.mozilla.com/D42557
--HG--
rename : third_party/rust/parking_lot_core/src/thread_parker/wasm.rs => third_party/rust/parking_lot_core/src/thread_parker/wasm_atomic.rs
extra : moz-landing-system : lando
These two bugs (bug 1572738 and bug 1572451) are stylo regressions.
When font-family changes, we try to recompute the font-size with a length /
percentage combinations in case the generic family changes, so the user
preferences are kept.
When calc() is involved, we clamp to non-negative too early, via
NonNegativeLength::scale_by.
I think we should generally dump this "try to track font-size across calc()"
thingie, as as various comments note it is not quite perfect, and it's not clear
how it should work in presence of min()/max().
This patch fixes the issue and simplifies code a bit, I may consider removing
this altogether in a follow-up.
Differential Revision: https://phabricator.services.mozilla.com/D41776
--HG--
extra : moz-landing-system : lando
Return a raw pointer instead of a strong reference to a ComputedStyle, and
handle the case of the style not being present by returning null rather than
requiring an extra function to check it and crashing if the precondition is not
met.
Also, name them so that it's clear they just return outdated styles and don't
make any extra effort.
This is just cleanup that makes the next patch easier / more obvious.
Differential Revision: https://phabricator.services.mozilla.com/D40080
--HG--
extra : moz-landing-system : lando
CORS only works on http channels, so anything else that tries to do a
CORS-enabled request fails catastrophically.
resource:// images are useful for extension developers, so don't perform CORS
checks on them. We may want to also do file:// and fix bug 1565509, while at it,
if we consider it's causing developer pain.
Differential Revision: https://phabricator.services.mozilla.com/D40651
--HG--
extra : moz-landing-system : lando
It's much nicer.
One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D40792
--HG--
extra : moz-landing-system : lando
It's much nicer.
One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D40792
--HG--
extra : moz-landing-system : lando
Support `<track-size>+` on the implicit track sizing properties,
grid-auto-columns and grid-auto-rows.
Differential Revision: https://phabricator.services.mozilla.com/D38408
--HG--
extra : moz-landing-system : lando
I'm _really_ sorry for the size of the patch. I tried to do this in two steps
but it was a lot of work and pretty ugly.
This patch makes us use cbindgen for grid-template-{rows,columns}, in order to:
* Make us preserve repeat() at computed-value time. This is per spec since
interpolation needs to know about repeat(). Except for subgrid, which did the
repeat expansion at parse-time and was a bit more annoying (plus it doesn't
really animate yet so we don't need it to comply with the spec).
* Tweaks the WPT tests for interpolation to adopt the resolution at:
https://github.com/w3c/csswg-drafts/issues/3503.
Trade-off here, as this patch stands, is that this change makes us use less
long-living memory, since we expand repeat() during layout, but at the cost of a
bit of CPU time during layout (conditional on the property applying though,
which wasn't the case before). It should be very easy to store a cached version
of the template, should this be too hot (I expect it isn't), or to change the
representation in other ways to optimize grid layout code if it's worth it.
Another trade-off: I've used SmallPointerArray to handle line-name merging,
pointing to the individual arrays in the style data, rather than actually
heap-allocating the merged lists. This would also be pretty easy to change
should we measure and see that it's not worth it.
This patch also opens the gate to potentially improving memory usage in some
other ways, by reference-counting line-name lists for example, though I don't
have data that suggests it is worth it.
In general, this patch makes much easier to tweak the internal representation of
the grid style data structures. Overall, I think it's a win, the amount of magic
going on in that mako code was a bit huge; it took a bit to wrap my head around
it.
This patch comments out the style struct size assertions. They will be
uncommented in a follow-up patch which contains some improvements for this type,
which are worth getting reviewed separately.
Also, this patch doesn't remove as much code as I would've hoped for because of
I tried not to change most of the dom/grid code for inspector, but I think a
fair bit of the nsGridContainerFrame.cpp code that collects information for it
can be simplified / de-copy-pasted to some extent. But that was a pre-existing
problem and this patch is already quite massive.
Differential Revision: https://phabricator.services.mozilla.com/D36598
Skip whitespace upfront rather than on each individual branch. The only
difference in behavior is that we would've consumed some extra whitespace in the
error case, but I don't think that matters at all.
We were consuming some extra whitespace as well after the close path command for
example, which wasn't parsing anything.
Depends on D40538
Differential Revision: https://phabricator.services.mozilla.com/D40539
--HG--
extra : moz-landing-system : lando
None cannot be returned, since we just called peek() and it returned something.
Differential Revision: https://phabricator.services.mozilla.com/D40538
--HG--
extra : moz-landing-system : lando
This was an oversight in bug 1520154. We kept the -moz- version in the specified
value but not the computed value.
That's a very peculiar way of making aliases work. This makes them work
consistently as many other aliases instead.
Also, add an assert that would've caught this much much earlier.
Differential Revision: https://phabricator.services.mozilla.com/D40063
--HG--
extra : moz-landing-system : lando
… rather than as an extra step after `cargo doc`.
This helps always using the correct set of CSS properties
(for layout 2013 v.s. 2020).
Cherry-picked from: https://github.com/servo/servo/pull/23856
As a bonus this also removes one version of crossbeam-utils
This cherry-picks Servo PR #23630.
--HG--
rename : third_party/rust/crossbeam-deque-0.2.0/LICENSE-APACHE => third_party/rust/crossbeam-queue/LICENSE-APACHE
This is the easy fix.
The hard fix (outlined in the comment) would be nice, but I don't think this bug
alone justifies it.
Differential Revision: https://phabricator.services.mozilla.com/D38184
--HG--
extra : moz-landing-system : lando
And remove some of the ::placeholder and ::cue hacks where we need to use
!important to make the property not apply for content but apply on UA sheets.
The comment about the white-space property was wrong, we don't enforce it with
!important in the UA stylesheets for <input> (we do for <textarea> though), so
I've kept the flag since it really applies.
Differential Revision: https://phabricator.services.mozilla.com/D37717
--HG--
extra : moz-landing-system : lando
Now if you add a new inherited, pref-controlled property, you must
declare whether it can have an effect on scrollbar styles. If no,
then the property will be skipped in the assertions that check
whether our cached styles are equal to those we would compute.
Differential Revision: https://phabricator.services.mozilla.com/D37507
--HG--
extra : moz-landing-system : lando
According to this resolved spec issue:
https://github.com/w3c/csswg-drafts/issues/2140,
we retire the 3-valued <position> on
1. `object-position`
2. `perspective-origin`,
3. `mask-position`
4. `circle()` and `ellipse()`
, but still keep the support for `background-position`.
Besides, I simply run this python script to generate the .ini file:
```
s = sys.argv[1] + ".ini"
with open(s, "w") as f:
f.write('[{}]\n'.format(sys.argv[1]))
f.write(' expected: FAIL\n')
f.write(' bug: https://bugzilla.mozilla.org/show_bug.cgi?id=1559276\n')
```
Differential Revision: https://phabricator.services.mozilla.com/D37126
--HG--
extra : moz-landing-system : lando
And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the
inline function definitions, and nsFrame.cpp for the static assertions).
Differential Revision: https://phabricator.services.mozilla.com/D36120
And move the useful bits of it somewhere else (ServoStyleConstInlines.h for the
inline function definitions, and nsFrame.cpp for the static assertions).
Differential Revision: https://phabricator.services.mozilla.com/D36120
--HG--
extra : moz-landing-system : lando
We clamp earlier (parse time rather than computed value time), but that's the
only behavior change, which I think doesn't really matter.
Differential Revision: https://phabricator.services.mozilla.com/D35198
--HG--
extra : moz-landing-system : lando
This needs https://github.com/eqrion/cbindgen/pull/362, but I expect it to be
uncontroversial. I'll add a patch to this bug when it's merged to update it.
cbindgen historically didn't include these, but it turns out to be pretty useful
to generate constants for the style crate (since the binding crate is
`servo/ports/geckolib`).
An alternative is to get a completely different cbindgen-generated header for
these, but that seems a bit wasteful. This generates the constants with the
Style prefix (so we'll get `StyleMAX_GRID_LINE` for example), which is very
ugly. But we probably want to eventually stop using the Style prefix and use a
namespace instead, plus it's trivial to do `auto kMaxLine = StyleMAX_GRID_LINE`,
for example, so it's probably not a huge deal.
Another alternative would be to use associated consts, which _are_ generated by
cbindgen. Something like:
```
struct GridConstants([u8; 0]);
impl GridConstants {
const MAX_GRID_LINE: i32 = 10000;
}
```
Which would yield something like:
```
static const int32 StyleGridConstants_MAX_GRID_LINE = 10000;
```
I'm not sure if you find it preferrable, but I'm also happy to change it in a
follow-up to use this.
We need to fix a few manual C++ function signature definitions to match the C++
declaration.
Differential Revision: https://phabricator.services.mozilla.com/D35197
--HG--
extra : moz-landing-system : lando
Option<> is not FFI-safe, so if we want to use the same representation
everywhere we need to get rid of it. This also makes it take the same amount of
memory as the C++ representation, and it's not very complex, I'd think.
Differential Revision: https://phabricator.services.mozilla.com/D35195
--HG--
extra : moz-landing-system : lando
We clamp earlier (parse time rather than computed value time), but that's the
only behavior change, which I think doesn't really matter.
Differential Revision: https://phabricator.services.mozilla.com/D35198
--HG--
extra : moz-landing-system : lando
This needs https://github.com/eqrion/cbindgen/pull/362, but I expect it to be
uncontroversial. I'll add a patch to this bug when it's merged to update it.
cbindgen historically didn't include these, but it turns out to be pretty useful
to generate constants for the style crate (since the binding crate is
`servo/ports/geckolib`).
An alternative is to get a completely different cbindgen-generated header for
these, but that seems a bit wasteful. This generates the constants with the
Style prefix (so we'll get `StyleMAX_GRID_LINE` for example), which is very
ugly. But we probably want to eventually stop using the Style prefix and use a
namespace instead, plus it's trivial to do `auto kMaxLine = StyleMAX_GRID_LINE`,
for example, so it's probably not a huge deal.
Another alternative would be to use associated consts, which _are_ generated by
cbindgen. Something like:
```
struct GridConstants([u8; 0]);
impl GridConstants {
const MAX_GRID_LINE: i32 = 10000;
}
```
Which would yield something like:
```
static const int32 StyleGridConstants_MAX_GRID_LINE = 10000;
```
I'm not sure if you find it preferrable, but I'm also happy to change it in a
follow-up to use this.
We need to fix a few manual C++ function signature definitions to match the C++
declaration.
Differential Revision: https://phabricator.services.mozilla.com/D35197
--HG--
extra : moz-landing-system : lando
Option<> is not FFI-safe, so if we want to use the same representation
everywhere we need to get rid of it. This also makes it take the same amount of
memory as the C++ representation, and it's not very complex, I'd think.
Differential Revision: https://phabricator.services.mozilla.com/D35195
--HG--
extra : moz-landing-system : lando
This doesn't change the way C++ code uses static prefs. But it does slightly
change how Rust code uses static prefs, specifically the name generated by
bindgen is slightly different.
The commit also improves some comments.
Differential Revision: https://phabricator.services.mozilla.com/D35764
--HG--
extra : rebase_source : 13cf215aeb713e188103ef0cd04d094aa150853e
Correctly handle clamping to 1 behavior of grayscale(),
invert(), opacity() and sepia().
Differential Revision: https://phabricator.services.mozilla.com/D35509
--HG--
extra : moz-landing-system : lando
This patch invalidates the style for `::selection`, which will restore the behavior before the regression.
However, it's still not quite correct, because repaint is not triggered. Given that `::selection` requires some major change to implement https://github.com/w3c/csswg-drafts/issues/2474, we can address this problem later.
Differential Revision: https://phabricator.services.mozilla.com/D35305
--HG--
extra : moz-landing-system : lando
This patch produces the following serialization:
```
input | computed value
------------------------------
1. "auto" "auto"
2. "auto auto" "auto"
3. "15px auto" "15px"
4. "15px" "15px"
```
i.e. If the second value is 'auto', then it's omitted from our serialization,
because it's implied.
Besides, we update the wpt to address this spec issue:
https://github.com/w3c/csswg-drafts/issues/2574
Differential Revision: https://phabricator.services.mozilla.com/D35510
--HG--
extra : moz-landing-system : lando
In particular:
* trait objects without an explicit `dyn` are deprecated
* `...` range patterns are deprecated
I think these shouldn't really warn by default and should be clippy / opt-in
lints, but anyway, doesn't hurt.
Differential Revision: https://phabricator.services.mozilla.com/D35135
--HG--
extra : moz-landing-system : lando
The style system already atomizes all CustomIdent values, which means that we're
just wasting memory and CPU by doing string copies all over the place.
This patch fixes it. This also simplifies further changes to use as much of the
rust data structures as possible.
I had to switch from nsTHashtable to mozilla::HashTable because the former
doesn't handle well non-default-constructible structs (like NamedLine, which
now has a StyleAtom, which is not default-constructible).
Differential Revision: https://phabricator.services.mozilla.com/D35119
--HG--
extra : moz-landing-system : lando
Right now we do a lot of useless string copying. In order to avoid transcoding
to utf-16 during layout, make sure to use nsCString at a few related places.
I may revisit this since we're storing other line names as atoms in some places.
So it may be better to just use atoms everywhere.
But that'd be a different patch either way.
Depends on D35116
Differential Revision: https://phabricator.services.mozilla.com/D35117
--HG--
extra : moz-landing-system : lando
Should not serialize default shape-outside circle() function radius.
The ToCss impl of Circle and Ellipse turn out to be identical in specified and computed value, thus move them to generics.
Differential Revision: https://phabricator.services.mozilla.com/D35183
--HG--
extra : moz-landing-system : lando
Should not serialize default shape-outside circle() function radius.
The ToCss impl of Circle and Ellipse turn out to be identical in specified and computed value, thus move them to generics.
Differential Revision: https://phabricator.services.mozilla.com/D35183
--HG--
extra : moz-landing-system : lando
I want to enable in Nightly to evaluate (in the medium term) shipping it without
the part forwarding, once the cascade order and importance issues are fixed, and
that we pass all the tests that don't involve forwarding.
That is, I want to monitor whether having ::part() causes compat issues or not.
Depends on D32648
Differential Revision: https://phabricator.services.mozilla.com/D32649
--HG--
extra : moz-landing-system : lando
This should make all the pieces come together.
Note that we don't need to look at the snapshot for ::part() for now (other than
when selector-matching normally) because I decided to just restyle the element
for now when the part attribute changes.
::part() can't affect descendants anyway (as long as we don't do the forwarding
stuff), and eager pseudo-elements are handled during the normal element restyle,
so it seems to me that adding all the complexity that we have for classes to
part may not be worth it at least yet.
Depends on D32647
Differential Revision: https://phabricator.services.mozilla.com/D32648
--HG--
extra : moz-landing-system : lando
I still haven't implemented each_part(), so this will do nothing yet.
The cascade order stuff is fishy, I know, and I'll fix in a followup if it's
fine with you. I moved the sorting of the rules to rule_collector, since it
seemed to me it was better that way that duplicating the code, and those
SelectorMap functions only have a single caller anyway.
Depends on D32646
Differential Revision: https://phabricator.services.mozilla.com/D32647
--HG--
extra : moz-landing-system : lando
Unlike for :host() or ::slotted(), or regular rules, we don't need a whole
SelectorMap<>, so gotta make the code a bit more generic.
Depends on D32645
Differential Revision: https://phabricator.services.mozilla.com/D32646
--HG--
extra : moz-landing-system : lando
This grows the selector struct, but only in 32-bit, since in 64-bit we take
space from the alignment padding that we're paying due to having the size of the
slice as a word.
Depends on D32644
Differential Revision: https://phabricator.services.mozilla.com/D32645
--HG--
extra : moz-landing-system : lando
This uses the bit added for tracking part attributes in order to avoid doing
wasted work.
Depends on D32643
Differential Revision: https://phabricator.services.mozilla.com/D32644
--HG--
extra : moz-landing-system : lando
Still does nothing, since we still do not collect part rules, but this is all
the plumbing that should allow us to invalidate parts when attributes or state
change on their ancestors.
Depends on D32641
Differential Revision: https://phabricator.services.mozilla.com/D32642
--HG--
extra : moz-landing-system : lando
These are owned by the element and not referenced from the stylesheets.
They're referenced from the rule tree, but the rule nodes don't measure their
style source (since they're non-owning).
So unconditionally reporting them even though it's a refcounted object is ok.
While at it, remove some other fields from the old style system that are no
longer used.
Differential Revision: https://phabricator.services.mozilla.com/D34014
--HG--
extra : moz-landing-system : lando
It looks like bug 1547939 will stick, given how fast the other regressions came
in for bug 1337655.
We haven't seen any regression from this, and it seems unlikely that we'd want
this code back.
This blocks further improvements to the style system. Simplifying this code
allows me to remove all the conversion code for gradients.
Let me know if you think it's premature and I'm happy to wait, but I really want
to see this code gone :)
Differential Revision: https://phabricator.services.mozilla.com/D33820
--HG--
extra : moz-landing-system : lando