Always store the pointer in little-endian order so that the tag trick works.
Differential Revision: https://phabricator.services.mozilla.com/D61386
--HG--
extra : moz-landing-system : lando
For now, we still bail out at the stage of getting the calc node into a
CalcLengthPercentage if we couldn't simplify the min() / max() / clamps()
involved.
After this plan is to use just CalcNode everywhere instead of
specified::CalcLengthPercentage, and then modify the computed
CalcLengthPercentage, which would look slightly different as we know all the sum
terms for those are a struct like { Length, Percentage, bool has_percentage } or
such, so all the simplification code for that becomes much simpler, ideally.
Or we could turn CalcNode generic otherwise, if it's too much code... We'll see.
Differential Revision: https://phabricator.services.mozilla.com/D61739
--HG--
extra : moz-landing-system : lando
There were two issues with the existing code that we use to determine whether a
widget is styled or not.
First, it was using `color == Color::transparent()` instead of
`color.is_transparent()` to check for transparent backgrounds. That is not sound
as `Color::transparent()` is the literal value `rgba(0, 0, 0, 0)`, not the
`transparent` keyword, so the equality check would fail.
The other issue is that this function was early-returning false if that check
was returning false. It is a bug for this function to early-return false, as it
makes the result of the function dependent of the order of the declarations.
Differential Revision: https://phabricator.services.mozilla.com/D62060
--HG--
extra : moz-landing-system : lando
This removes nsStyleImageRequest by moving the load state to LoadData instead
(where other lazy state like the resolved URL and load id lives).
That way we can use cbindgen for more stuff (there's no blocker for using it for
all images now), and we can undo the image tracking shenanigans that I had to do
in bug 1605803 in nsImageFrame.
This removes the mDocGroup member because well, there's no real upside of that
now that quantum DOM is not a thing.
It also removes the static clones of the image requests, and the need for each
computed value instance to have its own request. These were needed because we
needed the image loader for the particular document to observe the image
changes. But we were also tracking the request -> loader for other purposes.
Instead, Now all the images get loaded with GlobalImageObserver as a listener,
which looks in the image map and forwards the notification to all the interested
loaders instead dynamically.
The style value is only responsible to load the image, and no longer tracks /
locks it. Instead, the loader does so, via the image tracker.
Differential Revision: https://phabricator.services.mozilla.com/D58519
--HG--
extra : moz-landing-system : lando
Keep a flat list of sum members. Simpify product and division ASAP.
I want to preserve the tree for a bit longer to implement min / max / clamp.
This doesn't do anything for it that we weren't doing already, but it helps to
eventually keep this specified representation and the equivalent computed
representation for <length-percentage> values.
Enable the tests for the comparison functions too, to prevent regressions.
Differential Revision: https://phabricator.services.mozilla.com/D61514
--HG--
extra : moz-landing-system : lando
This removes nsStyleImageRequest by moving the load state to LoadData instead
(where other lazy state like the resolved URL and load id lives).
That way we can use cbindgen for more stuff (there's no blocker for using it for
all images now), and we can undo the image tracking shenanigans that I had to do
in bug 1605803 in nsImageFrame.
This removes the mDocGroup member because well, there's no real upside of that
now that quantum DOM is not a thing.
It also removes the static clones of the image requests, and the need for each
computed value instance to have its own request. These were needed because we
needed the image loader for the particular document to observe the image
changes. But we were also tracking the request -> loader for other purposes.
Instead, Now all the images get loaded with GlobalImageObserver as a listener,
which looks in the image map and forwards the notification to all the interested
loaders instead dynamically.
The style value is only responsible to load the image, and no longer tracks /
locks it. Instead, the loader does so, via the image tracker.
Differential Revision: https://phabricator.services.mozilla.com/D58519
--HG--
extra : moz-landing-system : lando
MANUAL PUSH: Patch from contributor was missing this, causing bustage.
CLOSED TREE
--HG--
extra : amend_source : ebf9505656921c452d3b2abac2f5a88f1b99db15
This is needed to make the root element not a containing block in presence of
filters or what not.
Differential Revision: https://phabricator.services.mozilla.com/D61167
--HG--
extra : moz-landing-system : lando
This provides stronger typing and removes a bunch of subtle constants matching.
Differential Revision: https://phabricator.services.mozilla.com/D61058
--HG--
extra : moz-landing-system : lando
We're resetting `color` to the default color when there's a declaration that
applies in order to make stuff like this:
<div style="color: transparent">
<div style="color: red">
Red
</div>
</div>
To not show transparent. But the behavior we want is more like "override with
default color iff there's no other declaration that would set the color from an
user or UA sheet".
This implements that behavior, plus avoids it if we're not inheriting
from transparent, so that stuff like this preserves the behavior from before bug
844349:
<a href="foo">
<span style="color: red">Should be the red color</span>
</a>
Differential Revision: https://phabricator.services.mozilla.com/D60391
--HG--
extra : moz-landing-system : lando
(And while at it, format the end of the other keyword tables so that
cleanup_ktables.py works).
It seems `Window.setCursor` is only used once in our code, maybe
we should remove it...
Differential Revision: https://phabricator.services.mozilla.com/D61090
--HG--
extra : moz-landing-system : lando
We're resetting `color` to the default color when there's a declaration that
applies in order to make stuff like this:
<div style="color: transparent">
<div style="color: red">
Red
</div>
</div>
To not show transparent. But the behavior we want is more like "override with
default color iff there's no other declaration that would set the color from an
user or UA sheet".
This implements that behavior, plus avoids it if we're not inheriting
from transparent, so that stuff like this preserves the behavior from before bug
844349:
<a href="foo">
<span style="color: red">Should be the red color</span>
</a>
Differential Revision: https://phabricator.services.mozilla.com/D60391
--HG--
extra : moz-landing-system : lando
Per SVG2 spec, the EBNF allows the path data string to be empty.
An empty path data string disables rendering of the path.
Therefore, we should make path('') a valid path string.
The related spec issue: https://github.com/w3c/fxtf-drafts/issues/392.
Now we serialize `path("")` as `path("")` for offset-path and clip-path.
Differential Revision: https://phabricator.services.mozilla.com/D60771
--HG--
extra : moz-landing-system : lando
This simplifies a bit the code, and guarantees that all calc()s have percentages
and lengths.
I also wanted to remove unclamped_length() / specified_percentage() (for the
same reason as the above patch), but they're needed for animations for now. When
I implement min() / max() for <length-percentage> they'll be fixed.
Differential Revision: https://phabricator.services.mozilla.com/D60194
--HG--
extra : moz-landing-system : lando
This is just not a thing you can do if you have min() / max() / etc, as the min
/ max value may depend on the percentage basis.
Differential Revision: https://phabricator.services.mozilla.com/D60168
--HG--
extra : moz-landing-system : lando
This simplifies a bit the code, and guarantees that all calc()s have percentages
and lengths.
I also wanted to remove unclamped_length() / specified_percentage() (for the
same reason as the above patch), but they're needed for animations for now. When
I implement min() / max() for <length-percentage> they'll be fixed.
Differential Revision: https://phabricator.services.mozilla.com/D60194
--HG--
extra : moz-landing-system : lando
This is just not a thing you can do if you have min() / max() / etc, as the min
/ max value may depend on the percentage basis.
Differential Revision: https://phabricator.services.mozilla.com/D60168
--HG--
extra : moz-landing-system : lando
It does not make any sense with min() / max() / clamp. So just forget the
keyword info when calc() is used. This also removes a bit of complex / hacky
code.
Differential Revision: https://phabricator.services.mozilla.com/D60663
--HG--
extra : moz-landing-system : lando
We generate ByteBuf by rust bindgen, so we can drop StyleVecU8.
One potential follow-up is that we can merge this together with WrVecU8.
Differential Revision: https://phabricator.services.mozilla.com/D60328
--HG--
rename : ipc/glue/ByteBuf.h => ipc/glue/ByteBufUtils.h
extra : moz-landing-system : lando
Though this may make us use more space when serializing
StyleTransform, but we don't have to do extra conversion on the compostior
side, and this makes us easier to maintain the Rust type.
Differential Revision: https://phabricator.services.mozilla.com/D60045
--HG--
extra : moz-landing-system : lando
The only drawback is: we resolve LengthPercentage value before passing
translate property through IPC, so its percentage part is redundant.
However, this makes us easier to maintain the Rust type.
Differential Revision: https://phabricator.services.mozilla.com/D60044
--HG--
extra : moz-landing-system : lando
We generate ByteBuf by rust bindgen, so we can drop StyleVecU8.
One potential follow-up is that we can merge this together with WrVecU8.
Differential Revision: https://phabricator.services.mozilla.com/D60328
--HG--
rename : ipc/glue/ByteBuf.h => ipc/glue/ByteBufUtils.h
extra : moz-landing-system : lando
Though this may make us use more space when serializing
StyleTransform, but we don't have to do extra conversion on the compostior
side, and this makes us easier to maintain the Rust type.
Differential Revision: https://phabricator.services.mozilla.com/D60045
--HG--
extra : moz-landing-system : lando
The only drawback is: we resolve LengthPercentage value before passing
translate property through IPC, so its percentage part is redundant.
However, this makes us easier to maintain the Rust type.
Differential Revision: https://phabricator.services.mozilla.com/D60044
--HG--
extra : moz-landing-system : lando
Introduce a new pref "layout.css.prefixes.columns" to guard the prefixed
aliases.
The modification to `properties-db.js` was generated by
`./mach devtools-css-db`.
Differential Revision: https://phabricator.services.mozilla.com/D59564
--HG--
extra : moz-landing-system : lando
So for everything but <length> and <length-percentage>, which have more complex
mechanics.
The pref is off for now of course.
Differential Revision: https://phabricator.services.mozilla.com/D60012
--HG--
extra : moz-landing-system : lando
So that extending it to support other math functions like min / max / etc is
simpler.
There should be no behavior change with this patch, though I added a comment to
some places where we don't do calc() clamping correctly (though other browsers
don't either so...).
Differential Revision: https://phabricator.services.mozilla.com/D59939
--HG--
extra : moz-landing-system : lando
Instead, subclass nsTextControlFrame. This simplifies the code and avoids
correctness issues.
I kept the localization functionality though it is not spec compliant. But I
filed a bug to remove it in a followup.
Differential Revision: https://phabricator.services.mozilla.com/D57193
--HG--
extra : moz-landing-system : lando
PDFJS uses it, for example to allow text selection. It's not great if it shows
on top of the actual PDF :-)
Differential Revision: https://phabricator.services.mozilla.com/D58703
--HG--
extra : moz-landing-system : lando
Instead, subclass nsTextControlFrame. This simplifies the code and avoids
correctness issues.
I kept the localization functionality though it is not spec compliant. But I
filed a bug to remove it in a followup.
Differential Revision: https://phabricator.services.mozilla.com/D57193
--HG--
extra : moz-landing-system : lando
To implement safe area support on Gecko, we should get safe area from Device.
Differential Revision: https://phabricator.services.mozilla.com/D52504
--HG--
extra : moz-landing-system : lando
CssEnvironment alwasy is in Device, so use Device as parameter instead of CssEnvironment.
Differential Revision: https://phabricator.services.mozilla.com/D52507
--HG--
extra : moz-landing-system : lando
Although CssEnvironment is in Device of media query implementation, some code
creates CssEnvironment instance without Device. So I would like always to use it from Device of media query.
Differential Revision: https://phabricator.services.mozilla.com/D52506
--HG--
extra : moz-landing-system : lando
So that it takes one pointer instead of two, and doesn't make nsStylePosition's
size blow up.
This is not as ugly as I was fearing, thankfully, though it requires a bit of
boilerplate. I think it's acceptable.
Differential Revision: https://phabricator.services.mozilla.com/D58702
--HG--
extra : moz-landing-system : lando
I'm (sadly) about to make it a bit more complicated to pack it better. So we
may as well do this so it is easier to reason about navigate.
I also reordered things a bit, and removed some From<> implementations and
such.
Differential Revision: https://phabricator.services.mozilla.com/D58701
--HG--
rename : servo/components/style/values/computed/length.rs => servo/components/style/values/computed/length_percentage.rs
extra : moz-landing-system : lando
This is needed to support min() / max() / clamp(), etc, as those need to be a
tree of values and thus need heap storage.
This unfortunately grows LengthPercentage to be two pointers, which is bad as
it blows up the size of nsStylePosition enough to trigger the size assertions.
This patch comments out the assertion for now, the follow-up patches will
uncomment them.
Differential Revision: https://phabricator.services.mozilla.com/D58700
--HG--
extra : moz-landing-system : lando
Now that we have UTF8String in the WebIDL, we can remove quite a few of the
conversions. Do that, and lift the remaining string conversions up as needed.
Also deindent Servo_ComputeColor while touching it.
Most of the remaining copies are because either bug 1606994, or because they're
WebIDL attributes that we still need to serialize back as UTF-16 (bug 1606995).
Differential Revision: https://phabricator.services.mozilla.com/D58687
--HG--
extra : moz-landing-system : lando
It is unexpected (see bug) that a -moz-box is affected by baseline alignment.
Make -moz-box be block-outside, and -moz-inline-box be inline-outside, instead
of the bespoke thing we have now.
This is more similar to everything else, and fixes the bug.
Differential Revision: https://phabricator.services.mozilla.com/D58726
--HG--
extra : moz-landing-system : lando
It is unexpected (see bug) that a -moz-box is affected by baseline alignment.
Make -moz-box be block-outside, and -moz-inline-box be inline-outside, instead
of the bespoke thing we have now.
This is more similar to everything else, and fixes the bug.
Differential Revision: https://phabricator.services.mozilla.com/D58726
--HG--
extra : moz-landing-system : lando
cbindgen understands references, there's no need to use raw pointers here and
then unwrapping or unsafely dereferencing them.
Also remove one unused function while at it.
Differential Revision: https://phabricator.services.mozilla.com/D58708
--HG--
extra : moz-landing-system : lando
This cleans up and also allows us to keep the distinction between content: none
and content: normal, which allows us to fix the computed style we return from
getComputedStyle().
Do this last bit from the resolved value instead of StyleAdjuster, because
otherwise we need to tweak every initial struct for ::before / ::after.
Differential Revision: https://phabricator.services.mozilla.com/D58276
--HG--
extra : moz-landing-system : lando
In particular, the ones where we transcode unconditionally atm (property names
and such).
There are others like cssText getters and setters which are a bit harder,
because I either need to rewrite all our serialization code to work with UTF8
(which is fine, but a lot of work), or teach webidl to have a setter that takes
UTF8String as input but returns DOMString as output (which is at best hacky).
Differential Revision: https://phabricator.services.mozilla.com/D58631
--HG--
extra : moz-landing-system : lando
Do the same we do for classes for now. We could be more precise and achieve a
bit more sharing with some more effort (left a comment there), but it seems
unlikely to matter in practice (and if we did that, we'd probably want to do the
same for classes).
Differential Revision: https://phabricator.services.mozilla.com/D58453
--HG--
extra : moz-landing-system : lando
This matches the new servo layout engine too, and thus removes some #[cfg]
gunk. Just use `flow` since it doesn't simplify the layout code as much.
Differential Revision: https://phabricator.services.mozilla.com/D45973
--HG--
extra : moz-landing-system : lando
This is needed to support min() / max() / clamp(), as LengthPercentage will have
a potential heap allocation and the current copy-assignment operators just do
bitwise copies.
Differential Revision: https://phabricator.services.mozilla.com/D57300
--HG--
extra : moz-landing-system : lando
Font code is the only thing that was using Au in the style system without
interfacing with Gecko, and there was no real reason for it to do so.
This slightly simplifies the code.
Differential Revision: https://phabricator.services.mozilla.com/D57248
--HG--
extra : moz-landing-system : lando
I was going to send a test for `:focus` via wpt, but then realized it was
probably not spec-compliant with the new rules people want to follow for
:focus, so I filed https://github.com/w3c/csswg-drafts/issues/4555 instead.
Testing `:hover` / `:active` via wpt looked quite a bit of a hassle.
Differential Revision: https://phabricator.services.mozilla.com/D55591
--HG--
extra : moz-landing-system : lando
This includes more bitflag operators, which means we can remove some slightly
ugly code.
Differential Revision: https://phabricator.services.mozilla.com/D56308
--HG--
extra : moz-landing-system : lando
I couldn't get some Windows sandbox code to build with the other patch in this
bug.
Differential Revision: https://phabricator.services.mozilla.com/D56343
--HG--
extra : moz-landing-system : lando
We need to ensure the rules that override all properties for scrollbar
part elements only apply to those that are NAC (and so will be eligible
for NAC style sharing). We have some uses of non-NAC <scrollbar>
elements that should continue to inherit properties from their parents.
To avoid any changes in rule matching order that come with changing specificity,
we add a new :-moz-native-anonymous-no-specificity pseudo-class.
While we're here, we note :-moz-native-anonymous-no-specificity (and the
regular :-moz-native-anonymous pseudo-class) as not needing style
sharing cache revalidation, as we never share NAC styles.
Differential Revision: https://phabricator.services.mozilla.com/D56154
--HG--
extra : moz-landing-system : lando
We're vendoring it already so no reason not to. Only a couple dependencies left
after these to get rid of 0.6.
Differential Revision: https://phabricator.services.mozilla.com/D56044
--HG--
extra : moz-landing-system : lando
I see atom dropping code generated in release builds for stuff like dropping the
"class" atom here:
https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/servo/components/style/gecko/wrapper.rs#592
That is silly, and I hope making Atom be able to be used in const context will
help the compiler see that yeah, we're not doing anything interesting and the
atom shouldn't get dropped.
It also allows us to get rid of a few lazy_static!s, so we should do it anyway.
In order to accomplish this, compute the offset into gGkAtoms manually instead
of going through the static_atoms() array and then back to the byte offset.
Differential Revision: https://phabricator.services.mozilla.com/D55039
--HG--
extra : moz-landing-system : lando
The only way for this to happen is calling set_len(0) on an already-empty array.
We should be replacing these bindings by the `ThinVec` crate, but this is easier
for now.
Differential Revision: https://phabricator.services.mozilla.com/D55291
--HG--
extra : moz-landing-system : lando
cbindgen understands references, so use them rather than pointers when we expect
non-null stuff.
Differential Revision: https://phabricator.services.mozilla.com/D55011
--HG--
extra : moz-landing-system : lando
When zoom is disabled, we still count it, but with the current code the testing
function will throw instead of returning the right value, which means we'd fail
layout/style/test/test_use_counters.html.
Differential Revision: https://phabricator.services.mozilla.com/D55005
--HG--
extra : moz-landing-system : lando