Commit graph

2583 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8777c4ee63
style: followup: set the rule type in the custom properties code, since we use it.
Though I think it may be slightly fishy if used in, e.g., a @keyframes block.

For our purposes right now it doesn't make a difference, I think.

Bug: 1466008
MozReview-Commit-ID: A7VCTOqaIuB
2018-06-02 12:08:58 +02:00
Emilio Cobos Álvarez
600f19540e
style: Make PropertyId::parse less of a footgun.
Bug: 1466095
Reviewed-by: xidorn
MozReview-Commit-ID: 2BmtSDPmHj9
2018-06-02 12:08:40 +02:00
Emilio Cobos Álvarez
5db1387f39
style: Make will-change honor prefs properly, and clean it up while at it.
Bug: 1466008
Reviewed-by: xidorn
MozReview-Commit-ID: JyzwaRgf5Ct
2018-06-02 12:08:25 +02:00
Dan Glastonbury
4108b1b278
style: Change nscolor to StyleComplexColor in SVG properties.
Change mStopColor, mFloodColor, and mLightingColor in nsStyleSVGReset.

Bug: 1457353
Reviewed-by: xidorn
MozReview-Commit-ID: KMRMtHk1jNK
2018-06-02 12:07:42 +02:00
Morgan Rae Reschenberg
0bfd1dc5c0
style: Add contain:size and contain:content parsing functionality.
Bug: 1463589
Reviewed-by: emilio
MozReview-Commit-ID: 4fOqln3oOpC
2018-06-02 12:07:28 +02:00
Emilio Cobos Álvarez
92e2adf45f
style: Cleanup transform animation.
Reviewed-by: hiro
But: 1465066
MozReview-Commit-ID: D9rq8CZIgf5
2018-06-02 12:06:22 +02:00
Hiroyuki Ikezoe
378fcc2b6a
style: Implement the smarter interporation for transform.
Corresponding to this spec change;
32812668df

The expected value in test_transitions_per_property.html can be calculated;

  'start' + ('end' - 'start') * 0.25

Bug: 1464647
Reviewed-by: birtles, emilio
MozReview-Commit-ID: NI9gOUuPnG
2018-06-02 12:05:11 +02:00
Yusuf Sermet
f0fbcf204e
style: Create a stacking context for contain:paint.
Bug: 1463599
Reviewed-by: mattwoodrow
MozReview-Commit-ID: Ln72MOlHXwi
2018-06-02 12:04:48 +02:00
Emilio Cobos Álvarez
82e97b8ec5
style: The fix: scale and translate appropriately.
Loops are hard. This hasn't been the funniest Saturday evening.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: I8rfuIRIsrY
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
b199ca864a
style: Move skew and rotation application to their own scope for clarity.
The skew resetting of temp I think fixes a bug in presence of skew in every
direction, but again haven't double-checked.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: Bn93CoaG8Bu
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
66b8bd2829
style: Cleanup multiply().
We assign all the members, the result matrix doesn't really need to be any clone
of a.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: 3NkhvyfqQL
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
4c51624bcf
style: Add a FIXME comment which I think reveals a bug but I haven't confirmed it.
Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: DgCfqA5TNzP
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
875c4ff621
style: Cleanup and add references to decompose_3d_matrix.
Same, no functional change, but I basically rewrote this two times so...

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: FXOnJDPyPu5
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
6ddb04a483
style: Cleanup and add references to Quaternion::animate.
No functional change, but I did this while searching for the bug.

Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: KsJxFoYaOq1
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
99d4e7b65c
style: Trivial cleanup.
Bug: 1459403
Reviewed-by: hiro
MozReview-Commit-ID: K7zVYGiYAn6
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
92b856b70a
style: Reuse computed rotate animation.
I have the feeling this fixes a bug, but...

Bug: 1464615
Reviewed-by: hiro
MozReview-Commit-ID: Aj478qCbMV9
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
2e500d70ef
style: Match rotate ops.
Per bug 1322189 we really should. I've copied the setup we have already for
translate / scale, but we should really clean this up a bit more I'd think.

In any case, probably skew should be matched as well...

Bug: 1464615
Reviewed-by: hiro
MozReview-Commit-ID: Jky5k8HVfuH
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
01f805af9f
style: Make the general setup for computed style bits nicer.
This patch:

 * Makes StyleStructID an enum class, and moves it to the mozilla namespaces.

 * Introduces StyleStructConstants with some constants scattered through the
   codebase.

 * Makes the computed style bits an enum class, and splits mPseudoType and mBits
   into their own members, since we were using a uint64_t when we have only a
   couple flags and CSSPseudoElementType is a byte. We statically assert that
   the number of style structs is less or equal to 32.

 * Makes mPseudoTag, mPseudoType and mBits const, since we don't want them to be
   mutated from C++, and we still need a few more refactorings (mostly getting
   rid of FinishStyle) to avoid mutating ComputedStyle instead.

Bug: 1464060
Reviewed-by: xidorn
MozReview-Commit-ID: 7qsTtASGcYB
2018-05-28 16:02:31 +02:00
Emilio Cobos Álvarez
6b19318cc8
style: Remove a bunch of unused style bits.
Bug: 1464060
MozReview-Commit-ID: FLACqfSHfSO
2018-05-28 15:39:28 +02:00
Emilio Cobos Álvarez
2c1ec89943
style: Cleanup single transform functions that can't really error.
Also call them "resolve" since it's the general term for computing something
more specific than what you have.

Though I don't feel strongly about that, feel free to push back.

Bug: 1464595
Reviewed-by: hiro
MozReview-Commit-ID: KtqjzlppZLp
2018-05-28 15:39:13 +02:00
Xidorn Quan
8f367be650
style: Don't generate catch-all branch if a image layer keyword value is exhaustive.
Bug: 1463978
Reviewed-by: emilio
MozReview-Commit-ID: H8T9Low6kqY
2018-05-28 15:38:40 +02:00
Xidorn Quan
6306cc7e2d
style: Ensure modified_reset is set when {mutate,take}_reset_struct is called.
Bug: 1463603
Reviewed-by: heycam
MozReview-Commit-ID: 8mqVb7kl0ok
2018-05-28 15:38:22 +02:00
Emilio Cobos Álvarez
5fc6b47d74
followup: Add a comment regarding why a type is generic.
Bug: 1462829
Rubber-stamped-by: xidorn
MozReview-Commit-ID: 5DE8W2n1NP
2018-05-28 15:38:04 +02:00
Emilio Cobos Álvarez
32c6d5b7c6
style: Refactor vector types.
This fixes clamping of mask-size and moves it out of mako while at it.

Bug: 1462829
Reviewed-by: hiro,xidorn
MozReview-Commit-ID: 9hiTe63odna
2018-05-28 15:37:28 +02:00
Xidorn Quan
3016a7f552
style: Add scrollbar-{face,track}-color properties.
Bug: 1460456
Reviewed-by: heycam
MozReview-Commit-ID: ImNfHHfzRdM
2018-05-28 15:37:12 +02:00
Xidorn Quan
1b236bf620
style: Rename CaretColor to ColorOrAuto for reusing.
Bug: 1460456
Reviewed-by: heycam
MozReview-Commit-ID: LD6PlNI60GC
2018-05-28 15:36:55 +02:00
Emilio Cobos Álvarez
fade636ebe
style: Fix Gecko build after #20506. 2018-05-20 20:12:30 +02:00
Xidorn Quan
514aba51ad
style: Use RefPtr::new instead of RefPtr::from_ptr_ref + clone.
Bug: 1461858
Reviewed-by: emilio
2018-05-20 18:58:44 +02:00
Xidorn Quan
ecb2ec63de
style: Rename from_url_value_data to from_url_value and reuse URLValue passed in for ComputedUrl.
Bug: 1461858
Reviewed-by: emilio
MozReview-Commit-ID: LJGm3lUS9mD
2018-05-20 18:58:31 +02:00
Xidorn Quan
45a37503af
style: Make from_image_request infallible.
All callsites already assert, so moving the assertion into the method
should be fine. It is not expected to handle a null image value anyway.

Bug: 1461858
Reviewed-by: emilio
MozReview-Commit-ID: J8CA8m22eSv
2018-05-20 18:57:55 +02:00
Xidorn Quan
dc2aadd43a
style: Make creating CssUrl infallible.
There were a check in CssUrl::parse_from_string for extra data, which
was removed as part of servo/servo#16241, so it never fails now.

CssUrl::from_url_value_data doesn't seem to need Result from the very
beginning. It is unclear why it was made that way.

Bug: 1461858
Reviewed-by: emilio
MozReview-Commit-ID: LXzKlZ6wPYW
2018-05-20 18:57:35 +02:00
bors-servo
77dcc678fe
Auto merge of #20506 - jonleighton:font-fallback, r=emilio,mbrubeck
Font fallback

This implements more complete support for font fallback, see #17267.

r? @glennw @mbrubeck

<!-- 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/20506)
<!-- Reviewable:end -->
2018-05-19 09:53:29 -04:00
Emilio Cobos Álvarez
2a5007926d
Fix Servo build. 2018-05-19 10:15:17 +02:00
Emilio Cobos Álvarez
dccb8263cc
style: Don't crash when finding an unexpected default font type.
For now just return sans-serif, though as the FIXME comment indicates we should
probably just carry around the font-name instead.

Bug: 1442195
Reviewed-by: xidorn
MozReview-Commit-ID: CIPbV3R5Ul
2018-05-19 10:15:17 +02:00
Emilio Cobos Álvarez
1314f47da5
style: Distinguish between specified and computed URLs.
This is needed to serialize computed URLs correctly from getComputedStyle.

Bug: 1461288
Reviewed-by: xidorn
MozReview-Commit-ID: 9wakhqNrszb
2018-05-19 10:15:17 +02:00
Emilio Cobos Álvarez
a6328ba3ce
style: Ensure all lonhands have a working clone(), and to_css.
This removes some dubious font-family code too.

It ensures that vector longhands have a proper clone implementation
auto-generating it using `collect()`.

Bug: 1461296
Reviewed-by: xidorn
MozReview-Commit-ID: FkdnbTkeF6E
2018-05-19 10:15:17 +02:00
Kristen Wright
2688588538
style: Convert NS_STYLE_IMAGELAYER_ATTACHMENT_* to enum class.
Converted NS_STYLE_IMAGELAYER_ATTATCHMENT_* vals to enum class, StyleImageLayerAttachment.

Bug: 1459367
Reviewed-by: Manishearth
2018-05-19 10:15:17 +02:00
Xidorn Quan
db0134e697
style: Rename pointing to inherited_ui.
And also merge values::*::pointing into values::*::ui.

Bug: 1460192
Reviewed-by: heycam
MozReview-Commit-ID: FM4gWEszahB
2018-05-19 10:15:17 +02:00
Xidorn Quan
4ab0e85ed5
style: Consistently use top-right-bottom-left order for physical sides.
Bug: 1454591
Reviewed-by: heycam
MozReview-Commit-ID: 6pLRSO8YNDI
2018-05-19 10:15:17 +02:00
Jon Leighton
691c6c6f1a Implement font fallback
Prior to this change, if none of the fonts specified in CSS contained a
glyph for a codepoint, we tried only one fallback font. If that font
didn't contain the glyph, we'd give up.

With this change, we try multiple fonts in turn. The font names we try
differ across each platform, and based on the codepoint we're trying to
match. The current implementation is heavily inspired by the analogous
code in Gecko, but I've used to ucd lib to make it more readable,
whereas Gecko matches raw unicode ranges.

This fixes some of the issues reported in #17267, although colour emoji
support is not implemented.

== Notes on changes to WPT metadata ==

=== css/css-text/i18n/css3-text-line-break-opclns-* ===

A bunch of these have started failing on macos when they previously
passed.

These tests check that the browser automatically inserts line breaks
near certain characters that are classified as "opening and closing
punctuation". The idea is that if we have e.g. an opening parenthesis,
it does not make sense for it to appear at the end of a line box; it
should "stick" to the next character and go into the next line box.

Before this change, a lot of these codepoints rendered as a missing
glyph on Mac and Linux. In some cases, that meant that the test was
passing.

After this change, a bunch of these codepoints are now rendering glyphs
on Mac (but not Linux). In some cases, the test should continue to pass
where it previously did when rendering with the missing glyph.

However, it seems this has also exposed a layout bug. The "ref" div in
these tests contains a <br> element, and it seems that this, combined
with these punctuation characters, makes the spacing between glyphs ever
so slightly different to the "test" div. (Speculation: might be
something to do with shaping?)

Therefore I've had to mark a bunch of these tests failing on mac.

=== css/css-text/i18n/css3-text-line-break-baspglwj-* ===

Some of these previously passed on Mac due to a missing glyph. Now that
we're rendering the correct glyph, they are failing.

=== css/css-text/word-break/word-break-normal-bo-000.html ===

The characters now render correctly on Mac, and the test is passing. But
we do not find a suitable fallback font on Linux, so it is still failing
on that platform.

=== css/css-text/word-break/word-break-break-all-007.html ===

This was previously passing on Mac, but only because missing character
glyphs were rendered. Now that a fallback font is able to be found, it
(correctly) fails.

=== mozilla/tests/css/font_fallback_* ===

These are new tests added in this commit. 01 and 02 are marked failing
on Linux because the builders don't have the appropriate fonts installed
(that will be a follow-up).

Fix build errors from rebase

FontTemplateDescriptor can no longer just derive(Hash). We need to
implement it on each component part, because the components now
generally wrap floats, which do not impl Hash because of NaN. However in
this case we know that we won't have a NaN, so it is safe to manually
impl Hash.
2018-05-19 14:33:36 +10: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
Jonathan Watt
12913d048f
style: Remove the 'property_name' macro.
Bug: 1458219
Reviewed-by: xidorn
2018-05-05 16:22:52 +02:00
Emilio Cobos Álvarez
0ef70d52f2
style: Fix perspective interpolation.
It's not sound to insert random matrices in random positions in the transform
operation list.

I cannot make any sense of what the old code was trying to do.

Bug: 1458715
Reviewed-by: hiro
MozReview-Commit-ID: 5BtCiueEPlR
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
a375baf84b
style: Derive ToCss for Counters.
Bug: 1457332
Reviewed-by: xidorn
MozReview-Commit-ID: 1jOglcqt1Dd
2018-05-05 16:20:10 +02:00
Emilio Cobos Álvarez
292f899631
style: Fix tidy issues and Servo build. 2018-04-29 05:09:43 +02:00
Xidorn Quan
07de715bb5
style: Manually implement collect_completion_keywords for some types.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 6T35uylxgho
2018-04-29 03:28:50 +02:00
Xidorn Quan
185e4ce61d
style: Allow shorthands to specify their own impl of SpecifiedValueInfo and manual impl it for font and border.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 3B9OfkWU0Eq
2018-04-29 03:28:43 +02:00
Xidorn Quan
26c3aeda97
style: Add collect_values function to SpecifiedValueInfo trait for collecting possible values.
This is the basic structure of the stuff. Following patches will fill
the gap between Gecko and Servo on value generating, and finally hook
it into InspectorUtils.

Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: KNLAfFBiY6e
2018-04-29 03:28:40 +02:00
Xidorn Quan
3b9c40dd14
style: Skip system font variant for ToCss in font subproperties.
System font keywords are not a valid value for those properties.

The newly-added #[css(skip)] would be reused by deriving algorithm of
SpecifiedValueInfo to skip them as well.

Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: EmnhkaA9RR5
2018-04-29 03:28:39 +02:00
Emilio Cobos Álvarez
6e3fa68f46
style: Fix serialization order of the outline shorthand.
This is going to be tested in
https://github.com/w3c/web-platform-tests/pull/10700.

Bug: 1457652
Reviewed-by: xidorn
MozReview-Commit-ID: 7Oi1it70YFw
2018-04-29 03:28:38 +02:00