Commit graph

1547 commits

Author SHA1 Message Date
Manish Goregaokar
433b653f70 Move clip resolution code into style 2020-07-27 19:59:59 -07:00
Simon Sapin
b91e293819 Add layout support for list markers 2020-07-24 09:31:24 +02:00
Simon Sapin
4a4199c1d6 Don’t parse unspported values of content 2020-07-24 09:31:24 +02:00
Simon Sapin
82e274aec9 Make a bool for display: list-item available to flow box construction 2020-07-23 16:43:57 +02:00
bors-servo
6659e9004d
Auto merge of #27032 - mrobinson:fractional-iteration, r=jdm
animations: Finish support for fractional iteration counts

This change also improves support for creating animations with negative
delays, as that is necessary to test support for fractional iteration
lengths.

Fixes: #14858

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #14858
- [x] There are tests for these changes

<!-- 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-06-24 15:54:27 -04:00
Martin Robinson
cf4510011f animations: Don't convert linear easing to a bezier
This conversion can lead to floating point errors and extra work when
computing animations. Avoiding it allows animation-iteration-count-009.html
to pass.
2020-06-24 17:19:25 +02:00
Simon Sapin
01905923db First pass at implementing the Flex Layout Algorithm
https://drafts.csswg.org/css-flexbox/#layout-algorithm
2020-06-23 00:41:27 +02:00
bors-servo
53263595f1
Auto merge of #26968 - servo:layout-2020-lazy-content-sizes, r=SimonSapin
Compute content sizes lazily in layout 2020
2020-06-19 13:50:29 -04:00
Emilio Cobos Álvarez
a7d740331d
style: Fix a warning in layout-2020 2020-06-18 23:51:19 +02:00
Emilio Cobos Álvarez
bb8c3ee8ba
style: fix formatting. 2020-06-18 23:51:18 +02:00
Emilio Cobos Álvarez
97f29c893f
style: Fix gecko build. 2020-06-18 23:51:18 +02:00
Emilio Cobos Álvarez
e5484250db
style: Remove the dependency on font-kit from style.
No good reason to have this IMO, and helps remove some #[cfg] blocks.
2020-06-18 23:51:17 +02:00
Emilio Cobos Álvarez
7a696cbffe
style: build / rebase fixes. 2020-06-18 23:51:17 +02:00
Emilio Cobos Álvarez
56283a3226
style: Fix FontFamilyList definition. 2020-06-18 23:51:17 +02:00
Colomban Wendling
af2e157c88
style: Fix tree column header color to follow theme.
The background color for the tree column headers is drawn using the
system APIs, but the foreground uses custom colors, which didn't follow
theme.  This can lead to unreadable text with specific colors, e.g.
leading to black on black.

Fix this by using system colors for the foreground as well.  It also
adds on-hover styling to match possible background change on hover.

Differential Revision: https://phabricator.services.mozilla.com/D78073
2020-06-18 23:51:15 +02:00
Emilio Cobos Álvarez
8f215a8444
style: Port the style crate to rust 2018.
Differential Revision: https://phabricator.services.mozilla.com/D80101
2020-06-18 23:51:15 +02:00
Emilio Cobos Álvarez
c578a82adc
style: Fix some manual occurrences of try().
Depends on D80099

Differential Revision: https://phabricator.services.mozilla.com/D80100
2020-06-18 23:51:15 +02:00
Emilio Cobos Álvarez
685e749cfc
style: Switch all callsites of try() to try_parse() in the style crate.
Fully automated via:

  $ rg -l '\.try\(' | xargs sed -i 's/\.try(/.try_parse(/g'
  $ cd servo/components/style && cargo +nightly fmt

Differential Revision: https://phabricator.services.mozilla.com/D80099
2020-06-18 23:51:14 +02:00
Philipp Zech
5af0d7ca7c
style: Remove StyleFontSize enum from nsStyleConsts.h.
Differential Revision: https://phabricator.services.mozilla.com/D77511
2020-06-18 23:51:14 +02:00
Anthony Ramine
235df94f2e Compute content sizes lazily in layout 2020 2020-06-18 14:11:02 +02:00
Utsav Oza
8372cf1bd8 Derive Serialize and Deserialize traits for font styles for #[cfg_attr(feature = "servo")] 2020-06-12 18:43:09 +05:30
Utsav Oza
34d0c313dc Enable textAlign, textBaseline and direction attributes for canvas 2020-06-10 22:34:20 +05:30
Utsav Oza
c21fde3751 Implement CanvasRenderingContext2D.font property 2020-06-10 22:11:24 +05:30
Simon Sapin
64124f7a5e Layout 2020 skeleton for display: flex, behind a pref 2020-06-04 13:09:57 +02:00
Emilio Cobos Álvarez
762abbaf9f
style: Rustfmt recent changes. 2020-06-04 02:02:50 +02:00
Emilio Cobos Álvarez
332aec212c style: Miscellaneous servo build fixes. 2020-06-04 01:50:36 +02:00
Boris Chiou
eff8f0fca0 style: Update aspect-ratio syntax for HTML IMG mapped ratio.
Differential Revision: https://phabricator.services.mozilla.com/D76942
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
a9c88729a8 style: Remove two useless mem::replace calls.
Differential Revision: https://phabricator.services.mozilla.com/D76884
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
224550f818 style: Derive parse for ShapeRadius.
Depends on D76331

Differential Revision: https://phabricator.services.mozilla.com/D76332
2020-06-04 01:50:36 +02:00
Emilio Cobos Álvarez
e259c53c62 style: Derive parse for TextOverflowSide.
Depends on D76330

Differential Revision: https://phabricator.services.mozilla.com/D76331
2020-06-04 01:50:36 +02:00
Boris Chiou
35546aea54 style: Use style::One for Integer to avoid implementing Mul.
Differential Revision: https://phabricator.services.mozilla.com/D76207
2020-06-04 01:50:36 +02:00
Boris Chiou
7022f451e1 style: Replace AspectRatio with computed::position::Ratio in media-queries.
Also, we drop the pref, layout.css.aspect-ratio-number.enabled, becacuse
the spec of css-sizing-4 uses Number now.

Differential Revision: https://phabricator.services.mozilla.com/D75233
2020-06-04 01:50:36 +02:00
Boris Chiou
fc9321bb23 style: Let aspect-ratio (css-sizing-4) support 'auto | <ratio>'.
In order to test its parsing and serialization, we expose it but protect
it behind a pref.

Besides, I would like to drop layout.css.aspect-ratio-number.enabled in
the next patch because the spec has been updated. It seems we don't have
to keep this pref and we should always use Number.

Differential Revision: https://phabricator.services.mozilla.com/D74955
2020-06-04 01:50:36 +02:00
longsonr
4359aae44e style: Don't apply minimum font sizes to SVG text.
Differential Revision: https://phabricator.services.mozilla.com/D74581
2020-06-04 01:50:36 +02:00
Cameron McCormack
6bae0b99ca style: Gracefully handle errors creating shared memory UA style sheets.
We still panic in a debug build, so that developers can notice when they
need to add a new static atom after modifying UA sheets.

We also add telemetry to note when this happens, add an app note to a
crash report, in case any crash later on occurs, and re-up the existing,
expired shared memory sheet telemetry probes so we can look at them
again.

Differential Revision: https://phabricator.services.mozilla.com/D73188
2020-06-04 01:50:36 +02:00
Emily McDonough
a8c318a068 style: Use fill length rather than index to indicate a repeat(auto) in subgrid from Servo.
Differential Revision: https://phabricator.services.mozilla.com/D70066
2020-06-04 01:50:36 +02:00
Mats Palmgren
6f58c66589 style: Implement style system support for Masonry layout.
This implements support for this CSS Masonry layout proposal:
https://github.com/w3c/csswg-drafts/issues/4650

I've intentionally left out a shorthand (place-tracks?) for now until
we have a draft CSS spec for this.

Differential Revision: https://phabricator.services.mozilla.com/D67061
2020-06-04 01:50:36 +02:00
Kunal Mohan
f3fa53b849 update rust toolchain 2020-05-21 21:51:49 +05:30
Simon Sapin
09dbf91e7b display: contents computes to block on the root element 2020-05-15 13:25:35 +02:00
Martin Robinson
9c7b1ae715 layout_2020: Add initial support for getComputedStyle
This implementation is more-or-less on par with the one from layout_2013
and in some cases better. There are still some cases where we don't
return the correct "resolved value," but this is enough to test
animations and transitions.
2020-05-11 20:14:01 +02:00
Emilio Cobos Álvarez
3d1df8dce7 style: Fix two regressions from #26113. 2020-04-16 21:16:02 +02:00
Emilio Cobos Álvarez
e6b4ceca07 Fix Gecko build. 2020-04-16 18:29:34 +02:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +02:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Cameron McCormack
fa733ecb72 style: Fix a few initial values in Rust property definitions.
Differential Revision: https://phabricator.services.mozilla.com/D67929
2020-04-16 16:35:07 +02:00
Tim Nguyen
d17b3cc202 style: Omit center positions in conic/radial gradient serialization.
Differential Revision: https://phabricator.services.mozilla.com/D67461
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
414edb5a4a style: Simplify the implementation of HasAuthorSpecifiedRules.
This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.

This changes behavior in two ways, one of them which is not observable to
content, I believe:

 * revert now re-enables the native styling. This was brought up in
   https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.

   This is observable to content, and I'm adding a test for it.

 * We don't look at inherited styles from our ancestors when `inherit` is
   specified in a non-author stylesheet. This was introduced for bug 452969 but
   we don't seem to inherit background anymore for file controls or such. It
   seems back then file controls used to have a text-field.

   I audited forms.css and ua.css and we don't explicitly inherit
   padding / border / background-color into any nested form control.

We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.

We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.

Differential Revision: https://phabricator.services.mozilla.com/D67722
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
7d438cd816 style: Ensure that derived types are right for optimized-away implementations.
We have this optimization where, for non-generic structs, we generate just a
clone / move as the ToComputedValue / ToResolvedValue implementation.

This moves the optimization a bit further down, and refines it so that we still
generate all the relevant where clauses that make it sound, that is, that all
the ToComputedValue implementations of the fields return the same type.

Otherwise this wouldn't be sound and the type would need to become generic.

We add an escape hatch (no_field_bound) for fields that need to be cloned but
which don't implement the trait. This is right now only for the RefPtr<> in the
shared font-family list, and a piece of code in PaintWorklet which looks kinda
fishy, and probably should be fixed (but we don't ship it in Firefox and there's
a pre-existing FIXME for servo, so I punted on it for now).

The other thing this patch does is adding a bunch of ToComputedValue /
ToResolvedValue implementations that are trivial and were missing.

Differential Revision: https://phabricator.services.mozilla.com/D67913
2020-04-16 16:35:07 +02:00
Emily McDonough
e0b4619fa5 style: Enable multiple grid repeat values in Servo.
Differential Revision: https://phabricator.services.mozilla.com/D60931
2020-04-16 16:35:07 +02:00
Emily McDonough
b85b6ac16f style: Add auto-fill length field to line name lists returned from Servo.
Rename fill_idx to fill_start, to indicate it is not a single value but a
range. Also change a numeric_limits<>::max() involving the fill_start to use
decltype() to ensure its type matches that of the auto-generated structure's
field, while we're touching that code.

The test to ensure only a single repeat value is allowed will be removed by a
later commit.

Differential Revision: https://phabricator.services.mozilla.com/D60929
2020-04-16 16:35:07 +02:00