Commit graph

113 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
2634ad10de style: Blockify outside markers at used value time rather than at computed value time
Trusting the display value in style_adjuster is wrong, as some elements
force a given kind of frame (like <details>).

Differential Revision: https://phabricator.services.mozilla.com/D119609
2023-05-24 18:32:38 +02:00
Emilio Cobos Álvarez
d7d407a9ae style: Fix mixed indentation in style_adjuster.rs
Differential Revision: https://phabricator.services.mozilla.com/D119579
2023-05-24 18:32:38 +02:00
Mats Palmgren
183ec78be5 style: Implement 'content: none' for ::marker
Differential Revision: https://phabricator.services.mozilla.com/D111707
2023-05-24 18:32:36 +02:00
Emilio Cobos Álvarez
67f9b97735 style: Unify font-family storage
This changes font-family storage to reuse the rust types, removing a
bunch of code while at it. This allows us to, for example, use a single
static font family for -moz-bullet and clone it, rather than creating a
lot of expensive copies.

Differential Revision: https://phabricator.services.mozilla.com/D118011
2023-05-24 18:32:35 +02:00
Mats Palmgren
d7e00ba03d style: Add some style quirks for legacy ::markers created from list-style-type/list-style-image
Specifically:
For "bullets", i.e. 'list-style-type:disc|circle|square|
disclosure-closed|disclosure-open', we use a built-in font
(-moz-bullet-font, which has glyphs for those symbols + space) to
retain mostly backwards compatible rendering for those.  Authors may
override that with an explicit 'font-family' ::marker style though.
We also use this font for 'list-style-image' in case it would
fallback to one of the above when the image fails to load (so that
we get the same width space).

When the -moz-bullet-font is used we also set 'font-synthesis' to
avoid synthesizing italic/bold for this font. Authors may override
this with an explicit ::marker declaration.

We also set 'letter-spacing' and 'word-spacing' to the initial value
for bullets for web-compat reasons.  Again, authors may override
this with an explicit ::marker declaration. (This breaks backwards-
compat slightly but makes us compatible with Chrome.  We used to
ignore these for list-style-type:<string> too.)

Differential Revision: https://phabricator.services.mozilla.com/D111693
2023-05-24 18:32:34 +02:00
Emilio Cobos Álvarez
31e8e418ea Miscellaneous build / tidy fixes. 2021-02-26 17:53:55 +01:00
Emilio Cobos Álvarez
80dae5bc59 Rustfmt. 2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
9f40b9ba38 style: Avoid some allocations in selector serialization.
The allocations in display_to_css_identifier show up in the profiles of
bug 1675628.

Differential Revision: https://phabricator.services.mozilla.com/D97856
2021-02-26 16:44:05 +01:00
Sean Feng
cf496e4727 style: Make the document blocked by the topmost element in the top layer.
Spec: https://html.spec.whatwg.org/multipage/#blocked-by-a-modal-dialog

Depends on D86392

Differential Revision: https://phabricator.services.mozilla.com/D86227
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
9d55296893 style: Fix two minor issues with scrollbar style caching.
Add -moz-inert and -moz-script-level to the set of internal properties
that aren't included in "all".

-moz-inert may need to be uncacheable in the future if we make it not
change the pointer-events computed value. Left a comment to that effect.

Differential Revision: https://phabricator.services.mozilla.com/D87115
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
687fc20274 style: Use Overflow::is_scrollable in StyleAdjuster.
It was introduced in the overflow: clip work but this standalone
equivalent remained.

Differential Revision: https://phabricator.services.mozilla.com/D85778
2021-02-26 16:44:05 +01:00
Mats Palmgren
b29824bf75 style: Implement overflow:clip/visible combinations.
Differential Revision: https://phabricator.services.mozilla.com/D73717
2021-02-26 16:44:05 +01:00
Jeremy Ir
9bfcb3d741 style: Rename overflow:-moz-hidden-unscrollable to overflow:clip.
Differential Revision: https://phabricator.services.mozilla.com/D73716
2021-02-26 16:44:05 +01:00
Alexander Surkov
32f92d18a8 style: implement -moz-inert CSS property.
-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
2021-02-26 16:44:05 +01:00
Cameron McCormack
7ae2f8602e style: Defer to -moz-default-appearance when appearance is auto.
Differential Revision: https://phabricator.services.mozilla.com/D83429
2021-02-26 16:44:05 +01:00
Cameron McCormack
01efe3a459 style: Add unprefixed appearance property and make -moz-appearance and -webkit-appearance be aliases.
Differential Revision: https://phabricator.services.mozilla.com/D83428
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
46df06b3e2 style: Use mozilla::Length rather than nscoord to store font sizes.
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
2021-02-26 16:44:05 +01:00
Emilio Cobos Álvarez
f76acc84c6 style: Reformat recent changes. 2020-04-16 17:50:17 +02:00
Emilio Cobos Álvarez
decc648c46 style: Fix number input so that it honors overflow-clip-box-block.
This never worked, but it's more visible with the new form controls which have
more padding.

Make the anonymous div and co a pseudo-element, so that they inherit from the
<input> properly in all cases. This works for non-number inputs because the
editor root is a direct child of the <input>, but it doesn't for number inputs
because there's a flex wrapper in between.

This way overflow-clip-box: inherit does what we want. Reset the padding in the
inline direction, as the padding for <input type=number> applies to the arrow
boxes as well, and thus we'd double-apply it.

Differential Revision: https://phabricator.services.mozilla.com/D65271
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
1bd551ddc2 style: Add an inherited style bit to know whether an element is in an opacity: 0 subtree.
I think this should work for the animation throttling stuff.

Opacity works on the element tree, so I think this is sound.

Differential Revision: https://phabricator.services.mozilla.com/D64441
2020-04-16 16:35:07 +02:00
Emilio Cobos Álvarez
071ce6f345
style: Rustfmt recent changes. 2020-02-12 02:43:23 +01:00
Emilio Cobos Álvarez
16fd7cad0c
style: Add a style flag for the root element style.
This is needed to make the root element not a containing block in presence of
filters or what not.

Differential Revision: https://phabricator.services.mozilla.com/D61167
2020-02-12 02:43:18 +01:00
Jonathan Kew
f426b644ca
style: Don't apply text-combine-upright in sideways-* writing modes.
Differential Revision: https://phabricator.services.mozilla.com/D61326
2020-02-12 02:43:18 +01:00
Xidorn Quan
ec37e7a5b8
style: Ensure nested ruby level container don't escape from line break suppression.
Differential Revision: https://phabricator.services.mozilla.com/D58351
2020-02-12 02:43:10 +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
31837a1efa
style: Make Rust static atoms able to be used in const contexts.
I see atom dropping code generated in release builds for stuff like dropping the
"class" atom here:

https://searchfox.org/mozilla-central/rev/4df8821c1b824db5f40f381f48432f219d99ae36/servo/components/style/gecko/wrapper.rs#592

That is silly, and I hope making Atom be able to be used in const context will
help the compiler see that yeah, we're not doing anything interesting and the
atom shouldn't get dropped.

It also allows us to get rid of a few lazy_static!s, so we should do it anyway.

In order to accomplish this, compute the offset into gGkAtoms manually instead
of going through the static_atoms() array and then back to the byte offset.

Differential Revision: https://phabricator.services.mozilla.com/D55039
2019-11-30 20:45:06 +01:00
Emilio Cobos Álvarez
6b674a670b
style: Use consistent naming and shared code for out-of-flow stuff.
Use the functions introduced in ee17eedf3a.
2019-10-07 16:57:18 +02:00
Cameron McCormack
3c2e4d1e98 style: Align the Rust and C++ representations of WritingMode.
Differential Revision: https://phabricator.services.mozilla.com/D44412
2019-09-12 22:34:16 +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
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
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
Emilio Cobos Álvarez
43444db8a8 style: Cleanup selector-matching for nested pseudo-elements, match ::slotted correctly when there's no selector before it, and add tests.
D29542 fixed the bogus checks that was making nested pseudo-elements match
author rules. This adds tests and ends up being just a cleanup, though as it
turns out we it also fixes an issue with ::slotted() matched from
Element.matches.

Differential Revision: https://phabricator.services.mozilla.com/D27529
2019-05-29 16:14:26 +02:00
Emilio Cobos Álvarez
7c4f9bbf49 style: Make the list-item increment not visible from the computed style.
This is per https://drafts.csswg.org/css-lists/#declaring-a-list-item.

I intentionally kept <li value> defined using attribute mapping, I think that's
saner than special-casing it in layout.

Differential Revision: https://phabricator.services.mozilla.com/D24935
2019-04-12 12:20:14 +02:00
Mats Palmgren
9b66f452cb style: Remove a note about <li value> style mapping that is no longer true.
Differential Revision: https://phabricator.services.mozilla.com/D26814
2019-04-12 12:20:07 +02:00
Emilio Cobos Álvarez
1f73c524bd style: Follow the list-item definition from the spec a bit more closely.
The HTML restriction doesn't match any browser.

This matches Edge, though I filed
https://github.com/w3c/csswg-drafts/issues/3766 about the pseudo-element
condition.

Differential Revision: https://phabricator.services.mozilla.com/D24936
2019-04-12 12:19:36 +02:00
Emilio Cobos Álvarez
ff41f82720 style: Fix Gecko and Servo builds, and appease tidy. 2019-03-27 14:29:28 +01:00
Mats Palmgren
64f19ae34d style: Add support for the 'content' CSS property on ::marker pseudo elements.
Bug: 205202
Reviewed-by: emilio
2019-03-27 14:29:25 +01:00
Mats Palmgren
ed74e8acbb style: Implement display:list-item counters using a built-in 'list-item' CSS counter.
Bug: 288704
Reviewed-by: emilio
2019-03-27 14:29:23 +01:00
Emilio Cobos Álvarez
ed4a23eccf style: Keep track of whether a style is affected by font metrics.
Differential Revision: https://phabricator.services.mozilla.com/D20728
2019-03-27 14:29:15 +01:00
Simon Sapin
be69f9c3e6 Rustfmt has changed its default style :/ 2018-12-28 13:17:47 +01:00
Jan Andre Ikenmeyer
1d6fe65401
Update MPL license to https (part 4) 2018-11-19 14:47:27 +01:00
Simon Sapin
b1822a39fa cargo fix --edition --features gecko 2018-11-10 17:47:28 +01:00
Simon Sapin
a15d33a10e cargo fix --edition 2018-11-10 17:47:28 +01:00
Pyfisch
9e92eb205a Reorder imports 2018-11-06 22:35:07 +01:00
Pyfisch
cb07debcb6 Format remaining files 2018-11-06 22:30:31 +01:00
Emilio Cobos Álvarez
05f9f10a1c
style: Fix servo build and tidy lints. 2018-10-28 23:52:13 +01:00
Mats Palmgren
a51b4e754c
style: Force line-height:normal for themed comboboxes for compat with other UAs.
Bug: 1501908
Reviewed-by: emilio
2018-10-28 23:45:29 +01:00
chansuke
8dab4d659a
Format style component. 2018-09-09 16:24:45 +02:00