Commit graph

7732 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
a7c50b57a1
style: Handle logical shorthand animations with variable references correctly.
When we physicalize the declarations for @keyframes, we end up having a physical
declaration with an unparsed value with `from_shorthand` being the logical
shorthand.

Account for this case properly when substituting custom properties, to avoid
panicking.

Differential Revision: https://phabricator.services.mozilla.com/D53663
2019-11-30 20:45:01 +01:00
Boris Chiou
9a43ad996f
style: Update the expected direction vector of rotate property in wpt.
For interpolations with the primitive rotate3d(), the direction vectors of
the transform functions get normalized first. This should also be applied to
rotate property.

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

Differential Revision: https://phabricator.services.mozilla.com/D52944
2019-11-30 20:45:01 +01:00
Emilio Cobos Álvarez
246433acfa
style: Remove NODE_IS_ANONYMOUS_ROOT.
We no longer have multiple kinds of anonymous subtrees, so we can get back one
node bit.

Differential Revision: https://phabricator.services.mozilla.com/D53344
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
425025c230
style: Use only Origin during the cascade, rather than CascadeLevel.
The micro-benchmark `style-attr-1.html` regressed slightly with my patch, after
the CascadeLevel size increase.

This benchmark is meant to test for the "changing the style attribute doesn't
cause selector-matching" optimization (which, mind you, keeps working).

But in the process it creates 10k rules which form a perfect path in the rule
tree and that we put into a SmallVec during the cascade, and the benchmark
spends most of the time pushing to that SmallVec and iterating the declarations
(as there's only one property to apply).

So we could argue that the regression is minor and is not what the benchark is
supposed to be testing, but given I did the digging... :)

My patch made CascadeLevel bigger, which means that we create a somewhat bigger
vector in this case. Thankfully it also removed the dependency in the
CascadeLevel, so we can stop using that and use just Origin which is one byte to
revert the perf regression.

Differential Revision: https://phabricator.services.mozilla.com/D53181
2019-11-30 20:45:00 +01:00
Boris Chiou
45c64a7224
style: Set WillChangeBits::TRANSFORM for offset-path and add tests for it.
Differential Revision: https://phabricator.services.mozilla.com/D53109
2019-11-30 20:45:00 +01:00
Boris Chiou
b420293a57
style: Treat 3d translate/scale as 2d if the value can be expressed as 2d.
For the individual transform properties if they spec a value that can be
expressed as 2d we treat as 2d and serialize accordingly.

We drop Translate::Translate and Scale::Scale, and then rename
Translate::Translate3D as Translate::Translate, Scale::Scale3D as
Scale::Scale. So now we use Translate::Translate to represent 2d and 3d
translation, and Scale::Scale to represent 2d and 3d scale. There is no
difference between 2d and 3d translate/scale in Gecko because we always
convert them into 3d format to layers (on the compositor thread), so this
change makes things simpler.

Differential Revision: https://phabricator.services.mozilla.com/D52931
2019-11-30 20:45:00 +01:00
Emilio Cobos Álvarez
bb06ed7206
style: Centralize logic to ignore document colors.
This was a follow-up from the backplate stuff which I requested but didn't
happen.

Differential Revision: https://phabricator.services.mozilla.com/D53170
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
0cfc91d6ce
style: Remove NODE_MAY_BE_IN_BINDING_MNGR.
Never set anymore.

Differential Revision: https://phabricator.services.mozilla.com/D52994
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
1f2c1f555c
style: Optimize storage of ApplicableDeclaration again.
So that we don't regress perf.

Differential Revision: https://phabricator.services.mozilla.com/D52576
2019-11-30 20:44:59 +01:00
Emilio Cobos Álvarez
349492b5e2
style: Fix cascade order of shadow parts.
This moves the shadow cascade order into the cascade level, and refactors the
code a bit for that.

Differential Revision: https://phabricator.services.mozilla.com/D49988
2019-11-30 20:44:58 +01:00
Emilio Cobos Álvarez
28110c060f
style: Split collect_style_attribute_and_animation_rules.
Animations are their own cascade level per https://drafts.csswg.org/css-cascade-4/#cascade-origin

Differential Revision: https://phabricator.services.mozilla.com/D52575
2019-11-30 20:44:58 +01:00
Sam Mauldin
9bdad610ff
style: Remove SpecialColorKeyword enum and merge into SystemColor.
Move all the entires of SpecialColorKeyword into SystemColor
and rearrange their computation to match.
Add the new SystemColor entries into the property list of nsXPLookAndFeel.

Differential Revision: https://phabricator.services.mozilla.com/D50903
2019-11-30 20:44:58 +01:00
Hiroyuki Ikezoe
7fec79ffcf
style: Factor dynamic toolbar max height into layout metrics.
Now
* nsPresContext::mVisibleArea is excluding the toolbar max height so that
  ICB is now static regardless of the dynamic toolbar transition
* nsPresContext::mSizeForViewportUnits is introduced to resolve viewport units
  which is including the toolbar max height

That means that with the dynamic toolbar max height;

  mVisibleArea < mSizeForViewportUnits

See https://github.com/bokand/URLBarSizing for more detail backgrounds of this
change.

Depends on D50417

Differential Revision: https://phabricator.services.mozilla.com/D50418
2019-11-30 20:44:58 +01:00
Dzmitry Malyshau
ff1a9dbb2e
style: Update some dependencies.
Differential Revision: https://phabricator.services.mozilla.com/D49458
2019-11-30 20:44:57 +01:00
Emilio Cobos Álvarez
c28ca7b405
style: Use MaybeUninit in style struct clone impls / constructors.
Differential Revision: https://phabricator.services.mozilla.com/D51788
2019-11-30 20:44:57 +01:00
Tim Nguyen
c04a37982c
style: Remove nsStackFrame platform code.
Differential Revision: https://phabricator.services.mozilla.com/D49487
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
cceb0bcb73
style: Simplify code for keeping alive shared memory until all sheets go away.
The existing code wasn't sound, as CSSOM objects also needed to go away before
the shared memory goes away (as they keep references to them).

This is sound assuming no presence of reference cycles introduced by CSSOM.

We may want to live with this and rely on chrome code not writing cycles like
this with UA stylesheet DOM objects.

We could explicitly drop all potentially-static objects... That seems pretty
error prone though.

Or we could also just leak the shared memory buffer, is there any reason why we
may not want to do that?

Differential Revision: https://phabricator.services.mozilla.com/D51870
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
9c1dd4b3ea
style: Make zoom: 0 mean the same as zoom: 1.
This matches the WebKit implementation, and is clearly a violation of the rules
we generally use for ranges in CSS.

But it seems to be depended-on legacy behavior, see the linked WebKit bug, this
bug, and bug 1593317.

Differential Revision: https://phabricator.services.mozilla.com/D51539
2019-11-30 20:44:56 +01:00
Emilio Cobos Álvarez
d797b0e475
style: Fix ElementWrapper::is_link.
And do a full restyle only when the state goes from visited to unvisited or vice
versa. That is, use regular invalidation for addition or removals of href
attributes, for example.

Differential Revision: https://phabricator.services.mozilla.com/D50821
2019-11-30 20:44:55 +01:00
Emilio Cobos Álvarez
d68d6f7c56
style: Always restyle / repaint when a visited query finishes.
Differential Revision: https://phabricator.services.mozilla.com/D50810
2019-11-30 20:44:55 +01:00
Anthony Ramine
c6f241b0ce Remove some stale servo-2020 gates 2019-11-27 11:09:34 +01:00
Anthony Ramine
20bde0efb3 Dump more stuff in the assertion in set_font_size_dependency 2019-11-27 10:13:24 +01:00
Anthony Ramine
b3d30d284e Start implementing text in layout 2020 2019-11-25 10:54:46 +01:00
Anthony Ramine
7e143c7a05 Make floats not parse on layout 2020 2019-11-25 10:54:46 +01:00
Simon Sapin
94b19beefb Fix some warnings new in Rust Nightly 2019-11-08 11:45:16 +01:00
Emilio Cobos Álvarez
0f512b4432
style: Fix Servo build. 2019-11-04 13:41:55 +01:00
Emilio Cobos Álvarez
a44515c314 style: Rustfmt recent changes. 2019-11-04 13:36:32 +01:00
Sam Mauldin
ac4894ed8d style: Rename Mozfield / Mozfieldtext to Field and Fieldtext.
Split off of Bug 1590894
Rename these to support unprefixed version
Also add alias to keep compatibility

Differential Revision: https://phabricator.services.mozilla.com/D50989
2019-11-04 13:36:32 +01:00
Boris Chiou
0624324942 style: Extend compositor properties for motion.
Differential Revision: https://phabricator.services.mozilla.com/D50014
2019-11-04 13:36:32 +01:00
Boris Chiou
40ede5bacb style: Use serde to serialize LengthPercentage and StyleRayFunction.
We need to pass these two types into the compositor, so we need a better
way to serialize these rust types. We use serde and bincode to
serialize/deserialize them, and use ByteBuf to pass the &[u8] data
through IPC. We define StyleVecU8 for FFI usage only.

Differential Revision: https://phabricator.services.mozilla.com/D50688
2019-11-04 13:36:32 +01:00
Boris Chiou
d99606a841 style: Add new layer messages for passing motion path info.
This also includes the implementation of SetAnimatable, FromAnimatable,
and merge the final matrix with motion path.

Besides, we always use PathBuilderSkia for calculating the gfx::Path for
web-renderer.

Differential Revision: https://phabricator.services.mozilla.com/D50011
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
fc1233f3d2 style: Remove -moz-binding, nsStyleDisplay::mBinding and similar.
Differential Revision: https://phabricator.services.mozilla.com/D50556
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
5f30ecc9b1 style: Remove some XBL code in the style system.
Differential Revision: https://phabricator.services.mozilla.com/D50554
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
854c480177 style: Experiment with implementing zoom as a transform + transform-origin shorthand.
This is a gross hack, of course, but has the advantage of not breaking sites
that use both zoom and -moz-transform / -moz-transform-origin.

There should be no behavior change when the pref is off, of course, and the
webcompat team wanted to experiment with this.

Differential Revision: https://phabricator.services.mozilla.com/D49792
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
ca05003ef6 style: Simplify media query code now that lifetimes are non-lexical.
We can deindent and simplify a bunch of this code now.

Differential Revision: https://phabricator.services.mozilla.com/D49509
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
11c1317c37 style: Remove useless conditional compilation.
Servo doesn't use this flag or -webkit- prefixed media queries, so no point in
doing this conditionally.

Differential Revision: https://phabricator.services.mozilla.com/D49508
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
70dda74b0f style: Remove layout.css.prefixes.device-pixel-ratio-webkit.
There's no effort to disable it any time soon, so I don't think it's useful to
keep the pref around.

Differential Revision: https://phabricator.services.mozilla.com/D49507
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
b98ac61a70 style: Hide -moz-touch-enabled media query in Nightly and Early Beta.
This is effectively superseded by the hover / any-hover media queries, which
actually are standard, and is also causing trouble in the wild.

Not even the browser fronted uses it, so we should be able to just remove it
everywhere at once.

Differential Revision: https://phabricator.services.mozilla.com/D49506
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
7965ddefa6 style: Support multiple parts in ::part() selectors.
Differential Revision: https://phabricator.services.mozilla.com/D48753
2019-11-04 13:36:32 +01:00
Emilio Cobos Álvarez
f701192e38 style: Remove old scroll-snap implementation, and scroll snapping prefs.
Differential Revision: https://phabricator.services.mozilla.com/D49267
2019-11-04 13:36:32 +01:00
Cameron McCormack
972e89fd41 style: Report missing include filename in ServoBindings.toml.
Differential Revision: https://phabricator.services.mozilla.com/D48625
2019-11-04 13:36:32 +01:00
Simon Sapin
5eb1472a33 2020: paint borders 2019-10-24 15:06:20 +02:00
Simon Sapin
59f68525c4 2020: enable CSS parsing of properties that are (somewhat) implemented 2019-10-24 10:44:31 +02:00
Simon Sapin
8f89f59329 2020: parse display: contents 2019-10-24 10:44:31 +02:00
Simon Sapin
13e494d74f More compact debug output for CSS values
```
Rect {
    start_corner: Vec2 { i: 0.0 px, b: 0.0 px },
    size: Vec2 { i: 1024.0 px, b: 20.0 px },
}
```

… instead of:

```
Rect {
    start_corner: Vec2 {
        inline: CSSPixelLength(
            0.0,
        ),
        block: CSSPixelLength(
            0.0,
        ),
    },
    size: Vec2 {
        inline: CSSPixelLength(
            1024.0,
        ),
        block: CSSPixelLength(
            0.0,
        ),
    },
}
```
2019-10-24 10:44:31 +02:00
Anthony Ramine
785a344e32 Update rand to 0.7 (fixes #24448) 2019-10-23 15:34:48 +02:00
Kitlith
0a07a88904 Remove usage of opts::get() from style.
Part of #22854.
2019-10-21 13:44:31 -07:00
bors-servo
4ded3038c0
Auto merge of #24339 - servo:sharing-cache-size, r=emilio
Remove obsolete logic for LRUCache size

The LRUCache implementation has been replaced, and no longer requires a backing store larger than its capacity.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/24339)
<!-- Reviewable:end -->
2019-10-10 00:45:14 -04:00
Emilio Cobos Álvarez
031cb05c67 style: Fix servo build. 2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
33d39d37a2 style: Rustfmt recent changes. 2019-10-09 13:21:35 +02:00