Commit graph

6718 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
164bfbcb40
Make servo-tidy happy. 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
Emilio Cobos Álvarez
ce62cb1ba7
style: Support x as a resolution unit.
Bug: 1460655
Reviewed-by: xidorn
MozReview-Commit-ID: TjU0FLCLMN
2018-05-19 10:15:17 +02:00
Emilio Cobos Álvarez
2f18b67ce1
style: Make resolutions more like the rest of the CSS values.
Bug: 1460655
Reviewed-by: xidorn
MozReview-Commit-ID: 3Gt8VX1KhjC
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
Emilio Cobos Álvarez
06dbb6700d
style: Unprefix :-moz-selection.
Our implementation is totally not what the spec says, but totally what other
UAs do, see https://github.com/w3c/csswg-drafts/issues/2474.

So given this is causing webcompat pain, I think we should be pragmatic and just
unprefix this.

We could keep serialization and getComputedStyle with ::selection working with a
bit more effort, like we do for :-moz-placeholder, but I'd prefer not doing at
least the serialization bit, and just alias in nsCSSPseudoElements
:-moz-selection to selection too.

Bug: 509958
Reviewed-by: dbaron,xidorn
MozReview-Commit-ID: 6lxctozRDqv
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
Simon Sapin
ffcf92d843 Remove nsstring bindings 2018-05-18 12:19:04 -05:00
Emilio Cobos Álvarez
932c00f95f Remove gecko generated files. 2018-05-17 11:24:59 -05: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
Emilio Cobos Álvarez
cb48a837bf
style: Implement Debug for KeyframeAnimationStyle by hand.
The ComputedValues format is huge and unneeded.
2018-05-05 17:42:58 +02:00
Emilio Cobos Álvarez
33b593d32e
style: Fix servo build. 2018-05-05 17:19:06 +02:00
Emilio Cobos Álvarez
39169ad92e
style: Fix tidy issues. 2018-05-05 16:24:36 +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
6ecc7445fc
style: Make the font canvas code not mess with the rule tree.
Inserting a lot of rules in the root level is super-inefficient. This fixes it
by not doing it.

It gives the root rule node to the style, but that's fine, since it's useless.
All this code-path is already pretty messy.

Bug: 1457678
Reviewed-by: xidorn,hiro
MozReview-Commit-ID: GoGHI4YJbKr
2018-05-05 16:22:47 +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
9d721072f5
style: Remove ServoStyleSheet usage.
Bug: 1457920
Reviewed-by: xidorn
MozReview-Commit-ID: LIBkovuQ6MB
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
9ed48952f5
style: Merge ServoStyleSheet and StyleSheet.
These are the most minimal changes I could make. More cleanups incoming.

Bug: 1457920
Reviewed-by: xidorn
MozReview-Commit-ID: AdMOA1acQIH
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
4f161d9339
style: Handle Shadow DOM in keyframes lookup.
Bug: 1018269
Reviewed-by: heycam
MozReview-Commit-ID: AeUmsOHOUYR
2018-05-05 16:22:47 +02:00
Emilio Cobos Álvarez
c508d8576d
style: Move represents_keyword to the css attributes.
Bug: 1457635
Reviewed-by: xidorn
MozReview-Commit-ID: 21yuU4h34AQ
2018-05-05 16:20:22 +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
Xidorn Quan
8c322b9c1e
style: Make KTableEntry an independent type.
Bug: 1448759
Reviewed-by: heycam
MozReview-Commit-ID: oZfJAigThN
2018-05-05 16:19:46 +02:00
Simon Sapin
3bcf64be7b Silence an 'unused' warning 2018-05-04 11:38:44 +02:00
Emilio Cobos Álvarez
292f899631
style: Fix tidy issues and Servo build. 2018-04-29 05:09:43 +02:00
Emilio Cobos Álvarez
64cceb328a
style: cherry-pick some changes from m-c that had got lost. 2018-04-29 03:28:51 +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
0f7f9eebc0
style: Add some attributes for SpecifiedValueInfo to help deriving more from types.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: IyohSTbUO31
2018-04-29 03:28:48 +02:00
Xidorn Quan
0021c70c08
style: Handle keywords for color values.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 5GvIHSeQuCX
2018-04-29 03:28:47 +02:00
Xidorn Quan
20398491cc
style: Use unified list for TextDecorationLine and implement its SpecifiedValueInfo.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 2sCnK1AecFk
2018-04-29 03:28:46 +02:00
Xidorn Quan
5437c96402
style: Have TextAlign derive ToCss and unship char value from it.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: CXDnyqzjQkq
2018-04-29 03:28:44 +02:00
Xidorn Quan
43bb6364f6
style: Have Parse derive respect #[css(skip)] on variant as well and derive Parse for KeywordSize.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: evSvk1RQGe
2018-04-29 03:28:44 +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
e50847666c
style: Derive ToCss for values::generics::font::KeywordSize.
Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 9ek3PcqYiU3
2018-04-29 03:28:42 +02:00
Xidorn Quan
54d8863e60
style: Use unified lists to impl several bitflag font-variant properties.
This also changes their ToCss impl to use SequenceWriter instead of
checking has_value manually.

SpecifiedValueInfo for those types are also implemented in this patch.

Bug: 1434130
Reviewed-by: emilio
MozReview-Commit-ID: 23h2VWS417H
2018-04-29 03:28:42 +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
Gerald Squelart
361046d4fa
style: Remove "layout.css.text-combine-upright.enabled" pref.
Shipped since Firefox 48, other browsers have similar impls, and the related
spec has been in CR since a while ago.
The syntax of this property as implemented should be considered to be pretty
stable, so we can remove this pref.

Bug: 1417761
Reviewed-by: xidorn
MozReview-Commit-ID: H7lDsdbUamD
2018-04-29 03:28:38 +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
Emilio Cobos Álvarez
276fb7e04b
style: Unify MediaList and ServoMediaList.
Bug: 1456471
Reviewed-by: xidorn
MozReview-Commit-ID: KFWxoohpGlb
2018-04-29 03:28:33 +02:00
Brad Werth
b91ae6b1f9
style: support shape-margin.
Bug: 1265342
Reviewed-by: xidorn
MozReview-Commit-ID: 99pLZsFA9mj
2018-04-29 03:28:32 +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
Xidorn Quan
89fba41e1d
style: Support calc in cursor.
Bug: 1453258
Reviewed-by: emilio
MozReview-Commit-ID: 1ZzxkYboWZg
2018-04-29 03:17:19 +02:00
Emilio Cobos Álvarez
54b444992d
Fix servo build. 2018-04-28 10:26:47 +02:00
Emilio Cobos Álvarez
16ca8de6df
style: Compare degrees for font-style to account for compute_angle introducing error. 2018-04-28 10:26:40 +02:00
Emilio Cobos Álvarez
1f5d90568d
style: Make tidy happy. 2018-04-28 10:26:08 +02:00