Commit graph

404 commits

Author SHA1 Message Date
Hiroyuki Ikezoe
2c0b821564 Make cascade_with_rules() take a boolean representing whether the cascade is for pseudo element or not.
cascade_with_rules() doesn't mutate any already-computed styles.
2017-04-06 10:08:51 +09:00
Hiroyuki Ikezoe
c22d4e518c Make cascade_with_rules take SharedStyleContext instead StyleContext. 2017-04-06 10:08:50 +09:00
Bobby Holley
3f0d022ba2 Use a more compact representation to store eager pseudo-elements.
This means that ElementStyles only need a single word to store eager pseudos.

MozReview-Commit-ID: 5bDXlDweN46
2017-04-03 14:34:23 -07:00
Bobby Holley
1ff008caa3 Improve some ergonomics around pseudo-elements.
I think a lot of the current indirection predates the crate merge.

MozReview-Commit-ID: FM28dgZa5go
2017-04-03 12:35:14 -07:00
Hiroyuki Ikezoe
2513c8e24a Call UpdateEffectProperties for stylo. 2017-03-27 17:38:33 +09:00
Hiroyuki Ikezoe
4183b0dff2 Introduce UpdateAnimationTasks to perform a bunch of animation's tasks in a SequentialTask.
The UpdateAnimationsTasks is a bitflags and each bit is generated from
Gecko's UpdateAnimationsTasks (enum class) values for matching values
between C++ and Rust. For this reason, the bitflags is annotated as
(feature = "gecko"), as a result update_animations() which uses this bitflags
also became gecko-only function.
2017-03-27 17:38:09 +09:00
Hiroyuki Ikezoe
7c4f4d5be9 Introduce eRestyle_CSSAnimations.
RESTYLE_CSS_ANIMATIONS will be individually processed prior to other restyle
hints in a traversal.
2017-03-27 06:19:51 +09:00
Hiroyuki Ikezoe
6d5ee2e361 Introduce a closure to replace rule nodes.
We need a scope to restore rule_node_changed that were borrowed by the closure.
This closure function will be used for animation-only restyles as well.
2017-03-27 06:19:51 +09:00
Hiroyuki Ikezoe
6bbd8b09f4 Add a function to get after-change style for CSS Transition. 2017-03-24 10:39:50 +09:00
Hiroyuki Ikezoe
dde46c5c90 Make cascade_internal() reusable with rule nodes.
A new function, cascade_with_rules, takes StrongRuleNode
and computes cascading result values with the StrongRuleNode.
This new function will be used for getting after-change-style
for CSS Transitions.
2017-03-24 10:39:49 +09:00
Hiroyuki Ikezoe
4c4b01954c Drop mut from pseudo_style for the argument of cascade_internal. 2017-03-24 09:56:56 +09:00
Emilio Cobos Álvarez
a9b133bcbb
Bug 1345950: stylo: Fix slow selector flags. r=bholley
MozReview-Commit-ID: QwuSxulNG0
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-22 11:21:24 +01:00
Simon Sapin
1bacd0eb15 Move all PropertyDeclarationBlock from RwLock<_> to Locked<_> 2017-03-19 22:30:38 +01:00
Simon Sapin
aeffca2a59 Replace RwLock<StyleRule> with Locked<StyleRule> 2017-03-19 22:30:37 +01:00
Hiroyuki Ikezoe
88c69206eb Do not call get_animation_rules for pseudo elements other than ::before and ::after. 2017-03-17 12:27:51 +09:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter. 2017-03-14 00:49:18 +01:00
Emilio Cobos Álvarez
eaf27ccfa0
style: Kill SharedStyleContext::default_computed_values.
Now that cascade() gets a Device, we can use the default computed values from
there to avoid propagating that state all over the place.

Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-14 00:49:16 +01:00
Matt Brubeck
16e318d055
Add support for non-standard -moz color keyword values.
Closes #15928
2017-03-14 00:49:08 +01:00
bors-servo
06f99c13f2 Auto merge of #15913 - emilio:viewport-size, r=heycam,hiro
Use the proper viewport size for stylo

Reviewed upstream at [bug 1303229](https://bugzil.la/1303229).

<!-- 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/15913)
<!-- Reviewable:end -->
2017-03-11 04:40:31 -08:00
Emilio Cobos Álvarez
95ccfa748e
Bug 1303229: Get the proper viewport size for stylo. r=heycam
At least until we support scrollbars properly, this size is going to be the
correct one. I've left a TODO to grab the proper one once we support it.

This allows to trivially test viewport units for now.

MozReview-Commit-ID: JdaZ6WlZ2C6
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-11 11:54:12 +01:00
Emilio Cobos Álvarez
d3e7f1f0f4
style: Iterate the LRU cache contents from back to front.
We put the more recently used item last, so iterating then from left to right is
pointless.
2017-03-11 11:31:10 +01:00
Hiroyuki Ikezoe
c32ba98031 Skip update_animations if we have no running animations and the element becomes display:none. 2017-03-10 11:37:05 +09:00
Hiroyuki Ikezoe
9ff99d4608 Update CSS animations in a SequentialTask.
We create the SequentialTask only if:

* We have no old computed values and we have animation name style in the new
  computed values.
* Any animation properties is changed.
* display property is changed from 'none' and we have animation name style.
* display property is changed to 'none'.

In a subsequent patch we skip the SequentialTask if we have no running
animations and the display propery is changed to 'none'.
2017-03-10 11:36:58 +09:00
Hiroyuki Ikezoe
fdb8c48094 Split off animation related process in a function. 2017-03-10 11:09:18 +09:00
Emilio Cobos Álvarez
727be58b4a
style: Simplify style sharing code. 2017-03-09 19:31:03 +01:00
Hiroyuki Ikezoe
6503717c20 Skip animation and transition process in servo side.
Otherwise they trigger their animations and transitions.
We will introduce gecko's own process in bug 1341985 (animations) and
bug 1341372 (transitions).
2017-03-07 13:27:55 +09:00
Xidorn Quan
6273fa0305 Make animation-name parse none 2017-03-06 22:00:04 +11:00
Bobby Holley
3a56899201 Revert "Auto merge of #15793 - upsuper:animation, r=emilio,bholley"
This reverts commit 7cd4c69c40, reversing
changes made to 1b1fadb8b8.
2017-03-03 11:50:15 -08:00
Xidorn Quan
550c64cbf2 Make animation-name parse none 2017-03-03 16:12:06 +11:00
Emilio Cobos Álvarez
6875c65d37
Bug 1341083: Implement dynamic restyling for display: contents. r=heycam
MozReview-Commit-ID: KimTU2j4V4p
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-02-25 19:58:56 +01:00
Bobby Holley
d9606a4fae Implement "handled for descendants" tracking for RestyleDamage.
MozReview-Commit-ID: Bbk99ogILXC
2017-02-17 10:15:53 -08:00
Bobby Holley
1f4f099efe Clean up and simplify the accumulation of restyle damage. 2017-02-10 10:34:28 -08:00
Bobby Holley
0e3aeac922 Stop returning rule nodes from match_element and overhaul style calculation logic. 2017-02-10 10:34:28 -08:00
Bobby Holley
5873de3fb6 Allow the ComputedValues in ComputedStyle to be null.
This is necessary to start synthesizing the styles in match_element and avoid
round-tripping them through the caller.
2017-02-10 10:34:27 -08:00
Bobby Holley
9e860df9df Bug 1336646 - Apply selector flags during traversal. r=emilio 2017-02-08 19:21:05 -08:00
Bobby Holley
e7a8f5ec30 Bug 1336646 - Use the bloom filter for manual style resolves and pass a mutable StyleContext into match_element. r=emilio
We need to do something here to avoid a double-borrow when passing a mutable
StyleContext to match_element. After some discussion on IRC, we decided that
building the bloom filter for this case is probably worthwhile.
2017-02-08 17:09:35 -08:00
Emilio Cobos Álvarez
2594cb9c33
style: Refactor the traversal so it's more easy to read and straight-forward. 2017-02-02 11:58:36 +01:00
Emilio Cobos Álvarez
8859aa004f
style: Avoid selector-matching when only the style attribute is changed. 2017-02-02 11:58:08 +01:00
Emilio Cobos Álvarez
314f2ce714
style: Define a CascadeLevel enum, and make the rule tree operate on it.
We'll use this level to know where to stop replacing nodes in the tree.
2017-01-30 23:53:53 +01:00
Boris Chiou
19aea7ea78 Bug 1317209 - Part 5: Support transition cascade level. r=emilio
Support a new enum, EffectCompositor_CascadeLevel, which is an equivalent of
EffectCompositor::CascadeLevel in Gecko.
2017-01-24 18:44:07 +08:00
Boris Chiou
3a89e89952 Bug 1317209 - Part 4: Put animation rule to cascade. r=emilio
We try to get the servo animation rule and declarations during elements
matching, and put the rule to the right priority.
Note: According to CSS Cascade Level spec, Animations is between
      Important author declarations and Normal override declarations.
2017-01-24 16:32:20 +08:00
Emilio Cobos Álvarez
6f3957a549
Bug 1331272: style: Unify restyle-damage display: none checks.
They were formerly different because we used the element check to cull the
traversal.

Now this is no longer true, so we can just unify them.

Also, update a no-longer up-to-date comment on that.

MozReview-Commit-ID: FH5GH7NfI8G
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-01-16 09:39:14 +01:00
Bobby Holley
3fcfc9c5fc Bug 1325734 - Simplify ElementData and eliminate the concept of consuming styles. r=emilio 2017-01-09 11:51:37 -08:00
Emilio Cobos Álvarez
cf65f09794
style: Allow caching elements with non-common style affecting attributes.
We have already that check in place, see
`match_same_non_common_style_affecting_attribute_selectors`.
2017-01-07 01:53:16 +01:00
Emilio Cobos Álvarez
ac8547416d
style: Move relations_are_shareable to matching.rs
It's only used there.
2017-01-07 01:53:15 +01:00
Boris Zbarsky
61f6025dc3 Bug 1298588 part 9, servo piece. Pass through useful default styles to cascade(). r=bholley 2017-01-04 23:13:46 -05:00
Emilio Cobos Álvarez
7bf80e5d50
style: Document the matching module. 2016-12-31 23:24:18 +01:00
Bobby Holley
ab71b29959 style: Add a special, explicit path for lazy style resolution and use it for GetComputedStyle.
MozReview-Commit-ID: KAM9mVoxCHE
2016-12-28 11:52:46 +08:00
bors-servo
9d320d5a34 Auto merge of #14518 - mbrubeck:rowspan2, r=notriddle
Fix inline layout of table cells impacted by rowspan

This is part of the fix for #11297. This PR fixes the inline layout of table cells impacted by row-spanning cells from previous rows. A separate PR to follow will fix the table block size calculations to account for rowspan.

This PR doesn't yet include any test changes. If it doesn't cause any existing tests to pass, I will add a new test to it.

r? @pcwalton

<!-- 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/14518)
<!-- Reviewable:end -->
2016-12-26 10:09:09 -08:00
Bobby Holley
96dc0d1eac Hoist SendElement into dom.rs, label construction as unsafe, and add corresponding SendNode. 2016-12-22 10:42:53 -08:00