mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 13:35:12 +00:00
LibWeb: Update create_new_child_navigable() after spec fix
Now that https://github.com/whatwg/html/issues/9686 is fixed, let's fix it the exact same way in our implementation. :^)
This commit is contained in:
parent
49fcc5dcd8
commit
0a05be69cf
Notes:
sideshowbarker
2024-07-17 02:29:45 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/0a05be69cf Pull-request: https://github.com/SerenityOS/serenity/pull/22544
1 changed files with 9 additions and 7 deletions
|
@ -114,16 +114,18 @@ WebIDL::ExceptionOr<void> NavigableContainer::create_new_child_navigable()
|
|||
|
||||
auto parent_doc_state = parent_navigable->active_session_history_entry()->document_state;
|
||||
|
||||
// 2. Let targetStepSHE be the first session history entry in traversable's session history entries whose document state equals parentDocState.
|
||||
// NOTE: We need to look for parent document state in parent navigable instead of traversable as specification says. https://github.com/whatwg/html/issues/9686
|
||||
auto target_step_she = *(parent_navigable->get_session_history_entries().find_if([parent_doc_state](auto& entry) {
|
||||
return entry->document_state == parent_doc_state;
|
||||
}));
|
||||
// 2. Let parentNavigableEntries be the result of getting session history entries for parentNavigable.
|
||||
auto parent_navigable_entries = parent_navigable->get_session_history_entries();
|
||||
|
||||
// 3. Set historyEntry's step to targetStepSHE's step.
|
||||
// 3. Let targetStepSHE be the first session history entry in parentNavigableEntries whose document state equals parentDocState.
|
||||
auto target_step_she = *parent_navigable_entries.find_if([parent_doc_state](auto& entry) {
|
||||
return entry->document_state == parent_doc_state;
|
||||
});
|
||||
|
||||
// 4. Set historyEntry's step to targetStepSHE's step.
|
||||
history_entry->step = target_step_she->step;
|
||||
|
||||
// 4. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
|
||||
// 5. Let nestedHistory be a new nested history whose id is navigable's id and entries list is « historyEntry ».
|
||||
DocumentState::NestedHistory nested_history {
|
||||
.id = navigable->id(),
|
||||
.entries { *history_entry },
|
||||
|
|
Loading…
Add table
Reference in a new issue