Commit graph

591 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
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
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
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
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
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
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
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
Jonathan Watt
12913d048f
style: Remove the 'property_name' macro.
Bug: 1458219
Reviewed-by: xidorn
2018-05-05 16:22:52 +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
7fe7b2ffb1
style: Add a ValueInfo trait for exposing types needed by devtools.
Most of types just derive it using proc_macro directly. Some of value
types need manual impl.

In my current plan, this new trait will be used in bug 1434130 to expose
values as well.

Bug: 1455576
Reviewed-by: emilio
MozReview-Commit-ID: LI7fy45VkRw
2018-04-29 03:28:34 +02:00
Bobby Holley
48558e313a
style: Update StyleSource to use ArcUnion.
Bug: 1455784
Reviewed-by: Manishearth
MozReview-Commit-ID: AT4sud9goGV
2018-04-29 03:28:32 +02:00
Emilio Cobos Álvarez
54b444992d
Fix servo build. 2018-04-28 10:26:47 +02:00
Emilio Cobos Álvarez
48de556f8c
style: Fixups for css-fonts-4 font-weight. 2018-04-28 10:26:03 +02:00
Xidorn Quan
0f19c25706
style: Add CAN_ANIMATE_ON_COMPOSITOR in Servo side and propagate it to ServoCSSPropList.h.
Bug: 1454830
Reviewed-by: emilio
MozReview-Commit-ID: 2OBCliDY02g
2018-04-28 10:26:02 +02:00
Xidorn Quan
bc81f09833
style: Add GETCS_NEEDS_LAYOUT_FLUSH flag in Servo side and propagate it to ServoCSSPropList.h.
Bug: 1454830
Reviewed-by: emilio
MozReview-Commit-ID: 5k08FWjobCg
2018-04-28 10:26:02 +02:00
Xidorn Quan
1599357cff Make nscssproperty a method of longhand/shorthand/alias class. 2018-04-11 15:55:11 +10:00
Xidorn Quan
2aee174b6d Put alias instances into {longhand,shorthand}.alias. 2018-04-11 15:55:09 +10:00
Xidorn Quan
22cf429c35 Use Servo code to check whether a property is inherited. 2018-04-09 19:10:44 +10:00
Emilio Cobos Álvarez
bd70c405b4
style: Rename StyleContext to ComputedStyle.
Bug: 1447483
Reviewed-by: jwatt
MozReview-Commit-ID: KATZ6DkmpVY
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2018-03-22 18:04:29 +01:00
Jonathan Watt
b8185b4744 Add Servo_Property_IsShorthand to geckolib/glue.rs 2018-03-19 14:55:39 +00:00
Anthony Ramine
ca45695db1 Introduce #[css(skip)] 2018-03-05 15:53:15 +01:00
Anthony Ramine
75b05c518d Derive ToCss for DeclaredValueOwned rather than DeclaredValue 2018-03-05 12:02:32 +01:00
Anthony Ramine
886554dba5 Derive ToCss for DeclaredValue 2018-03-04 15:21:11 +01:00
Anthony Ramine
1937f594ac Implement ToCss for UnparsedValue 2018-03-04 15:16:09 +01:00
Anthony Ramine
13c40f4fb8 Derive ToCss for TransitionProperty 2018-03-03 16:15:20 +01:00
Emilio Cobos Álvarez
8c4b401dd3
style: Only expose longhands to rust via iterators.
The key here is that we only filter longhands if the shorthand is accessible to
content and vice-versa. This prevents the bug that prevented me to land this
patch before, which was us not expanding properly chrome-only shorthands.

Again, this is incomplete, and I need to teach LonghandsToSerialize to get a
potentially incomplete list of properties, and all that.
2018-02-28 00:19:31 +01:00
Emilio Cobos Álvarez
650e947c94
style: Make Servo deal with CSS property prefs more correctly.
Right now you could still set preffed-off properties from CSSStyleDeclaration.
2018-02-27 19:29:07 +01:00
Emilio Cobos Álvarez
d016278159
style: Remove unused function. 2018-02-27 13:07:37 +01:00
Emilio Cobos Álvarez
17257f94b9
style: Split out NonCustomPropertyId::enabled_for_all_content from allowed_in. 2018-02-27 13:07:36 +01:00
Anthony Ramine
761689f32d Replace PositiveIntegerOrAuto by ColumnCount
It was its only use.
2018-02-22 10:16:46 +01:00
Emilio Cobos Álvarez
1359c7c218
style: Don't try to serialize the same shorthand over and over.
I looked at what were we doing in that loop, and we're doing tons of dumb stuff.

In particular, we try to serialize the "all" shorthand all the time. This patch
prevents us from trying to serialize shorthands that we've already tried to
serialize.
2018-02-20 14:21:35 +01:00
Emilio Cobos Álvarez
c09257b540
style: There's no need to check the serialized custom properties.
Given they're not duplicated, and can't be part of a shorthand.
2018-02-20 14:21:34 +01:00
Emilio Cobos Álvarez
e46f910b66
style: Rejigger serialization of a declaration block to not look at the shorthands length.
This is because I'm going to make shorthands() and longhands() return an
iterator, so that we account for prefs properly
(https://bugzilla.mozilla.org/show_bug.cgi?id=1438234).
2018-02-20 10:05:58 +01:00
Emilio Cobos Álvarez
7473796aba
style: Unship the legacy syntax for -moz-transform.
Intent to unship link:

  https://groups.google.com/d/msg/mozilla.dev.platform/T3PGm97MPNU/59XUavMlCgAJ

Reviewed-by: xidorn
Bug: 1438297
MozReview-Commit-ID: 6ybGBasPAWU
2018-02-19 10:46:14 +01:00
Emilio Cobos Álvarez
1548520710
style: Move most of allowed_in to NonCustomPropertyId.
Also simplify the servo property id to gecko property id conversion to be faster
and less repetitive.
2018-02-14 19:10:28 +01:00
Anthony Ramine
57daf06c71 Make PropertyDeclaration::id and AnimationValue::id inline 2018-02-10 16:31:46 +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
Anthony Ramine
335cb4c9f4 Whitelist Copy types when generating PropertyDeclaration 2018-02-07 22:49:15 +01:00
Anthony Ramine
8b9b3617a2 Merge all keyword arms in Clone for PropertyDeclaration 🐉🐲
We further partition the variants to retrieve all properties that are
defined as simple keywords, and we clone them by copying the value
as a smaller enum made of only the keyword variants.
2018-02-07 20:50:00 +01:00
Emilio Cobos Álvarez
32c409d5aa
style: Get rid of gecko_size_type.
This also fixes a style sharing issue with MaxLength, anecdotally.
2018-02-07 02:05:30 +01:00
Anthony Ramine
1f0a1267bb Implement MallocSizeOf for PropertyDeclaration by hand
We merge arms with identical field types.
2018-02-06 14:11:20 +01:00
Anthony Ramine
456c18f767 Implement PartialEq for PropertyDeclaration by hand 🐉🐲
We first check that the discriminants are equal, then we pattern match only
on `*self` and use `PropertyDeclarationVariantRepr` to look into `other` directly.
2018-02-06 14:11:19 +01:00
Anthony Ramine
8ebf0f057f Merge common arms in PropertyDeclaration::to_css 2018-02-06 14:11:18 +01:00