Commit graph

3391 commits

Author SHA1 Message Date
Paul Rouget
019fdaa1bd remove bhtml 2018-02-11 08:02:39 +01:00
Xidorn Quan
b9ef2bbdd5 Return whether property was removed from Servo_DeclarationBlock_RemoveProperty. 2018-02-10 19:58:30 +11:00
Emilio Cobos Álvarez
a254dc12a4
style: Move author-style-disabled handling to push_applicable_declarations.
This will make it easier to handle it properly for Shadow DOM, though this patch
doesn't do that.

This also makes some method inline and infallible for convenience, since nobody
checks the errors anyway.

Bug: 1436798
Reviewed-by: bholley
MozReview-Commit-ID: Hq3erAUs5tf
2018-02-09 19:44:53 +01:00
Emilio Cobos Álvarez
438251cbfc
style: Make AuthorStylesEnabled an enum.
Chances are we need to pass it around in a bit.

Also invert the boolean because I don't want to reason about double negations,
even if they're simple.

MozReview-Commit-ID: KhX4lDKwDoj
2018-02-09 13:27:35 +01:00
Manish Goregaokar
9d23962d8e Remove traversal telemetry 2018-02-08 03:04:34 -08:00
bors-servo
e57319a734
Auto merge of #19973 - emilio:media-feature-change, r=xidorn
style: Rework how media feature changes are handled for XBL.

Bug: 1435939
Reviewed-by: xidorn

<!-- 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/19973)
<!-- Reviewable:end -->
2018-02-07 08:02:34 -05:00
Emilio Cobos Álvarez
0907c21600
style: Process all the MediumFeatureChanges at the same time.
This avoids resetting the computed values all the time, and paves the way to
avoid using a StyleSet on XBL bindings / Shadow DOM, which we should really
really do because it's super overkill.

There are some XBL bits that are kind of hacky, in particular the mStylistDirty,
but they'll go away soon, since I want to redo how we store styles in XBL.

The alternative, which was returning an array of indices or something was even
more hacky I think.

Bug: 1435939
Reviewed-by: xidorn
MozReview-Commit-ID: 6tEl5gebXVF
2018-02-07 13:29:58 +01:00
Emilio Cobos Álvarez
9324feb994
style: Don't reset the default computed values if they cannot change.
This actually fixes the bug.

Bug: 1435939
Reviewed-by: xidorn
MozReview-Commit-ID: AejqMLZzpQp
2018-02-07 13:29:43 +01:00
bors-servo
5d209a70ab
Auto merge of #19970 - janczer:change_debug_assertions, r=emilio
Change debug assertions to specific ones

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #19962 (github issue number if applicable).

<!-- 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/19970)
<!-- Reviewable:end -->
2018-02-07 06:20:36 -05:00
janczer
661d234c3c Change debug assertions to specific ones 2018-02-07 09:21:24 +01:00
bors-servo
dc446198a7
Auto merge of #19966 - emilio:bye-gecko-size, r=nox
style: Get rid of gecko_size_type.

It's a hack, should die.

<!-- 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/19966)
<!-- Reviewable:end -->
2018-02-06 21:15:07 -05:00
Emilio Cobos Álvarez
32c409d5aa
style: Get rid of gecko_size_type.
This also fixes a style sharing issue with MaxLength, anecdotally.
2018-02-07 02:05:30 +01:00
Emilio Cobos Álvarez
173c9aee61
style: Don't serialize default values of the font shorthand.
This makes us consistent with the old style system and Blink / WebKit.

Not adding a test because shorthands serialization is a mess... :(

Anyway, nothing like fixing bugs by removing code.

Bug: 1436031
2018-02-06 21:42:42 +01:00
Emilio Cobos Álvarez
a6fa64fc79
ports: Remove leftover CEF config file. 2018-02-04 19:01:00 +01:00
Emilio Cobos Álvarez
349d6e7167
style: Cleanup StyleBuilder.
This is in preparation of a cascade optimization for custom properties.

This fixes various fishiness around our StyleBuilder stuff. In particular,
StyleBuilder::for_derived_style (renamed to for_animation) is only used to
compute specified values, and thus doesn't need to know about rules, visited
style, or other things like that.

The flag propagation that was done in StyleAdjuster is now done in StyleBuilder,
since we know beforehand which ones are always inherited, and it simplified the
callers and the StyleAdjuster code. It also fixed some fishiness wrt which flags
were propagated to anon boxes and text.

The text-decoration-lines bit is interesting, because the way it was implemented
in #17722 meant that display: contents elements did get HAS_DECORATION_LINES
flags only if its parent also had it, so in practice the Contents check
preserves behavior, but it's only an optimization looking at Gecko's call-sites,
so we can remove it too.

MozReview-Commit-ID: 6BHCyEO2U8c
2018-02-03 18:07:25 +01:00
Emilio Cobos Álvarez
7fb470c373
style: Remove some uses of StyleBuilder::for_derived_style.
for_derived_style(default_values) is effectively for_inheritance(default_values).

MozReview-Commit-ID: DfTeD49uTlp
2018-02-03 17:40:35 +01:00
Emilio Cobos Álvarez
3b34d734e6
style: Refactor font-feature-settings and font-variation-settings.
This fixes all known issues with serialization and parsing of these two
properties, and in particular calc handling and such:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1434692
  https://bugzilla.mozilla.org/show_bug.cgi?id=1434724

Also does a fair amount of cleanup and all that, which was needed.
2018-02-01 12:54:45 +01:00
bors-servo
4bd0590117
Auto merge of #19915 - emilio:color-errors-whee, r=jdm
stylo: Fix missing null terminator in error reporting code.

This was causing the patch in bug 1420026 to fail.

<!-- 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/19915)
<!-- Reviewable:end -->
2018-01-31 12:37:33 -06:00
Emilio Cobos Álvarez
d82c54bd30
stylo: Fix missing null terminators in error reporting code.
This was causing the patch in bug 1420026 to fail.
2018-01-31 17:49:15 +01:00
Simon Sapin
cace4fc6eb Remove #![deny(warnings)]
We already have https://github.com/servo/servo/pull/19612
to deny warnings at the time of landing into master.
But it’s not useful to break the build when later compiler
with a more recent Rust version that has introduced new warnings:

https://bugzilla.mozilla.org/show_bug.cgi?id=1434619
2018-01-31 17:00:27 +01:00
Paul Rouget
2282292fa4 Drop CEF support 2018-01-31 06:36:21 +01:00
Linus Färnstrand
b2ec9792f6 Upgrade all deps using core-foundation 2018-01-29 00:38:11 +01:00
Emilio Cobos Álvarez
657d8b8e31
style: Look at the snapshots when invalidating due to stylesheet changes.
Otherwise removal of stylesheets may get out of sync with other DOM changes, and
we may fail to invalidate the style of the affected elements.

Bug: 1432850
Reviewed-by: bz
MozReview-Commit-ID: DrMTgLzQcnk
2018-01-27 02:34:27 +01:00
CYBAI
31631cdc47 Use specific negative assertion for gultin window 2018-01-26 02:24:30 +08:00
CYBAI
a13a9f8f8d Use specific negative assertion for cef window 2018-01-26 02:24:21 +08: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
f5dd50dcfd Avoid some unnecessary intermediate utf8 strings in glue.rs.
MozReview-Commit-ID: 79qv87uPzjR
2018-01-22 13:59:45 -08:00
Simon Sapin
897a5b39c5 Fix some "unnecessary parentheses" warnings 2018-01-22 17:41:25 +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
Emilio Cobos Álvarez
c49434726e
style: Skip a function for the static tests. 2018-01-20 02:10:58 +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
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
Bobby Holley
f858ce91e8 Avoid entraining various Debug impls in release builds.
MozReview-Commit-ID: Lp9i9EI5qdU
2018-01-13 09:51:46 -08:00
bors-servo
6ca651c0c8 Auto merge of #19751 - servo:selectors, r=bholley
Clean up the selectors crate for a new crates.io release

<!-- 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/19751)
<!-- Reviewable:end -->
2018-01-12 16:55:12 -06:00
Bobby Holley
2b1c1d7b68 Avoid atomic overhead in Servo_Element_IsDisplayNone.
This reduces time spent in NoteDirtyElement by about 15% in the testcase. Even
though the subsequent patch will cause us to call Servo_Element_IsDisplayNone less
for this particular testcase, it could still be hot on other testcases, and so
it's worth optimizing.

MozReview-Commit-ID: 3F3Zfp48dDW
2018-01-12 10:19:07 -08:00
Bobby Holley
ac74cf7a60 Add machinery to assert single-threadedness from geckolib.
MozReview-Commit-ID: 9LBNm2h5Ct3
2018-01-12 10:19:06 -08:00
Simon Sapin
7d1dc7286a Move selectors size_of tests to Stylo tests 2018-01-12 15:10:56 +01:00
Bobby Holley
fd41646699 Adjust size of gecko ComputedValues struct for removal of separate lazy pseudo cache. 2018-01-11 10:15:35 -08:00
Emilio Cobos Álvarez
8f6455b9df
style: Remove some unneeded indirection.
All TElement's implement Copy, and are just pointers, so the double indirection
is stupid.

I'm going to try to see if removing this double-indirection fixes some
selector-matching performance, and this is a trivial pre-requisite while I wait
for Talos results.
2018-01-10 03:56:34 +01:00
Emilio Cobos Álvarez
ce1d8cd232
style: Make invalidation state also be with the ::slotted rules.
MozReview-Commit-ID: GYmsXYvL9vj
2018-01-09 14:26:03 +01: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
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
tigercosmos
6d6491e814 deny warnings 2017-12-22 03:34:11 +08:00