Commit graph

6982 commits

Author SHA1 Message Date
Andre Bogus
34b5d8fbe8 This updates the smallvec crate and enables the union feature
We had a mix of 0.6.2 and 0.6.5 (which is the current release),
this unifies to the latest version. It also enables the union
feature which removes the discriminant, reducing memory usage.
2018-09-19 07:16:30 +02:00
Emilio Cobos Álvarez
5ab81c4254
style: Make Servo build.
StrongRuleNode is really Sync.
2018-09-18 11:46:23 +02:00
Emilio Cobos Álvarez
4c97f68f3e
Fix tidy issues. 2018-09-18 11:46:01 +02:00
Manish Goregaokar
84ca681a78
servo_arc cleanups for publishing.
Differential Revision: https://phabricator.services.mozilla.com/D6034
2018-09-18 11:39:54 +02:00
Emilio Cobos Álvarez
22da3c22a2
style: Make LonghandId::flags an indexing operation.
I always see a bunch of time in our profiles in the iterator over the
declarations, this ensures it's not something dumb.

I suspect it's just a bunch of cache misses from walking the rule tree but in
any case this is consistent with the other getters we have and such.

Differential Revision: https://phabricator.services.mozilla.com/D5971
2018-09-18 11:39:48 +02:00
Emilio Cobos Álvarez
bc39f16b4b
style: Simplify CSSWideKeyword::parse.
Differential Revision: https://phabricator.services.mozilla.com/D5972
2018-09-18 11:39:42 +02:00
Emilio Cobos Álvarez
72ce653daf
style: Allow integer division inside calc() expressions.
Differential Revision: https://phabricator.services.mozilla.com/D5980
2018-09-18 11:39:36 +02:00
Emilio Cobos Álvarez
5cafac5d10
style: Remove DeclaredValue.
I think it used to be the case that all PropertyDeclaration variants had a
DeclaredValueOwned<T> inside. But that's no longer the case, so this abstraction
seems less useful now.

Differential Revision: https://phabricator.services.mozilla.com/D5978
2018-09-18 11:39:31 +02:00
Emilio Cobos Álvarez
4cd0f492f4
style: Deindent the non-css-wide-keyword-related code from cascade_property.
There's no good reason we construct a DeclaredValue as an intermediate step.

Differential Revision: https://phabricator.services.mozilla.com/D5977
2018-09-18 11:39:25 +02:00
Emilio Cobos Álvarez
c155efe7a5
style: Remove DeclaredValue::WithVariables.
We never construct it.

Differential Revision: https://phabricator.services.mozilla.com/D5976
2018-09-18 11:39:17 +02:00
Emilio Cobos Álvarez
d5ba19696a
style: Make ExtremumLength::valid_for static.
Differential Revision: https://phabricator.services.mozilla.com/D5975
2018-09-18 11:39:12 +02:00
Emilio Cobos Álvarez
8040c8bfec
style: Split apply_declarations into its own file, and without mako.
All that font code thrown out in the middle was making me mad.

There should be no change in behavior from this patch.

I ran rustfmt on the code but I corrected manually the following:

  https://github.com/rust-lang-nursery/rustfmt/issues/3025

Differential Revision: https://phabricator.services.mozilla.com/D5970
2018-09-18 11:39:06 +02:00
Emilio Cobos Álvarez
278ab8613f
style: Fix servo build and drop a FIXME there. 2018-09-15 19:19:18 +02:00
Emilio Cobos Álvarez
8aeaa3fc02
style: Remove a useless type bound. 2018-09-15 19:19:18 +02:00
Emilio Cobos Álvarez
da5283d066
style: Fix Gecko build. 2018-09-15 19:19:18 +02:00
Hiroyuki Ikezoe
3d909132ba
style: Implement any-hover and any-pointer media queries features.
Differential Revision: https://phabricator.services.mozilla.com/D3609
2018-09-15 17:57:29 +02:00
Hiroyuki Ikezoe
9354a42fc1
style: Add media feature keys for hover and pointer.
https://drafts.csswg.org/mediaqueries-4/#hover
https://drafts.csswg.org/mediaqueries-4/#pointer

In this patch series, we don't introduce any-hover and any-pointer media
features yet, but functionalities for them on each platform backends will be
introduced in this patch series, so eIntID_AllPointerCapabilities and relevant
stuff is added in this patch for the convenience that each platform backends
can be reviewed at once.

Differential Revision: https://phabricator.services.mozilla.com/D3296
2018-09-15 17:57:18 +02:00
Cameron McCormack
1f45fc0339
style: Update comments to no longer point to nsRuleNode.
There are a few mentions of nsRuleNode left but they are mostly
historical references so it makes sense to keep them.

Differential Revision: https://phabricator.services.mozilla.com/D5505
2018-09-15 17:57:12 +02:00
Brad Werth
6d57cbd881
style: Expand the Parser trait to allow anonymous CORS to be applied.
Depends on D5106

Differential Revision: https://phabricator.services.mozilla.com/D5341
2018-09-15 17:57:05 +02:00
Brad Werth
b96d44e329
style: Change Gecko_ImageValue_Create to take a CORS mode argument.
Differential Revision: https://phabricator.services.mozilla.com/D5106
2018-09-15 17:56:57 +02:00
Emilio Cobos Álvarez
ca335ba2e4
style: Remove unused nsStyleFont::{EnableZoom, UnZoomText}.
Differential Revision: https://phabricator.services.mozilla.com/D5530
2018-09-15 17:56:47 +02:00
Emilio Cobos Álvarez
25db9e3be7
style: Teach ComputeSquaredDistance derive about #[animation(constant)].
Differential Revision: https://phabricator.services.mozilla.com/D5337
2018-09-15 17:56:41 +02:00
Simon Sapin
2a996fbc8f Replace mpsc with crossbeam/servo channel, update ipc-channel
Co-authored-by: Gregory Terzian <gterzian@users.noreply.github.com>
2018-09-12 13:33:32 +08:00
Matt Brubeck
a77d05538b Switch from new-ordered-float back to ordered-float
The `new-ordered-float` fork has been merged back into the original
`ordered-float` crate.
2018-09-11 09:59:01 -07:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00
Boris Chiou
31fc6cd565
style: Use the standalone struct and enum for the flags in SVG path.
We define the standalone types for using derive macro easily and overriding
the behaviors of this traits. This could avoid defining the general
behavior of booleans.

Depends on D4788

Differential Revision: https://phabricator.services.mozilla.com/D4813
2018-09-09 16:09:08 +02:00
Boris Chiou
b0604c9be5
style: Make offset-path: path() animatable.
Here, we change the animation type of offset-path as ComputedValue, so
we could do animation on it. Also enable the wpt for offset-path
interpolation. In test_transition_per_property.html, we add some basic tests
ifor offset-path.

ToAnimatedZero for PathCommand will be dropped later.

Because the animations of arcs with mismatched flags are fallen back to
discrete animations, the result of getComputedValue is not normalized in this
case. This makes some wpt failed even though the progress is 100%.

Depends on D4786

Differential Revision: https://phabricator.services.mozilla.com/D4787
2018-09-09 16:08:56 +02:00
Boris Chiou
14911b96e0
style: Make SVGPathData and clip-path: path() animatable.
Implement Animate trait for SVGPathData.

The basic idea is: we normalize |this| and |other| svg paths, and then
do interpolation on the normalized svg paths. The normalization is to
convert relative coordinates into absolute coordinates, so we could do
real number interpolation on each path command directly.

In this patch, we also make |clip-path:path()| animatable.

Differential Revision: https://phabricator.services.mozilla.com/D4786
2018-09-09 16:08:24 +02:00
Emilio Cobos Álvarez
6dcf9b7630
style: Use decomposition to interpolate matched perspective transform operations.
Looks like this produces sensible results for interpolation with 0, though I'm
not really convinced about the results from, let's say, 1px to 2000px in the
attached test-case, I would've expected a linear interpolation from that to go
through normal length interpolation.

css-transforms-1 says:

  > Two transform functions with the same name and the same number of arguments
  > are interpolated numerically without a former conversion. The calculated
  > value will be of the same transform function type with the same number of
  > arguments.
  >
  > Special rules apply to <matrix()>.

Which is what we do... I was going to file a spec issue but turns out that it's
already addressed in css-transforms-2:

  https://drafts.csswg.org/css-transforms-2/#interpolation-of-transform-functions

Which says:

  > The transform functions <matrix()>, matrix3d() and perspective() get
  > converted into 4x4 matrices first and interpolated as defined in section
  > Interpolation of Matrices afterwards.

Differential Revision: https://phabricator.services.mozilla.com/D4942
2018-09-05 19:11:26 +02:00
Emilio Cobos Álvarez
3e0250ae61
style: Only no-op visited <-> unvisited changes.
Other changes should really be (and are) indistinguishable.

Differential Revision: https://phabricator.services.mozilla.com/D4847
2018-09-05 19:11:18 +02:00
Boris Chiou
cf6215c85f
style: Add a pref for |clip-path:path()|.
Add a preference, layout.css.clip-path-path.enabled, for |clip-path:path()|.

Differential Revision: https://phabricator.services.mozilla.com/D4965
2018-09-05 19:11:12 +02:00
Emilio Cobos Álvarez
3f08d2cc02
style: Make the author styles disabled stuff actually disable style attribute, animations, and XBL rules.
This also removes one of my FIXMEs from when I was looking at this code.

We don't seem to have a pre-existing test for this feature, sigh. I'll try to
write one if I have cycles for it...

Note that it not applying XBL rules is a feature, given the current state of
affairs. Video controls and such are right now unusable with no styles enabled.

Differential Revision: https://phabricator.services.mozilla.com/D4795
2018-09-05 19:10:46 +02:00
Emilio Cobos Álvarez
0c0018e4d6
style: Make <svg:use> in shadow tree apply the rules from the originating tree.
Differential Revision: https://phabricator.services.mozilla.com/D4674
2018-09-05 19:10:37 +02:00
Emilio Cobos Álvarez
1254cbf313
style: Update style build script for bindgen changes. 2018-09-03 14:11:02 +02:00
Emilio Cobos Álvarez
6d43bf78bc
style: Fix servo build. 2018-09-03 12:56:30 +02:00
Emilio Cobos Álvarez
c0f516f17d
style: Appease tidy. 2018-09-03 12:39:02 +02:00
Emilio Cobos Álvarez
72b29d3202
style: Simplify the Lang pseudo-class stuff a bit.
Differential Revision: https://phabricator.services.mozilla.com/D4754
2018-09-03 12:36:49 +02:00
Emilio Cobos Álvarez
d56e537882
style: Use proper escaping for pseudo-class strings.
We always serialize as an atom, which is the previous behavior (though previous
code was using string escaping which I think was not totally sound either...).

Differential Revision: https://phabricator.services.mozilla.com/D4753
2018-09-03 12:36:41 +02:00
Emilio Cobos Álvarez
40d2cbe8ed
style: Shrink CascadeData by turning the bloom filters into hash sets.
We're wasting 1kb there, which is kind of stupid.

The only advantage of using a bloom filter is that memory usage doesn't increase
even if there's a gazillion attribute selectors and such. But:

 * For IDs we already have a bunch of data structures for invalidation and such
   which key on the id, so the bloom filter would be a very minor thing.

 * For attribute selectors we don't have such a data structure, but if people
   used a gazillion attribute selectors we should!

Differential Revision: https://phabricator.services.mozilla.com/D4668
2018-09-03 12:36:34 +02:00
Cameron McCormack
2af9264cfe
style: Use an Atom to store pseudo-class string arguments.
Differential Revision: https://phabricator.services.mozilla.com/D4740
2018-09-03 12:33:24 +02:00
Cameron McCormack
4ee3b56d54
style: Use an Atom to represent Direction values in pseudo-classes.
Differential Revision: https://phabricator.services.mozilla.com/D4730
2018-09-03 12:33:13 +02:00
Emilio Cobos Álvarez
1e6aa62c6f
style: Make the allocation of AuthorStyles for ShadowRoot lazy.
So that we don't waste a bunch of memory with stuff like <svg:use>. I
plan to shrink AuthorStyles further, but this should help regardless, and isn't
very complex.

Differential Revision: https://phabricator.services.mozilla.com/D4618
2018-09-03 12:33:03 +02:00
Boris Chiou
1bc452703b
style: Parse byte slice in PathParser.
We only care about ascii char for svg path, so we could parse the string
as byte slice.

Differential Revision: https://phabricator.services.mozilla.com/D4168
2018-09-03 12:32:58 +02:00
Boris Chiou
bb65d1fb6d
style: Define path() for clip-path.
For now, |clip-path: path()| is chrome-only, and not for shape-outside,
so we only implement the parser for clip-path. Besides, I didn't put
path() in BasicShape because path() doesn't use the reference box to
resolve the percentage or keywords (i.e. SVG path only accept floating
point or integer number as the css pixel value). Therefore, I add it into
ShapeSource, instead of BasicShape.

Differential Revision: https://phabricator.services.mozilla.com/D3633
2018-09-03 12:32:50 +02:00
Boris Chiou
a92f9c105a
style: Move SVGPathData and its parser into svg_path.rs.
SVGPathData will be used by clip-path and offset-path (and/or more on the
properties which support <basic-shape>). Therefore, let's move
SVGPathData out of motion.rs.

Differential Revision: https://phabricator.services.mozilla.com/D3631
2018-09-03 12:32:43 +02:00
Xidorn Quan
d4163eae96
style: Accept unknown webkit pseudo-element.
Differential Revision: https://phabricator.services.mozilla.com/D4186
2018-09-03 12:32:37 +02:00
Emilio Cobos Álvarez
d12d420974
style: Adjust an assertion to account for the changes from bug 1485930. 2018-09-03 12:32:31 +02:00
Boris Chiou
68ab6217bd
style: Use cbindgen for basic_shape::FillRule.
Just a minor fix to use cbindgen to avoid the conversion between
basic_shape::FillRule and mozilla::StyleFillRule.

Differential Revision: https://phabricator.services.mozilla.com/D4171
2018-09-03 12:32:25 +02:00
Boris Chiou
e46daa09ea
style: Drop the manually implementation of ToCSS for BasicShape::Polygon.
The implementation of ToCSS for Polygon has some rule, and we could use skip_if
to handle and serialization of fill-rule. However, we should derive ToCSS for
the pair of LengthOrPercentages, so define a new type for it.

Differential Revision: https://phabricator.services.mozilla.com/D4153
2018-09-03 12:32:17 +02:00
Xidorn Quan
c587fa3586
style: Make tree pseudo-element prefix not case-sensitive.
Differential Revision: https://phabricator.services.mozilla.com/D4185
2018-09-03 12:32:10 +02:00