Граф коммитов

13546 Коммитов

Автор SHA1 Сообщение Дата
Nicolas Silva 66fc42bbc6 Bug 1656236 - Update to euclid 0.22. r=kvark
Differential Revision: https://phabricator.services.mozilla.com/D85549
2020-08-05 08:35:29 +00:00
Emilio Cobos Álvarez 62f6fc74f8 Bug 1656954 - Use Overflow::is_scrollable in StyleAdjuster. r=mats
It was introduced in the overflow: clip work but this standalone
equivalent remained.

Differential Revision: https://phabricator.services.mozilla.com/D85778
2020-08-03 21:19:56 +00:00
Mats Palmgren 910e11aa99 Bug 1531609 part 2 - Implement overflow:clip/visible combinations. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73717
2020-08-01 01:57:41 +00:00
Jeremy Ir 20235b390f Bug 1531609 part 1 - Rename overflow:-moz-hidden-unscrollable to overflow:clip. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73716
2020-08-01 01:56:58 +00:00
Butkovits Atila cc95b93cba Backed out 3 changesets (bug 1635473, bug 1531609) for reftest failures. CLOSED TREE
Backed out changeset 1e7b32808be8 (bug 1531609)
Backed out changeset e64a61869cdb (bug 1531609)
Backed out changeset 6da37d7f6dd3 (bug 1635473)
2020-07-31 23:56:54 +03:00
Mats Palmgren c875610606 Bug 1531609 part 2 - Implement overflow:clip/visible combinations. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73717
2020-07-31 15:31:36 +00:00
Jeremy Ir 92b8f0f77a Bug 1531609 part 1 - Rename overflow:-moz-hidden-unscrollable to overflow:clip. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73716
2020-07-31 16:40:48 +00:00
Zeke Medley dc8e84e2d4 Bug 546052 - Add parsing for cross-fade from CSS Image Values and Replaced Content Module Level 4 r=emilio
This is the first of what will likely be a couple patches for
cross-fade's implementation. Bug 546052 tracks it's complete
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D81889
2020-07-31 16:11:38 +00:00
Dorel Luca 3714922d1b Backed out changeset 9e9c50bbb2f3 (bug 546052) for build bustage on Linux. CLOSED TREE 2020-07-29 02:12:55 +03:00
Zeke Medley 1f9a50dd97 Bug 546052 - Add parsing for cross-fade from CSS Image Values and Replaced Content Module Level 4 r=emilio
This is the first of what will likely be a couple patches for
cross-fade's implementation. Bug 546052 tracks it's complete
implementation.

Differential Revision: https://phabricator.services.mozilla.com/D81889
2020-07-28 22:18:31 +00:00
Brian Birtles cb11586e66 Bug 1654195 - Make text-combine-upright not animatable; r=boris
Differential Revision: https://phabricator.services.mozilla.com/D84935
2020-07-27 18:45:35 +00:00
Alexander Surkov 305d2fd10d Bug 921504 - implement -moz-inert CSS property r=emilio
-moz-inert CSS property reflects inert subtrees concept and can be used to implement HTML:dialog element and HTML:inert attribute

Differential Revision: https://phabricator.services.mozilla.com/D81701
2020-07-26 21:30:56 +00:00
Philipp Zech 3d4be168ae Bug 1648938 - Convert writing-modes #defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D84016
2020-07-23 21:31:23 +00:00
Narcis Beleuzu 37cb83a398 Backed out 2 changesets (bug 921504) for wpt failures on inert-retargeting-iframe.tentative.html . CLOSED TREE
Backed out changeset 8b75cd744e80 (bug 921504)
Backed out changeset a56b2d354613 (bug 921504)
2020-07-22 23:53:55 +03:00
Alexander Surkov 1c382cad65 Bug 921504 - implement HTML:inert r=emilio,heycam
Differential Revision: https://phabricator.services.mozilla.com/D81701
2020-07-22 04:26:08 +00:00
Brian Birtles 029c6ab57b Bug 1637532 - Allow animations and transitions on ::marker; r=boris
As per the following change to the spec:

6b3d7240b5

The additional failure annotation is added because we don't currently treat
text-combine-upright as non-animatable and this patch exposes the existing bug
(bug 1654195).

Differential Revision: https://phabricator.services.mozilla.com/D84308
2020-07-22 00:44:18 +00:00
Brian Birtles 9159650f0b Bug 1636562 - Respect property restrictions on pseudo elements when animating; r=boris
Differential Revision: https://phabricator.services.mozilla.com/D84306
2020-07-21 23:12:35 +00:00
Mats Palmgren 0a85300e43 Bug 1653052 - [css-grid] Make empty and all-whitespace strings in 'grid-template-areas' invalid. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D84398
2020-07-21 19:46:45 +00:00
Narcis Beleuzu 0ac1595a1a Backed out 2 changesets (bug 921504) for mochitest failures on test_animation-type-longhand.html . CLOSED TREE
Backed out changeset e87edffd46b9 (bug 921504)
Backed out changeset eb53880e5f0e (bug 921504)
2020-07-20 17:37:32 +03:00
Alexander Surkov cf6cccf0ef Bug 921504 - implement HTML:inert r=emilio,heycam
Differential Revision: https://phabricator.services.mozilla.com/D81701
2020-07-20 04:22:36 +00:00
Emilio Cobos Álvarez 12c7ce039a Bug 1652698 - Make stylesheet invalidation faster. r=heycam
This fixes performance issues when there's a massive number of rules and
a massive DOM.

Instead of going through all rules for all the DOM, we now look stuff in
hashmaps.

Differential Revision: https://phabricator.services.mozilla.com/D83506
2020-07-20 07:40:17 +00:00
Cameron McCormack 82b32f112e Bug 1643246 - Don't use attribute selectors for determining if a select is a drop down or a list box. r=emilio
Instead add a pseudo-class that does the expected size="" attribute parsing.

Removing the Gtk-specific rule setting the text color since it doesn't
seem to have any effect currently.

Differential Revision: https://phabricator.services.mozilla.com/D83448
2020-07-17 09:56:53 +00:00
Cameron McCormack ec3a51f08d Bug 1620467 - Part 12: Hide range and number-input appearance values from content. r=emilio
Forgot to follow up on these two remaining non-standard values that may have
been being used to reset a <meter> or <input type=number> back to its
original appearance, but which telemetry showed no usage of.

Differential Revision: https://phabricator.services.mozilla.com/D83598
2020-07-16 22:04:38 +00:00
Cameron McCormack dbda1613e6 Bug 1620467 - Part 11: Re-order Appearance values. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83437
2020-07-16 22:04:31 +00:00
Cameron McCormack 557d0316a9 Bug 1620467 - Part 8: Make `appearance: button` behave like auto on various elements. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83434
2020-07-16 22:04:24 +00:00
Cameron McCormack 4de7c62706 Bug 1620467 - Part 7: Avoid exposing `appearance: range-thumb` to content. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83433
2020-07-16 22:04:21 +00:00
Cameron McCormack 7794182b6d Bug 1620467 - Part 6: Mark appearance values that are only used internally as chrome-only. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83432
2020-07-16 22:04:17 +00:00
Cameron McCormack af3cb9efc8 Bug 1620467 - Part 5: Remove appearance values not used by the browser or Web content. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83431
2020-07-16 22:04:14 +00:00
Cameron McCormack dd61f595eb Bug 1620467 - Part 4: Change internal uses of -moz-appearance to appearance and -moz-default-appearance. r=emilio,webcompat-reviewers,geckoview-reviewers,preferences-reviewers,ntim,agi,miketaylr
Uses of `-moz-appearance: none` are changed to `appearance: none`.

Uses of other values that are simply reverting the appearance back to
its default are changed to `appearance: auto`.

Uses of values in UA sheets that are defining the inherent appearance of
widgets are changed to:

  appearance: auto;
  -moz-default-appearance: <value>;

since those values are either no longer supported on (-moz-)appearance,
or are still supported but only in some limited form.

There are some uses of `-moz-appearance: textfield` on <input
type=number> elements that are renamed to `appearance: textfield`.

Differential Revision: https://phabricator.services.mozilla.com/D83430
2020-07-16 22:04:14 +00:00
Cameron McCormack 1fe732d979 Bug 1620467 - Part 3: Defer to -moz-default-appearance when appearance is auto. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83429
2020-07-16 22:04:12 +00:00
Cameron McCormack 1739610d9a Bug 1620467 - Part 2: Add unprefixed appearance property and make -moz-appearance and -webkit-appearance be aliases. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83428
2020-07-16 22:04:11 +00:00
Cameron McCormack 4e13fec003 Bug 1620467 - Part 1: Remove appearance use counters. r=emilio
They have served their purpose.

Differential Revision: https://phabricator.services.mozilla.com/D83427
2020-07-16 22:03:54 +00:00
Emilio Cobos Álvarez a4fa8230aa Bug 1653339 - Teach style_derive's map_type_params about mapping self correctly. r=boris
Consider the following:

struct Complex<T> {
    something: T,
    #[compute(field_bound)]
    something_else: Generic<Self, T>,
}

That will generate:

impl<T> ToComputedValue for Complex<T>
where
    T: ToComputedValue,
    Generic<Self, T>: ToComputedValue<ComputedValue = Generic<Self, <T as ToComputedValue>::ComputedValue>>,
{
    // ...
}

That last clause is obviously incorrect. map_type_params correctly maps
the T, but it should know also about Self.

Ideally we could just do the same as for T and do:

    <Self as ToComputedValue>::ComputedValue

But that doesn't quite work, because we are in that implementation of
the trait, and the compiler rightfully complains about we don't yet
knowing the computed type. So we need to pass it explicitly, which is
simple enough, if a bit annoying.

Differential Revision: https://phabricator.services.mozilla.com/D83816
2020-07-16 18:51:21 +00:00
Simon Giesecke 4e8c935384 Bug 1652023 - Remove unnecessary includes from PresShell.h. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D83114
2020-07-15 13:53:02 +00:00
Simon Giesecke f4dc6dfdea Bug 1652010 - Reduce instantiations and cost of StyleOwnedSlice::AsSpan. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D83104
2020-07-15 12:48:16 +00:00
Emilio Cobos Álvarez d275fd6251 Bug 1631449 - Apply a grayscale filter to pages when monochrome. r=jwatt
This hooks the "monochrome" media query and co to the
nsIPrintSettings.printInColor setting.

This print setting we're using is not exposed in the print preview UI,
but you can test it setting the print.print_in_color preference to
"false", and then print preview will correctly show up greyscale'd.

Once this lands, the UI folks just have to use it as they see fit :)

I would've liked to add a proper rendering test, but the print reftests
check only whether the PDF text matches.

I could add a test to printpreview_helper.xhtml, but I'm refactoring
that file in bug 1648064 so I'd rather wait a bit and add it in a
separate bug. The test for the media feature should make sure that we
test that code path at least.

Differential Revision: https://phabricator.services.mozilla.com/D83552
2020-07-15 03:45:33 +00:00
Emilio Cobos Álvarez 8a684e8429 Bug 1650189 - Fix an off-by-one in the transition property iterator. r=mrobinson
By the time we get to iterate over the longhands of a shorthand, we've
already advanced the range iterator, so we look at the next duration and
such, which causes this bug.

I'm seriously baffled that no existing test caught this when it
landed, neither in our internal test suite nor wpt...  :/

Differential Revision: https://phabricator.services.mozilla.com/D82396
2020-07-06 16:26:20 +00:00
Cameron McCormack e309ecf825 Bug 1650259 - Remove unused function on Appearance. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D82124
2020-07-03 04:11:18 +00:00
Cameron McCormack c40850b854 Bug 1650256 - Remove unused StyleAppearance values. r=emilio
The parsing of these values was disabled in bug 1554150.

Differential Revision: https://phabricator.services.mozilla.com/D82122
2020-07-03 04:06:13 +00:00
Emilio Cobos Álvarez 3f74138cd4 Bug 1631929 - Have the destructor of CalcNode be never inline. r=dmajor
You tell me which other things need it... Copy-constructor? operator==?
and such?

Differential Revision: https://phabricator.services.mozilla.com/D73385
2020-06-30 22:31:22 +00:00
Zeke Medley 83e9191999 Bug 1506364 - Implement the prefers-contrast media-query. r=morgan,emilio
Differential Revision: https://phabricator.services.mozilla.com/D79553
2020-06-29 17:46:12 +00:00
Emilio Cobos Álvarez b9b9e38dd9 Bug 1646224 - Use mozilla::Length rather than nscoord to store font sizes. r=heycam,jfkthame
This avoids arbitrary precision loss when computing REM units and so on,
which is particularly important if we ever change the base of our app
units (but useful regardless).

Differential Revision: https://phabricator.services.mozilla.com/D79928
2020-06-22 09:45:40 +00:00
Emilio Cobos Álvarez 40b0214e2c Bug 1646811 - Fix gecko build.
Depends on D80248

Differential Revision: https://phabricator.services.mozilla.com/D80249
2020-06-18 18:14:29 +00:00
Emilio Cobos Álvarez 3222b8debd Bug 1646811 - Remove some unused extern crate declarations now that style is in rust 2018.
This avoids some warnings.

Depends on D80247

Differential Revision: https://phabricator.services.mozilla.com/D80248
2020-06-18 18:14:24 +00:00
Emilio Cobos Álvarez 886d53972c Bug 1646811 - servo: Remove the dependency on font-kit from style.
No good reason to have this IMO, and helps remove some #[cfg] blocks.

Depends on D80246

Differential Revision: https://phabricator.services.mozilla.com/D80247
2020-06-18 18:14:21 +00:00
Emilio Cobos Álvarez 9077e6a4a9 Bug 1646811 - Fix servo build.
Depends on D80245

Differential Revision: https://phabricator.services.mozilla.com/D80246
2020-06-18 18:14:13 +00:00
Emilio Cobos Álvarez 3eaf5b6acb Bug 1646811 - Sync some comment changes from servo.
Depends on D80244

Differential Revision: https://phabricator.services.mozilla.com/D80245
2020-06-18 18:14:10 +00:00
Martin Robinson ce1653098e Bug 1646811 - servo: Combine AnimationAndTransitionDeclarations and AnimationRules.
These two structs are very similar, so we can combine them.

Depends on D80243

Differential Revision: https://phabricator.services.mozilla.com/D80244
2020-06-18 18:14:07 +00:00
Martin Robinson 0346b7de29 Bug 1646811 - servo: 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

Depends on D80242

Differential Revision: https://phabricator.services.mozilla.com/D80243
2020-06-18 18:14:05 +00:00
Martin Robinson d406afe4e6 Bug 1646811 - servo: 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.

Depends on D80241

Differential Revision: https://phabricator.services.mozilla.com/D80242
2020-06-18 18:14:02 +00:00
Matthias Deiml 1a949f1378 Bug 1646811 - servo: Implement visibility for layout_2020.
Depends on D80240

Differential Revision: https://phabricator.services.mozilla.com/D80241
2020-06-18 18:13:59 +00:00
Utsav Oza 6817ed6eaa Bug 1646811 - servo: Derive Serialize and Deserialize traits for font styles.
Depends on D80239

Differential Revision: https://phabricator.services.mozilla.com/D80240
2020-06-18 18:13:56 +00:00
Utsav Oza d2b54e0692 Bug 1646811 - servo: Enable textAlign, textBaseline and direction attributes for canvas.
Depends on D80238

Differential Revision: https://phabricator.services.mozilla.com/D80239
2020-06-18 18:12:56 +00:00
Utsav Oza 464c001324 Bug 1646811 - servo: Implement CanvasRenderingContext2D.font property.
Depends on D80237

Differential Revision: https://phabricator.services.mozilla.com/D80238
2020-06-18 18:12:46 +00:00
Martin Robinson 27f264de00 Bug 1646811 - servo: 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.

Depends on D80236

Differential Revision: https://phabricator.services.mozilla.com/D80237
2020-06-18 18:12:34 +00:00
Simon Sapin 0dc1b939cb Bug 1646811 - servo: Enable parsing of `flex-*` properties for layout-2020.
Depends on D80235

Differential Revision: https://phabricator.services.mozilla.com/D80236
2020-06-18 18:12:23 +00:00
Martin Robinson 7b23d8c773 Bug 1646811 - servo: 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.

Depends on D80234

Differential Revision: https://phabricator.services.mozilla.com/D80235
2020-06-18 18:12:14 +00:00
Martin Robinson 697bb739d1 Bug 1646811 - servo: 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.

Depends on D80233

Differential Revision: https://phabricator.services.mozilla.com/D80234
2020-06-18 18:12:07 +00:00
Martin Robinson 0afc032d4b Bug 1646811 - servo: 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.

Depends on D80232

Differential Revision: https://phabricator.services.mozilla.com/D80233
2020-06-18 18:11:57 +00:00
Simon Sapin f1f1e8df2b Bug 1646811 - Enable `order` in layout-2020.
Depends on D80231

Differential Revision: https://phabricator.services.mozilla.com/D80232
2020-06-18 18:11:47 +00:00
Simon Sapin ce5f91aa47 Bug 1646811 - servo: Gate layout 2020 flex implementation behind a pref.
Differential Revision: https://phabricator.services.mozilla.com/D80231
2020-06-18 18:11:39 +00:00
Simon Sapin 7c14e4e23e Bug 1633410 - Back out bug 1631721.
Rebased and squashed.

Differential Revision: https://phabricator.services.mozilla.com/D78174
2020-06-18 15:25:33 +00:00
Cosmin Sabou 65d75a47f3 Backed out changeset 299e19193e11 (bug 1646224) for causing font related failures. CLOSED TREE 2020-06-18 18:26:51 +03:00
Emilio Cobos Álvarez 090e3d2409 Bug 1646224 - Use mozilla::Length rather than nscoord to store font sizes. r=heycam,jfkthame
This avoids arbitrary precision loss when computing REM units and so on,
which is particularly important if we ever change the base of our app
units (but useful regardless).

Differential Revision: https://phabricator.services.mozilla.com/D79928
2020-06-18 13:55:03 +00:00
Emilio Cobos Álvarez 28c68306b3 Bug 1646546 - Port the style crate to rust 2018. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D80101
2020-06-17 23:40:30 +00:00
Emilio Cobos Álvarez 7b1b460d78 Bug 1646546 - Fix some manual occurrences of try(). r=boris
Depends on D80099

Differential Revision: https://phabricator.services.mozilla.com/D80100
2020-06-17 22:27:45 +00:00
Emilio Cobos Álvarez b774002cf9 Bug 1646546 - Switch all callsites of try() to try_parse() in the style crate. r=boris
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-17 22:27:37 +00:00
Philipp Zech 169b68c745 Bug 1636205 - Remove StyleFontSize enum from nsStyleConsts.h. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77511
2020-06-17 11:08:44 +00:00
Emilio Cobos Álvarez ffec6f608b Bug 1643656 - Remove prefers-color-scheme: no-preference. r=gl,remote-protocol-reviewers,hiro,whimboo
It was removed from the spec.

Differential Revision: https://phabricator.services.mozilla.com/D78834
2020-06-14 23:26:04 +00:00
Emilio Cobos Álvarez 58bb0b25d9 Backed out 2 changesets (bug 477157) for border rendering regressions.
Backed out changeset 04543b8ded50 (bug 477157)
Backed out changeset 5df17ecbcaa1 (bug 477157)

MANUAL PUSH: backout
2020-06-14 11:45:06 +02:00
Emilio Cobos Álvarez 4cb5da08a2 Bug 1640623 - Use an enum class for LookAndFeel::FontID. r=jmathies
Differential Revision: https://phabricator.services.mozilla.com/D76696
2020-06-11 11:27:58 +00:00
neil 6b1f254a89 Bug 1641324 Remove the layout.css.scrollbar-width.enabled and layout.css.scrollbar-color.enabled prefs r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D78400
2020-06-10 13:16:34 +00:00
Emilio Cobos Álvarez e8caef7a14 Bug 477157 - Ceil border and outline widths to 1 dev px at computed value time, but don't floor others to dev pixels until paint time. r=mats,dbaron
This seems to match what other browsers do, and seems saner layout-wise,
at least.

I only annotated outline-width-interpolation.html because it's already
fixed upstream in:

  8a489657bc

Differential Revision: https://phabricator.services.mozilla.com/D75360
2020-06-10 10:44:32 +00:00
Razvan Maries f761608e79 Backed out changeset bca9f7459a16 (bug 1643656) for reftests perma failures. CLOSED TREE 2020-06-09 18:24:48 +03:00
Emilio Cobos Álvarez 6b86e22f72 Bug 1643656 - Remove prefers-color-scheme: no-preference. r=gl,remote-protocol-reviewers,hiro,whimboo
It was removed from the spec. Bug 1643934 updates the WPT tests.

Differential Revision: https://phabricator.services.mozilla.com/D78834
2020-06-09 13:21:54 +00:00
Colomban Wendling 120fea1c42 Bug 1628762 - Fix tree column header color to follow theme. r=geckoview-reviewers,snorp
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-03 20:52:55 +00:00
Cameron McCormack 5e27c1bd6b Bug 1642261 - Part 2: Add telemetry for -moz-appearance usage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77637
2020-06-05 00:39:50 +00:00
Emilio Cobos Álvarez 15e3db4260 Bug 1643230 - Clear last_parsed_property_id right after successfully parsing the value. r=jwatt
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-05 18:13:14 +00:00
Dorel Luca fc6456ef88 Backed out changeset bde27b38c9c5 (bug 1643201) for causing Valgrind failures and build bustages 2020-06-04 05:17:11 +03:00
Emilio Cobos Álvarez a58560613e Bug 1643201 - Rustfmt recent changes.
Depends on D78203

Differential Revision: https://phabricator.services.mozilla.com/D78204
2020-06-04 00:35:41 +00:00
Simon Sapin 0cf71dd3a3 Bug 1643201 - Move most of `SequenceWriter::write_item` to non-generic functions.
The size of LLVM IR for the `style` crate is reduced by ~1.5% (27k lines out of 1.8M)

CC https://github.com/servo/servo/issues/26713

Depends on D78202

Differential Revision: https://phabricator.services.mozilla.com/D78203
2020-06-04 00:35:30 +00:00
Emilio Cobos Álvarez 25666b5157 Bug 1643201 - Cherry-pick servo changes to use the matches macro from the standard library.
Depends on D78201

Differential Revision: https://phabricator.services.mozilla.com/D78202
2020-06-04 00:35:22 +00:00
Emilio Cobos Álvarez 1afb168e99 Bug 1643201 - Cherry-pick some Servo Cargo.toml cleanups.
Depends on D78200

Differential Revision: https://phabricator.services.mozilla.com/D78201
2020-06-04 00:35:19 +00:00
Emilio Cobos Álvarez fa85c059f7 Bug 1643201 - Cherry-pick some servo changes to derive_common.
Depends on D78199

Differential Revision: https://phabricator.services.mozilla.com/D78200
2020-06-04 00:35:11 +00:00
Emilio Cobos Álvarez 31ea245f41 Bug 1643201 - Miscellaneous build fixes.
Depends on D78198

Differential Revision: https://phabricator.services.mozilla.com/D78199
2020-06-04 00:35:08 +00:00
Anthony Ramine b6b478f721 Bug 1643201 - servo: Return the root from the traversal.
Depends on D78196

Differential Revision: https://phabricator.services.mozilla.com/D78198
2020-06-04 00:35:00 +00:00
Martin Robinson 72e28ea0e8 Bug 1643201 - servo: layout_2020: Add support for transitions and animations.
Depends on D78195

Differential Revision: https://phabricator.services.mozilla.com/D78196
2020-06-04 00:34:53 +00:00
Martin Robinson 81d4be443e Bug 1643201 - servo: Implement `animation-fill-mode`.
Fixes #26460.

Depends on D78194

Differential Revision: https://phabricator.services.mozilla.com/D78195
2020-06-04 00:34:45 +00:00
Simon Sapin 376d2f283e Bug 1643201 - servo: `display: contents` computes to `block` on the root element.
Depends on D78193

Differential Revision: https://phabricator.services.mozilla.com/D78194
2020-06-04 00:34:42 +00:00
Martin Robinson fb83423da6 Bug 1643201 - servo: Remove AnimatedProperty.
This removes an extra layer of abstraction and allows Servo to share
more code with Gecko. In addition, we will need to handle raw
`AnimationValue` structs soon in order to fully implement "faster
reversing of interrupted transitions."

Depends on D78192

Differential Revision: https://phabricator.services.mozilla.com/D78193
2020-06-04 00:34:34 +00:00
Martin Robinson 67b71f76f3 Bug 1643201 - servo: Move most animation processing to script.
This is preparation for sharing this code with layout_2020 and
implementing selective off-the-main-thread animations.

We still look for nodes not in the flow tree in the layout thread.

Depends on D78191

Differential Revision: https://phabricator.services.mozilla.com/D78192
2020-06-04 00:34:31 +00:00
Martin Robinson bd72db8c67 Bug 1643201 - servo: 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.

Depends on D78190

Differential Revision: https://phabricator.services.mozilla.com/D78191
2020-06-04 00:34:28 +00:00
Martin Robinson f095ec60bf Bug 1643201 - servo: Split animations and transitions into separate lists.
This change splits the list of animations and transitions, which are
almost always handled differently. It also renames
`ElementAnimationState` to `ElementAnimationSet` and establishes an
`AnimationState` for every transition and animation. This allows us to
stop continually reallocating lists every time a transition or animation
needs to be canceled.

Fixes #14419.

Depends on D78189

Differential Revision: https://phabricator.services.mozilla.com/D78190
2020-06-04 00:34:20 +00:00
Martin Robinson bf4fd750e3 Bug 1643201 - servo: Start having animations conform to the HTML spec.
This is a small step toward fixing #19242. The main idea is that the
clock for animations should advance as the event loop ticks. We
accomplish this by moving the clock from layout and naming it the
"animation timeline" which is the spec language. This should fix
flakiness with animations and transitions tests where a reflow could
move animations forward while script was running.

This change also starts to break out transition and animation events
into their own data structure, because it's quite likely that the next
step in fixing #19242 is to no longer send these events through a
channel.

Depends on D78188

Differential Revision: https://phabricator.services.mozilla.com/D78189
2020-06-04 00:34:18 +00:00
Martin Robinson f92e20c3cc Bug 1643201 - servo: Use a restyle for animation ticks.
This change corrects synchronization issues with animations, by
reworking the animation processing model to do a quick restyle and
incremental layout when ticking animations.

While this change adds overhead to animation ticks, the idea is that
this will be the fallback when synchronous behavior is required to
fulfill specification requirements. In the optimistic case, many
animations could be updated and applied off-the-main-thread and then
resynchronized when style information is queried by script.

Fixes #13865.

Depends on D78187

Differential Revision: https://phabricator.services.mozilla.com/D78188
2020-06-04 00:34:15 +00:00
Martin Robinson f879808ac6 Bug 1643201 - servo: Add support for animationend event.
This is triggered when an animation finishes. This is a high priority
because it allows us to start rooting nodes with animations in the
script thread.

This doesn't yet cause a lot of tests to pass because they rely on the
existence of `Document.getAnimations()` and the presence of
`animationstart` and animationiteration` events.

Depends on D78186

Differential Revision: https://phabricator.services.mozilla.com/D78187
2020-06-04 00:34:12 +00:00
Martin Robinson 05ab25fd1b Bug 1643201 - servo: Split animation cancellation from update_style_for_animation.
`update_style_for_animation` previously handled both canceling defunct
animations and also updating style to reflect current animation state.
This change splits those two concerns because we want to start handling
replaced or canceled animations and finished animations in two different
places.

This is a refactor, so ideally it shouldn't change any behavior.

Depends on D78185

Differential Revision: https://phabricator.services.mozilla.com/D78186
2020-06-04 00:34:09 +00:00
Martin Robinson 35c1ea7756 Bug 1643201 - servo: Restyle should reflect animations and transitions.
When doing a restyle, we should apply animations and transitions to the
new style so that it is reflected in `getComputedStyle()` and the new
style information properly cascades. This is the first part of properly
ticking animations and transitions.

This causes a couple new animations tests failures (along with many new
passes), but we currently don't have support for properly handling
animations after they have completed, so this isn't totally unexpected.

Depends on D78184

Differential Revision: https://phabricator.services.mozilla.com/D78185
2020-06-04 00:34:06 +00:00
Martin Robinson 504f6b82e4 Bug 1643201 - servo: Add ElementAnimationState and PossibleElementAnimationState.
This refactor is preparation for implementing a specification
compliant transitions and animations processing model.

These data structures hold all the animation information about a single
node. Since adding, updating, and modifying animations for a single node
are all interdependent, it makes sense to start encapsulating animation
data and functionality into a single data structure. This also opens up
the possibility for easier concurrency in the future by more easily
allowing per-node mutexes.

Differential Revision: https://phabricator.services.mozilla.com/D78184
2020-06-04 00:34:02 +00:00
Emilio Cobos Álvarez 96b2b6d63a Bug 1643078 - Don't use lazy_static for media feature parsing. r=boris
This used to be needed when destructors in statics were not allowed, but
we can get rid of it nowadays.

Differential Revision: https://phabricator.services.mozilla.com/D78109
2020-06-03 22:43:49 +00:00
Bogdan Tara ffdcf42e89 Backed out 2 changesets (bug 1642261) for browser_use_counters.js failures CLOSED TREE
Backed out changeset dd4c99038ede (bug 1642261)
Backed out changeset 308d2f7a4a13 (bug 1642261)
2020-06-03 11:43:20 +03:00
Cameron McCormack 061da14b2e Bug 1642261 - Part 2: Add telemetry for -moz-appearance usage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77637
2020-06-03 05:15:21 +00:00
Narcis Beleuzu 726ebdec39 Backed out 2 changesets (bug 1642261) for mochitest failures on test_property_database.html . CLOSED TREE
Backed out changeset 32b26c1984f6 (bug 1642261)
Backed out changeset 68456151c046 (bug 1642261)
2020-06-03 07:30:23 +03:00
Cameron McCormack 8cf9670c90 Bug 1642261 - Part 2: Add telemetry for -moz-appearance usage. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D77637
2020-06-02 13:15:04 +00:00
Boris Chiou 57938596a7 Bug 1640036 - Update aspec-ratio syntax for HTML IMG mapped ratio. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D76942
2020-05-27 21:43:00 +00:00
Emilio Cobos Álvarez 99ed9d65e3 Bug 1640843 - Finer grained invalidation for attribute changes. r=heycam
This should help out quite a bit with uBO, which has lots of very
general attribute selectors. We invalidate per attribute name rather
than using a SelectorMap, which prevents matching for attribute
selectors that can't have changed.

The idea is that this should be generally cheaper, though there are
cases where this would be a slight pesimization. For example, if there's
an attribute selector like:

  my-specific-element[my-attribute] { /* ... */ }

And you change `my-attribute` in an element that isn't a
`my-specific-element`, before that the SelectorMap would've prevented us
from selector-matching completely. Now we'd still run selector-matching
for that (though the matching would be pretty cheap).

However I think this should speed up things generally, let's see what
the perf tests think before landing this though.

Differential Revision: https://phabricator.services.mozilla.com/D76825
2020-05-27 09:17:47 +00:00
Emilio Cobos Álvarez 9dd644c92d Bug 1640667 - Manually tweak inlining in stateless pseudo selector matching. r=boris
This addresses a minor regression in bloom-matching.html. The common
case here is that there's no selector to the right of the
pseudo-element, so keep that path inline, while keeping all other checks
out of line.

Differential Revision: https://phabricator.services.mozilla.com/D76793
2020-05-27 00:00:52 +00:00
Emilio Cobos Álvarez 7e76f582e7 Bug 1640985 - Remove two useless mem::replace calls. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D76884
2020-05-26 21:58:25 +00:00
Emilio Cobos Álvarez 31c487f429 Bug 1449753 - Remove the @-moz-document url-prefix() hack preference, enable it everywhere. r=jwatt
It doesn't seem like realistically we're going to be able to get rid of
this any time soon.

Differential Revision: https://phabricator.services.mozilla.com/D76809
2020-05-26 09:39:33 +00:00
Emilio Cobos Álvarez b68f73c01a Bug 1635675 - Implement the ::file-chooser-button pseudo-element. r=jwatt
As per https://github.com/w3c/csswg-drafts/issues/5049.

Don't enable it unconditionally just yet, as the name may change.

I had to move some rules in forms.css because otherwise you get
specificity conflicts.

Differential Revision: https://phabricator.services.mozilla.com/D76214
2020-05-25 23:54:10 +00:00
Narcis Beleuzu 973d9eb6a0 Backed out changeset 82df6f70ec60 (bug 1635675) for lint failure on file-chooser-button-001.tentative.html . CLOSED TREE 2020-05-25 13:49:39 +03:00
Emilio Cobos Álvarez a39a3a3807 Bug 1635675 - Implement the ::file-chooser-button pseudo-element. r=jwatt
As per https://github.com/w3c/csswg-drafts/issues/5049.

Don't enable it unconditionally just yet, as the name may change.

I had to move some rules in forms.css because otherwise you get
specificity conflicts.

Differential Revision: https://phabricator.services.mozilla.com/D76214
2020-05-21 12:27:54 +00:00
Emilio Cobos Álvarez 0b56353433 Bug 1639756 - Enable :is() and :where() in UA sheets. r=jwatt
This will allow us to clean them up.

Differential Revision: https://phabricator.services.mozilla.com/D76262
2020-05-21 12:10:34 +00:00
sefeng 67c1284c8c Bug 1637307 - Push/Pop dialog to top layer when needed r=smaug,emilio
This patch completes the top layer requirement for showModal()
Spec: https://html.spec.whatwg.org/multipage/interactive-elements.html#dom-dialog-showmodal

Differential Revision: https://phabricator.services.mozilla.com/D74922
2020-05-23 01:45:33 +00:00
Mats Palmgren 7d8f8a5007 Bug 1639664 - Allow 'opacity' on ::first-letter/::first-line pseudos. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D76387
2020-05-21 21:13:10 +00:00
Emilio Cobos Álvarez f5e6a1beee Bug 1639905 - Derive parse for ShapeRadius. r=boris
Depends on D76331

Differential Revision: https://phabricator.services.mozilla.com/D76332
2020-05-21 18:43:12 +00:00
Emilio Cobos Álvarez 5b0a85dfc3 Bug 1639905 - Derive parse for TextOverflowSide. r=boris
Depends on D76330

Differential Revision: https://phabricator.services.mozilla.com/D76331
2020-05-21 18:44:19 +00:00
Emilio Cobos Álvarez 5786fe2012 Bug 1639905 - Clean up parsing of UnicodeRange. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D76330
2020-05-21 16:52:20 +00:00
Emilio Cobos Álvarez 18af4db46b Bug 1639689 - Support field_bound in #[derive(Parse)]. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D76268
2020-05-21 13:48:36 +00:00
Boris Chiou 5d461fdfee Bug 1635939 - Use style::One for Integer to avoid implementing Mul. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D76207
2020-05-20 21:13:37 +00:00
Boris Chiou 6b78a43a20 Bug 1635939 - Replace AspectRatio with computed::position::Ratio in media-queries. r=emilio
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-05-20 21:13:35 +00:00
Boris Chiou 599c6939d9 Bug 1635939 - Let aspect-ratio (css-sizing-4) support 'auto | <ratio>'. r=emilio
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-05-21 06:45:10 +00:00
Emilio Cobos Álvarez b50a39c2d3 Bug 1639533 - Fix a no-longer valid assumption in pseudo-element matching / invalidation code. r=heycam
After bug 1632647, we can have pseudo-classes inside :not / :is /
:where, which the invalidation and matching code weren't handling.

Add a few tests for this stuff working as expected.

Differential Revision: https://phabricator.services.mozilla.com/D76160
2020-05-20 23:53:34 +00:00
Emilio Cobos Álvarez a594bf82aa Bug 1639533 - Fix a case where we'd allow parsing functional :host incorrectly. r=heycam
This is a missing check I should've introduced in bug 1632647.

Differential Revision: https://phabricator.services.mozilla.com/D76161
2020-05-20 23:54:16 +00:00
Emilio Cobos Álvarez 6d165c571f Bug 1632647 - Fix parsing of :is() and :where() to account for constraints from parent selectors. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D75856
2020-05-20 12:16:22 +00:00
Emilio Cobos Álvarez f0953195ce Bug 1636998 - Make ::-moz-focus-outer a no-op, and remove it on Nightly. r=jwatt
See https://bugzilla.mozilla.org/show_bug.cgi?id=932410#c2 for the
context for which this pseudo-element was added.

In the previous patch, I had to special-case range appearance because of
this pseudo-class, but that patch makes this pseudo-class completely
redundant, as now all form controls, themed and unthemed, display
outlines, unless the native theme displays a focus indicator on its own.

Remove the special case, and make ranges use outlines like everything
else rather than this bespoke pseudo-element.

Differential Revision: https://phabricator.services.mozilla.com/D74734
2020-05-18 10:54:16 +00:00
Csoregi Natalia f6ee95862e Backed out changeset 62ad26fbfaf8 (bug 1636998) for reftest failures on 1174332-1.html. CLOSED TREE 2020-05-18 13:31:56 +03:00
Emilio Cobos Álvarez 36b46408b8 Bug 1636998 - Make ::-moz-focus-outer a no-op, and remove it on Nightly. r=jwatt
See https://bugzilla.mozilla.org/show_bug.cgi?id=932410#c2 for the
context for which this pseudo-element was added.

In the previous patch, I had to special-case range appearance because of
this pseudo-class, but that patch makes this pseudo-class completely
redundant, as now all form controls, themed and unthemed, display
outlines, unless the native theme displays a focus indicator on its own.

Remove the special case, and make ranges use outlines like everything
else rather than this bespoke pseudo-element.

Differential Revision: https://phabricator.services.mozilla.com/D74734
2020-05-18 07:59:32 +00:00
Emilio Cobos Álvarez b9c1bf761c Bug 312971 - Unprefix -moz-read-write / -moz-read-only. r=edgar
And remove some duplicated tests from WPT.

Differential Revision: https://phabricator.services.mozilla.com/D75231
2020-05-14 16:46:08 +00:00
longsonr 5fa0ddbf8f Bug 935056 - Don't apply minimum font sizes to SVG text. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D74581
2020-05-13 09:10:54 +00:00
Noemi Erli 2f8e464584 Backed out changeset afdf4d60166d (bug 935056) for causing Android reftest failures CLOSED TREE 2020-05-13 11:33:57 +03:00
longsonr 8e8e982151 Bug 935056 - Don't apply minimum font sizes to SVG text. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D74581
2020-05-13 02:13:03 +00:00
Razvan Maries 3181a5f197 Backed out changeset 8eef199bbda9 (bug 935056) for perma failures at 935056-1.html. CLOSED TREE 2020-05-12 22:16:12 +03:00
longsonr 008322377b Bug 935056 - Don't apply minimum font sizes to SVG text. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D74581
2020-05-12 16:19:15 +00:00
Emilio Cobos Álvarez eb40a0a258 Bug 1636357 - Clean up cascade rule iteration. r=nordzilla
The current API was pretty awkward as a result of two things:

 * Not being able to create empty iterators for smallbitvec.
 * We used to call the `F` function multiple times, but turns out that
   collecting the declarations in a SmallVec was a perf win.

So clean this up so that it looks more similar to other APIs, taking an
iterator directly.

This is a bit more code, but hopefully easier to understand (and also hopefully
easier to optimize).

The motivation for this work is that I plan to investigate rebasing / landing
https://github.com/servo/servo/pull/20151, and I don't want more instantiations
of apply_declarations and such.

Differential Revision: https://phabricator.services.mozilla.com/D74369
2020-05-11 21:33:31 +00:00
Cameron McCormack 3ccaaa0422 Bug 1621773 - Gracefully handle errors creating shared memory UA style sheets. r=emilio
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-05-11 00:11:45 +00:00
Philipp Zech 46da657360 Bug 1635160 - Convert style-font #defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D73728
2020-05-07 08:32:27 +00:00
Emily McDonough 1943cf3dcf Bug 1628041 - Use fill length rather than index to indicate a repeat(auto) in subgrid from Servo r=mats
Differential Revision: https://phabricator.services.mozilla.com/D70066
2020-05-06 19:35:03 +00:00
Simon Giesecke 40a765717d Bug 1626570 - Improve handling of copying arrays in layout/style/ and servo/. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D72351
2020-05-05 10:42:23 +00:00
Razvan Maries c2b627950c Backed out 10 changesets (bug 1626570) for build bustages. CLOSED TREE
Backed out changeset a3f17d392234 (bug 1626570)
Backed out changeset 5247e1ddd5d6 (bug 1626570)
Backed out changeset c339fd44c9f8 (bug 1626570)
Backed out changeset 4c69a4c013b3 (bug 1626570)
Backed out changeset e85450d69351 (bug 1626570)
Backed out changeset 793f978248b3 (bug 1626570)
Backed out changeset 68b4c2418d83 (bug 1626570)
Backed out changeset 52d0911d4ad3 (bug 1626570)
Backed out changeset a7d4e3a59ee3 (bug 1626570)
Backed out changeset 6c06d397a5d2 (bug 1626570)
2020-05-05 13:37:08 +03:00
Simon Giesecke e59bae7061 Bug 1626570 - Improve handling of copying arrays in layout/style/ and servo/. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D72351
2020-05-05 09:46:56 +00:00
Simon Giesecke ddfa9fe2d2 Bug 1633719 - Make NotNull move its member pointer where possible. r=jwalden
Differential Revision: https://phabricator.services.mozilla.com/D72827
2020-05-05 09:09:01 +00:00
Boris Chiou 3ceed5d372 Bug 1633486 - Add ::marker when checking may_have_animations() during traversal. r=emilio
When unhidding a ::marker element, we construct its generated item, and
then call StyleNewSubtree() on this generated item. During traversal, we
may update any animation related values in Gecko_UpdateAnimations(), which
may update the base styles for animation properties.

The test case is an animation segment from "null" to "inital" value. We
replace the "null" value with the base style value for the specific animation
property, so we can do interpolation properly.
(e.g. opacity: "null => initial" becomes "1.0 => initial")
If we don't update the animation related values in
Gecko_UpdateAnimations after generating ::marker, we may do
interpolation from "null" to "initial", which causes a panic.

Differential Revision: https://phabricator.services.mozilla.com/D73408
2020-05-04 19:15:43 +00:00
Philipp Zech e7364f83d0 Bug 1625745 - Convert counter-system #defines to enum classes. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D72554
2020-05-03 14:36:55 +00:00
Emilio Cobos Álvarez b14f021e00 Bug 1632102 - Only override to default color in high-contrast / forced-colors mode if inheriting from transparent. r=morgan
That way elements inside links, form controls, etc have the right
contrast, even if the page overrides the color.

We can't do it when inheriting from transparent because we've already
forgotten about the "right" color to inherit, so the default color makes
sense. But that is a pretty unlikely edge case.

Differential Revision: https://phabricator.services.mozilla.com/D73069
2020-04-30 00:09:19 +00:00
Mats Palmgren 12bca02735 Bug 1607954 part 1 - [css-grid][css-align] Implement style system support for Masonry layout. r=emilio
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-04-28 01:18:44 +00:00
Emilio Cobos Álvarez b8fbb6ead5 Bug 1509418 - Collect ancestor hashes from single-length :is and :where selector lists. r=heycam,boris
We can only collect hashes from single-length selectors, as described in
the comment.

Differential Revision: https://phabricator.services.mozilla.com/D71458
2020-04-23 19:20:35 +00:00
Emilio Cobos Álvarez f92b952261 Bug 1509418 - Handle disjoint selectors in the selector map. r=heycam,boris
This way, something like:

  *:where(.foo, .bar)

Will end up twice on the selector map, just as if you would've written
.foo, .bar.

But we're a bit careful to not be wasteful, so:

  .foo:where(div, span)

Will still end up using the .foo bucket.

It needs a bit of borrow-checker gymnastics to avoid cloning the entry
in the common path. It's a bit gross but not too terrible I think.

Differential Revision: https://phabricator.services.mozilla.com/D71457
2020-04-23 19:20:27 +00:00
Emilio Cobos Álvarez 7ff7bc8cc2 Bug 1509418 - Optimize invalidation by scanning the rightmost compound inside :where() and :is() with the outer visitor. r=heycam,boris
See the comment about why this is valuable. For a selector like:

    .foo:is(.bar) > .baz

Before this patch we'd generate an Dependency for .bar like this:

    Dependency {
        selector: .bar,
        offset: 0,
        parent: Some(Dependency {
            selector: .foo:is(.bar) > .baz,
            offset: 1, // Pointing to the `>` combinator.
            parent: None,
        }),
    }

After this patch we'd generate just:

    Dependency {
        selector: .foo:is(.bar) > .baz,
        offset: 1, // Pointing to the `>` combinator.
        parent: None,
    }

This is not only less memory but also less work. The reason for that is that,
before this patch, when .bar changes, we'd look the dependency, and see there's
a parent, and then scan that, so we'd match `.bar` two times, one for the
initial dependency, and one for .foo:is(.bar).

Instead, with this we'd only check `.foo:is(.bar)` once.

Differential Revision: https://phabricator.services.mozilla.com/D71423
2020-04-23 19:20:17 +00:00
Emilio Cobos Álvarez 2975274c6b Bug 1509418 - Make Invalidation work in terms of a dependency, not a selector. r=heycam,boris
That way we can look at the parent dependency as described in the previous
patch. An alternative would be to add a:

    parent_dependency: Option<&'a Dependency>

on construction to `Invalidation`, but this way seems slightly better to avoid
growing the struct. It's not even one more indirection because the selector is
contained directly in the Dependency struct.

Differential Revision: https://phabricator.services.mozilla.com/D71422
2020-04-23 19:20:10 +00:00
Emilio Cobos Álvarez 40a0b1a6d6 Bug 1509418 - Keep track of nested dependencies for :where() and :is(). r=heycam,boris
The tricky part of :is() and :where() is that they can have combinators inside,
so something like this is valid:

  foo:is(#bar > .baz) ~ taz

The current invalidation logic is based on the assumption that you can
represent a combinator as a (selector, offset) tuple, which are stored in the
Dependency struct. This assumption breaks with :is() and :where(), so we need
to make them be able to represent a combinator in an "inner" selector.

For this purpose, we add a `parent` dependency. With it, when invalidating
inside the `:is()` we can represent combinators inside as a stack.

The basic idea is that, for the example above, when an id of "bar" is added or
removed, we'd find a dependency like:

    Dependency {
        selector: #bar > .baz,
        offset: 1, // pointing to the `>` combinator
        parent: Some(Dependency {
            selector: foo:is(#bar > .baz) > taz,
            offset: 1, // Pointing to the `~` combinator.
            parent: None,
        })
    }

That way, we'd start matching at the element that changed, towards the right,
and if we find an element that matches .baz, instead of invalidating that
element, we'd look at the parent dependency, then double-check that the whole
left-hand-side of the selector (foo:is(#bar > .baz)) actually changed, and then
keep invalidating to the right using the parent dependency as usual.

This patch only builds the data structure and keeps the code compiling, the
actual invalidation work will come in a following patch.

Differential Revision: https://phabricator.services.mozilla.com/D71421
2020-04-23 19:20:03 +00:00
Cosmin Sabou dacaa0fa0b Backed out 6 changesets (bug 1509418) for causing dt failures on several files. CLOSED TREE
Backed out changeset 0de514478e3c (bug 1509418)
Backed out changeset 859910d9fee2 (bug 1509418)
Backed out changeset 0abf5d38ab61 (bug 1509418)
Backed out changeset f572e241c626 (bug 1509418)
Backed out changeset 6398c8f1b4d4 (bug 1509418)
Backed out changeset ebef9346b5b1 (bug 1509418)
2020-04-24 08:38:05 +03:00
Emilio Cobos Álvarez 8165749eb7 Bug 1509418 - Collect ancestor hashes from single-length :is and :where selector lists. r=heycam,boris
We can only collect hashes from single-length selectors, as described in
the comment.

Differential Revision: https://phabricator.services.mozilla.com/D71458
2020-04-23 19:20:35 +00:00
Emilio Cobos Álvarez bfd3683e13 Bug 1509418 - Handle disjoint selectors in the selector map. r=heycam,boris
This way, something like:

  *:where(.foo, .bar)

Will end up twice on the selector map, just as if you would've written
.foo, .bar.

But we're a bit careful to not be wasteful, so:

  .foo:where(div, span)

Will still end up using the .foo bucket.

It needs a bit of borrow-checker gymnastics to avoid cloning the entry
in the common path. It's a bit gross but not too terrible I think.

Differential Revision: https://phabricator.services.mozilla.com/D71457
2020-04-23 19:20:27 +00:00
Emilio Cobos Álvarez 31dc1cb456 Bug 1509418 - Optimize invalidation by scanning the rightmost compound inside :where() and :is() with the outer visitor. r=heycam,boris
See the comment about why this is valuable. For a selector like:

    .foo:is(.bar) > .baz

Before this patch we'd generate an Dependency for .bar like this:

    Dependency {
        selector: .bar,
        offset: 0,
        parent: Some(Dependency {
            selector: .foo:is(.bar) > .baz,
            offset: 1, // Pointing to the `>` combinator.
            parent: None,
        }),
    }

After this patch we'd generate just:

    Dependency {
        selector: .foo:is(.bar) > .baz,
        offset: 1, // Pointing to the `>` combinator.
        parent: None,
    }

This is not only less memory but also less work. The reason for that is that,
before this patch, when .bar changes, we'd look the dependency, and see there's
a parent, and then scan that, so we'd match `.bar` two times, one for the
initial dependency, and one for .foo:is(.bar).

Instead, with this we'd only check `.foo:is(.bar)` once.

Differential Revision: https://phabricator.services.mozilla.com/D71423
2020-04-23 19:20:17 +00:00
Emilio Cobos Álvarez 9c9a799887 Bug 1509418 - Make Invalidation work in terms of a dependency, not a selector. r=heycam,boris
That way we can look at the parent dependency as described in the previous
patch. An alternative would be to add a:

    parent_dependency: Option<&'a Dependency>

on construction to `Invalidation`, but this way seems slightly better to avoid
growing the struct. It's not even one more indirection because the selector is
contained directly in the Dependency struct.

Differential Revision: https://phabricator.services.mozilla.com/D71422
2020-04-23 19:20:10 +00:00
Emilio Cobos Álvarez 9a6a14fb98 Bug 1509418 - Keep track of nested dependencies for :where() and :is(). r=heycam,boris
The tricky part of :is() and :where() is that they can have combinators inside,
so something like this is valid:

  foo:is(#bar > .baz) ~ taz

The current invalidation logic is based on the assumption that you can
represent a combinator as a (selector, offset) tuple, which are stored in the
Dependency struct. This assumption breaks with :is() and :where(), so we need
to make them be able to represent a combinator in an "inner" selector.

For this purpose, we add a `parent` dependency. With it, when invalidating
inside the `:is()` we can represent combinators inside as a stack.

The basic idea is that, for the example above, when an id of "bar" is added or
removed, we'd find a dependency like:

    Dependency {
        selector: #bar > .baz,
        offset: 1, // pointing to the `>` combinator
        parent: Some(Dependency {
            selector: foo:is(#bar > .baz) > taz,
            offset: 1, // Pointing to the `~` combinator.
            parent: None,
        })
    }

That way, we'd start matching at the element that changed, towards the right,
and if we find an element that matches .baz, instead of invalidating that
element, we'd look at the parent dependency, then double-check that the whole
left-hand-side of the selector (foo:is(#bar > .baz)) actually changed, and then
keep invalidating to the right using the parent dependency as usual.

This patch only builds the data structure and keeps the code compiling, the
actual invalidation work will come in a following patch.

Differential Revision: https://phabricator.services.mozilla.com/D71421
2020-04-23 19:20:03 +00:00
Daniel Holbert 4adb473174 Bug 1626458 part 1: Remove pref for CSS Containment (layout.css.contain.enabled) r=AlaskanEmily
(Since we've been shipping with it default-enabled for a while now.)

See https://bugzilla.mozilla.org/show_bug.cgi?id=1466008#c9 through #c13 for
notes on the reftest.list change.

Differential Revision: https://phabricator.services.mozilla.com/D71861
2020-04-23 05:01:07 +00:00
Simon Sapin 5af9f4fc2a Bug 1631721 - Remove hashglobe r=manishearth
Differential Revision: https://phabricator.services.mozilla.com/D71743
2020-04-23 00:19:51 +00:00
Simon Sapin 08ac9e2e6c Bug 1631721 - Use std::alloc instead of hashbrown::alloc in fallible r=manishearth
This works even if the Rust standard library’s allocator is not `libc::malloc`,
so we can remove the `known_system_malloc `feature flag
and make the `fallible` crate unconditional.

Differential Revision: https://phabricator.services.mozilla.com/D71742
2020-04-23 00:19:51 +00:00
Simon Sapin 67ea7f6752 Bug 1631721 - Use hashbrown instead of hashglobe r=manishearth
Differential Revision: https://phabricator.services.mozilla.com/D71741
2020-04-23 00:19:51 +00:00
Simon Sapin cbe24024bb Bug 1631721 - Vendor the hashbrown crate r=manishearth
This is the hash map implementation now used in the Rust standard library:

* https://blog.rust-lang.org/2019/07/04/Rust-1.36.0.html#a-new-hashmapk-v-implementation
* https://github.com/rust-lang/rust/pull/58623
* https://crates.io/crates/hashbrown

Differential Revision: https://phabricator.services.mozilla.com/D71740
2020-04-23 00:19:50 +00:00
Emilio Cobos Álvarez 6341ebf29a Bug 1632363 - Fix some warnings introduced by the previous patches.
MANUAL PUSH: Avoid reviewer information from previous patches from
getting lost.
2020-04-23 05:11:04 +02:00
Martin Robinson 2561f2d680 Bug 1632363 - Add support for canceling CSS transitions. r=emilio
This change adds support for canceling CSS transitions when a property
is no longer transitionable or when an element becomes styled with
display:none. Support for canceling and replacing CSS transitions when
the end value changes is still pending. This change also takes advantage
of updating the constellation message to fix a bug where transition
events could be sent for closed pipelines.

Cherry-picked from https://github.com/servo/servo/pull/26244
(though this is not part of the Gecko build).
2020-04-23 05:10:23 +02:00
Martin Robinson 34bc586539 Bug 1632363 - Eliminate `AnimationFrame`. r=emilio
This intermediate data structure doesn't really buy us anything and is a
bit confusing.

Cherry-picked from https://github.com/servo/servo/pull/26214
(though this is not part of the Gecko build).
2020-04-23 05:10:21 +02:00
Anthony Ramine 9c1d8b545f Bug 1632363 - Make the rule tree actually threadsafe. r=emilio
RuleTree::gc is now a safe method that any thread can call
at any time, and StrongRuleNode values can all be dropped
whenever their owner want to, on any thread.

Cherry-picked from https://github.com/servo/servo/pull/26227
2020-04-23 05:10:20 +02:00
Anthony Ramine 7b4fc703a7 Bug 1632363 - Change Map::get_or_insert_with to Map::entry. r=emilio
Cherry-picked from https://github.com/servo/servo/pull/26227
2020-04-23 05:10:18 +02:00
Emilio Cobos Álvarez 2550d855b2 Bug 1631232 - Ensure that we hold an actual reference to the root, not to a field of a node we can just GC below. r=nox
Differential Revision: https://phabricator.services.mozilla.com/D71542
2020-04-20 11:07:22 +00:00
Anthony Ramine cf2f0bb18e Bug 1631232 - Always upgrade existing weak child references in the rule tree. r=emilio
Just because we didn't find a child when read-locking a node children list
doesn't mean it still won't exist while we wait to upgrade the read lock
into a write lock to create the child.

This cherry-picks https://github.com/servo/servo/pull/26220

MANUAL PUSH: So that I can preserve reviewer information.
2020-04-19 12:25:55 +02:00
Emilio Cobos Álvarez c1c10e4f44 Bug 1631154 - Fix a size test that was trying to test a now-private type.
MANUAL PUSH: bustage on a CLOSED TREE
2020-04-18 04:33:40 +02:00
Emilio Cobos Álvarez 57516a9b50 Bug 1631154 - Rustfmt and fix Servo build.
MANUAL PUSH: Review information would be lost.
2020-04-18 04:04:24 +02:00
Emilio Cobos Álvarez 73ce034b20 Bug 1631154 - Fix some rebase messups. 2020-04-18 04:04:24 +02:00
Martin Robinson 08a4e2cbc2 Bug 1631154 - Add an iterator for transition properties. r=emilio
This simplifies the code a bit and also will allow us to more easily
make improvements to servo's animation implementation in the future.
2020-04-18 04:04:24 +02:00
Anthony Ramine 54e5523868 Bug 1631154 - Introduce a new type UnsafeBox<T> in the rule tree. r=emilio
This lets us rely less on raw pointers, thus better tracking the lifetime
of the rule node values while dropping strong references etc.
2020-04-18 04:04:24 +02:00
Anthony Ramine 06ea2dd325 Bug 1631154 - Make StrongRuleNode::downgrade be unsafe. r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine 49a6858e5c Bug 1631154 - Make StrongRuleNode::ensure_child take a StrongRuleNode for the root. r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine a8dec99fc8 Bug 1631154 - Remove WeakRuleNode::clone. r=emilio
MallocSizeOf for RuleTree should not keep around weak references in
case someone runs a GC meanwhile.
2020-04-18 04:04:24 +02:00
Anthony Ramine f71e5d7ef4 Bug 1631154 - Make WeakRuleNode::from_ptr be unsafe. r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine 47d8182814 Bug 1631154 - Make StrongRuleNode::from_ptr be unsafe. r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine 2d243f239d Bug 1631154 - Move the meat of the rule tree to a submodule "core". r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine 971b28fce9 Bug 1631154 - Move CascadeLevel to its own rule_tree submodule. r=emilio 2020-04-18 04:04:24 +02:00
Anthony Ramine ebdcec89d4 Bug 1631154 - Refactor rule tree children. r=emilio
We move the data structure to its own module for better
encapsulation of unsafe code.
2020-04-18 04:04:24 +02:00
Emilio Cobos Álvarez 2769a14cc2 Bug 1629735 - Implement parsing / selector-matching for :is() and :where(). r=heycam
This implements the easy / straight-forward parts of the :where / :is
selectors.

The biggest missing piece is to handle properly invalidation when there
are combinators present inside the :where. That's the hard part of this,
actually.

But this is probably worth landing in the interim. This fixes some of
the visitors that were easy to fix.

Differential Revision: https://phabricator.services.mozilla.com/D70788
2020-04-17 13:37:59 +00:00
Emilio Cobos Álvarez b69a3cb639 Bug 1630676 - Fix two regressions from the previous patches.
MANUAL PUSH: Review information for upstream patches would get lost otherwise.
2020-04-16 21:17:50 +02:00
Emilio Cobos Álvarez 2be2ef7470 Bug 1630676 - Reformat recent changes, various build fixes, and tidy fixes. 2020-04-16 21:17:50 +02:00
Josh Matthews 1f61fd94da Bug 1630676 - Refactor some Servo-only animations code. 2020-04-16 21:17:44 +02:00
Anthony Ramine e0efb285ff Bug 1630676 - Rearrange FontLanguageOverride. r=emilio
Creating one from a u32 should be unsafe because we rely on the fact that the
value is a valid &str.
2020-04-16 21:17:43 +02:00
Anthony Ramine cd9ba34b12 Bug 1630676 - Replace ScopedTLS::unsafe_get by ScopedTLS::into_slots. r=emilio
We only ever look at the slots after we are done with the thread pool,
so we don't need to expose any unsafety to inspect the slots.
2020-04-16 21:17:42 +02:00
Anthony Ramine 26b6ee1d3a Bug 1630676 - Don't use transmute to create PaintOrder values. r=emilio
I checked that rustc optimises the code just as well as with the transmute.

https://rust.godbolt.org/z/w6UJN4
2020-04-16 21:17:41 +02:00
Anthony Ramine 40593d91fb Bug 1630676 - Don't expose any AtomicRefCell directly from style traits.
This lets us experiment with how we store this data on the DOM side.
2020-04-16 21:17:41 +02:00
Tipowol 538f9d20c8 Bug 1630676 - Update Servo's attribute length parsing code to match spec. 2020-04-16 21:17:40 +02:00
Martin Robinson 51ad515388 Bug 1630676 - Cherry-pick some layout-2020 changes. 2020-04-16 21:17:39 +02:00
Josh Matthews 785ded933e Bug 1630676 - Update ipc-channel and crossbeam-channel in Servo. 2020-04-16 21:17:39 +02:00
Simon Sapin 0158f5c65e Bug 1630676 - Fix some errors and formatting changes when updating rustc to 1.43.0-nightly (5d04ce67f 2020-02-13). 2020-04-16 21:17:38 +02:00
Ciure Andrei aec781a233 Backed out 11 changesets (bug 1630676) for causing multiple failures CLOSED TREE
Backed out changeset c1fbe364b76c (bug 1630676)
Backed out changeset 629970c8f0b7 (bug 1630676)
Backed out changeset 1530f4a9aef2 (bug 1630676)
Backed out changeset a5b60fb5a0e1 (bug 1630676)
Backed out changeset a6e1a31c3e0d (bug 1630676)
Backed out changeset 4df9717e28f0 (bug 1630676)
Backed out changeset c76b0b0e503b (bug 1630676)
Backed out changeset 3c89aec57d0a (bug 1630676)
Backed out changeset 369cf504584d (bug 1630676)
Backed out changeset d7eff4acb616 (bug 1630676)
Backed out changeset 1d47c9354eeb (bug 1630676)
2020-04-16 21:45:51 +03:00
Emilio Cobos Álvarez a891140d96 Bug 1630676 - Fix a typo introduced earlier in this bug.
MANUAL PUSH: orange

CLOSED TREE
2020-04-16 19:25:26 +02:00
Emilio Cobos Álvarez 694173c605 Bug 1630676 - Reformat recent changes, various build fixes, and tidy fixes.
MANUAL PUSH: Review information for upstream patches would get lost otherwise.
2020-04-16 18:38:02 +02:00
Josh Matthews 0bff3e6dfd Bug 1630676 - Refactor some Servo-only animations code. 2020-04-16 18:37:52 +02:00
Anthony Ramine 878b6338d1 Bug 1630676 - Rearrange FontLanguageOverride. r=emilio
Creating one from a u32 should be unsafe because we rely on the fact that the
value is a valid &str.
2020-04-16 18:37:51 +02:00
Anthony Ramine 0f5b32207e Bug 1630676 - Replace ScopedTLS::unsafe_get by ScopedTLS::into_slots. r=emilio
We only ever look at the slots after we are done with the thread pool,
so we don't need to expose any unsafety to inspect the slots.
2020-04-16 18:37:50 +02:00