Commit graph

130 commits

Author SHA1 Message Date
Simon Sapin
82e274aec9 Make a bool for display: list-item available to flow box construction 2020-07-23 16:43:57 +02:00
Emilio Cobos Álvarez
a7d740331d
style: Fix a warning in layout-2020 2020-06-18 23:51:19 +02:00
Emilio Cobos Álvarez
bb8c3ee8ba
style: fix formatting. 2020-06-18 23:51:18 +02:00
Emilio Cobos Álvarez
97f29c893f
style: Fix gecko build. 2020-06-18 23:51:18 +02:00
Emilio Cobos Álvarez
685e749cfc
style: Switch all callsites of try() to try_parse() in the style crate.
Fully automated via:

  $ rg -l '\.try\(' | xargs sed -i 's/\.try(/.try_parse(/g'
  $ cd servo/components/style && cargo +nightly fmt

Differential Revision: https://phabricator.services.mozilla.com/D80099
2020-06-18 23:51:14 +02:00
Simon Sapin
64124f7a5e Layout 2020 skeleton for display: flex, behind a pref 2020-06-04 13:09:57 +02:00
Simon Sapin
09dbf91e7b display: contents computes to block on the root element 2020-05-15 13:25:35 +02:00
Martin Robinson
9c7b1ae715 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.
2020-05-11 20:14:01 +02:00
Emilio Cobos Álvarez
414edb5a4a style: Simplify the implementation of HasAuthorSpecifiedRules.
This patch computes the author-specified properties during the CSS cascade, and
removes the complex rule-tree-based implementation that tries to do the cascade
again.

This changes behavior in two ways, one of them which is not observable to
content, I believe:

 * revert now re-enables the native styling. This was brought up in
   https://github.com/w3c/csswg-drafts/issues/4777 and I think it is a bug-fix.

   This is observable to content, and I'm adding a test for it.

 * We don't look at inherited styles from our ancestors when `inherit` is
   specified in a non-author stylesheet. This was introduced for bug 452969 but
   we don't seem to inherit background anymore for file controls or such. It
   seems back then file controls used to have a text-field.

   I audited forms.css and ua.css and we don't explicitly inherit
   padding / border / background-color into any nested form control.

We keep the distinction between border/background and padding, because the later
has some callers. I think we should try to align with Chromium in the long run
and remove the padding bit.

We need to give an appearance to the range-thumb and such so that we can assert
that we don't call HasAuthorSpecifiedRules on non-themed stuff. I used a new
internal value for that.

Differential Revision: https://phabricator.services.mozilla.com/D67722
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
4a19074664 style: Rename -moz-menulist-button to -moz-menulist-arrow-button.
This should be less confusing. This is not supported outside of chrome:// or
user-agent stylesheets so we can name this however we want.

Differential Revision: https://phabricator.services.mozilla.com/D65605
2020-04-16 16:35:07 +02:00
Tim Nguyen
fc88e908d5 style: Re-introduce display: -moz-stack; as <legacy-stack>.
Differential Revision: https://phabricator.services.mozilla.com/D62758
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
071ce6f345
style: Rustfmt recent changes. 2020-02-12 02:43:23 +01:00
Tim Nguyen
127755551d
style: Remove nsGroupBoxFrame (display: -moz-groupbox).
Differential Revision: https://phabricator.services.mozilla.com/D61422
2020-02-12 02:43:19 +01:00
Emilio Cobos Álvarez
718a9b1f05
style: Make display: -moz-box more similar to other display types for block layout.
It is unexpected (see bug) that a -moz-box is affected by baseline alignment.
Make -moz-box be block-outside, and -moz-inline-box be inline-outside, instead
of the bespoke thing we have now.

This is more similar to everything else, and fixes the bug.

Differential Revision: https://phabricator.services.mozilla.com/D58726
2020-02-12 02:43:09 +01:00
Emilio Cobos Álvarez
2b499e4850
style: Do not use synthetic display-inside values.
This matches the new servo layout engine too, and thus removes some #[cfg]
gunk.  Just use `flow` since it doesn't simplify the layout code as much.

Differential Revision: https://phabricator.services.mozilla.com/D45973
2020-02-12 02:43:07 +01:00
Emilio Cobos Álvarez
ef16c5844f Rustfmt recent changes. 2019-12-16 14:23:56 +01:00
Emilio Cobos Álvarez
f89c31120f
style: Remove layout.css.xul-box-display-values.survive-blockification.enabled.
Differential Revision: https://phabricator.services.mozilla.com/D55898
2019-12-15 21:03:48 +01:00
Simon Sapin
d717382c0c Disable in Layout 2020 an assertion that does not apply there 2019-12-10 18:41:14 +01:00
Emilio Cobos Álvarez
006417e40a
style: Rustfmt recent changes. 2019-11-30 20:45:07 +01:00
Boris Chiou
45c64a7224
style: Set WillChangeBits::TRANSFORM for offset-path and add tests for it.
Differential Revision: https://phabricator.services.mozilla.com/D53109
2019-11-30 20:45:00 +01:00
Tim Nguyen
c04a37982c
style: Remove nsStackFrame platform code.
Differential Revision: https://phabricator.services.mozilla.com/D49487
2019-11-30 20:44:56 +01:00
Simon Sapin
8f89f59329 2020: parse display: contents 2019-10-24 10:44:31 +02:00
Emilio Cobos Álvarez
031cb05c67 style: Fix servo build. 2019-10-09 13:21:35 +02:00
Emilio Cobos Álvarez
33d39d37a2 style: Rustfmt recent changes. 2019-10-09 13:21:35 +02:00
Boris Chiou
19ddfd57d5 style: Set WillChangeBits::TRANSFORM for individual transform.
We always check StyleWillChangeBits_TRANSFORM bit together with a
transform-like property set, so using WillChangeBits::TRANSFORM bit to
represent all transform-like properties is ok.

However, it seems the new test case works well even if we don't have this
patch. I still add it for individual transform properties to make sure
the test coverage is enough anyway.

Differential Revision: https://phabricator.services.mozilla.com/D47509
2019-10-09 13:21:35 +02:00
Daniel Holbert
fee0f2cd23 style: In css 'display' blockification codepath, leave -moz-box alone and promote -moz-inline-box to -moz-box (if a new pref is set).
This is in the interests of allowing the frontend team to experiment with
switching from XUL grid to CSS grid, without inadvertently changing the
display values for the grid items via css-grid-item blockification.

This patch's new pref is not expected to remain in the codebase for long.
We're just adding it so that the behavior remains the same by default, because
we do currently have some XUL code that inadvertently depends on -moz-box
display values being blockified to 'block'.  The plan is for folks to remove
that dependency e.g. by adding explicit 'display:block' styling to frontend
code as-needed. After we've done that, we can tentatively flip the pref to true
by default, and then remove the pref entirely.

Differential Revision: https://phabricator.services.mozilla.com/D45258
2019-10-09 13:21:35 +02:00
Mats Palmgren
dd5715d4f1 style: Remove display:-moz-inline-grid/-moz-inline-stack.
Differential Revision: https://phabricator.services.mozilla.com/D42552
2019-09-12 22:34:16 +02:00
Mats Palmgren
bff52ae4a1 style: Implement layout for 'display: flow-root list-item'.
Differential Revision: https://phabricator.services.mozilla.com/D42087
2019-09-12 22:07:45 +02:00
Anthony Ramine
4444c5a2ad Import victor's layout system 🍷 2019-09-11 10:36:30 +02:00
Emilio Cobos Álvarez
4752110d53
Fix Servo build and unify display representation. 2019-08-15 17:11:08 +02:00
Emilio Cobos Álvarez
4d8fc4b8f7
style: Fix formatting of recent changes. 2019-08-15 17:02:37 +02:00
Mats Palmgren
5949d42bf7
style: Implement 'display:block ruby'.
Differential Revision: https://phabricator.services.mozilla.com/D40211
2019-08-15 17:02:30 +02:00
Mats Palmgren
2d29e6edd4
style: Implement 'inline list-item' and 'inline flow-root list-item' values for the 'display' property.
Differential Revision: https://phabricator.services.mozilla.com/D39832
2019-08-15 17:02:23 +02:00
Mats Palmgren
07dad28e49
style: Hide some 'display' values in devtools auto-completion that we want to discourage authors from using.
Differential Revision: https://phabricator.services.mozilla.com/D39810
2019-08-15 17:02:17 +02:00
Mats Palmgren
a9814ccb82
style: Implement multi-keyword 'display' values for Gecko.
Differential Revision: https://phabricator.services.mozilla.com/D39764
2019-08-15 17:02:09 +02:00
Nicholas Nethercote
bb032c1ddc
style: Use static_prefs::pref!.
It's much nicer.

One nice thing about this is that the new code is subject to the existing
threadedness checking, which identified that several of these should be atomic
because they're accessed off the main thread.

Differential Revision: https://phabricator.services.mozilla.com/D40792
2019-08-15 17:00:37 +02:00
Simon Sapin
ddb4e369dd Stylo: replace product={gecko,servo} with engine={gecko,servo-2013,servo-2020}
Renaming the variable helped make sure I looked at every use.
2019-07-29 17:37:03 +02:00
Nicholas Nethercote
323221051f
style: Change StaticPrefs from a class to a namespace.
This doesn't change the way C++ code uses static prefs. But it does slightly
change how Rust code uses static prefs, specifically the name generated by
bindgen is slightly different.

The commit also improves some comments.

Differential Revision: https://phabricator.services.mozilla.com/D35764
2019-07-08 12:42:58 +02:00
Emilio Cobos Álvarez
1f5bed4473
style: Hide some appearance values from content.
They're not used internally either, so remove all ability to address them.

I haven't removed the implementation yet, as some of them are quite complex, and
I don't have a mac / windows build. We should do that when this hits release
though.

Differential Revision: https://phabricator.services.mozilla.com/D32488
2019-06-25 13:11:26 +02:00
Emilio Cobos Álvarez
85752fa479 style: Use OwnedSlice for will-change.
We could use ArcSlice if wanted I guess, your call. Though will change is not
supposed to be used very frequently.

Differential Revision: https://phabricator.services.mozilla.com/D30548
2019-05-29 16:14:12 +02:00
Emilio Cobos Álvarez
57874ae90a style: Rustfmt recent changes. 2019-05-07 12:56:02 +02:00
Emilio Cobos Álvarez
c990c9623d style: Use rust types for vertical-align.
The previous commit removed the dependence on the discriminant value, so we
don't need to keep discriminants different from text-align anymore.

Differential Revision: https://phabricator.services.mozilla.com/D29361
2019-05-07 12:55:41 +02:00
Emilio Cobos Álvarez
8c004c0858 style: Reformat recent changes. 2019-04-12 12:20:14 +02:00
Hiroyuki Ikezoe
21481e315e style: Switch to the new scroll-snap-type syntax for the old scroll snap implementation and drop the scroll-snap-type-{x,y} longhands.
Now scroll-snap-type is a longhand property.

Differential Revision: https://phabricator.services.mozilla.com/D21622
2019-04-12 12:20:12 +02:00
Hiroyuki Ikezoe
2f457ed144 style: Rename ScrollSnapType to ScrollSnapStrictness.
The scroll snap strictness is defined in the new spec [1], and the structure
is the exactly same as the old scroll snap type structure.

[1] https://drafts.csswg.org/css-scroll-snap-1/#snap-strictness

Differential Revision: https://phabricator.services.mozilla.com/D21621
2019-04-12 12:20:12 +02:00
Emilio Cobos Álvarez
a47dcb5707 style: Derive ToResolvedValue.
Differential Revision: https://phabricator.services.mozilla.com/D26783
2019-04-12 12:20:09 +02:00
Cameron McCormack
40248ae5fd style: Add derived ToShmem implementations.
Differential Revision: https://phabricator.services.mozilla.com/D17197
2019-04-12 12:19:52 +02:00
Emilio Cobos Álvarez
bd77cd64b9 style: Refactor some enabledness checks.
There are some common checks that could get some easy-to-use aliases.

Differential Revision: https://phabricator.services.mozilla.com/D25117
2019-04-12 12:19:38 +02:00
Emilio Cobos Álvarez
01e0f37861 style: Make the will-change bitfield use cbindgen.
Differential Revision: https://phabricator.services.mozilla.com/D23414
2019-03-27 14:29:12 +01:00
Emilio Cobos Álvarez
6e2643c636 style: Use cbindgen for touch-action.
And rename the constants to not be prefixed by TOUCH_ACTION_, since that's part
of the type name anyway.

Differential Revision: https://phabricator.services.mozilla.com/D23413
2019-03-27 14:29:11 +01:00