Commit graph

490 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
335ca47361
style: Use Default for ExtraStyleData instead of Option. 2018-01-12 12:08:47 +01:00
Emilio Cobos Álvarez
cb1a951477
style: Allow storing a DocumentState for invalidation. 2018-01-12 12:08:39 +01:00
Emilio Cobos Álvarez
b6a2bff032
style: Move :-moz-locale-dir matching to rust. 2018-01-11 14:47:29 +01: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
Emilio Cobos Álvarez
b26f3280d2
style: Add invalidation support for ::slotted().
Bug: 1424607
Reviewed-by: heycam
MozReview-Commit-ID: 8pIVUx27o7x
2018-01-09 14:26:02 +01:00
Emilio Cobos Álvarez
040379208e
style: Implement GeckoElement::assigned_slot.
This allows to selector-match ::slotted, though we still don't parse it.

Bug: 1425755
Reviewed-by: heycam
MozReview-Commit-ID: ItELHkf2PMl
2018-01-08 19:01:41 +01: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
bors-servo
f71fb8bddc Auto merge of #19654 - emilio:geckolib-nightly, r=jdm
style: Allow building stylo with rust nightly.

See individual commits for details.

<!-- 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/19654)
<!-- Reviewable:end -->
2018-01-03 12:01:42 -06:00
Emilio Cobos Álvarez
51e2942c25
style: Make GetFlattenedTreeParent more straight-forward.
Now that accessing nsIContent slots is not a blob of virtual function calls, we
should be able to unify logic here, and speed up the not-so-rare case for
chrome, while keeping the usual case fast.

Bug: 1427511
Reviewed-by: smaug
MozReview-Commit-ID: 87iY5Cbhx4T
2018-01-02 16:25:59 +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
bors-servo
1970e82b0d Auto merge of #19666 - emilio:root-and-item, r=upsuper
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.

<!-- 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/19666)
<!-- Reviewable:end -->
2017-12-31 07:01:10 -06: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
dd1cef1a6c
style: Stop duplicating slots.
Bug: 1427001
Reviewed-by: smaug
MozReview-Commit-ID: Cq647BcOzbe
2017-12-31 09:01:55 +01:00
Gecko Backout
cf8b8db87d Backed out changeset dda1c7951937 for build bustage force-cargo-library-build. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/19660
2017-12-31 01:17:32 +00:00
Emilio Cobos Álvarez
72e0bfa52f
style: Stop duplicating slots.
Bug: 1427001
Reviewed-by: smaug
MozReview-Commit-ID: Cq647BcOzbe
2017-12-30 12:36:52 +01:00
Emilio Cobos Álvarez
99dfc67d60
style: Specify the type of a pointer.
This avoids nightly warnings.
2017-12-29 19:17:29 +01:00
Matt Brubeck
3005a26daf style: Use the ? operator for Option 2017-12-09 08:29:53 -08:00
Emilio Cobos Álvarez
3119db724a
selectors: Simplify :visited by only using the "is inside link" information.
Right now we go through a lot of hoops to see if we ever see a relevant link.

However, that information is not needed: if the element is a link, we'll always
need to compute its visited style because its its own relevant link.

If the element inherits from a link, we need to also compute the visited style
anyway.

So the "has a relevant link been found" is pretty useless when we know what are
we inheriting from.

The branches at the beginning of matches_complex_selector_internal were
affecting performance, and there are no good reasons to keep them.

I've verified that this passes all the visited tests in mozilla central, and
that the test-cases too-flaky to be landed still pass.
2017-12-08 05:35:12 +01:00
Emilio Cobos Álvarez
af879523ea
style: Make all keywords CamelCase for consistency.
This prevents confusion and paves the ground for derive(Parse) of them.
2017-12-06 02:35:10 +01:00
Emilio Cobos Álvarez
720b88b028
style: Inline Gecko_GetSMILOverrideDeclarationBlock.
Bug: 1422641
Reviewed-by: xidorn, Manishearth
MozReview-Commit-ID: E8cM7zRZHn1
2017-12-05 11:21:31 +01:00
Emilio Cobos Álvarez
ecb92065d3
style: Inline Gecko_Namespace.
Bug: 1422636
Reviewed-by: xidorn
MozReview-Commit-ID: FFdmaYCDxnv
2017-12-05 11:13:10 +01:00
Emilio Cobos Álvarez
026bacafb3
style: Inline the Rust bits of GetDocumentState.
Bug: 1422633
Reviewed-by: xidorn
MozReview-Commit-ID: 9zvZF72ljS
2017-12-05 11:12:54 +01:00
bors-servo
45bbbac9d9 Auto merge of #19454 - emilio:has-class-is-stupid, r=upsuper
style: Add a missing fast-path in GeckoElement::each_class.

This shows up when inserting elements in the bloom filter.

<!-- 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/19454)
<!-- Reviewable:end -->
2017-12-02 01:40:00 -06:00
Emilio Cobos Álvarez
d570fc8164
style: Remove pretty useless layer of abstraction. 2017-12-02 03:23:22 +01:00
bors-servo
f7aa22a87e Auto merge of #19451 - emilio:inlining-is-fun, r=upsuper
style: Inline some things that should never ever appear in a profile.

<!-- 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/19451)
<!-- Reviewable:end -->
2017-12-01 16:52:34 -06:00
Emilio Cobos Álvarez
a4cb6b8f09
style: Formatting nits in snapshot_helpers-related code. 2017-12-01 20:37:45 +01:00
Emilio Cobos Álvarez
bea7b31445
style: Add a missing fast-path in GeckoElement::each_class.
This shows up when inserting elements in the bloom filter.
2017-12-01 20:37:28 +01:00
Emilio Cobos Álvarez
382a89511a
style: Add a fast-path for GeckoElement::is_root. 2017-12-01 20:17:53 +01:00
Emilio Cobos Álvarez
2bbeda97d3
style: Inline some things that should never ever appear in a profile. 2017-12-01 20:04:33 +01:00
bors-servo
006202732f Auto merge of #19195 - wilsoniya:issue-16840, r=emilio
style: :dir() pseudo class now represented by enum

`:dir()` pseudo class param now represented as enum variants.

---
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16840
- [X] There are tests for these changes

<!-- 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/19195)
<!-- Reviewable:end -->
2017-11-21 02:56:49 -06:00
Emilio Cobos Álvarez
6a6b5a53ee
style: Account for fallback content in GetFlattenedTreeParent.
Otherwise we may inappropriately style it or what not. This asserts with the
patches of bug 1414999 plus the cleanup of bug 1418456, since we no longer do
StyleNewChildren (which walks over the flattened tree children).

Too bad that GetXBLBinding is a virtual call in Gecko, probably can do just
MAY_BE_IN_BINDING_MGR...

Bug: 1418560
Reviewed-by: heycam
MozReview-Commit-ID: CNU0YdKeaR0
2017-11-20 15:49:09 +01:00
Michael Wilson
10f3ef42bb style: :dir() pseudo class now represented by enum
Fixes #19195
2017-11-15 18:12:44 -08:00
bors-servo
85fa6409bb Auto merge of #19226 - emilio:inline-qs, r=nox
style: Sprinkle some inline in trivial methods.

These methods are instantiated by the Gecko library, and used during
querySelector, which means that they end up being super-hot in micro-benchmarks.

MozReview-Commit-ID: K1XJb0QyX5a

<!-- 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/19226)
<!-- Reviewable:end -->
2017-11-15 09:22:14 -06:00
Emilio Cobos Álvarez
28c04278e1
style: Sprinkle some inline in trivial methods.
These methods are instantiated by the Gecko library, and used during
querySelector, which means that they end up being super-hot in micro-benchmarks.

MozReview-Commit-ID: K1XJb0QyX5a
2017-11-15 13:45:32 +01:00
Emilio Cobos Álvarez
69ddb9501b
style: Remove some uses of unused unsafe. 2017-11-15 13:26:24 +01:00
Emilio Cobos Álvarez
18ac41fe87
style: Inline a bunch of stuff, fixup indentation of a couple things.
MozReview-Commit-ID: CgUNMeBDOCw
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-11-04 11:34:40 +01:00
Emilio Cobos Álvarez
f993693eb2
style: Introduce TNode::is_in_document.
MozReview-Commit-ID: BrhhoOghtUL
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-11-04 11:34:37 +01:00
Emilio Cobos Álvarez
2783297fa9
style: Add a Document::elements_with_id API.
MozReview-Commit-ID: BNtbJp0RI68
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-11-04 11:34:36 +01:00
Gecko Backout
8f8fd517ed Backed out changeset dbd300f4d75b for build bustage. r=backout on a CLOSED TREE
Backs out https://github.com/servo/servo/pull/19108
2017-11-03 23:56:42 +00:00
Emilio Cobos Álvarez
bcc9c62620
style: Inline a bunch of stuff, fixup indentation of a couple things.
MozReview-Commit-ID: CgUNMeBDOCw
2017-11-03 14:18:49 +01:00
Emilio Cobos Álvarez
be1ba90284
style: Introduce TNode::is_in_document.
MozReview-Commit-ID: BrhhoOghtUL
2017-11-03 14:18:43 +01:00
Emilio Cobos Álvarez
db65c2d346
style: Add a Document::elements_with_id API.
MozReview-Commit-ID: BNtbJp0RI68
2017-11-03 13:49:15 +01:00
Bastien Orivel
29b4eec141 Bump bitflags to 1.0 in every servo crate 2017-10-30 23:36:06 +01:00
Emilio Cobos Álvarez
0df912be93
style: Make style sharing look at XBL / Shadow DOM rules.
Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU
2017-10-28 12:43:43 +02:00
Gecko Backout
cda9d186c1 Backed out changeset fc813bf68348 for failing reftest layout/reftests/bugs/272646-1.xul on OS X. r=backout
Backs out https://github.com/servo/servo/pull/19045
2017-10-28 08:08:47 +00:00
bors-servo
592c513c28 Auto merge of #19045 - emilio:shadow-style-sharing, r=bzbarsky
style: Make style sharing look at XBL / Shadow DOM rules.

Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU

<!-- 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/19045)
<!-- Reviewable:end -->
2017-10-27 19:14:20 -05:00
Emilio Cobos Álvarez
4b43b7c7f8
style: Make style sharing look at XBL / Shadow DOM rules.
Bug: 1412251
Reviewed-by: bz
MozReview-Commit-ID: II6lk6OmSZU
2017-10-28 02:13:59 +02:00
Emilio Cobos Álvarez
dd5cd29a61
style: Introduce TDocument::is_html_element and TDocument::quirks_mode.
This allows some code to read a bit nicer, and stop passing down quirks mode to
querySelector / querySelectorAll.
2017-10-26 13:22:31 +02:00
Emilio Cobos Álvarez
bfa7cd7d9e
style: Add TNode::owner_doc. 2017-10-26 13:03:11 +02:00
Emilio Cobos Álvarez
4d4fa69018
style: Introduce a TDocument trait.
This will be useful for querySelector optimizations.
2017-10-26 12:49:13 +02:00