Commit graph

6124 commits

Author SHA1 Message Date
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
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
bors-servo
7b92eb932b Auto merge of #19760 - emilio:ruby-display-adjust, r=upsuper
style: Ruby style adjustments shouldn't reset mOriginalDisplay.

This matches what Gecko does:

  https://searchfox.org/mozilla-central/rev/7476b71e0010ab3277b77cc0ae4d998c4b1d2b64/layout/style/GeckoStyleContext.cpp#992

And it's conceptually more right, since we ideally shouldn't mutate
mOriginalDisplay from 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/19760)
<!-- Reviewable:end -->
2018-01-13 13:16:06 -06:00
bors-servo
08fc9f190d Auto merge of #19756 - bholley:avoid_debug_impls_in_release, r=emilio
Avoid entraining various Debug impls in release builds

See https://bugzilla.mozilla.org/show_bug.cgi?id=1351737#c29

This patch saves more than 80k of code size.

<!-- 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/19756)
<!-- Reviewable:end -->
2018-01-13 11:52:15 -06: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
Emilio Cobos Álvarez
72e62fe308
style: Ruby style adjustments shouldn't reset mOriginalDisplay.
This matches what Gecko does:

  https://searchfox.org/mozilla-central/rev/7476b71e0010ab3277b77cc0ae4d998c4b1d2b64/layout/style/GeckoStyleContext.cpp#992

And it's conceptually more right, since we ideally shouldn't mutate
mOriginalDisplay from StyleAdjuster.
2018-01-13 13:21:58 +01:00
Emilio Cobos Álvarez
76f22adccc
style: Adjust the writing-mode fixup to call set_adjusted_display on Servo.
This is functionally equivalent right now (set_adjusted_display will just do
set_display), but won't be after #19709.
2018-01-13 12:57:02 +01: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
ac74cf7a60 Add machinery to assert single-threadedness from geckolib.
MozReview-Commit-ID: 9LBNm2h5Ct3
2018-01-12 10:19:06 -08:00
CYBAI
a061f2a89f Use Python's True instead of string for arbitrary Python code in mako 2018-01-12 10:17:37 -08:00
Igor Gutorov
c72066af2d style: Move -moz-context-properties outside of mako 2018-01-12 17:46:02 +02:00
Simon Sapin
c14b766ff5 Rename SelectorMethods to Visit, after its one method. 2018-01-12 15:26:56 +01:00
bors-servo
50e4171958 Auto merge of #19747 - emilio:doc-state-invalidator, r=upsuper
style: Add a document state invalidator.

Don't use it yet (since I was working from a Servo tree). Will hook it up and improve in the Gecko bug.

Right now it takes a `StyleRuleCascadeData`, which means that if all the origins in the document have state selectors we could do just one walk over the tree and not multiple, that will be improved.

Other than that, this is completely untested of course, but I prefer to land it, given I don't think it's complex, and work on the Gecko integration separately. The reason for this is that I also plan to fix the `<slot>` bugs, which will change `StyleRuleCascadeData` and such, and I want the two bugs to conflict as little as possible.

<!-- 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/19747)
<!-- Reviewable:end -->
2018-01-12 05:09:04 -06:00
Emilio Cobos Álvarez
335ca47361
style: Use Default for ExtraStyleData instead of Option. 2018-01-12 12:08:47 +01:00
Emilio Cobos Álvarez
9a1f20f1e8
style: Add a comment about figuring out what the best way to deal with XBL is. 2018-01-12 12:08:46 +01:00
Emilio Cobos Álvarez
a69d229615
style: Use a more compact form for should_process_descendants. 2018-01-12 12:08:43 +01:00
Emilio Cobos Álvarez
5b7d9eb94a
style: Add a document state invalidator. 2018-01-12 12:08:42 +01:00
Emilio Cobos Álvarez
2c1d72ad1a
style: Track document state dependencies in the invalidation maps. 2018-01-12 12:08:41 +01:00
Emilio Cobos Álvarez
14661e470f
style: Add a couple FIXMEs I've noticed while working on this.
::slotted is hard.
2018-01-12 12:08:40 +01:00
Emilio Cobos Álvarez
cb1a951477
style: Allow storing a DocumentState for invalidation. 2018-01-12 12:08:39 +01:00
Emilio Cobos Álvarez
1e27f2883b
selectors: Allow defining an implementation-dependent field in the matching context. 2018-01-12 12:08:38 +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
268f0f75b9
style: Factor out a few invalidation functions that are going to be shared soon. 2018-01-11 14:49:31 +01:00
Emilio Cobos Álvarez
b91efadd8d
style: Move invalidation::element::collector to invalidation::element::state_and_attributes.
Since it's what that file is about.
2018-01-11 14:49:31 +01:00
Emilio Cobos Álvarez
b6a2bff032
style: Move :-moz-locale-dir matching to rust. 2018-01-11 14:47:29 +01:00
bors-servo
f47cd758fa Auto merge of #19743 - EdgarChen:unresolved, r=heycam
style: Remove :unsolved pseudo-class

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

This is the servo part changes of https://bugzilla.mozilla.org/show_bug.cgi?id=1417829.

---
<!-- 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 https://bugzilla.mozilla.org/show_bug.cgi?id=1417829.

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because this PR is to remove a feature.

<!-- 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/19743)
<!-- Reviewable:end -->
2018-01-10 21:06:04 -06:00
CYBAI
2bc02bc78d style: Move paint-order outside of mako 2018-01-10 21:26:33 +08:00
Edgar Chen
4c778b34e6 style: Remove :unsolved pseudo-class
This is the servo part changes of https://bugzilla.mozilla.org/show_bug.cgi?id=1417829.
2018-01-10 17:20:06 +08:00
bors-servo
e2c89df8ee Auto merge of #19734 - emilio:less-indirection, r=mbrubeck
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.

<!-- 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/19734)
<!-- Reviewable:end -->
2018-01-09 23:34:15 -06: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
3595c98411
style: Use Option::get_or_insert_with.
Less unwraps is better.
2018-01-10 03:39:29 +01:00
Emilio Cobos Álvarez
bfc91c5e12
style: Update bindings. 2018-01-09 14:26:06 +01:00
Emilio Cobos Álvarez
26c7d307b7
style: rename normal_style_rule_data to normal_rule_data for consistency.
MozReview-Commit-ID: HyWAsI7VP2p
2018-01-09 14:26:05 +01:00