Commit graph

253 commits

Author SHA1 Message Date
Boris Chiou
eb8db7b892 Bug 1341372 - Part 6: Trigger transitions.
1. We need to call get_after_change_style, which is the computed styles
   without transition rules, while process_animations.
2. If we have after-change style, we may replace the new computed values with
   after-change style, according to whether we really need to update
   transitions.
3. There are some cases we don't update transitions, so we need to early
   return. might_needs_transitions_update() will check it first and it
   will filter out most common cases.
4. needs_transitions_update() will check each property and existing running
   transitions to make sure we really don't need to update transitions.
   The logic of this function is similar with that of
   nsTransitionManager::DoUpdateTransitions().

MozReview-Commit-ID: 2ccdPjgrxKz
2017-04-17 17:08:54 +08:00
Boris Chiou
b1476f1f81 Bug 1341372 - Part 2: Support has_css_transitions.
Add one FFI to check if there is any transition in CSSTransitionCollection.
This will be used to check if we need to update transition and if we
should compute the after-change style.

MozReview-Commit-ID: 6HpVAtrx6Rc
2017-04-17 17:06:31 +08:00
Boris Chiou
1c1e487491 Bug 1341372 - Part 1: Let animation-only restyle include css-transition.
Animation-only restyle should include both Animation and Transition
cascade levels.

MozReview-Commit-ID: 5l6gaJKbixM
2017-04-17 17:06:12 +08:00
Bobby Holley
297dc33a9f Store slow selector flags in a hashmap.
This reduces the flag setting overhead on a pessimal testcase from over a
second to ~20ms.
2017-04-13 21:52:47 +08:00
Manish Goregaokar
f506c6bcd1 stylo: Disable font metrics 2017-04-13 13:55:25 +08:00
Boris Chiou
9a3905f834 Bug 1343753 - Pass None before change style to Gecko_UpdateAnimations.
CSS Transition is not supported yet, so use None as the parameter.

MozReview-Commit-ID: Kv77lN92ny5
2017-04-12 18:32:51 +08:00
Manish Goregaokar
25667d0321 stylo: Use gecko's font metrics 2017-04-10 14:29:51 +08:00
Manish Goregaokar
2febe7ccde stylo: Use font metrics provider as a cache for font size results 2017-04-09 19:15:37 +08:00
Manish Goregaokar
e402c72d0e stylo: Store font metrics provider in thread local style context 2017-04-09 19:15:35 +08:00
Cameron McCormack
581cefccfe stylo: Don't leak the nsIAtom we get back from Gecko_GetXMLLangValue. 2017-04-05 17:39:40 +08:00
Manish Goregaokar
5d6bc8177e stylo: Add support for xml:lang
MozReview-Commit-ID: E0GpyPKES3k
2017-04-04 21:21:28 -07:00
Manish Goregaokar
8dea66e6f1
stylo: Add support for <math> default language
MozReview-Commit-ID: LhhSBzYjow5
2017-04-04 21:17:06 -07:00
Manish Goregaokar
1c23296d8a
stylo: Add support for <table> color quirk
MozReview-Commit-ID: 56IKARwfbhw
2017-04-04 21:17:04 -07:00
Manish Goregaokar
0392e58a2f
stylo: Add support for text-align match-parent and the <th> -moz-center-or-inherit behavior
MozReview-Commit-ID: GEDM7JfJB8A
2017-04-04 21:16:57 -07:00
Xidorn Quan
3d483a986d Move DUMMY_URL_DATA to glue and use static to avoid shutdown leak. 2017-04-03 22:02:57 +10:00
Xidorn Quan
37585309e9 Use a UrlExtraData type alias to unify url handling logic. 2017-04-03 21:57:16 +10:00
Bobby Holley
7e3671fc4c Introduce is_native_anonymous and cull style traversal of doomed native anonymous content.
MozReview-Commit-ID: LqwmavJnqW
2017-04-01 12:33:37 -07:00
bors-servo
e69bc2e0d3 Auto merge of #16204 - emilio:unify-note-descendants, r=emilio
stylo: Relax assertion that doesn't hold in layout/style/test/test_pseudoelement_state.html

It deserves more investigation, we should probably clear NAC data on
ServoRestyleManager::ClearServoDataFromSubtree, but not worth to keep the tree
orange meanwhile.
2017-03-31 09:05:32 -05:00
Emilio Cobos Álvarez
cdbb2c5d0d
stylo: Relax assertion that doesn't hold in layout/style/test/test_pseudoelement_state.html
It deserves more investigation, we should probably clear NAC data on
ServoRestyleManager::ClearServoDataFromSubtree, but not worth to keep the tree
orange meanwhile.
2017-03-31 16:03:09 +02:00
bors-servo
95e0532dd6 Auto merge of #16196 - emilio:unify-note-descendants, r=bholley
style: Make the servo and gecko implementations of Element::note_descendants equivalent.

<!-- 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/16196)
<!-- Reviewable:end -->
2017-03-31 04:40:13 -05:00
Emilio Cobos Álvarez
a4bc106e07
style: Make the servo and gecko implementations of Element::note_descendants equivalent. 2017-03-31 11:39:19 +02:00
Manish Goregaokar
bfc2cc4ebf stylo: Include content rules from HTMLTableCellElement::WalkContentStyleRules
This also removes the TABLE_ATTRS_DIRTY optimization. Constructing nsMappedAttributes isn't really expensive and we do it all the time anyway.
2017-03-30 20:20:45 -07:00
Emilio Cobos Álvarez
a6277d5513
Bug 1350140: stylo: Implement all the remaining state pseudo-classes. r=heycam
Also implements :link, :visited, and :any-link more efficiently, and stops
matching :-moz-read-only in everything that is not read-write, which is kind of
dumb, and probably creates some artifacts.

MozReview-Commit-ID: 6BQqi7nAWdT
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
2017-03-29 11:52:53 +02: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
0c843d4b7d Add an FFI to check that a given (pseudo-) element has any type of animations or not.
If an element has any type of animations in match_elements(), we need to call
UpdateEffectProperties() to update KeyframeEffectReadOnly::mProperties.
2017-03-27 17:32:18 +09:00
Hiroyuki Ikezoe
661574f9df Add NODE_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO to represent that an element's descendant has animation. 2017-03-27 06:19:51 +09:00
Boris Zbarsky
5a5a6cd876 Implement :required/:optional support for stylo.
Servo side of https://bugzilla.mozilla.org/show_bug.cgi?id=1349659
2017-03-22 20:20:17 -04:00
Matt Brubeck
dbfb3813f6 Bug 1337068 - stylo: :empty, :-moz-first-node, :-moz-last-node, and :-moz-only-whitespace. 2017-03-22 08:18:47 -07: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
Manish Goregaokar
f2f832d1d9 stylo: Support all non-ts pseudos with an argument 2017-03-21 12:33:57 -07:00
Simon Sapin
1bacd0eb15 Move all PropertyDeclarationBlock from RwLock<_> to Locked<_> 2017-03-19 22:30:38 +01:00
Nazım Can Altınova
d23cbd37b8
Stylo: Add support for -moz-* pseudo-classes for alt text 2017-03-18 19:46:53 +03:00
Hiroyuki Ikezoe
b210813124 Put computed values into AnimationValueMap instead of hashtable in gecko.
Before this patch, we store each computed values in a hashtable,
nsRefPtrHashtable<nsUint32HashKey, RawServoAnimationValue>, for all
KeyframeEffectReadOnly on an element, and convert the ServoAnimationValues of
the hashtable into an nsTArray<ServoAnimationValue*> and then convert
the ServoAnimationValues of the nsTArray into PropertyDeclarationBlock
in rust.  This way was really inefficient.
In this patch, we store the computed values into AnimationValueMap and
convert all AnimationValue in the map into PropertyDeclarationBlock
after EffectCompositor::GetAnimationRule.
2017-03-17 12:33:39 +09:00
Hiroyuki Ikezoe
ba18c14b91 Split get_animation_rules into get_animation_rule and get_transition_rule.
If an element has only CSS animations we don't need to get transition rule,
and vice versa. This will be used when we implement eRestyle_CSSAnimations
and eRestyle_CSSTransitions.
2017-03-17 12:28:37 +09:00
Matt Brubeck
2872c8bfab Bug 1340683 - stylo: Implement the :-moz-any pseudo-class 2017-03-16 11:44:47 -07:00
Nazım Can Altınova
bd7c8eb513
Stylo: Add support for :valid/:invalid/:-moz-ui-valid pseudo-classes 2017-03-16 13:44:50 +03:00
Nazım Can Altınova
04af68a4b4
Stylo: Add placeholder-shown/target pseudo-classes to pseudo_class_list 2017-03-16 13:44:23 +03:00
Manish Goregaokar
b37f991cb8 stylo: Add parsing support for functional non-ts pseudoclasses, add stub -moz-system-metric pseudo
MozReview-Commit-ID: KADDH6adZqR
2017-03-16 00:00:37 -07:00
Hiroyuki Ikezoe
60fadb2d2c Use computed styles of the pseudo and its parent when calling Gecko_UpdateAnimations to update CSS Animations on pseudo-elements. 2017-03-15 06:35:32 +09:00
Emilio Cobos Álvarez
b4de69e3eb
style: Avoid cloning all over the error reporter. 2017-03-14 00:49:18 +01:00
Manish Goregaokar
4deae33ab1 stylo: Make URLs work in inline style
MozReview-Commit-ID: 6Tc0kBw4V8c
2017-03-11 11:54:18 -08:00
Hiroyuki Ikezoe
f2c547aaaf Call UpdateAnimations even if the element has no computed values. 2017-03-10 11:37:06 +09: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
22de4dc7a6 Add a utility function to convert PseudoElement to nsIAtom*.
MozReview-Commit-ID: 14qYFpiW0iG
2017-03-10 11:08:58 +09:00
Simon Sapin
1a30c98f5f Stylo: add :-moz-table-border-nonzero pseudo-class. 2017-02-23 08:40:51 +01:00
Bobby Holley
1f4f099efe Clean up and simplify the accumulation of restyle damage. 2017-02-10 10:34:28 -08:00
Bobby Holley
9e860df9df Bug 1336646 - Apply selector flags during traversal. r=emilio 2017-02-08 19:21:05 -08:00
Anthony Ramine
55b2c5c1bd Update selectors to 0.17 2017-02-07 20:33:35 -08:00
Manish Goregaokar
34ba00e6d9 Basic handling framework for presentation attributes in Stylo, with handling for font-size and color
This introduces a basic framework for servo's style system to be able
to query the style of presentation attributes which it can then insert
into the cascade. It uses that framework to implement the size and
color attributes on <font>.

There are a number of improvements that can be done on top of this:

 - Implement all other properties
 - Abstractify the ruledata parameter of the mappers using templates or virtual dispatch so that it can be a Servo decl block instead
 - Implement aforementiond abstraction over Servo decl blocks (this obsoletes the code in the first item above, so it might just be better to skip that and directly do this)
 - Replace uses of nsHTMLStyleSheet with an abstract base class containing common elements between Servo and Gecko

I'd prefer for these to be done in separate steps.
2017-02-03 17:35:44 -08:00