Commit graph

6114 commits

Author SHA1 Message Date
bors-servo
c9ba16f9fb Auto merge of #19868 - CYBAI:specific-assertion, r=emilio
Use specific assertions

Similar to #19865
r? jdm

Note: Should I squash all the commits into one commit?

---
- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes do not require tests because it should not break anything

<!-- 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/19868)
<!-- Reviewable:end -->
2018-01-25 18:06:33 -06:00
CYBAI
775d6abb34 Use specific assertion for style logical geometry 2018-01-26 01:30:31 +08:00
CYBAI
e4799cc997 Use specific assertion for specified text 2018-01-26 01:18:59 +08:00
bors-servo
5355265c74 Auto merge of #19854 - emilio:try-match, r=nox
style: make the try_match_ident_ignore_ascii_case macro actually return the error.

This allows it to be used as an expression, which I'd like to do very soon.

<!-- 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/19854)
<!-- Reviewable:end -->
2018-01-25 10:18:24 -06:00
Emilio Cobos Álvarez
e978645a52
style: make the try_match_ident_ignore_ascii_case macro actually return the error.
This allows it to be used as an expression, which I'd like to do very soon.
2018-01-24 16:12:30 +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
Emilio Cobos Álvarez
da56bdecc6
style: Minor nits on the alignment properties.
I'm going to touch this in a bit, let's do it a bit less painful.

MozReview-Commit-ID: LhBNMkUXlUK
2018-01-24 12:14:23 +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
b1c580754a
style: Disable rustfmt for now.
Tons of people have broken rustfmts that cause build errors. Let's not force
them to update it for now.
2018-01-23 17:28:12 +01: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
42c8dc983f Derive ToCss for TransformOperation
Now that SequenceWriter<W> does not monomorphise excessively, we can actually
type check a derived ToCss without too much type recursion.
2018-01-23 11:02:34 +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
Anthony Ramine
3672856efa Derive ToCss for font_feature_values_rule::SingleValue 2018-01-23 09:25:16 +01:00
Anthony Ramine
6d2018ae38 Use Image::to_css in <Image as Debug>::fmt 2018-01-23 09:25:16 +01:00
Emilio Cobos Álvarez
104f5c2553
style: Derive debug for CascadeInputs.
It no longer has anything than rules.
2018-01-23 00:57:54 +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
bors-servo
c1ed4bb2d5 Auto merge of #19829 - servo:rustup, r=nox
Update Rust and use the newly-stable std::ptr::NonNull

<!-- 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/19829)
<!-- Reviewable:end -->
2018-01-22 11:11:44 -06:00
Simon Sapin
4be3096040 Add some FIXME comments about using ptr::NonNull 2018-01-22 17:41:26 +01:00
Emilio Cobos Álvarez
1183b47e69
style: Update bindings. 2018-01-22 16:12:36 +01: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
Emilio Cobos Álvarez
3d5bd40766
style: Update bindings. 2018-01-22 13:40:43 +01:00
Emilio Cobos Álvarez
08412647db
Update bindgen.
Bug: 1432134
Reviewed-by: SimonSapin
MozReview-Commit-ID: GXHw7KcCLN9
2018-01-22 13:40:23 +01:00
bors-servo
59033e6970 Auto merge of #19798 - gootorov:move_cursor_from_mako, r=emilio
style: Move cursor property out of mako

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

r? emilio

---
<!-- 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 build-geckolib` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #19775 (github issue number if applicable).

<!-- Either: -->
- [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/19798)
<!-- Reviewable:end -->
2018-01-20 12:10:58 -06:00
Igor Gutorov
4ee9eb8563 style: Move cursor property out of mako 2018-01-20 19:06:29 +02:00
bors-servo
6fc71a7644 Auto merge of #19822 - emilio:less-match-public, r=KiChjang
style: More tiny selector-matching cleanup

See each commit individually.

<!-- 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/19822)
<!-- Reviewable:end -->
2018-01-19 23:05:18 -06:00
Emilio Cobos Álvarez
be4c0fecd8
style: Indent some function calls properly. 2018-01-20 02:36:34 +01:00
Emilio Cobos Álvarez
d8455a772f
style: Remove redundant QuirksMode argument to SelectorMap 2018-01-20 02:32:11 +01:00
Emilio Cobos Álvarez
d14c979fb2
Revert "style: Remove new function added to the build from bindings.rs"
This reverts commit 8c0e455d9e.
2018-01-20 02:10:59 +01:00
Emilio Cobos Álvarez
e74fad6259
style: Handle correctly document state invalidation inside negation. 2018-01-20 02:10:57 +01:00
Emilio Cobos Álvarez
8e25c9e674
style: Track the visited-handling-mode on the MatchingContext.
Instead of on the stack.

This fixes bugs where we're not passing the value around correctly, like from
::-moz-any.

This is a fix for https://bugzilla.mozilla.org/show_bug.cgi?id=1431539.
2018-01-19 13:22:37 +01:00
Emilio Cobos Álvarez
e4f08ee2bb
selectors: Add a MatchingContext::nest function, make nesting_level private. 2018-01-19 12:40:17 +01: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
8c0e455d9e
style: Remove new function added to the build from bindings.rs
Since it was removed from gecko, and this confuses a lot to
ports/geckolib/tests/build.rs.
2018-01-18 03:33:42 +01:00
bors-servo
7d685d4baa Auto merge of #19790 - emilio:fix-all-the-bugs, r=heycam,xidorn
style: Work from multiple bugs.

Bug: 1429846,1429248,1430608,1409672
Reviewed-by: xidorn,heycam

<!-- 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/19790)
<!-- Reviewable:end -->
2018-01-17 13:55:03 -06:00
Emilio Cobos Álvarez
3cd4f5780f
style: Update bindings. 2018-01-17 18:03:17 +01:00
Emilio Cobos Álvarez
665690bba6
style: Hook in the document invalidator.
Bug: 1409672
Reviewed-by: xidorn
MozReview-Commit-ID: EoSMrYPS7dl
2018-01-17 18:03:16 +01:00
Emilio Cobos Álvarez
49535d6987
style: Cleanup a bit the calc code.
I happened to be looking at it.

MozReview-Commit-ID: Ketot34XtOX
2018-01-17 15:26:13 +01:00
Emilio Cobos Álvarez
75af7c0b41
style: Make Gecko's media query evaluation work with a document, not a pres context.
Returning a zero-sized viewport in the case there's no shell / pres context.

For now, no other change yet. After this we can start tweaking the ShadowRoot
Stylist setup, and even try to return computed styles without a document \o/.

Bug: 1430608
MozReview-Commit-ID: 3cT2PKQISri
2018-01-17 14:36:04 +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
7bdeeaa702
style: Fix slotted invalidation.
This is a partial revert of
ce1d8cd232

If you're in a shadow tree, you may not be slotted but you still need to look at
the slotted rules, since a <slot> could be a descendant of yours.

Just use the same invalidation map everywhere, and remove complexity.

This means that we can do some extra work while trying to gather invalidation
if there are slotted rules, but I don't think it's a problem.

The test is ported from https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/fast/css/invalidation/slotted.html?l=1&rcl=58d68fdf783d7edde1c82a642e037464861f2787

Curiously, Blink fails the test as written, presumably because they don't flush
styles from getComputedStyle correctly (in their test they do via
updateStyleAndReturnAffectedElementCount), due to <slot>s not being in the flat
tree in their implementation.

Bug: 1429846
Reviewed-by: heycam
MozReview-Commit-ID: 6b7BQ6bGMgd
2018-01-17 14:35:19 +01:00
bors-servo
525758ea5e Auto merge of #19781 - upsuper:matching-opt, r=emilio
Optimize selector matching for some common cases

This is the "better way" I mentioned in #19774, which seems to actually improve the score of dromaeo_css on talos.

<!-- 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/19781)
<!-- Reviewable:end -->
2018-01-16 16:47:29 -06:00
Xidorn Quan
d0fd92221c Optimize selector matching for some common cases. 2018-01-17 09:46:57 +11:00
Emilio Cobos Álvarez
e55bb3e76d
style: Always inline GeckoElement::has_class.
It's easier, and probably faster, than trying to inline the function call to
Gecko.

This symbol is in libxul.so as of right now.
2018-01-16 22:14:11 +01:00
Emilio Cobos Álvarez
1e72a12265
style: Pull out the branch from snapshot_helpers::has_class.
I've verified that current libxul, at least for Linux, doesn't manage to pull
the branch out.
2018-01-16 21:38:31 +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
Emilio Cobos Álvarez
1c1f9c94fd
style: update bindings. 2018-01-16 15:49:50 +01:00
Jessica Jong
2e532b8e00 style: Update shadow dom preference. 2018-01-16 17:52:50 +08:00
Bobby Holley
9a8821a1b0 Avoid debug serialization of PropertyDeclaration & co in release builds.
In total, this PR saves ~60k.

The conditional compilation on the _Debug FFI function eliminates one
of the ToCss variants, eliminating 54.4k, as well as a bunch of other
<1k functions. Removing the public trait implementation of Debug for the
font metrics provider eliminates the last Debug impl from stylo.

MozReview-Commit-ID: nIfQ3sy4OW
2018-01-15 17:24:27 -08:00