mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:57:43 +00:00
LibWeb: Add SessionHistoryTraversalQueue
This commit is contained in:
parent
6d866dc5ba
commit
08788072c1
5 changed files with 134 additions and 80 deletions
|
@ -479,24 +479,25 @@ void TraversableNavigable::traverse_the_history_by_delta(int delta)
|
|||
// FIXME: 2. If sourceDocument is given, then:
|
||||
|
||||
// 3. Append the following session history traversal steps to traversable:
|
||||
append_session_history_traversal_steps([this, delta] {
|
||||
// 1. Let allSteps be the result of getting all used history steps for traversable.
|
||||
auto all_steps = get_all_used_history_steps();
|
||||
|
||||
// 1. Let allSteps be the result of getting all used history steps for traversable.
|
||||
auto all_steps = get_all_used_history_steps();
|
||||
// 2. Let currentStepIndex be the index of traversable's current session history step within allSteps.
|
||||
auto current_step_index = *all_steps.find_first_index(current_session_history_step());
|
||||
|
||||
// 2. Let currentStepIndex be the index of traversable's current session history step within allSteps.
|
||||
auto current_step_index = *all_steps.find_first_index(current_session_history_step());
|
||||
// 3. Let targetStepIndex be currentStepIndex plus delta
|
||||
auto target_step_index = current_step_index + delta;
|
||||
|
||||
// 3. Let targetStepIndex be currentStepIndex plus delta
|
||||
auto target_step_index = current_step_index + delta;
|
||||
// 4. If allSteps[targetStepIndex] does not exist, then abort these steps.
|
||||
if (target_step_index >= all_steps.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 4. If allSteps[targetStepIndex] does not exist, then abort these steps.
|
||||
if (target_step_index >= all_steps.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 5. Apply the history step allSteps[targetStepIndex] to traversable, with checkForUserCancelation set to true,
|
||||
// sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to initiatorToCheck.
|
||||
apply_the_history_step(all_steps[target_step_index]);
|
||||
// 5. Apply the history step allSteps[targetStepIndex] to traversable, with checkForUserCancelation set to true,
|
||||
// sourceSnapshotParams set to sourceSnapshotParams, and initiatorToCheck set to initiatorToCheck.
|
||||
apply_the_history_step(all_steps[target_step_index]);
|
||||
});
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#apply-pending-history-changes
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue