mirror of
https://github.com/servo/servo.git
synced 2025-09-18 19:08:22 +01:00
Get the Rc to the custom_reaction_stack outside the loop instead of using the thread_local inside. (#39310)
This uses the ScriptThread::custom_element_reaction_stack to call the enqueue_callback_reaction on the Rc instead of in the loop. Potentially saving access to thread_local variables. Testing: Should not change functionality and should be covered by wpt tests. Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
8c3acaaec9
commit
22dcc8a49d
2 changed files with 8 additions and 5 deletions
|
@ -816,11 +816,12 @@ pub(crate) fn upgrade_element(
|
|||
// Step 4. For each attribute in element's attribute list, in order, enqueue a custom element callback reaction
|
||||
// with element, callback name "attributeChangedCallback", and « attribute's local name, null, attribute's value,
|
||||
// attribute's namespace ».
|
||||
let custom_element_reaction_stack = ScriptThread::custom_element_reaction_stack();
|
||||
for attr in element.attrs().iter() {
|
||||
let local_name = attr.local_name().clone();
|
||||
let value = DOMString::from(&**attr.value());
|
||||
let namespace = attr.namespace().clone();
|
||||
ScriptThread::enqueue_callback_reaction(
|
||||
custom_element_reaction_stack.enqueue_callback_reaction(
|
||||
element,
|
||||
CallbackReaction::AttributeChanged(local_name, None, Some(value), namespace),
|
||||
Some(definition.clone()),
|
||||
|
|
|
@ -389,7 +389,7 @@ impl Node {
|
|||
|
||||
// Step 12.
|
||||
let is_parent_connected = context.parent.is_connected();
|
||||
|
||||
let custom_element_reaction_stack = ScriptThread::custom_element_reaction_stack();
|
||||
for node in root.traverse_preorder(ShadowIncluding::Yes) {
|
||||
node.clean_up_style_and_layout_data();
|
||||
|
||||
|
@ -402,7 +402,7 @@ impl Node {
|
|||
// Step 12 & 14.2. Enqueue disconnected custom element reactions.
|
||||
if is_parent_connected {
|
||||
if let Some(element) = node.as_custom_element() {
|
||||
ScriptThread::enqueue_callback_reaction(
|
||||
custom_element_reaction_stack.enqueue_callback_reaction(
|
||||
&element,
|
||||
CallbackReaction::Disconnected,
|
||||
None,
|
||||
|
@ -2294,11 +2294,12 @@ impl Node {
|
|||
// Step 3.2 For each inclusiveDescendant in node’s shadow-including inclusive descendants
|
||||
// that is custom, enqueue a custom element callback reaction with inclusiveDescendant,
|
||||
// callback name "adoptedCallback", and « oldDocument, document ».
|
||||
let custom_element_reaction_stack = ScriptThread::custom_element_reaction_stack();
|
||||
for descendant in node
|
||||
.traverse_preorder(ShadowIncluding::Yes)
|
||||
.filter_map(|d| d.as_custom_element())
|
||||
{
|
||||
ScriptThread::enqueue_callback_reaction(
|
||||
custom_element_reaction_stack.enqueue_callback_reaction(
|
||||
&descendant,
|
||||
CallbackReaction::Adopted(old_doc.clone(), DomRoot::from_ref(document)),
|
||||
None,
|
||||
|
@ -2541,6 +2542,7 @@ impl Node {
|
|||
SuppressObserver::Suppressed => None,
|
||||
};
|
||||
|
||||
let custom_element_reaction_stack = ScriptThread::custom_element_reaction_stack();
|
||||
// Step 7. For each node in nodes, in tree order:
|
||||
for kid in new_nodes {
|
||||
// Step 7.1. Adopt node into parent’s node document.
|
||||
|
@ -2589,7 +2591,7 @@ impl Node {
|
|||
// Enqueue connected reactions for custom elements or try upgrade.
|
||||
if descendant.is_custom() {
|
||||
if descendant.is_connected() {
|
||||
ScriptThread::enqueue_callback_reaction(
|
||||
custom_element_reaction_stack.enqueue_callback_reaction(
|
||||
&descendant,
|
||||
CallbackReaction::Connected,
|
||||
None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue