Commit graph

127 commits

Author SHA1 Message Date
Martin Robinson
364235ac0c Include animations and transitions in the cascade
Instead of applying animations and transitions to styled elements,
include them in the cascade. This allows them to interact properly with
things like font-size and !important rules.
2020-06-09 11:41:07 +02:00
Martin Robinson
b875f14e86 Better computation of animation keyframes
This begins to address #26625 by properly applying CSS variables during
keyframe computation and no longer using `apply_declarations`. Instead,
walk the declarations, combining them into IntermediateComputedKeyframe,
maintaining declarations that modify CSS custom properties. Then compute
a set of AnimationValues for each keyframe and use those to produce
interpolated animation values.
2020-06-05 13:40:29 +02:00
Martin Robinson
83fa1b9eaa Cache animation computed values when animations change
Instead of recalculating the animation style every tick of an animation,
cache the computed values when animations change. In addition to being
more efficient, this will allow us to return animation rules as property
declarations because we don't need to consult the final style to produce
them.
2020-06-05 13:21:19 +02:00
Emilio Cobos Álvarez
848a6203de Some servo build fixes. 2020-04-16 18:29:30 +02:00
Anthony Ramine
030a1cf8fb Replace OpaqueStyleAndLayoutData by StyleAndOpaqueLayoutData 2020-04-06 23:06:13 +02:00
Anthony Ramine
e3be136c9b Rename a bunch of style/layout data items
GetLayoutData::get_style_and_layout_data becomes
GetOpaqueStyleAndLayoutData::get_opaque_style_and_layout_data.

GetRawData::get_raw_data becomes GetStyleAndLayoutData::get_style_and_layout_data.

LayoutNode::init_style_and_layout_data becomes
LayoutNode::init_opaque_style_and_layout_data.

LayoutNode::take_style_and_layout_data becomes
LayoutNode::take_opaque_style_and_layout_data.
2020-04-06 12:39:52 +02:00
bors-servo
57fe27a4ef
Auto merge of #26110 - servo:layout-2020-rm-note-dirty-descendant, r=emilio
Kill ServoLayoutElement::note_dirty_descendant
2020-04-04 09:51:19 -04:00
Anthony Ramine
8a0775fc89 Kill ServoLayoutElement::note_dirty_descendant
There is no need to set the dirty descendants flag unsafely from the layout side
for elements with pending restyles, we can do that on the DOM side when draining
the restyles from the Document.
2020-04-04 15:00:04 +02:00
Anthony Ramine
185a402d9c Make DOM own the style and layout data, in an UnsafeCell
The previous Cell was a lie.
2020-04-04 13:10:19 +02:00
Anthony Ramine
516e8e0aa6 Don't expose any AtomicRefCell directly from style traits
This lets us experiment with how we store this data on the DOM side.
2020-04-04 13:08:51 +02:00
Anthony Ramine
4c61baee30 Make OpaqueLayoutAndStyleData just a bit less opaque
It now stores a NonNull<dyn Any>.
2020-04-04 13:08:51 +02:00
Anthony Ramine
295f120425 Make LayoutShadowRootHelpers::get_style_data_for_layout return a &CascadeData
That return type is Sync, which thus means that the method can be safe.
2020-04-01 11:40:55 +02:00
Anthony Ramine
ebd2892158 Make synthesize_presentational_hints_for_legacy_attributes be safe 2020-04-01 11:40:55 +02:00
Anthony Ramine
0c0027ecfd Make LayoutDocumentHelpers::style_shared_lock be safe
StyleSharedRwLock is Sync.
2020-04-01 11:40:55 +02:00
Anthony Ramine
fc07a5147c Make LayoutNodeHelpers::composed_parent_node_ref be safe
For clarity, I introduce <LayoutDom<Element>>::parent_node_ref to contain
the remaining unsafety bits out of composed_parent_node_ref which is more
complex than just a field access.
2020-04-01 11:40:34 +02:00
Anthony Ramine
f712b0bcf8 Make LayoutShadowRootHelpers::get_host_for_layout be safe 2020-03-31 22:30:42 +02:00
Anthony Ramine
68d5cfffd5 Make a bunch of LayoutNodeHelpers be safe 2020-03-31 22:30:34 +02:00
Anthony Ramine
f014da9565 Introduce LayoutDom::is
Just like Castable::is.
2020-03-31 22:06:40 +02:00
Anthony Ramine
9c8540af5c Make layout methods accessing rare data be safe
They don't do anything fancy so there is no additional unsafety calling them
compared to using LayoutDom in the first place, the usual story of all
those changes.
2020-03-31 22:04:35 +02:00
Anthony Ramine
72c0771299 Make a bunch of LayoutDocumentHelpers be safe
The other methods are actually unsafe.
2020-03-31 21:39:45 +02:00
Anthony Ramine
fbc3e430ab Make a bunch or trivial LayoutElementHelpers safe 2020-03-31 20:37:57 +02:00
Anthony Ramine
5ff931d171 Introduce <LayoutDom<Element>>::attrs()
This safe method is the basic block to access element attributes from layout.
We reuse it in the other attr-related layout methods to remove a pretty big
source of rampant unsafe code between script and layout.
2020-03-31 18:46:49 +02:00
Anthony Ramine
0bda174823 Merge RawLayoutElementHelpers into LayoutElementHelpers 2020-03-31 18:30:42 +02:00
Anthony Ramine
6fe294fa5b Make LayoutNodeHelpers::text_content return a cow 2020-03-31 15:02:13 +02:00
Anthony Ramine
409bd3d989 Make LayoutCharacterDataHelpers::data_for_layout be safe 2020-03-31 14:57:44 +02:00
Anthony Ramine
86296b84ff Clean up LayoutShadowRootHelpers::get_style_data_for_layout
Parameter E is unused and the result should be bound by 'dom.
2020-03-30 13:07:25 +02:00
Anthony Ramine
dba6a635e5 Give a lifetime parameter to LayoutDom 2020-03-28 15:37:57 +01:00
Anthony Ramine
60ca98b753 Pass pending restyles instead of draining them from layout 2020-03-28 15:37:56 +01:00
Anthony Ramine
400c7012b1 Make ServoLayoutNode::new return a free lifetime value
Binding the scope of the ServoLayoutNode value to the originating
TrustedNodeAddress is just theater.
2020-03-28 14:06:08 +01:00
Anthony Ramine
df0118dd10 Move PendingRestyle to the style_layout_interface crate 2020-03-28 14:00:53 +01:00
Anthony Ramine
04af32128c Add a 'dom lifetime to GetLayoutData 2020-03-26 13:17:46 +01:00
Patrick Shaughnessy
8ca4db2cd6 :defined works 2020-01-30 10:09:51 -05:00
Emilio Cobos Álvarez
226c9807df
style: Fix servo build. 2019-11-30 20:45:08 +01:00
Fernando Jiménez Moreno
a3d0d95b61 Moar detach shadow improvements 2019-07-22 17:40:17 +02:00
Fernando Jiménez Moreno
1f3c879a85 Detach shadow clean up 2019-07-22 17:40:16 +02:00
Fernando Jiménez Moreno
e344203c11 Only allow UA widgets as children of media elements
Do not allow pseudo-elements for replaced elements
2019-07-22 17:40:15 +02:00
Emilio Cobos Álvarez
add08518cd
Fix style system build with recent changes. 2019-06-25 13:11:32 +02:00
Evgeniy Reizner
6f1df517e0 style: Do not use borrowed types in the selectors::Element trait.
Closes #22972
Closes #23463
2019-06-04 01:04:03 -04:00
Emilio Cobos Álvarez
66056bd4d5 script: Fix Servo build. 2019-05-29 16:14:36 +02:00
Emilio Cobos Álvarez
0000e4cec2 layout: fix Servo build. 2019-05-07 12:56:10 +02:00
Fernando Jiménez Moreno
68bee1c771 Final nits; fix custom elements rare data usage; s/owner_s_r/containing_s_r
Clarify special case for containing_shadow_root and add it to layout
accessor
2019-04-29 12:02:04 +02:00
Fernando Jiménez Moreno
59c634b259 Set dirty descendants if node is connected 2019-04-26 12:00:26 +02:00
Fernando Jiménez Moreno
5a165c6bd8 Move is_connected function from style to layout, where it is used 2019-04-26 11:42:38 +02:00
Fernando Jiménez Moreno
bdd2f32c0f Minor tweaks: rename composed_parent_node_ref, remove or update outdated comments... 2019-04-26 11:42:37 +02:00
Fernando Jiménez Moreno
0313e38074 Tweak list of shadow roots attached to doc 2019-04-26 11:42:37 +02:00
Fernando Jiménez Moreno
3e63655018 Make ServoShadowRoot.flush_stylesheets unsafe 2019-04-26 11:31:18 +02:00
Fernando Jiménez Moreno
2674a3e717 Flush shadow roots stylesheets only if they changed 2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
a841c713d6 Minor layout thread cleanups:
- lifetime naming
- unrequired reference removal
- containing_shadow_host getter simplification
- use stylist.device getter where possible
2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
00178aff4d Derive PartialEq for ServoShadowRoot 2019-04-26 11:31:17 +02:00
Fernando Jiménez Moreno
d7b6a6f509 Do not set dirty out-of-doc nodes 2019-04-26 11:31:16 +02:00