Emilio Cobos Álvarez
4752110d53
Fix Servo build and unify display representation.
2019-08-15 17:11:08 +02:00
Nicholas Nethercote
bb032c1ddc
style: Use static_prefs::pref!
.
...
It's much nicer.
One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.
Differential Revision: https://phabricator.services.mozilla.com/D40792
2019-08-15 17:00:37 +02:00
Emilio Cobos Álvarez
a109fbb7c8
style: Use ArcSlice for quotes.
...
This saves the intermediate allocation.
Differential Revision: https://phabricator.services.mozilla.com/D30546
2019-05-29 16:14:10 +02:00
Emilio Cobos Álvarez
0d5c4481b8
style: Introduce ArcSlice, a small wrapper over ThinArc but without an explicit header.
...
We could make the header PhantomData or something, but then we wouldn't be able
to bind to C++, since C++ doesn't have ZSTs. So add a canary instead to add a
runtime check of stuff being sane.
Differential Revision: https://phabricator.services.mozilla.com/D30133
2019-05-10 12:43:04 +02:00
Emilio Cobos Álvarez
2ed2151b3d
style: Move OwnedSlice to style_traits.
...
Differential Revision: https://phabricator.services.mozilla.com/D30126
2019-05-10 12:43:04 +02:00
Emilio Cobos Álvarez
330bccd659
style: Add an owned slice type which cbindgen can understand.
...
Passing these by value won't be ok of course, but that's fine.
I plan to combine this with https://github.com/eqrion/cbindgen/pull/333 to
actually be able to share representation for ~all the things, this is just the
first bit.
Box<T>, Atom and Arc<T> will be much easier since cbindgen can understand them
without issues.
It's boxed slices the only ones I should need something like this. I could avoid
it if I rely on Rust's internal representation, which we can per [1], but then I
need to teach cbindgen all about slices, which is generally hard, I think.
[1]: https://github.com/rust-lang/unsafe-code-guidelines/blob/master/reference/src/layout/pointers.md
Differential Revision: https://phabricator.services.mozilla.com/D29768
2019-05-10 12:43:02 +02:00
Cameron McCormack
40248ae5fd
style: Add derived ToShmem implementations.
...
Differential Revision: https://phabricator.services.mozilla.com/D17197
2019-04-12 12:19:52 +02:00
Cameron McCormack
7fa7c103d6
style: Add simple ToShmem implementations.
...
Differential Revision: https://phabricator.services.mozilla.com/D17190
2019-04-12 12:19:46 +02:00
Cameron McCormack
f6ef35c5d3
style: Add support for deriving ToShmem.
...
Differential Revision: https://phabricator.services.mozilla.com/D17189
2019-04-12 12:19:45 +02:00
Cameron McCormack
f581d2afb2
style: Add SharedMemoryBuilder type and ToShmem trait.
...
Differential Revision: https://phabricator.services.mozilla.com/D17187
2019-04-12 12:19:44 +02:00
Emilio Cobos Álvarez
7d01114cbf
style: Add a Zero trait that doesn't require Add, and use it in place of num_traits and IsZeroLength.
...
Use it to be consistent in InsetRect serialization and storage between Servo and
Gecko.
Differential Revision: https://phabricator.services.mozilla.com/D21493
2019-03-13 15:08:14 +01:00
Emilio Cobos Álvarez
9909816c76
style: sort extern crates and fix servo build.
2019-01-29 03:17:24 +01:00
Bobby Holley
af1bbd7b06
style: Derive more.
...
Differential Revision: https://phabricator.services.mozilla.com/D17029
2019-01-29 02:39:13 +01:00
Cameron McCormack
63fd707bd3
style: Use atom handles in favour of atom pointers in style system code.
...
Differential Revision: https://phabricator.services.mozilla.com/D15078
2019-01-11 00:50:26 +01:00
Shanavas M
b763d6737c
Remove OrderedMap in favor of IndexMap
2019-01-10 12:57:09 +05:30
Emilio Cobos Álvarez
006e71c7de
style: Make Servo use a single thread-pool for layout-related tasks per-process.
...
Instead of per-document. This also allows to reuse this thread-pool if needed
for other stuff, like parallel CSS parsing (#22478 ), and to share more code with
Gecko, which is always nice.
2018-12-23 13:00:56 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4)
2018-11-19 14:47:27 +01:00
Bastien Orivel
9a7eeb349a
Update crossbeam-channel to 0.3
2018-11-18 19:33:19 +01:00
Emilio Cobos Álvarez
667457a16c
style: Split up push_applicable_declarations.
...
Introduce RuleCollector, which contains all the state we need during the
cascade, and allows to reuse a bit of code.
Differential Revision: https://phabricator.services.mozilla.com/D11233
2018-11-10 21:10:34 +01:00
Simon Sapin
b1822a39fa
cargo fix --edition --features gecko
2018-11-10 17:47:28 +01:00
Simon Sapin
a15d33a10e
cargo fix --edition
2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a
Reorder imports
2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6
Format remaining files
2018-11-06 22:30:31 +01: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
chansuke
8dab4d659a
Format style component.
2018-09-09 16:24:45 +02:00
Emilio Cobos Álvarez
c8e5b7f1b0
style: Add a very simple use counter implementation.
...
As simple as I could make it, for now. We can improve on this.
Differential Revision: https://phabricator.services.mozilla.com/D3827
2018-09-03 12:31:23 +02:00
Emilio Cobos Álvarez
dc0f937224
style: Rewrite media queries so that they work on an evaluator function.
...
This moves most of the code to be Rust, except potentially some evaluator
functions, and allows to unblock the use case from any-hover / any-pointer and
remove nsMediaFeatures.
Differential Revision: https://phabricator.services.mozilla.com/D2976
2018-08-18 17:54:54 +02:00
Emilio Cobos Álvarez
689293e4fb
Fix Servo build.
2018-08-08 01:34:35 +02:00
Cameron McCormack
62419adaaa
style: Shrink selectors::Component to 24 bytes.
...
This saves about 37 KiB of memory across the UA style sheets.
Bug: 1475197
Reviewed-by: emilio
2018-08-08 01:36:53 +02:00
Nicholas Nethercote
fc9df0bcf3
style: Convert FnvHash{Set,Map} instances to FxHash{Set,Map}.
...
Bug: 1477628
Reviewed-by: heycam
2018-08-08 01:34:35 +02:00
Emilio Cobos Álvarez
921c389247
style: Remove some unneeded cfg(..).
...
The less not-compiled code in common builds, the better for everybody.
2018-05-05 17:53:22 +02:00
Bobby Holley
c99bcdd4b8
Run rustfmt on selectors, servo_arc, and style.
...
This was generated with:
./mach cargo fmt --package selectors &&
./mach cargo fmt --package servo_arc &&
./mach cargo fmt --package style
Using rustfmt 0.4.1-nightly (a4462d1 2018-03-26)
2018-04-10 17:35:15 -07:00
Bobby Holley
f7ae1a37e3
Manual fixups so that the rustfmt output won't trigger tidy.
2018-04-10 17:33:25 -07:00
Anthony Ramine
31036d6510
Derive ToCss for MediaList
...
This uncovered the fancy snowflake `use fmt::Write` in the impl of ToCss
for NonTSPseudoClass.
2018-03-05 12:02:31 +01:00
Emilio Cobos Álvarez
5e64cb3516
style: Make XBL / Shadow DOM use something more light-weight than a Stylist.
...
It's just a struct aggregating stylesheets + CascadeData, with a quirks_mode
parameter because XBL sucks so bad.
Bug: 1436059
Reviewed-by: xidorn
MozReview-Commit-ID: 7q99tSNXo0K
2018-02-16 13:42:36 +01:00
Anthony Ramine
79775541f2
Make AnimationValue have the same variants as PropertyDeclaration
...
By making AnimationValue have the same representation as PropertyDeclaration
and Void variants for non-animatable properties, we know by constructions
that all properties have the same discriminant in both.
2018-02-10 12:37:30 +01:00
bors-servo
41fb6ed1ff
Auto merge of #19980 - servo:derive-all-the-things, r=emilio
...
Merge all keyword arms in Clone for PropertyDeclaration 🐉 🐲
<!-- 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/19980 )
<!-- Reviewable:end -->
2018-02-09 16:17:01 -05:00
Manish Goregaokar
8c2b7b41ef
Autogenerate compute_damage ( fixes #10622 )
2018-02-09 08:48:04 -08:00
Anthony Ramine
5d8e70dc27
Avoid pattern matching to clone Copy variants of PropertyDeclaration 🐉 🐲
2018-02-09 12:10:42 +01:00
Emilio Cobos Álvarez
f4c9c598a3
style: Optimize serialization of identifiers of length <= 16 🐉 🐲
...
Much like we optimize to_ascii_lowercase.
This also fixes a bug in Servo where attr() rules with an unknown namespace
prefix are parsed, which is wrong.
2018-02-07 17:34:22 +01:00
Anthony Ramine
3d99a4489c
Don't use define_css_keyword_enum in style anymore
2018-02-01 12:43:48 +01:00
Simon Sapin
cace4fc6eb
Remove #![deny(warnings)]
...
We already have https://github.com/servo/servo/pull/19612
to deny warnings at the time of landing into master.
But it’s not useful to break the build when later compiler
with a more recent Rust version that has introduced new warnings:
https://bugzilla.mozilla.org/show_bug.cgi?id=1434619
2018-01-31 17:00:27 +01:00
Anthony Ramine
cd8f96cc9e
Change ToCss to take a CssWriter<W>
...
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
2018-01-23 10:41:42 +01:00
bors-servo
6938b4f3eb
Auto merge of #19230 - emilio:lru-cache, r=nox
...
style: Move lru_cache to its own crate.
One less crate pointlessly in components/.
<!-- 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/19230 )
<!-- Reviewable:end -->
2017-11-15 22:40:06 -06:00
Emilio Cobos Álvarez
47b02658ec
style: Move lru_cache to its own crate.
...
One less crate pointlessly in components/.
2017-11-15 16:18:11 +01:00
Emilio Cobos Álvarez
f0d749a544
style: Stop allowing unused_unsafe.
2017-11-15 13:26:26 +01:00
Emilio Cobos Álvarez
759becc5fc
style: add accidentally removed deny(warnings).
...
It was accidentally commented out in #19197 because I was developing on a
tree without #19162 .
2017-11-13 14:34:39 +01:00
Emilio Cobos Álvarez
a76cb65751
stylo: Integrate Servo SourceSizeList in ResponsiveImageSelector.
...
This needs to dumb down the parsing in order to match what we do in Gecko and
pass more tests.
The remaining tests are just because of calc() in media queries and "or" media
expressions.
Bug: 1408308
Reviewed-by: Manishearth
MozReview-Commit-ID: CXGdYVbojBL
2017-11-13 02:48:48 +01:00
Nika Layzell
2d3331fbd4
Move nsstring from gecko into servo/support/gecko/nsstring
...
This is the servo side of bug 1403213.
MozReview-Commit-ID: HFdQiuMnGhJ
2017-10-23 14:22:42 -04:00
Gecko Backout
662b2e7397
Backed out changeset 196206f129ef (bug 1403213) for referencing non-existing xpcom/rust/gtest/moz.build in xpcom/moz.build. r=backout on a CLOSED TREE
...
Backs out https://github.com/servo/servo/pull/18941
2017-10-20 19:33:29 +00:00