Commit graph

2338 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
8d7a3f4f3d
style: Update align-self / justify-self to the spec too.
MozReview-Commit-ID: 8JKF5ucCbYm
2018-01-29 10:37:17 +01:00
Emilio Cobos Álvarez
4c773a1424
style: Fix the position of the <overflow-position> in content distribution shorthands, and remove fallback.
MozReview-Commit-ID: 4rPICzZ5gMn
2018-01-29 10:37:17 +01:00
Emilio Cobos Álvarez
fd47a93b9c
style: Restrict <baseline-position> and <content-position> depending on the axis in content distribution properties.
This fixes https://bugzilla.mozilla.org/show_bug.cgi?id=1430817, and updates us
to the current version of the css-align spec.

MozReview-Commit-ID: LtBcdqYJeK
2018-01-29 10:37:16 +01:00
Emilio Cobos Álvarez
7497720081
style: Make content distribution parsing know the axis it's parsed for.
MozReview-Commit-ID: LMPXVtKU1mq
2018-01-29 10:37:16 +01:00
Emilio Cobos Álvarez
711ea51d7b
style: Rename AlignJustifySelf to SelfAlignment.
This matches the spec term and, again, the two properties will have different
grammars soon.

MozReview-Commit-ID: 8f8JXj2NnCi
2018-01-24 14:34:04 +01:00
Emilio Cobos Álvarez
d4a44de928
style: Rename AlignJustifyContent to ContentDistribution.
align-content and justify-content will have different types in a second.

MozReview-Commit-ID: 5JDeR5kXZNP
2018-01-24 14:34:03 +01:00
bors-servo
6b2e5283c9 Auto merge of #19838 - servo:rm-sequence-writer-as-it-was, r=emilio
Make ToCss' SequenceWriter not monomorphise like a maniac anymore

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19838)
<!-- Reviewable:end -->
2018-01-23 12:03:41 -06:00
Emilio Cobos Álvarez
cd04664fb9
style: Use CascadeFlags for what they're for.
Now that we have an Element around on cascade, we can stop using the cascade
flags mechanism to pass various element-related state, like "is this element the
root", or "should it use the item-based display fixup".

That fixes handwaviness in the handling of those flags from style reparenting,
and code duplication to handle tricky stuff like :visited.

There are a number of other changes that are worth noticing:

 * skip_root_and_item_based_display_fixup is renamed to skip_item_display_fixup:

   TElement::is_root() already implies being the document element, which by
   definition is not native anonymous and not a pseudo-element.

   Thus, you never get fixed-up if your NAC or a pseudo, which is what the code
   tried to avoid, so the only fixup with a point is the item one, which is
   necessary.

 * The pseudo-element probing code was refactored to return early a
   Option::<CascadeInputs>::None, which is nicer than what it was doing.

 * The visited_links_enabled check has moved to selector-matching time. The rest
   of the checks aren't based on whether the element is a link, or are properly
   guarded by parent_style.visited_style().is_some() or visited_rules.is_some().

   Thus you can transitively infer that no element will end up with a :visited
   style, not even from style reparenting.

Anyway, the underlying reason why I want the element in StyleAdjuster is because
we're going to implement an adjustment in there depending on the tag of the
element (converting display: contents to display: none depending on the tag), so
computing that information eagerly, including a hash lookup, wouldn't be nice.
2018-01-23 13:18:54 +01:00
Anthony Ramine
cd8f96cc9e Change ToCss to take a CssWriter<W>
This more concrete wrapper type can write a prefix the very first time something
is written to it. This allows removing plenty of useless monomorphisations caused
by the former W/SequenceWriter<W> pair of types.
2018-01-23 10:41:42 +01:00
Emilio Cobos Álvarez
5ac12b5df4
style: Make the TElement type arrive to the cascade function.
Not super-proud of this one, but it's the easiest way I could think of.

The changeset looks bigger than what it is, because while at it I've rewrapped a
fair amount of functions around to use proper block indentation.

Alternatives are parameterizing Stylist by <E>, which is not fun, or moving the
concrete element from layout_thread to layout, but that implies layout depending
on script, which isn't fun either.

Other alternative is implementing an empty enum and making anon boxes work on
it. It has the advantage of removing the annoying type parameter, but the
disadvantage of instantiating `cascade` twice, which isn't great, and having to
maintain all the boilerplate of a `TElement` implementation that just does
nothing.
2018-01-23 00:57:54 +01:00
Bobby Holley
5526947500 Avoid the generic writer parameter for PropertyDeclaration serialization.
MozReview-Commit-ID: JR3IcL1NRHO
2018-01-22 14:58:05 -08:00
Emilio Cobos Álvarez
c4ae2148f0
style: Remove -moz-border-*-colors.
Bug: 1429723
Reviewed-by: xidorn
MozReview-Commit-ID: 3P6f7rFcDa6
2018-01-22 16:12:35 +01:00
Igor Gutorov
4ee9eb8563 style: Move cursor property out of mako 2018-01-20 19:06:29 +02:00
Emilio Cobos Álvarez
212b2f56c7
style: Make the Gecko font-size calc() code do what it means to do.
It makes no sense to pass a custom base size of zero in presence of rem, ex, or
ch units.

Bug: 1431031
Reviewed-by: Manishearth
MozReview-Commit-ID: 7ZZwRzQKREX
2018-01-18 15:11:08 +01:00
Emilio Cobos Álvarez
e858dc060e
style: Special-case pseudo style attributes to avoid ignoring doc colors.
That way color pickers work even when this setting is on. We always know that
pseudo-element style attributes are trusted.

Bug: 1429248
Reviewed-by: heycam
MozReview-Commit-ID: 6IdmRaMzj6I
2018-01-17 14:35:42 +01:00
Emilio Cobos Álvarez
404148c82e
style: Don't allow fallback alignment in place-content shorthand.
Bug: 1430622
Reviewed-by: xidorn,mats
MozReview-Commit-ID: sALBFJeqvr
2018-01-16 17:51:24 +01:00
bors-servo
2ff3e119fa Auto merge of #19749 - gootorov:move_-moz-context-properties_from_mako, r=emilio
style: Move -moz-context-properties outside of mako.

<!-- Please describe your changes on the following line: -->
Sub-PR of #19015

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #19742  (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19749)
<!-- Reviewable:end -->
2018-01-15 06:04:30 -06:00
bors-servo
f2036e7661 Auto merge of #19757 - emilio:bye-custom-cascade, r=nox
style: Remove -servo-text-decorations-in-effect

It is bogus, because it depends on the display property as it's cascaded, but
the display property can change afterwards, for example, if we get blockified
because we're the root element or a flex item.

Replace it with a normal field instead.

Also, it carries some weight, because it's the last property that uses this
concept of "derived" property, and "custom cascade". So we can remove some code
after this.

Compute it after the cascade process in StyleAdjuster.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19757)
<!-- Reviewable:end -->
2018-01-15 05:14:49 -06:00
bors-servo
ec34023d7a Auto merge of #19766 - jonleighton:issue-19765, r=emilio
Move image-orientation property outside of mako

Fixes https://github.com/servo/servo/issues/19765

r? emilio

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19766)
<!-- Reviewable:end -->
2018-01-14 16:55:15 -06:00
Jon Leighton
bd55639d01 Move image-orientation property outside of mako
Fixes https://github.com/servo/servo/issues/19765
2018-01-14 21:19:12 +01:00
Emilio Cobos Álvarez
9dc25ed214
style: Remove "derived" properties and the concept of "custom cascade". 2018-01-14 17:10:44 +01:00
Emilio Cobos Álvarez
8732a1d7de
style: Remove -servo-text-decorations-in-effect.
It is bogus, because it depends on the display property as it's cascaded, but
the display property can change afterwards, for example, if we get blockified
because we're the root element or a flex item.

Replace it with a normal field instead.

Also, it carries some weight, because it's the last property that uses this
concept of "derived" property, and "custom cascade". So we can remove some code
after this.

Compute it after the cascade process in StyleAdjuster.
2018-01-14 17:10:44 +01:00
bors-servo
1b46e2e759 Auto merge of #19709 - CYBAI:servo-display-out-of-mako, r=emilio
style: Remove -servo-display-for-hypothetical-box from longhand

This is a sub-PR of #19015
r? emilio

For the `fn set_original_display` inside `properties.mako.rs`, I removed `is_item_or_root` first to see how the tests result is. If it's needed, I'll add it back.

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19697
- [x] These changes do not require tests

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19709)
<!-- Reviewable:end -->
2018-01-14 08:27:14 -06:00
Igor Gutorov
90978c1777 Make MozContextProperties a different type 2018-01-13 22:29:52 +02:00
Bobby Holley
f858ce91e8 Avoid entraining various Debug impls in release builds.
MozReview-Commit-ID: Lp9i9EI5qdU
2018-01-13 09:51:46 -08:00
CYBAI
0291a75b3c style: Remove -servo-display-for-hypothetical-box from longhand 2018-01-13 20:54:50 +08:00
CYBAI
3f6a613bea Use Python's True instead of string for arbitrary Python code in mako 2018-01-13 00:23:30 +08:00
Igor Gutorov
c72066af2d style: Move -moz-context-properties outside of mako 2018-01-12 17:46:02 +02:00
CYBAI
2bc02bc78d style: Move paint-order outside of mako 2018-01-10 21:26:33 +08:00
bors-servo
83a8891bd4 Auto merge of #18893 - emilio:bye-can-be-fragmented, r=SimonSapin
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.

Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18893)
<!-- Reviewable:end -->
2018-01-05 05:11:00 -06:00
bors-servo
6131371cc2 Auto merge of #19696 - upsuper:rule-cache-opt, r=emilio
Skip rule node which contains only inherited properties for rule cache

This is one possible fix for [bug 1427681](https://bugzilla.mozilla.org/show_bug.cgi?id=1427681) which tries to skip some rule nodes when using rule cache.

Try push for correctness: https://treeherder.mozilla.org/#/jobs?repo=try&revision=74e3941e2cfc5fba4bce839f2518af8a5a8b7411

It doesn't really show much memory saving on awsy. It only shows several KB save on fresh start memory. But since conceptually it's simple, I guess it's worth taking.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19696)
<!-- Reviewable:end -->
2018-01-05 03:35:04 -06:00
Xidorn Quan
3593392788 Skip rule node which contains only inherited properties for rule cache. 2018-01-05 11:29:01 +11:00
Hiroyuki Ikezoe
a4e687aedd Drop animation-name and transition-property from early properties
We don't need to calculate computed animation-name or transition-property prior
to other properties any more because we no longer fill out those other
properties values in response to animation-name or transition-property length
at the time when we calculate computed property values.
2018-01-05 07:02:05 +09:00
Hiroyuki Ikezoe
9b6c5da98f Don't fill out deficient animation/transition property values in the style struct 2018-01-05 07:02:05 +09:00
Hiroyuki Ikezoe
9c05bc92f8 Check each animation sub property count in animations_equals
In a subsequent patch, we will no longer fill out deficient property values in
mAnimations.
2018-01-05 07:02:05 +09:00
Hiroyuki Ikezoe
cd56223907 Call transition_combined_duration_at to get combined duration instead of calculating directly 2018-01-05 07:02:05 +09:00
Hiroyuki Ikezoe
18a99e50d8 Make transition_combined_duration_at consider duration and delay value are used by repeating the list of values if the given index is greater than the list length 2018-01-05 07:02:05 +09:00
Emilio Cobos Álvarez
f3ea248188
style: Remove TNode::set_can_be_fragmented and TNode::can_be_fragmented.
Replace them instead by a computed value flag, the same way as the
IS_IN_DISPLAY_NONE_SUBTREE flag works.
2018-01-04 14:45:54 +01:00
Emilio Cobos Álvarez
10a1e1e15f
style: Simplify some ComputedValueFlags setters. 2018-01-04 14:45:38 +01:00
lizhixun
4c23f09934 style: Move contain outside of mako 2018-01-03 23:13:56 -08:00
CYBAI
a764d9065e style: Move display outside of mako 2018-01-01 23:51:08 +08:00
Emilio Cobos Álvarez
bab6077c1c
Revert #19666 since we do create NAC elements and expect them to be inline.
This reverts commit 1970e82b0d, reversing
changes made to e882660ea6.

The reparenting logic is still bogus, but I'll figure out how to deal with that
in a bit.
2017-12-31 17:00:26 +01:00
Emilio Cobos Álvarez
e464f5b020
style: Simplify the skip item based display fixup adjustment.
In practice the only NAC that possibly inherits from a grid or flex container
are pseudos.

In Gecko, if the root element is an item container, custom anon content would
also sometimes incorrectly inherit from that (see bug 1405635), but that's fixed
in Stylo.

We remove the IS_ROOT_ELEMENT blockification from the "skip display fixup"
check, since the root element is never NAC or anything like that, so there's no
need for the check.

This also fixes some reparenting fishiness related to pseudo-elements. We were
only skipping the fixup when reparenting anon boxes, not when reparenting normal
element styles, nor when reparenting other pseudo styles which are not anon
boxes.
2017-12-31 13:57:49 +01:00
Emilio Cobos Álvarez
bc2ef519ca
style: Renumber CascadeFlags bits. 2017-12-31 09:17:00 +01:00
Emilio Cobos Álvarez
a747de1814
style: Simplify "prohibit display: contents" adjustment.
On top of #19661.

The NAC condition is pointless because NAC don't match author rules unless they
are a pseudo-element too.
2017-12-31 09:17:00 +01:00
Emilio Cobos Álvarez
563da3a19c
style: Simplify ::-moz-fieldset-content special-casing.
The style adjuster knows about the pseudo, so there's no reason to thread that
info down.

There are more simplifications that can be done in followups, cleaning a bit the
cascade flags too, those will come later.
2017-12-30 22:08:04 +01:00
CYBAI
05b014e720 style: Move touch-action outside of mako 2017-12-28 23:13:39 +08:00
Jon Leighton
214b423bbd Move list-style-type outside of mako
Closes issue #19629
2017-12-23 13:01:30 +01:00
Emilio Cobos Álvarez
cdb604ae69
style: Make sure to honor parse_method in transition and animation shorthands.
Reviewed-by: birtles
Bug: 1426312
MozReview-Commit-ID: HY3jtdSdaga
2017-12-21 13:56:57 +01:00
bors-servo
df0f9ad7ae Auto merge of #19618 - upsuper:border-image-repeat, r=emilio
Convert NS_STYLE_BORDER_IMAGE_REPEAT_* to an enum class

This is the Servo side change of [bug 1325940](https://bugzilla.mozilla.org/show_bug.cgi?id=1325940).

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19618)
<!-- Reviewable:end -->
2017-12-21 01:34:04 -06:00