Commit graph

8109 commits

Author SHA1 Message Date
bors-servo
6a3c3a4e18
Auto merge of #26447 - jdm:white-space-2020, r=nox
Layout 2020: Implement basic white-space: pre support

With these changes `<pre>` and `<br>` preserve spaces and force line breaks appropriately.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26440
- [x] There are tests for these changes
2020-07-29 10:29:30 -04:00
Manish Goregaokar
139f240baf Enable clip property in layout 2020 2020-07-27 19:59:59 -07:00
Manish Goregaokar
433b653f70 Move clip resolution code into style 2020-07-27 19:59:59 -07:00
Josh Matthews
d8b4dab4e3 Implement basic white-space: pre support for layout 2020. 2020-07-27 20:06:53 -04: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
Manish Goregaokar
1af5efc542 flexbox 2020: Enable align-self and align-items in CSS 2020-07-20 14:26:14 -07: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
Martin Robinson
954b5177f0 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.

This change also adjusts existing Servo animation tests which assumed
that advancing to the exact moment of the end of the animation would be
considered "before the end." With this change, this moment is "after the
end."

Fixes: #14858
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
Kagami Sascha Rosylight
d01648d637 Fix remaining flake8 warnings 2020-06-21 03:34:32 +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
059a50bba0
style: Remove some unused extern crate declarations now that style is in rust 2018.
This avoids some warnings.
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
Emilio Cobos Álvarez
1f797ca24d
style: Remove prefers-color-scheme: no-preference.
It was removed from the spec.

Differential Revision: https://phabricator.services.mozilla.com/D78834
2020-06-18 23:51:16 +02:00
Emilio Cobos Álvarez
33b548ae64
style: Use an enum class for LookAndFeel::FontID.
Differential Revision: https://phabricator.services.mozilla.com/D76696
2020-06-18 23:51:16 +02:00
neil
7b5953da95
style: Remove the layout.css.scrollbar-width.enabled and layout.css.scrollbar-color.enabled prefs.
Differential Revision: https://phabricator.services.mozilla.com/D78400
2020-06-18 23:51:16 +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
Cameron McCormack
9b980e2f49
style: Add telemetry for -moz-appearance usage.
Differential Revision: https://phabricator.services.mozilla.com/D77637
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
3884328ce3
style: Clear last_parsed_property_id right after successfully parsing the value.
Rather than waiting until parsing another id (successfully or
unsuccessfully).

If we error before we even get to PropertyId::parse, we'd incorrectly
associate the error with the wrong property, incorrectly omitting it
sometimes.

Differential Revision: https://phabricator.services.mozilla.com/D78260
2020-06-18 23:51:14 +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
Martin Robinson
f92164144e animations: Don't apply animation delay to every iteration
The delay should only be applied to the animation before the first
iteration.
2020-06-18 16:36:14 +02:00
Anthony Ramine
235df94f2e Compute content sizes lazily in layout 2020 2020-06-18 14:11:02 +02:00
Martin Robinson
36701e0223 Combine AnimationAndTransitionDeclarations and AnimationRules
These two structs are very similar, so we can combine them.
2020-06-16 19:25:52 +02:00
Martin Robinson
f3e373bc62 Add animation and transition support for pseudo-elements
This change extends the DocumentAnimationSet to hold animations for
pseudo-elements. Since pseudo-elements in Servo are not in the DOM like
in Gecko, they need to be handled a bit carefully in stylo.  When a
pseudo-element has an animation, recascade the style. Finally, this
change passes the pseudo-element string properly to animation events.

Fixes: #10316
2020-06-16 16:33:55 +02:00
Martin Robinson
4a3995bb37 Add DocumentAnimationSet and AnimationSetKey
This will be used in order to hold animations for pseudo elements in the
DocumentAnimationSet. Also no longer store the OpaqueNode in the
animation and transition data structures. This is already part of the
DocumentAnimationSet key.
2020-06-15 10:28:30 +02:00
Matthias Deiml
b85a5dac5d Implement visibility for layout_2020 2020-06-14 00:31:37 +02:00
bors-servo
721271dcd3
Auto merge of #26697 - utsavoza:ugo/issue-11681/22-05-2020, r=jdm
Implement CanvasRenderingContext2d.fillText

The PR consists of broadly two main changes:
- Implementation of Canvas2dRenderingContext.font
- Basic implementation of Canvas2dRenderingContext.fillText

Although I am not fully sure about the long term goals for the canvas backend in Servo, I assumed limited scope for font and text handling (should support simple text drawing with font selection) in the current implementation as I believe a more complete implementation would eventually be brought in as a part of #22957.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #11681
- [x] There are tests for these changes
2020-06-12 13:43:51 -04: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
bors-servo
d85c6ee341
Auto merge of #26838 - servo:flexbox, r=nox
Flexbox, the boring parts

I have a local branch starting to implement https://drafts.csswg.org/css-flexbox/#layout-algorithm. It’s not PR-ready yet, but it’s going to be large so here are some of the less interesting parts meaningful by themselves. Landing the module split in particular will help reduce merge conflicts.

CC https://github.com/servo/servo/issues/26639
2020-06-10 17:19:16 -04:00
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
Martin Robinson
af0bb1f728 animations: Don't always re-resolve the node style
When animations and transitions change don't always re-resolve node
style, just replace the animation and transition rules and re-cascade.
2020-06-10 17:03:58 +02:00
Simon Sapin
dcd25a06da Enable (behind a pref) parsing of the flex-* properties 2020-06-10 08:38:36 +02:00
Martin Robinson
364235ac0c Include animations and transitions in the cascade
Instead of applying animations and transitions to styled elements,
include them in the cascade. This allows them to interact properly with
things like font-size and !important rules.
2020-06-09 11:41:07 +02:00
Martin Robinson
b875f14e86 Better computation of animation keyframes
This begins to address #26625 by properly applying CSS variables during
keyframe computation and no longer using `apply_declarations`. Instead,
walk the declarations, combining them into IntermediateComputedKeyframe,
maintaining declarations that modify CSS custom properties. Then compute
a set of AnimationValues for each keyframe and use those to produce
interpolated animation values.
2020-06-05 13:40:29 +02:00
Martin Robinson
83fa1b9eaa Cache animation computed values when animations change
Instead of recalculating the animation style every tick of an animation,
cache the computed values when animations change. In addition to being
more efficient, this will allow us to return animation rules as property
declarations because we don't need to consult the final style to produce
them.
2020-06-05 13:21:19 +02:00
Simon Sapin
29005e1626 Keep flex items in order-modified document order in the box tree 2020-06-04 13:19:53 +02:00
Simon Sapin
64124f7a5e Layout 2020 skeleton for display: flex, behind a pref 2020-06-04 13:09:57 +02:00
Emilio Cobos Álvarez
79c2c447fc
style: fix tidy. 2020-06-04 05:01:54 +02:00