Commit graph

7672 commits

Author SHA1 Message Date
Brian Birtles
c349dbbaa9 style: Make various border-image-* properties interpolable.
Differential Revision: https://phabricator.services.mozilla.com/D46724
2019-10-09 13:21:35 +02:00
Brian Birtles
877c6ac821 style: Parse '0' as a number for border-image-width.
As per CSS Values & Units:

"However, if a 0 could be parsed as either a <number> or a <length> in a
property (such as line-height), it must parse as a <number>."

(https://drafts.csswg.org/css-values-4/#lengths)

Differential Revision: https://phabricator.services.mozilla.com/D46723
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
a0e2aeb51c style: Let the CSS use counter prefs be independent.
* Let layout.css.use-counters.enabled be independent from the unimplemented
   property counters.

 * Always count in the style system (that is, always create
   Document::mStyleUseCounters), so that the warning from bug 1582374 works
   irrespective of these prefs.

 * Add a pref check to the SVGElement code path so that the prefs properly
   reflect whether the histograms end up being recorded or not.

 * Make the pref checks consistent (check both when reporting telemetry, not
   earlier).

Differential Revision: https://phabricator.services.mozilla.com/D46633
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
7d23cfb91e style: Always serialize aspect-ratio and font shorthand with spaces around the slash.
Differential Revision: https://phabricator.services.mozilla.com/D46568
2019-10-09 13:21:35 +02:00
Daniel Holbert
fee0f2cd23 style: In css 'display' blockification codepath, leave -moz-box alone and promote -moz-inline-box to -moz-box (if a new pref is set).
This is in the interests of allowing the frontend team to experiment with
switching from XUL grid to CSS grid, without inadvertently changing the
display values for the grid items via css-grid-item blockification.

This patch's new pref is not expected to remain in the codebase for long.
We're just adding it so that the behavior remains the same by default, because
we do currently have some XUL code that inadvertently depends on -moz-box
display values being blockified to 'block'.  The plan is for folks to remove
that dependency e.g. by adding explicit 'display:block' styling to frontend
code as-needed. After we've done that, we can tentatively flip the pref to true
by default, and then remove the pref entirely.

Differential Revision: https://phabricator.services.mozilla.com/D45258
2019-10-09 13:21:35 +02:00
Ting-Yu Lin
0138fc3707 style: Split SIDEWAYS bit in WritingMode.
Currently, there's no way to tell whether the SIDEWAYS bit is set from
`writing-mode:sideways-*` or `writing-mode:vertical-*; text-orientation:sideways;`.
To be able to tell them apart, split SIDEWAYS bits into VERTICAL_SIDEWAYS
and TEXT_SIDEWAYS. This is needed by my proposed solution in bug 1102175.

Also, provide convenience methods related to sideways writing-mode, and replace
obscure checks in the codebase.

Note that we don't have the use cases to distinguish vertical-rl from
sideways-rl in layout, but for the completeness, IsSidewaysLR() is still
defined.

Differential Revision: https://phabricator.services.mozilla.com/D46321
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
c92d1f6b9c style: Report counted unknown properties as well.
Differential Revision: https://phabricator.services.mozilla.com/D44717
2019-10-09 13:21:35 +02:00
Boris Chiou
5e77ba9bf4 style: Support ray() in offset-path and make it animatable.
1. Add `generics::motion::OffsetPath`, and use specified `Angle` and
   computed `Angle` to define specified `OffsetPath` and computed `OffsetPath`.
2. Add `ray` function into `OffsetPath`.

We also tweak the degree from 150deg to 135deg in wpt (e.g.
offset-path-ray-001.html and others) to avoid floating point precision issues.
For example:
```
// offset-path: ray(150deg ...);
// offset-distance: 20px;
matrix:
{
  {0.500000 0.866025 0.000000 0.000000},
  {-0.866025 0.500000 0.000000 0.000000},
  {0.000000 0.000000 1.000000 0.000000},
  {10.000000 17.320509 0.000000 1.000000}
}

// rotate(60deg) translate(20px)
matrix:
{
  {0.500000 0.866025 0.000000 0.000000},
  {-0.866025 0.500000 0.000000 0.000000},
  {0.000000 0.000000 1.000000 0.000000},
  {10.000000 17.320507 0.000000 1.000000}
}
```
Their translate parts, 17.320509 vs 17.320507, are almost the same (only
tiny difference), which may cause the reftest failed.

Differential Revision: https://phabricator.services.mozilla.com/D42721
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
35a98af0ed style: Add a comment quoting the spec. 2019-10-09 13:21:35 +02:00
fantasai
8798549beb style: 'text-orientation: upright' forces used 'direction' to LTR. r=jfkthame
Bug: 1315892
Reviewed-by: jfkthame
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
c78f1b62de style: Remove LengthPercentage::was_calc.
There should not be any behavior change between specifying a percentage using %
or calc(%) per the resolution of https://github.com/w3c/csswg-drafts/issues/3482.

Differential Revision: https://phabricator.services.mozilla.com/D43747
2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
6b674a670b
style: Use consistent naming and shared code for out-of-flow stuff.
Use the functions introduced in ee17eedf3a.
2019-10-07 16:57:18 +02:00
bors-servo
402db83b2b
Auto merge of #24303 - servo:script-codegen, r=nox
WebIDL codegen: Replace cmake with a single Python script

When [playing around with Cargo’s new timing visualization](https://internals.rust-lang.org/t/exploring-crate-graph-build-times-with-cargo-build-ztimings/10975/21), I was surprised to see the `script` crate’s build script take 76 seconds. I did not expect WebIDL bindings generation to be *that* computationally intensive.

It turns out almost all of this time is overhead. The build script uses CMake to generate bindings for each WebIDL file in parallel, but that causes a lot of work to be repeated 366 times:

* Starting up a Python VM
* Importing (parts of) the Python standard library
* Importing ~16k lines of our Python code
* Recompiling the latter to bytecode, since we used `python -B` to disable writing `.pyc` files
* Deserializing with `cPickle` and recreating in memory the results   of parsing all WebIDL files

----

This commit remove the use of CMake and cPickle for the `script` crate. Instead, all WebIDL bindings generation is done sequentially in a single Python process. This takes 2 to 3 seconds.

<!-- 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/24303)
<!-- Reviewable:end -->
2019-09-30 05:23:19 -04:00
Anthony Ramine
bceecddb64 Update html5ever to 0.24 2019-09-27 17:43:37 +02:00
Simon Sapin
5c60023cb8 WebIDL codegen: Replace cmake with a single Python script
When playing around with Cargo’s new timing visualization:
https://internals.rust-lang.org/t/exploring-crate-graph-build-times-with-cargo-build-ztimings/10975/21

… I was surprised to see the `script` crate’s build script take 76 seconds.
I did not expect WebIDL bindings generation to be *that* computationally
intensive.

It turns out almost all of this time is overhead. The build script uses CMake
to generate bindings for each WebIDL file in parallel, but that causes a lot
of work to be repeated 366 times:

* Starting up a Python VM
* Importing (parts of) the Python standard library
* Importing ~16k lines of our Python code
* Recompiling the latter to bytecode, since we used `python -B` to disable
  writing `.pyc` file
* Deserializing with `cPickle` and recreating in memory the results
  of parsing all WebIDL files

----

This commit remove the use of CMake and cPickle for the `script` crate.
Instead, all WebIDL bindings generation is done sequentially
in a single Python process. This takes 2 to 3 seconds.
2019-09-27 13:53:19 +02:00
bors-servo
f12f6546a4
Auto merge of #24294 - servo:missing-feature, r=jdm
Fix error message for invalid combination of style crate feature flags

Instead of ``cannot find value `engine` in this scope`` https://github.com/servo/servo/issues/24284

<!-- 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/24294)
<!-- Reviewable:end -->
2019-09-25 21:11:55 -04:00
Simon Sapin
36e53a39bf Fix error message for invalid combination of style crate feature flags
Instead of ``cannot find value `engine` in this scope``
https://github.com/servo/servo/issues/24284
2019-09-25 18:29:52 +02:00
Simon Sapin
d69607064b Upgrade to rustc 1.39.0-nightly (66bf391c3 2019-09-23) 2019-09-25 18:04:35 +02:00
Anthony Ramine
9cef3eee65 Uncomment more stuff related to box construction 2019-09-19 11:58:07 +02:00
Emilio Cobos Álvarez
cd3b0c23fa
style: Fix Servo build, and rustfmt recent changes. 2019-09-12 23:04:56 +02:00
Emilio Cobos Álvarez
9eaadc6860 style: Shutdown Servo's thread-pool in leak-checking builds, leak the atom table elsewhere.
Differential Revision: https://phabricator.services.mozilla.com/D44217
2019-09-12 22:34:16 +02:00
Michael Woerister
d54d1bcb17 style: Remove duplicated logic from stylo's Gecko wrapper.
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
2019-09-12 22:34:16 +02:00
Boris Chiou
eb8195dfa4 style: Tweak the serialization of text-decoration.
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
2019-09-12 22:34:16 +02:00
Cameron McCormack
3c2e4d1e98 style: Align the Rust and C++ representations of WritingMode.
Differential Revision: https://phabricator.services.mozilla.com/D44412
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
987a1eeb62 style: Use cbindgen for counters.
Differential Revision: https://phabricator.services.mozilla.com/D44403
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
3fcd23dcdf style: Add a comment about a Send bound that may look confusing. 2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
c7add81517 style: Account for user stylesheets for Shadow DOM invalidation.
Differential Revision: https://phabricator.services.mozilla.com/D43992
2019-09-12 22:34:16 +02:00
Boris Chiou
c3a3bd48d7 style: Support css use counters for unimplemented properties.
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
2019-09-12 22:34:16 +02:00
Mats Palmgren
f7a87c49b1 style: [css-lists-3] Make 'none' invalid as a <counter-style> in counter()/counters().
CSSWG resolution:
https://github.com/w3c/csswg-drafts/issues/4163#issuecomment-521331100

Spec:
https://drafts.csswg.org/css-lists-3/#counter-functions

Differential Revision: https://phabricator.services.mozilla.com/D43893
2019-09-12 22:34:16 +02:00
Joel Olsson
1406ae7f39 style: Media Query - Enable single <number> and <number>/<number> for <aspect-ratio>.
Differential Revision: https://phabricator.services.mozilla.com/D41557
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
54ce45f3ee style: Update cbindgen.
This cleans up the pattern of "Use a private dtor so that the helper functions
do the right thing" by enabling it everywhere using:

  https://github.com/eqrion/cbindgen/pull/377

It also caught some uninitialized value issues.

I think they're mostly harmless since we zero-initialize our structs:

https://searchfox.org/mozilla-central/rev/325c1a707819602feff736f129cb36055ba6d94f/servo/components/style/properties/gecko.mako.rs#632

And since we override the clip rect, which is the other bit of code that was
failing to build with this change.

Differential Revision: https://phabricator.services.mozilla.com/D43491
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
b238698691 style: Use cbindgen for clip / -moz-image-region.
This also fixes some of the issues with -moz-image-region, where we just minted
an auto out of the blue.

Differential Revision: https://phabricator.services.mozilla.com/D43474
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
53cd37ce39 style: Remove old warning allow which is no longer relevant.
-moz-appearance uses cbindgen since a long time ago.

Differential Revision: https://phabricator.services.mozilla.com/D43472
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
b0f3a68a6c style: Rustfmt declaration_block.rs.
Differential Revision: https://phabricator.services.mozilla.com/D43400
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
ee106992e1 style: Simplify -x-span property.
Differential Revision: https://phabricator.services.mozilla.com/D42914
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
432b417d98 style: Avoid manual paint-order glue code.
Differential Revision: https://phabricator.services.mozilla.com/D42913
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
14c7e133ad style: Avoid some signed -> unsigned conversions for box-ordinal-group.
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
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
7c4dc9e797 style: Make font-variant-alternates use cbindgen.
Differential Revision: https://phabricator.services.mozilla.com/D42859
2019-09-12 22:34:16 +02:00
Emilio Cobos Álvarez
b8108eaa80 style: Remove unused impl_coord_copy.
Differential Revision: https://phabricator.services.mozilla.com/D42857
2019-09-12 22:34:16 +02:00
Mats Palmgren
dd5715d4f1 style: Remove display:-moz-inline-grid/-moz-inline-stack.
Differential Revision: https://phabricator.services.mozilla.com/D42552
2019-09-12 22:34:16 +02:00
Boris Chiou
d794c8527d style: Clamp negative values for font-size-adjust animations.
Differential Revision: https://phabricator.services.mozilla.com/D42586
2019-09-12 22:07:45 +02:00
Emilio Cobos Álvarez
9404ac89b7 style: Don't clamp font-size calc() factors too early.
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
2019-09-12 22:07:45 +02:00
Mats Palmgren
bff52ae4a1 style: Implement layout for 'display: flow-root list-item'.
Differential Revision: https://phabricator.services.mozilla.com/D42087
2019-09-12 22:07:45 +02:00
Anthony Ramine
4444c5a2ad Import victor's layout system 🍷 2019-09-11 10:36:30 +02:00
Bastien Orivel
b6cddbebaa Deduplicate parking_lot and friends by updating it to 0.9 2019-09-05 10:47:39 +02:00
Simon Sapin
98e4a53b72 Upgrade to rustc 1.39.0-nightly (f7af19c27 2019-08-15) 2019-08-23 08:23:21 +02:00
bors-servo
aa60077563
Auto merge of #23973 - emilio:gecko-sync, r=emilio,jdm
style: Sync changes from mozilla-central.

See each individual commit for details.

<!-- 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/23973)
<!-- Reviewable:end -->
2019-08-16 06:44:52 -04:00
Emilio Cobos Álvarez
4752110d53
Fix Servo build and unify display representation. 2019-08-15 17:11:08 +02:00
Emilio Cobos Álvarez
4d8fc4b8f7
style: Fix formatting of recent changes. 2019-08-15 17:02:37 +02:00
Emilio Cobos Álvarez
cea6966fd2
style: Fix Servo build. 2019-08-15 17:02:37 +02:00