mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 21:58:12 +00:00
LibWeb: Fix various spec comment inconsistencies
- Don't add multiple numbers to nested steps, just the innermost one (as rendered in the HTML document) - "Otherwise" comments go before the else, not after it - "FIXME:" goes before step number, not between it and the comment text - Always add a period between number and comment text The majority of these were introduced in #13756, but some unrelated ones have been updated as well.
This commit is contained in:
parent
bf16061142
commit
95541d7064
7 changed files with 133 additions and 131 deletions
|
@ -1354,7 +1354,7 @@ void Document::evaluate_media_queries_and_report_changes()
|
|||
// 1. For each MediaQueryList object target that has doc as its document,
|
||||
// in the order they were created, oldest first, run these substeps:
|
||||
for (auto& media_query_list_ptr : m_media_query_lists) {
|
||||
// 1.1. If target’s matches state has changed since the last time these steps
|
||||
// 1. If target’s matches state has changed since the last time these steps
|
||||
// were run, fire an event at target using the MediaQueryListEvent constructor,
|
||||
// with its type attribute initialized to change, its isTrusted attribute
|
||||
// initialized to true, its media attribute initialized to target’s media,
|
||||
|
|
|
@ -36,17 +36,17 @@ static EventTarget* retarget(EventTarget* left, EventTarget* right)
|
|||
// To retarget an object A against an object B, repeat these steps until they return an object:
|
||||
for (;;) {
|
||||
// 1. If one of the following is true then return A.
|
||||
// 1.1 A is not a node
|
||||
// - A is not a node
|
||||
if (!is<Node>(left))
|
||||
return left;
|
||||
|
||||
// 1.2 A’s root is not a shadow root
|
||||
// - A’s root is not a shadow root
|
||||
auto* left_node = verify_cast<Node>(left);
|
||||
auto& left_root = left_node->root();
|
||||
if (!is<ShadowRoot>(left_root))
|
||||
return left;
|
||||
|
||||
// B is a node and A’s root is a shadow-including inclusive ancestor of B
|
||||
// - B is a node and A’s root is a shadow-including inclusive ancestor of B
|
||||
if (is<Node>(right) && left_root.is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*right)))
|
||||
return left;
|
||||
|
||||
|
@ -181,10 +181,10 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha
|
|||
|
||||
// 9. If found is false and event’s isTrusted attribute is true, then:
|
||||
if (!found && event.is_trusted()) {
|
||||
// 9.1 Let originalEventType be event’s type attribute value.
|
||||
// 1. Let originalEventType be event’s type attribute value.
|
||||
auto original_event_type = event.type();
|
||||
|
||||
// 9.2 If event’s type attribute value is a match for any of the strings in the first column in the following table,
|
||||
// 2. If event’s type attribute value is a match for any of the strings in the first column in the following table,
|
||||
// set event’s type attribute value to the string in the second column on the same row as the matching string, and return otherwise.
|
||||
if (event.type() == "animationend")
|
||||
event.set_type("webkitAnimationEnd");
|
||||
|
@ -197,10 +197,10 @@ void EventDispatcher::invoke(Event::PathEntry& struct_, Event& event, Event::Pha
|
|||
else
|
||||
return;
|
||||
|
||||
// 9.3 Inner invoke with event, listeners, phase, invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag if given.
|
||||
// 3. Inner invoke with event, listeners, phase, invocationTargetInShadowTree, and legacyOutputDidListenersThrowFlag if given.
|
||||
inner_invoke(event, listeners, phase, invocation_target_in_shadow_tree);
|
||||
|
||||
// 9.4 Set event’s type attribute value to originalEventType.
|
||||
// 4. Set event’s type attribute value to originalEventType.
|
||||
event.set_type(original_event_type);
|
||||
}
|
||||
}
|
||||
|
@ -229,94 +229,95 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
|
|||
bool clear_targets = false;
|
||||
// 5. If target is not relatedTarget or target is event’s relatedTarget, then:
|
||||
if (related_target != target || event->related_target() == target) {
|
||||
// 5.1 Let touchTargets be a new list.
|
||||
// 1. Let touchTargets be a new list.
|
||||
Event::TouchTargetList touch_targets;
|
||||
|
||||
// 5.2 For each touchTarget of event’s touch target list, append the result of retargeting touchTarget against target to touchTargets.
|
||||
// 2. For each touchTarget of event’s touch target list, append the result of retargeting touchTarget against target to touchTargets.
|
||||
for (auto& touch_target : event->touch_target_list()) {
|
||||
touch_targets.append(retarget(touch_target, target));
|
||||
}
|
||||
|
||||
// 5.3 Append to an event path with event, target, targetOverride, relatedTarget, touchTargets, and false.
|
||||
// 3. Append to an event path with event, target, targetOverride, relatedTarget, touchTargets, and false.
|
||||
event->append_to_path(*target, target_override, related_target, touch_targets, false);
|
||||
|
||||
// 5.4 Let isActivationEvent be true, if event is a MouseEvent object and event’s type attribute is "click"; otherwise false.
|
||||
// 4. Let isActivationEvent be true, if event is a MouseEvent object and event’s type attribute is "click"; otherwise false.
|
||||
bool is_activation_event = is<UIEvents::MouseEvent>(*event) && event->type() == HTML::EventNames::click;
|
||||
|
||||
// 5.5 If isActivationEvent is true and target has activation behavior, then set activationTarget to target.
|
||||
// 5. If isActivationEvent is true and target has activation behavior, then set activationTarget to target.
|
||||
if (is_activation_event && target->activation_behavior)
|
||||
activation_target = target;
|
||||
|
||||
// 5.6 FIXME: Let slottable be target, if target is a slottable and is assigned, and null otherwise.
|
||||
// FIXME: 6. Let slottable be target, if target is a slottable and is assigned, and null otherwise.
|
||||
|
||||
// 5.7 Let slot-in-closed-tree be false
|
||||
// 7. Let slot-in-closed-tree be false
|
||||
bool slot_in_closed_tree = false;
|
||||
|
||||
// 5.8 Let parent be the result of invoking target’s get the parent with event.
|
||||
// 8. Let parent be the result of invoking target’s get the parent with event.
|
||||
auto* parent = target->get_parent(event);
|
||||
|
||||
// 5.9 While parent is non-null:
|
||||
// 9. While parent is non-null:
|
||||
while (parent) {
|
||||
// FIXME:
|
||||
// 5.9.1 If slottable is non-null:
|
||||
// 5.9.1.1 Assert: parent is a slot.
|
||||
// 5.9.1.2 Set slottable to null.
|
||||
// 5.9.1.3 If parent’s root is a shadow root whose mode is "closed", then set slot-in-closed-tree to true.
|
||||
// 5.9.2 If parent is a slottable and is assigned, then set slottable to parent.
|
||||
// FIXME: 1. If slottable is non-null:
|
||||
// 1. Assert: parent is a slot.
|
||||
// 2. Set slottable to null.
|
||||
// 3. If parent’s root is a shadow root whose mode is "closed", then set slot-in-closed-tree to true.
|
||||
// FIXME: 2. If parent is a slottable and is assigned, then set slottable to parent.
|
||||
|
||||
// 5.9.3 Let relatedTarget be the result of retargeting event’s relatedTarget against parent.
|
||||
// 3. Let relatedTarget be the result of retargeting event’s relatedTarget against parent.
|
||||
related_target = retarget(event->related_target(), parent);
|
||||
|
||||
// 5.9.4 Let touchTargets be a new list.
|
||||
// 4. Let touchTargets be a new list.
|
||||
touch_targets.clear();
|
||||
|
||||
// 5.9.5 For each touchTarget of event’s touch target list, append the result of retargeting touchTarget against parent to touchTargets.
|
||||
// 5. For each touchTarget of event’s touch target list, append the result of retargeting touchTarget against parent to touchTargets.
|
||||
for (auto& touch_target : event->touch_target_list()) {
|
||||
touch_targets.append(retarget(touch_target, parent));
|
||||
}
|
||||
|
||||
// 5.9.6 If parent is a Window object, or parent is a node and target’s root is a shadow-including inclusive ancestor of parent, then:
|
||||
// 6. If parent is a Window object, or parent is a node and target’s root is a shadow-including inclusive ancestor of parent, then:
|
||||
if (is<HTML::Window>(parent)
|
||||
|| (is<Node>(parent) && verify_cast<Node>(*target).root().is_shadow_including_inclusive_ancestor_of(verify_cast<Node>(*parent)))) {
|
||||
// 5.9.6.1 If isActivationEvent is true, event’s bubbles attribute is true, activationTarget is null, and parent has activation behavior, then set activationTarget to parent.
|
||||
// 1. If isActivationEvent is true, event’s bubbles attribute is true, activationTarget is null, and parent has activation behavior, then set activationTarget to parent.
|
||||
if (is_activation_event && event->bubbles() && !activation_target && parent->activation_behavior)
|
||||
activation_target = parent;
|
||||
|
||||
// 5.9.6.2 Append to an event path with event, parent, null, relatedTarget, touchTargets, and slot-in-closed-tree.
|
||||
// 2. Append to an event path with event, parent, null, relatedTarget, touchTargets, and slot-in-closed-tree.
|
||||
event->append_to_path(*parent, nullptr, related_target, touch_targets, slot_in_closed_tree);
|
||||
|
||||
} else if (related_target == parent) {
|
||||
// 5.9.7 Otherwise, if parent is relatedTarget, then set parent to null.
|
||||
}
|
||||
// 7. Otherwise, if parent is relatedTarget, then set parent to null.
|
||||
else if (related_target == parent) {
|
||||
parent = nullptr;
|
||||
} else {
|
||||
// 5.9.8 Otherwise, set target to parent and then:
|
||||
}
|
||||
// 8. Otherwise, set target to parent and then:
|
||||
else {
|
||||
target = *parent;
|
||||
|
||||
// 5.9.8.1 If isActivationEvent is true, activationTarget is null, and target has activation behavior, then set activationTarget to target.
|
||||
// 1. If isActivationEvent is true, activationTarget is null, and target has activation behavior, then set activationTarget to target.
|
||||
if (is_activation_event && !activation_target && target->activation_behavior)
|
||||
activation_target = target;
|
||||
|
||||
// 5.9.8.2 Append to an event path with event, parent, target, relatedTarget, touchTargets, and slot-in-closed-tree.
|
||||
// 2. Append to an event path with event, parent, target, relatedTarget, touchTargets, and slot-in-closed-tree.
|
||||
event->append_to_path(*parent, target, related_target, touch_targets, slot_in_closed_tree);
|
||||
}
|
||||
|
||||
// 5.9.9 If parent is non-null, then set parent to the result of invoking parent’s get the parent with event.
|
||||
// 9. If parent is non-null, then set parent to the result of invoking parent’s get the parent with event.
|
||||
if (parent) {
|
||||
parent = parent->get_parent(event);
|
||||
}
|
||||
|
||||
// 5.9.10 Set slot-in-closed-tree to false.
|
||||
// 10. Set slot-in-closed-tree to false.
|
||||
slot_in_closed_tree = false;
|
||||
}
|
||||
|
||||
// 5.10 Let clearTargetsStruct be the last struct in event’s path whose shadow-adjusted target is non-null.
|
||||
// 10. Let clearTargetsStruct be the last struct in event’s path whose shadow-adjusted target is non-null.
|
||||
auto clear_targets_struct = event->path().last_matching([](auto& entry) {
|
||||
return !entry.shadow_adjusted_target.is_null();
|
||||
});
|
||||
|
||||
VERIFY(clear_targets_struct.has_value());
|
||||
|
||||
// 5.11 Let clearTargets be true if clearTargetsStruct’s shadow-adjusted target, clearTargetsStruct’s relatedTarget,
|
||||
// 11. Let clearTargets be true if clearTargetsStruct’s shadow-adjusted target, clearTargetsStruct’s relatedTarget,
|
||||
// or an EventTarget object in clearTargetsStruct’s touch target list is a node and its root is a shadow root; otherwise false.
|
||||
if (is<Node>(clear_targets_struct.value().shadow_adjusted_target.ptr())) {
|
||||
auto& shadow_adjusted_target_node = verify_cast<Node>(*clear_targets_struct.value().shadow_adjusted_target);
|
||||
|
@ -342,39 +343,40 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
|
|||
}
|
||||
}
|
||||
|
||||
// 5.12 If activationTarget is non-null and activationTarget has legacy-pre-activation behavior, then run activationTarget’s legacy-pre-activation behavior.
|
||||
// 12. If activationTarget is non-null and activationTarget has legacy-pre-activation behavior, then run activationTarget’s legacy-pre-activation behavior.
|
||||
if (activation_target)
|
||||
activation_target->legacy_pre_activation_behavior();
|
||||
|
||||
// 5.13 For each struct in event’s path, in reverse order:
|
||||
// 13. For each struct in event’s path, in reverse order:
|
||||
for (auto& entry : event->path().in_reverse()) {
|
||||
// 5.13.1 If struct’s shadow-adjusted target is non-null, then set event’s eventPhase attribute to AT_TARGET.
|
||||
// 1. If struct’s shadow-adjusted target is non-null, then set event’s eventPhase attribute to AT_TARGET.
|
||||
if (entry.shadow_adjusted_target)
|
||||
event->set_phase(Event::Phase::AtTarget);
|
||||
// 2. Otherwise, set event’s eventPhase attribute to CAPTURING_PHASE.
|
||||
else
|
||||
// 5.13.2 Otherwise, set event’s eventPhase attribute to CAPTURING_PHASE.
|
||||
event->set_phase(Event::Phase::CapturingPhase);
|
||||
|
||||
// 5.13.3 Invoke with struct, event, "capturing", and legacyOutputDidListenersThrowFlag if given.
|
||||
// 3. Invoke with struct, event, "capturing", and legacyOutputDidListenersThrowFlag if given.
|
||||
invoke(entry, event, Event::Phase::CapturingPhase);
|
||||
}
|
||||
|
||||
// 5.14 For each struct in event’s path:
|
||||
// 14. For each struct in event’s path:
|
||||
for (auto& entry : event->path()) {
|
||||
// 5.14.1 If struct’s shadow-adjusted target is non-null, then set event’s eventPhase attribute to AT_TARGET.
|
||||
// 1. If struct’s shadow-adjusted target is non-null, then set event’s eventPhase attribute to AT_TARGET.
|
||||
if (entry.shadow_adjusted_target) {
|
||||
event->set_phase(Event::Phase::AtTarget);
|
||||
} else {
|
||||
// 5.14.2 Otherwise:
|
||||
// 5.14.2.1 If event’s bubbles attribute is false, then continue.
|
||||
}
|
||||
// 2. Otherwise:
|
||||
else {
|
||||
// 1. If event’s bubbles attribute is false, then continue.
|
||||
if (!event->bubbles())
|
||||
continue;
|
||||
|
||||
// 5.14.2.2 Set event’s eventPhase attribute to BUBBLING_PHASE.
|
||||
// 2. Set event’s eventPhase attribute to BUBBLING_PHASE.
|
||||
event->set_phase(Event::Phase::BubblingPhase);
|
||||
}
|
||||
|
||||
// 5.14.3 Invoke with struct, event, "bubbling", and legacyOutputDidListenersThrowFlag if given.
|
||||
// 3. Invoke with struct, event, "bubbling", and legacyOutputDidListenersThrowFlag if given.
|
||||
invoke(entry, event, Event::Phase::BubblingPhase);
|
||||
}
|
||||
}
|
||||
|
@ -395,24 +397,25 @@ bool EventDispatcher::dispatch(NonnullRefPtr<EventTarget> target, NonnullRefPtr<
|
|||
|
||||
// 10. If clearTargets, then:
|
||||
if (clear_targets) {
|
||||
// 10.1 Set event’s target to null.
|
||||
// 1. Set event’s target to null.
|
||||
event->set_target(nullptr);
|
||||
|
||||
// 10.2 Set event’s relatedTarget to null.
|
||||
// 2. Set event’s relatedTarget to null.
|
||||
event->set_related_target(nullptr);
|
||||
|
||||
// 10.3 Set event’s touch target list to the empty list.
|
||||
// 3. Set event’s touch target list to the empty list.
|
||||
event->clear_touch_target_list();
|
||||
}
|
||||
|
||||
// 11. If activationTarget is non-null, then:
|
||||
if (activation_target) {
|
||||
// 11.1 If event’s canceled flag is unset, then run activationTarget’s activation behavior with event.
|
||||
// 1. If event’s canceled flag is unset, then run activationTarget’s activation behavior with event.
|
||||
if (!event->cancelled()) {
|
||||
activation_target->activation_behavior(event);
|
||||
activation_target->legacy_cancelled_activation_behavior_was_not_called();
|
||||
} else {
|
||||
// 11.2 Otherwise, if activationTarget has legacy-canceled-activation behavior, then run activationTarget’s legacy-canceled-activation behavior.
|
||||
}
|
||||
// 2. Otherwise, if activationTarget has legacy-canceled-activation behavior, then run activationTarget’s legacy-canceled-activation behavior.
|
||||
else {
|
||||
activation_target->legacy_cancelled_activation_behavior();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -358,59 +358,58 @@ void Node::insert_before(NonnullRefPtr<Node> node, RefPtr<Node> child, bool supp
|
|||
|
||||
// 4. If node is a DocumentFragment node, then:
|
||||
if (is<DocumentFragment>(*node)) {
|
||||
// 4.1 Remove its children with the suppress observers flag set.
|
||||
// 1. Remove its children with the suppress observers flag set.
|
||||
node->remove_all_children(true);
|
||||
|
||||
// 4.2 FIXME: Queue a tree mutation record for node with « », nodes, null, and null.
|
||||
// FIXME: 2. Queue a tree mutation record for node with « », nodes, null, and null.
|
||||
// NOTE: This step intentionally does not pay attention to the suppress observers flag.
|
||||
}
|
||||
|
||||
// 5. If child is non-null, then:
|
||||
if (child) {
|
||||
// 5.1 For each live range whose start node is parent and start offset is greater than child’s index, increase its start offset by count.
|
||||
// 1. For each live range whose start node is parent and start offset is greater than child’s index, increase its start offset by count.
|
||||
for (auto& range : Range::live_ranges()) {
|
||||
if (range->start_container() == this && range->start_offset() > child->index())
|
||||
range->set_start(*range->start_container(), range->start_offset() + count);
|
||||
}
|
||||
|
||||
// 5.2 For each live range whose end node is parent and end offset is greater than child’s index, increase its end offset by count.
|
||||
// 2. For each live range whose end node is parent and end offset is greater than child’s index, increase its end offset by count.
|
||||
for (auto& range : Range::live_ranges()) {
|
||||
if (range->end_container() == this && range->end_offset() > child->index())
|
||||
range->set_end(*range->end_container(), range->end_offset() + count);
|
||||
}
|
||||
}
|
||||
|
||||
// 6. FIXME: Let previousSibling be child’s previous sibling or parent’s last child if child is null. (Currently unused so not included)
|
||||
// FIXME: 6. Let previousSibling be child’s previous sibling or parent’s last child if child is null. (Currently unused so not included)
|
||||
|
||||
// 7. For each node in nodes, in tree order:
|
||||
// FIXME: In tree order
|
||||
for (auto& node_to_insert : nodes) {
|
||||
// 7.1 Adopt node into parent’s node document.
|
||||
// 1. Adopt node into parent’s node document.
|
||||
document().adopt_node(node_to_insert);
|
||||
|
||||
// 7.2 If child is null, then append node to parent’s children.
|
||||
// 2. If child is null, then append node to parent’s children.
|
||||
if (!child)
|
||||
TreeNode<Node>::append_child(node_to_insert);
|
||||
// 3. Otherwise, insert node into parent’s children before child’s index.
|
||||
else
|
||||
// 7.3 Otherwise, insert node into parent’s children before child’s index.
|
||||
TreeNode<Node>::insert_before(node_to_insert, child);
|
||||
|
||||
// FIXME: 7.4 If parent is a shadow host and node is a slottable, then assign a slot for node.
|
||||
// FIXME: 7.5 If parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent.
|
||||
// FIXME: 7.6 Run assign slottables for a tree with node’s root.
|
||||
// FIXME: 4. If parent is a shadow host and node is a slottable, then assign a slot for node.
|
||||
// FIXME: 5. If parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent.
|
||||
// FIXME: 6. Run assign slottables for a tree with node’s root.
|
||||
|
||||
// FIXME: This should be shadow-including.
|
||||
// 7.7 For each shadow-including inclusive descendant inclusiveDescendant of node, in shadow-including tree order:
|
||||
// 7. For each shadow-including inclusive descendant inclusiveDescendant of node, in shadow-including tree order:
|
||||
node_to_insert.for_each_in_inclusive_subtree([&](Node& inclusive_descendant) {
|
||||
// 7.7.1 Run the insertion steps with inclusiveDescendant.
|
||||
// 1. Run the insertion steps with inclusiveDescendant.
|
||||
inclusive_descendant.inserted();
|
||||
|
||||
// 7.7.2 If inclusiveDescendant is connected, then:
|
||||
// 2. If inclusiveDescendant is connected, then:
|
||||
if (inclusive_descendant.is_connected()) {
|
||||
// 7.7.2.1 FIXME: If inclusiveDescendant is custom, then enqueue a custom element callback reaction with inclusiveDescendant,
|
||||
// callback name "connectedCallback", and an empty argument list.
|
||||
// FIXME: 1. If inclusiveDescendant is custom, then enqueue a custom element callback reaction with inclusiveDescendant, callback name "connectedCallback", and an empty argument list.
|
||||
|
||||
// 7.7.2.2 FIXME: Otherwise, try to upgrade inclusiveDescendant.
|
||||
// FIXME: 2. Otherwise, try to upgrade inclusiveDescendant.
|
||||
// NOTE: If this successfully upgrades inclusiveDescendant, its connectedCallback will be enqueued automatically during the upgrade an element algorithm.
|
||||
}
|
||||
|
||||
|
@ -518,42 +517,42 @@ void Node::remove(bool suppress_observers)
|
|||
node_iterator.run_pre_removing_steps(*this);
|
||||
});
|
||||
|
||||
// 9. FIXME: Let oldPreviousSibling be node’s previous sibling. (Currently unused so not included)
|
||||
// 10. FIXME: Let oldNextSibling be node’s next sibling. (Currently unused so not included)
|
||||
// FIXME: 9. Let oldPreviousSibling be node’s previous sibling. (Currently unused so not included)
|
||||
// FIXME: 10. Let oldNextSibling be node’s next sibling. (Currently unused so not included)
|
||||
|
||||
// 11. Remove node from its parent’s children.
|
||||
parent->TreeNode::remove_child(*this);
|
||||
|
||||
// 12. FIXME: If node is assigned, then run assign slottables for node’s assigned slot.
|
||||
// FIXME: 12. If node is assigned, then run assign slottables for node’s assigned slot.
|
||||
|
||||
// 13. FIXME: If parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent.
|
||||
// FIXME: 13. If parent’s root is a shadow root, and parent is a slot whose assigned nodes is the empty list, then run signal a slot change for parent.
|
||||
|
||||
// 14. FIXME: If node has an inclusive descendant that is a slot, then:
|
||||
// 14.1 Run assign slottables for a tree with parent’s root.
|
||||
// 14.2 Run assign slottables for a tree with node.
|
||||
// FIXME: 14. If node has an inclusive descendant that is a slot, then:
|
||||
// 1. Run assign slottables for a tree with parent’s root.
|
||||
// 2. Run assign slottables for a tree with node.
|
||||
|
||||
// 15. Run the removing steps with node and parent.
|
||||
removed_from(parent);
|
||||
|
||||
// 16. FIXME: Let isParentConnected be parent’s connected. (Currently unused so not included)
|
||||
// FIXME: 16. Let isParentConnected be parent’s connected. (Currently unused so not included)
|
||||
|
||||
// 17. FIXME: If node is custom and isParentConnected is true, then enqueue a custom element callback reaction with node,
|
||||
// FIXME: 17. If node is custom and isParentConnected is true, then enqueue a custom element callback reaction with node,
|
||||
// callback name "disconnectedCallback", and an empty argument list.
|
||||
// NOTE: It is intentional for now that custom elements do not get parent passed. This might change in the future if there is a need.
|
||||
|
||||
// FIXME: This should be shadow-including.
|
||||
// 18. For each shadow-including descendant descendant of node, in shadow-including tree order, then:
|
||||
for_each_in_subtree([&](Node& descendant) {
|
||||
// 18.1 Run the removing steps with descendant
|
||||
// 1. Run the removing steps with descendant
|
||||
descendant.removed_from(nullptr);
|
||||
|
||||
// 18.2 FIXME: If descendant is custom and isParentConnected is true, then enqueue a custom element callback reaction with descendant,
|
||||
// FIXME: 2. If descendant is custom and isParentConnected is true, then enqueue a custom element callback reaction with descendant,
|
||||
// callback name "disconnectedCallback", and an empty argument list.
|
||||
|
||||
return IterationDecision::Continue;
|
||||
});
|
||||
|
||||
// 19. FIXME: For each inclusive ancestor inclusiveAncestor of parent, and then for each registered of inclusiveAncestor’s registered observer list,
|
||||
// FIXME: 19. For each inclusive ancestor inclusiveAncestor of parent, and then for each registered of inclusiveAncestor’s registered observer list,
|
||||
// if registered’s options["subtree"] is true, then append a new transient registered observer
|
||||
// whose observer is registered’s observer, options is registered’s options, and source is registered to node’s registered observer list.
|
||||
|
||||
|
@ -624,24 +623,24 @@ ExceptionOr<NonnullRefPtr<Node>> Node::replace_child(NonnullRefPtr<Node> node, N
|
|||
if (reference_child == node)
|
||||
reference_child = node->next_sibling();
|
||||
|
||||
// 9. FIXME: Let previousSibling be child’s previous sibling. (Currently unused so not included)
|
||||
// 10. FIXME: Let removedNodes be the empty set. (Currently unused so not included)
|
||||
// FIXME: 9. Let previousSibling be child’s previous sibling. (Currently unused so not included)
|
||||
// FIXME: 10. Let removedNodes be the empty set. (Currently unused so not included)
|
||||
|
||||
// 11. If child’s parent is non-null, then:
|
||||
// NOTE: The above can only be false if child is node.
|
||||
if (child->parent()) {
|
||||
// 11.1 FIXME: Set removedNodes to « child ».
|
||||
// FIXME: 1. Set removedNodes to « child ».
|
||||
|
||||
// 11.2 Remove child with the suppress observers flag set.
|
||||
// 2. Remove child with the suppress observers flag set.
|
||||
child->remove(true);
|
||||
}
|
||||
|
||||
// 12. FIXME: Let nodes be node’s children if node is a DocumentFragment node; otherwise « node ». (Currently unused so not included)
|
||||
// FIXME: 12. Let nodes be node’s children if node is a DocumentFragment node; otherwise « node ». (Currently unused so not included)
|
||||
|
||||
// 13. Insert node into parent before referenceChild with the suppress observers flag set.
|
||||
insert_before(node, reference_child, true);
|
||||
|
||||
// 14. FIXME: Queue a tree mutation record for parent with nodes, removedNodes, previousSibling, and referenceChild.
|
||||
// FIXME: 14. Queue a tree mutation record for parent with nodes, removedNodes, previousSibling, and referenceChild.
|
||||
|
||||
// 15. Return child.
|
||||
return child;
|
||||
|
@ -657,14 +656,14 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children)
|
|||
|
||||
// 2. If node is an element, then:
|
||||
if (is<Element>(this)) {
|
||||
// 2.1 Let copy be the result of creating an element, given document, node’s local name, node’s namespace, node’s namespace prefix, and node’s is value, with the synchronous custom elements flag unset.
|
||||
// 1. Let copy be the result of creating an element, given document, node’s local name, node’s namespace, node’s namespace prefix, and node’s is value, with the synchronous custom elements flag unset.
|
||||
auto& element = *verify_cast<Element>(this);
|
||||
auto element_copy = DOM::create_element(*document, element.local_name(), element.namespace_() /* FIXME: node’s namespace prefix, and node’s is value, with the synchronous custom elements flag unset */);
|
||||
|
||||
// 2.2 For each attribute in node’s attribute list:
|
||||
// 2. For each attribute in node’s attribute list:
|
||||
element.for_each_attribute([&](auto& name, auto& value) {
|
||||
// 2.2.1 Let copyAttribute be a clone of attribute.
|
||||
// 2.2.2 Append copyAttribute to copy.
|
||||
// 1. Let copyAttribute be a clone of attribute.
|
||||
// 2. Append copyAttribute to copy.
|
||||
element_copy->set_attribute(name, value);
|
||||
});
|
||||
copy = move(element_copy);
|
||||
|
@ -886,15 +885,15 @@ u16 Node::compare_document_position(RefPtr<Node> other)
|
|||
|
||||
// 5. If node2 is an attribute, then:
|
||||
if (is<Attribute>(node2)) {
|
||||
// 5.1 Set attr2 to node2 and node2 to attr2’s element.
|
||||
// 1. Set attr2 to node2 and node2 to attr2’s element.
|
||||
attr2 = verify_cast<Attribute>(node2);
|
||||
node2 = const_cast<Element*>(attr2->owner_element());
|
||||
|
||||
// 5.2 If attr1 and node1 are non-null, and node2 is node1, then:
|
||||
// 2. If attr1 and node1 are non-null, and node2 is node1, then:
|
||||
if (attr1 && node1 && node2 == node1) {
|
||||
// 5.2.1 FIXME: For each attr in node2’s attribute list:
|
||||
// 5.2.1.1 FIXME: If attr equals attr1, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_PRECEDING.
|
||||
// 5.2.1.2 FIXME: If attr equals attr2, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_FOLLOWING.
|
||||
// FIXME: 1. For each attr in node2’s attribute list:
|
||||
// 1. If attr equals attr1, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_PRECEDING.
|
||||
// 2. If attr equals attr2, then return the result of adding DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC and DOCUMENT_POSITION_FOLLOWING.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1085,10 +1084,10 @@ bool Node::is_shadow_including_inclusive_ancestor_of(Node const& other) const
|
|||
// https://dom.spec.whatwg.org/#concept-node-replace-all
|
||||
void Node::replace_all(RefPtr<Node> node)
|
||||
{
|
||||
// 1. FIXME: Let removedNodes be parent’s children. (Current unused so not included)
|
||||
// 2. FIXME: Let addedNodes be the empty set. (Currently unused so not included)
|
||||
// 3. FIXME: If node is a DocumentFragment node, then set addedNodes to node’s children.
|
||||
// 4. FIXME: Otherwise, if node is non-null, set addedNodes to « node ».
|
||||
// FIXME: 1. Let removedNodes be parent’s children. (Current unused so not included)
|
||||
// FIXME: 2. Let addedNodes be the empty set. (Currently unused so not included)
|
||||
// FIXME: 3. If node is a DocumentFragment node, then set addedNodes to node’s children.
|
||||
// FIXME: 4. Otherwise, if node is non-null, set addedNodes to « node ».
|
||||
|
||||
// 5. Remove all parent’s children, in tree order, with the suppress observers flag set.
|
||||
remove_all_children(true);
|
||||
|
@ -1097,7 +1096,7 @@ void Node::replace_all(RefPtr<Node> node)
|
|||
if (node)
|
||||
insert_before(*node, nullptr, true);
|
||||
|
||||
// 7. FIXME: If either addedNodes or removedNodes is not empty, then queue a tree mutation record for parent with addedNodes, removedNodes, null, and null.
|
||||
// FIXME: 7. If either addedNodes or removedNodes is not empty, then queue a tree mutation record for parent with addedNodes, removedNodes, null, and null.
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#string-replace-all
|
||||
|
@ -1117,13 +1116,13 @@ void Node::string_replace_all(String const& string)
|
|||
// https://w3c.github.io/DOM-Parsing/#dfn-fragment-serializing-algorithm
|
||||
String Node::serialize_fragment(/* FIXME: Requires well-formed flag */) const
|
||||
{
|
||||
// 1. FIXME: Let context document be the value of node's node document.
|
||||
// FIXME: 1. Let context document be the value of node's node document.
|
||||
|
||||
// 2. FIXME: If context document is an HTML document, return an HTML serialization of node.
|
||||
// FIXME: 2. If context document is an HTML document, return an HTML serialization of node.
|
||||
// (We currently always do this)
|
||||
return HTML::HTMLParser::serialize_html_fragment(*this);
|
||||
|
||||
// 3. FIXME: Otherwise, context document is an XML document; return an XML serialization of node passing the flag require well-formed.
|
||||
// FIXME: 3. Otherwise, context document is an XML document; return an XML serialization of node passing the flag require well-formed.
|
||||
}
|
||||
|
||||
// https://dom.spec.whatwg.org/#dom-node-issamenode
|
||||
|
|
|
@ -43,7 +43,7 @@ void HTMLIFrameElement::inserted()
|
|||
// 1. Create a new nested browsing context for element.
|
||||
create_new_nested_browsing_context();
|
||||
|
||||
// 2. FIXME: If element has a sandbox attribute, then parse the sandboxing directive given the attribute's value and element's iframe sandboxing flag set.
|
||||
// FIXME: 2. If element has a sandbox attribute, then parse the sandboxing directive given the attribute's value and element's iframe sandboxing flag set.
|
||||
|
||||
// 3. Process the iframe attributes for element, with initialInsertion set to true.
|
||||
load_src(attribute(HTML::AttributeNames::src));
|
||||
|
|
|
@ -77,7 +77,7 @@ bool HTMLObjectElement::has_ancestor_media_element_or_object_element_not_showing
|
|||
void HTMLObjectElement::queue_element_task_to_run_object_representation_steps()
|
||||
{
|
||||
queue_an_element_task(HTML::Task::Source::DOMManipulation, [&]() {
|
||||
// 1. FIXME: If the user has indicated a preference that this object element's fallback content be shown instead of the element's usual behavior, then jump to the step below labeled fallback.
|
||||
// FIXME: 1. If the user has indicated a preference that this object element's fallback content be shown instead of the element's usual behavior, then jump to the step below labeled fallback.
|
||||
|
||||
// 2. If the element has an ancestor media element, or has an ancestor object element that is not showing its fallback content, or if the element is not in a document whose browsing context is non-null, or if the element's node document is not fully active, or if the element is still in the stack of open elements of an HTML parser or XML parser, or if the element is not being rendered, then jump to the step below labeled fallback.
|
||||
if (!document().browsing_context() || !document().is_fully_active())
|
||||
|
@ -85,7 +85,7 @@ void HTMLObjectElement::queue_element_task_to_run_object_representation_steps()
|
|||
if (has_ancestor_media_element_or_object_element_not_showing_fallback_content())
|
||||
return run_object_representation_fallback_steps();
|
||||
|
||||
// 3. FIXME: If the classid attribute is present, and has a value that isn't the empty string, then: if the user agent can find a plugin suitable according to the value of the classid attribute, and plugins aren't being sandboxed, then that plugin should be used, and the value of the data attribute, if any, should be passed to the plugin. If no suitable plugin can be found, or if the plugin reports an error, jump to the step below labeled fallback.
|
||||
// FIXME: 3. If the classid attribute is present, and has a value that isn't the empty string, then: if the user agent can find a plugin suitable according to the value of the classid attribute, and plugins aren't being sandboxed, then that plugin should be used, and the value of the data attribute, if any, should be passed to the plugin. If no suitable plugin can be found, or if the plugin reports an error, jump to the step below labeled fallback.
|
||||
|
||||
// 4. If the data attribute is present and its value is not the empty string, then:
|
||||
if (auto data = attribute(HTML::AttributeNames::data); !data.is_empty()) {
|
||||
|
@ -135,8 +135,8 @@ void HTMLObjectElement::resource_did_load()
|
|||
// 1. Let the resource type be unknown.
|
||||
Optional<String> resource_type;
|
||||
|
||||
// 2. FIXME: If the user agent is configured to strictly obey Content-Type headers for this resource, and the resource has associated Content-Type metadata, then let the resource type be the type specified in the resource's Content-Type metadata, and jump to the step below labeled handler.
|
||||
// 3. FIXME: If there is a type attribute present on the object element, and that attribute's value is not a type that the user agent supports, but it is a type that a plugin supports, then let the resource type be the type specified in that type attribute, and jump to the step below labeled handler.
|
||||
// FIXME: 2. If the user agent is configured to strictly obey Content-Type headers for this resource, and the resource has associated Content-Type metadata, then let the resource type be the type specified in the resource's Content-Type metadata, and jump to the step below labeled handler.
|
||||
// FIXME: 3. If there is a type attribute present on the object element, and that attribute's value is not a type that the user agent supports, but it is a type that a plugin supports, then let the resource type be the type specified in that type attribute, and jump to the step below labeled handler.
|
||||
|
||||
// 4. Run the appropriate set of steps from the following list:
|
||||
// * If the resource has associated Content-Type metadata
|
||||
|
@ -144,7 +144,7 @@ void HTMLObjectElement::resource_did_load()
|
|||
// 1. Let binary be false.
|
||||
bool binary = false;
|
||||
|
||||
// 2. FIXME: If the type specified in the resource's Content-Type metadata is "text/plain", and the result of applying the rules for distinguishing if a resource is text or binary to the resource is that the resource is not text/plain, then set binary to true.
|
||||
// FIXME: 2. If the type specified in the resource's Content-Type metadata is "text/plain", and the result of applying the rules for distinguishing if a resource is text or binary to the resource is that the resource is not text/plain, then set binary to true.
|
||||
|
||||
// 3. If the type specified in the resource's Content-Type metadata is "application/octet-stream", then set binary to true.
|
||||
if (it->value == "application/octet-stream"sv)
|
||||
|
@ -183,7 +183,7 @@ void HTMLObjectElement::resource_did_load()
|
|||
resource_type = move(tentative_type);
|
||||
}
|
||||
|
||||
// 5. FIXME: If applying the URL parser algorithm to the URL of the specified resource (after any redirects) results in a URL record whose path component matches a pattern that a plugin supports, then let resource type be the type that that plugin can handle.
|
||||
// FIXME: 5. If applying the URL parser algorithm to the URL of the specified resource (after any redirects) results in a URL record whose path component matches a pattern that a plugin supports, then let resource type be the type that that plugin can handle.
|
||||
|
||||
run_object_representation_handler_steps(move(resource_type));
|
||||
}
|
||||
|
|
|
@ -204,13 +204,13 @@ i32 Window::run_timer_initialization_steps(Bindings::TimerHandler handler, i32 t
|
|||
// 2. If previousId was given, let id be previousId; otherwise, let id be an implementation-defined integer that is greater than zero and does not already exist in global's map of active timers.
|
||||
auto id = previous_id.has_value() ? previous_id.value() : m_timer_id_allocator.allocate();
|
||||
|
||||
// 3. FIXME: If the surrounding agent's event loop's currently running task is a task that was created by this algorithm, then let nesting level be the task's timer nesting level. Otherwise, let nesting level be zero.
|
||||
// FIXME: 3. If the surrounding agent's event loop's currently running task is a task that was created by this algorithm, then let nesting level be the task's timer nesting level. Otherwise, let nesting level be zero.
|
||||
|
||||
// 4. If timeout is less than 0, then set timeout to 0.
|
||||
if (timeout < 0)
|
||||
timeout = 0;
|
||||
|
||||
// 5. FIXME: If nesting level is greater than 5, and timeout is less than 4, then set timeout to 4.
|
||||
// FIXME: 5. If nesting level is greater than 5, and timeout is less than 4, then set timeout to 4.
|
||||
|
||||
// 6. Let callerRealm be the current Realm Record, and calleeRealm be global's relevant Realm.
|
||||
// FIXME: Implement this when step 9.2 is implemented.
|
||||
|
@ -237,7 +237,7 @@ i32 Window::run_timer_initialization_steps(Bindings::TimerHandler handler, i32 t
|
|||
// 3. Otherwise:
|
||||
[&](String const& source) {
|
||||
// 1. Assert: handler is a string.
|
||||
// 2. FIXME: Perform HostEnsureCanCompileStrings(callerRealm, calleeRealm). If this throws an exception, catch it, report the exception, and abort these steps.
|
||||
// FIXME: 2. Perform HostEnsureCanCompileStrings(callerRealm, calleeRealm). If this throws an exception, catch it, report the exception, and abort these steps.
|
||||
|
||||
// 3. Let settings object be global's relevant settings object.
|
||||
auto& settings_object = window->associated_document().relevant_settings_object();
|
||||
|
@ -272,8 +272,8 @@ i32 Window::run_timer_initialization_steps(Bindings::TimerHandler handler, i32 t
|
|||
}
|
||||
};
|
||||
|
||||
// 10. FIXME: Increment nesting level by one.
|
||||
// 11. FIXME: Set task's timer nesting level to nesting level.
|
||||
// FIXME: 10. Increment nesting level by one.
|
||||
// FIXME: 11. Set task's timer nesting level to nesting level.
|
||||
|
||||
// 12. Let completionStep be an algorithm step which queues a global task on the timer task source given global to run task.
|
||||
auto completion_step = [weak_window = make_weak_ptr(), task = move(task)]() mutable {
|
||||
|
|
|
@ -34,15 +34,15 @@ DOM::ExceptionOr<void> WorkerGlobalScope::import_scripts(Vector<String> urls)
|
|||
// which if provided will be used when invoking fetch a classic worker-imported script.
|
||||
// NOTE: Service Workers is an example of a specification that runs this algorithm with its own options for the perform the fetch hook.
|
||||
|
||||
// 1. FIXME: If worker global scope's type is "module", throw a TypeError exception.
|
||||
// 2. FIXME: Let settings object be the current settings object.
|
||||
// FIXME: 1. If worker global scope's type is "module", throw a TypeError exception.
|
||||
// FIXME: 2. Let settings object be the current settings object.
|
||||
|
||||
// 3. If urls is empty, return.
|
||||
if (urls.is_empty())
|
||||
return {};
|
||||
|
||||
// 4. FIXME: Parse each value in urls relative to settings object. If any fail, throw a "SyntaxError" DOMException.
|
||||
// 5. FIXME: For each url in the resulting URL records, run these substeps:
|
||||
// FIXME: 4. Parse each value in urls relative to settings object. If any fail, throw a "SyntaxError" DOMException.
|
||||
// FIXME: 5. For each url in the resulting URL records, run these substeps:
|
||||
// 1. Fetch a classic worker-imported script given url and settings object, passing along any custom perform the fetch steps provided.
|
||||
// If this succeeds, let script be the result. Otherwise, rethrow the exception.
|
||||
// 2. Run the classic script script, with the rethrow errors argument set to true.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue