Commit graph

25052 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
decc648c46 style: Fix number input so that it honors overflow-clip-box-block.
This never worked, but it's more visible with the new form controls which have
more padding.

Make the anonymous div and co a pseudo-element, so that they inherit from the
<input> properly in all cases. This works for non-number inputs because the
editor root is a direct child of the <input>, but it doesn't for number inputs
because there's a flex wrapper in between.

This way overflow-clip-box: inherit does what we want. Reset the padding in the
inline direction, as the padding for <input type=number> applies to the arrow
boxes as well, and thus we'd double-apply it.

Differential Revision: https://phabricator.services.mozilla.com/D65271
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
ece146988c style: Change the parsing order of border shorthands.
It's not ambiguous, and <width> <style> <color> seems like a more common order.

This is just a minor perf tweak, as the CSS parser token cache will most often
kick in to avoid re-tokenizing values.

Also remove a redundant continue statement.

Differential Revision: https://phabricator.services.mozilla.com/D67224
2020-04-16 16:35:07 +02:00
Sam Mauldin
ccc41dd89d style: Unprefix existing CSS4 system colors.
Expect forced-colors-mode-backplate tests to fail because they were passing for the wrong reason,
and the backplate is now properly applied, causing them to fail.

Remove tests for field and fieldtext from color-valid.html because they are tested again
in system-color-valid.html.

Differential Revision: https://phabricator.services.mozilla.com/D66879
2020-04-16 16:35:07 +02:00
Erik Nordin
edddf9e503 style: Disallow @import rules for all Constructable StyleSheets functions.
- Add enum AllowImportRules to CSS parsing.
- `replaceSync()` will skip over @import rules and continue parsing.
- `replace()` will skip over @import rules and continue parsing.
- `insertRule()` will throw a syntax error on @import rules.
- Modify WPT test cases to reflect these changes.

Differential Revision: https://phabricator.services.mozilla.com/D61882
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
635f5fbf1b style: Allow to export a shadow part under multiple names.
Other browsers allow this and the spec doesn't really disallow it, so fix it,
add a test and carry on.

Differential Revision: https://phabricator.services.mozilla.com/D65107
2020-04-16 16:35:07 +02:00
Philipp Zech
614d3e746f style: Convert vector-effect #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D65718
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
4a19074664 style: Rename -moz-menulist-button to -moz-menulist-arrow-button.
This should be less confusing. This is not supported outside of chrome:// or
user-agent stylesheets so we can name this however we want.

Differential Revision: https://phabricator.services.mozilla.com/D65605
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
a73e4353fe style: Respect the cascade properly when in high-contrast mode.
Differential Revision: https://phabricator.services.mozilla.com/D65345
2020-04-16 16:35:07 +02:00
Makoto Kato
c5b74bf001 style: Get safe area insets from Gecko.
Add binding to get safe area insets from Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D52509
2020-04-16 16:35:07 +02:00
Morgan Reschenberg
45cc310f7f style: Modify background image styling to only apply URL-sourced images when backplate is enabled.
Differential Revision: https://phabricator.services.mozilla.com/D64200
2020-04-16 16:35:07 +02:00
Philipp Zech
b9bf5fb868 style: Convert color-interpolation #defines to an enum class.
Differential Revision: https://phabricator.services.mozilla.com/D64813
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
1bd551ddc2 style: Add an inherited style bit to know whether an element is in an opacity: 0 subtree.
I think this should work for the animation throttling stuff.

Opacity works on the element tree, so I think this is sound.

Differential Revision: https://phabricator.services.mozilla.com/D64441
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
3460f71205 style: Minor cleanup of ServoStyleSet.
Removing unused arguments and so on.

The origin can always be inferred from the stylesheet so it wasn't being used.

Differential Revision: https://phabricator.services.mozilla.com/D64150
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
225e0000f0 style: Remove no-longer-used argument to pseudo-class-list-macro.
This used to be needed for Gecko interop, but now all this is in the Rust side
so we no longer need it.

Depends on D63861

Differential Revision: https://phabricator.services.mozilla.com/D63863
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
d8cb4c4647 style: Prototype :focus-visible behind a flag.
The heuristic is that we show focus outlines for unknown or key focus, and not
for mouse / touch.

This is probably not the final heuristic we take, but this allows people to play
with it and file bugs.

Once this is mature enough we should remove :-moz-focusring in favor of
:focus-visible.

Differential Revision: https://phabricator.services.mozilla.com/D63861
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7af9a087aa style: Use enums for text-align / text-align-last.
This also fixes some backwards logic in nsBlockFrame::ReflowDirtyLines, and adds
some static assertions to nsGenericHTMLElement that almost cause a very subtle
bug.

Depends on D63792

Differential Revision: https://phabricator.services.mozilla.com/D63793
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
37c382a74b style: Minor LengthPercentage improvements.
* Use debug_unreachable for really unreachable code (having a release
   unreachable!() there gives us little to no benefit, as a borked union can
   already confuse us into reading an arbitrary pointer as a CalcPercentage).

 * Avoid a clone of the calc variant when clamping. We only need to mutate the
   clamping mode. This was the only clamp_to_non_negative function that didn't
   consume the value.

Differential Revision: https://phabricator.services.mozilla.com/D63584
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
582ccf4778 style: Minor cleanup of gecko.mako.rs.
Differential Revision: https://phabricator.services.mozilla.com/D63779
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
76e9cb44f0 style: Use cbindgen for SVG lengths.
Depends on D63777

Differential Revision: https://phabricator.services.mozilla.com/D63778
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
18570bf077 style: Use cbindgen for cursors.
Pretty straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D63777
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
787ac98d18 style: Properly reject numbers as part of <length-percentage>.
We never fast-reject numbers (because they could be part of a product). Without
this refactoring we'd accept stuff like calc(10) and crash during the evaluation
for obvious reasons.

Differential Revision: https://phabricator.services.mozilla.com/D63401
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
039ef3dd53 style: Fix one minor serialization issue which was causing test failures.
We were serializing calc(10% + 4px) as calc(10% + calc(4px)).

Differential Revision: https://phabricator.services.mozilla.com/D63400
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
c0f2a4e785 style: Simplify math function resolution.
So as to avoid allocating an intermediate tree in Rust to resolve
`<length-percentage>` values.

Differential Revision: https://phabricator.services.mozilla.com/D63399
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
280402b2a1 style: Fix C++ side of <length-percentage> values.
Differential Revision: https://phabricator.services.mozilla.com/D63398
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7e8dbd0896 style: Make CalcNode the specified representation of <length> and <length-percentage> values.
This is the meat of the patch. There are a couple improvements done in a couple
later patches which should hopefully be straight-forward.

Differential Revision: https://phabricator.services.mozilla.com/D63397
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
426edbd991 style: Move the guts of calc nodes into a generic enum.
We'll have different leaf nodes as we progress in the value computation stage.

Differential Revision: https://phabricator.services.mozilla.com/D63396
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
869553357d style: Implement ToCss for CalcNode.
We'll use `CalcNode` as the specified value representation for <length> and
<length-percentage> values, so they'll have to implement ToCss.

There's one minor issue (two calls to to_css() instead of to_css_impl() which
are addressed later in the series).

Differential Revision: https://phabricator.services.mozilla.com/D63395
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
c52bae1923 style: Remove an invalid assert.
This assert was wrong. The assert may fire if we resurrect the node from a
different thread and insert a kid fast enough.

We allow resurrecting nodes (bumping the nodes from zero to one) to avoid
allocation churn.

In particular, while the thread dropping the node gets to read the children (so
after the fetch_sub from the refcount, but before the read() of the children),
another thread could plausibly bumped the refcount back, and added a children.

This is a very big edge case of course, but I'm kinda sad I hadn't realized
before.

Differential Revision: https://phabricator.services.mozilla.com/D63286
2020-04-16 16:35:07 +02:00
Jonathan Kew
471e491a89 style: Add support for the 'all' value of text-decoration-skip-ink.
Differential Revision: https://phabricator.services.mozilla.com/D61184
2020-04-16 16:35:07 +02:00
Tim Nguyen
61712d1a03 style: Implement parsing for CSS conic-gradient syntax.
Differential Revision: https://phabricator.services.mozilla.com/D62148
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
31187b0180 style: Remove layout.css.webkit-appearance.enabled.
I don't think we want to keep the ugly widget hacks forever. Let me know if
you'd rather keep the property behind a pref but I don't think there's a point
in doing that.

Differential Revision: https://phabricator.services.mozilla.com/D62649
2020-04-16 16:35:07 +02:00
Cameron McCormack
47db01f793 style: Change initial value of image-orientation to from-image.
Differential Revision: https://phabricator.services.mozilla.com/D62826
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
f25e0b77e9 style: Minor gradient parsing cleanup.
I suggested the compat_mode bit in D62923 but it was somehow only applied to one
of the branches.

Also rustfmt the code for consistency, and add a local alias.

Differential Revision: https://phabricator.services.mozilla.com/D63015
2020-04-16 16:35:07 +02:00
Tim Nguyen
25b265a10f style: Refactor GenericGradient for conic-gradient support.
Differential Revision: https://phabricator.services.mozilla.com/D62923
2020-04-16 16:35:07 +02:00
Tim Nguyen
fc88e908d5 style: Re-introduce display: -moz-stack; as <legacy-stack>.
Differential Revision: https://phabricator.services.mozilla.com/D62758
2020-04-16 16:35:07 +02:00
Martin McNickle
28d8565f38 style: Use the cbindgen output for GridAutoFlow directly in gecko.
Depends on D62787

Differential Revision: https://phabricator.services.mozilla.com/D62910
2020-04-16 16:35:07 +02:00
Martin McNickle
cf20c627b5 style: Replace existing GridAutoFlow struct with a bitflags! backed one.
Differential Revision: https://phabricator.services.mozilla.com/D62787
2020-04-16 16:35:07 +02:00
Tim Nguyen
0e3c122890 style: Make GradientItem and ColorStop support angular color stops.
Differential Revision: https://phabricator.services.mozilla.com/D62544
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
5cedc45858 style: Make font-family serialization algorithm a bit more conservative.
So as to avoid serializing as identifiers font-families with spaces as part of
the identifier. This avoids serializing confusing escaped sequences if the
beginning of the stuff after the space happens to not be a valid ident start.

This is an slightly more restrictive version of the existing logic, which
happens to also match other browsers in my testing.

Differential Revision: https://phabricator.services.mozilla.com/D62376
2020-04-16 16:35:07 +02:00
Boris Chiou
ef2d934dac style: Drop fallback attribute from animate and distance.
Still keep the discriminant checks to avoid generating terrible code.

Differential Revision: https://phabricator.services.mozilla.com/D62329
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
239302b1ed style: Split clip-path and shape-outside values.
We don't actually share _that_ much code across them. This makes callers clearer
and code less confusing, IMHO.

This also has the benefit of not autocompleting path from devtools for
shape-outside.

Differential Revision: https://phabricator.services.mozilla.com/D62373
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
ab03688994 style: Use cbindgen for shape-outside and clip-path.
Differential Revision: https://phabricator.services.mozilla.com/D62372
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
558cc59288 style: Use cbindgen instead of nsStyleImage.
The trickier part is that we represent -moz-image-rect as a Rect() type instead
of image with non-null clip-rect. So we need to add a bit of code to
distinguish "image request types" from other types of images.

But it's not too annoying, and we need to do the same for fancier images like
image-set and such whenever we implement it, so seems nice to get rid of
most explicit usages of nsStyleImage::GetType().

Differential Revision: https://phabricator.services.mozilla.com/D62164
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
4dadcf71a5 style: Some preparation to start using cbindgen for shape-outside and clip-path.
Tweak the ShapeSourceRepresentation so that it doesn't store Option<>s.

Some renames so that GeometryBox doesn't conflict with the Gecko type, and some
other usual bits / re-exports to deal with cbindgen and generics.

Also, drive-by derive parsing of GeometryBox as it's trivial.

Doing this unfortunately is not possible without removing nsStyleImage first, so
let's do that before.

This makes us serialize in the shortest form for shape-outside, but that's what
we should do anyway.

(aside: the shapes code is a bit too generic, maybe we should unify
ClippingShape and FloatAreaShape...)

Differential Revision: https://phabricator.services.mozilla.com/D62163
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
08175a494e style: Remove some include dependencies in nsStyleConsts.h.
We include it everywhere because it's included from gfxTypes.h.

This should avoid including all the generated bindings _everywhere_.

Differential Revision: https://phabricator.services.mozilla.com/D62174
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
149cb5f5f1 style: Merge ImageLayer and Image.
ImageLayer is almost the only usage of Image, so keeping them in the same enum
makes the resulting C++ struct smaller, and makes it map more cleanly to
nsStyleImage.

Differential Revision: https://phabricator.services.mozilla.com/D62161
2020-04-16 16:35:07 +02:00
bors-servo
a4fbad2533
Auto merge of #26190 - servo:unstable, r=nox
Remove use of soon-to-be-deprecated unstable feature

https://github.com/rust-lang/rust/issues/47336#issuecomment-586589016
2020-04-16 03:05:05 -04:00
bors-servo
f8db6666e0
Auto merge of #26191 - jdm:webgl2-origin-trial, r=Manishearth
Automatically enable WebGL 2 for specific domains.

Our WebGL 2 implementation has progressed to the point where some but not all content works well. One particular example of non-working content is Babylon.js; if the WebGL2RenderingContext interface is present, it automatically tries to use it and causes panics in Servo. However, there are demos like http://www.servoexperiments.com/webxr-particles/ that work fine today and would be great to feature on our HoloLens homepage.

This change adds what is effectively an origin trial, where we can identify content that works well, ensure it's running in a list of blessed hosts, and reap the benefits.
2020-04-15 20:25:43 -04:00
bors-servo
324e2d2b42
Auto merge of #26185 - daemon1024:handle-null-proj, r=Manishearth
handle detached array in XRView

<!-- Please describe your changes on the following line: -->
Recompute XRView.projectionmatrix when the buffer is detached
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `___` with appropriate data: -->
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26153 (GitHub issue number if applicable)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because ___

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->
2020-04-15 18:43:16 -04:00
Josh Matthews
e2845a6939 Automatically enable WebGL 2 for specific domains. 2020-04-15 17:26:42 -04:00