瀏覽代碼

LibWeb: Port fire_a_page_transition_event() to new FlyString

Kenneth Myhra 2 年之前
父節點
當前提交
cbefab21be

+ 1 - 1
Userland/Libraries/LibWeb/DOM/Document.cpp

@@ -2327,7 +2327,7 @@ void Document::unload(bool recursive_flag, Optional<DocumentUnloadTimingInfo> un
         m_page_showing = false;
 
         // 2. Fire a page transition event named pagehide at document's relevant global object with document's salvageable state.
-        global_object().fire_a_page_transition_event(HTML::EventNames::pagehide.to_deprecated_fly_string(), m_salvageable);
+        global_object().fire_a_page_transition_event(HTML::EventNames::pagehide, m_salvageable);
 
         // 3. Update the visibility state of newDocument to "hidden".
         update_the_visibility_state(HTML::VisibilityState::Hidden);

+ 1 - 1
Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp

@@ -1125,7 +1125,7 @@ WebIDL::ExceptionOr<void> BrowsingContext::traverse_the_history(size_t entry_ind
 
             // 4. Fire a page transition event named pageshow at newDocument's relevant global object with true.
             auto& window = verify_cast<HTML::Window>(relevant_global_object(*new_document));
-            window.fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), true);
+            window.fire_a_page_transition_event(HTML::EventNames::pageshow, true);
         });
     }
 

+ 1 - 1
Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp

@@ -313,7 +313,7 @@ void HTMLParser::the_end()
         document->set_page_showing(true);
 
         // 11. Fire a page transition event named pageshow at window with false.
-        window->fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), false);
+        window->fire_a_page_transition_event(HTML::EventNames::pageshow, false);
 
         // 12. Completely finish loading the Document.
         document->completely_finish_loading();

+ 2 - 2
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -567,14 +567,14 @@ Optional<CSS::MediaFeatureValue> Window::query_media_feature(CSS::MediaFeatureID
 }
 
 // https://html.spec.whatwg.org/#fire-a-page-transition-event
-void Window::fire_a_page_transition_event(DeprecatedFlyString const& event_name, bool persisted)
+void Window::fire_a_page_transition_event(FlyString const& event_name, bool persisted)
 {
     // To fire a page transition event named eventName at a Window window with a boolean persisted,
     // fire an event named eventName at window, using PageTransitionEvent,
     // with the persisted attribute initialized to persisted,
     PageTransitionEventInit event_init {};
     event_init.persisted = persisted;
-    auto event = PageTransitionEvent::create(associated_document().realm(), String::from_deprecated_string(event_name).release_value_but_fixme_should_propagate_errors(), event_init).release_value_but_fixme_should_propagate_errors();
+    auto event = PageTransitionEvent::create(associated_document().realm(), event_name, event_init).release_value_but_fixme_should_propagate_errors();
 
     // ...the cancelable attribute initialized to true,
     event->set_cancelable(true);

+ 1 - 1
Userland/Libraries/LibWeb/HTML/Window.h

@@ -106,7 +106,7 @@ public:
 
     Optional<CSS::MediaFeatureValue> query_media_feature(CSS::MediaFeatureID) const;
 
-    void fire_a_page_transition_event(DeprecatedFlyString const& event_name, bool persisted);
+    void fire_a_page_transition_event(FlyString const& event_name, bool persisted);
 
     WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> local_storage();
     WebIDL::ExceptionOr<JS::NonnullGCPtr<Storage>> session_storage();

+ 1 - 1
Userland/Libraries/LibWeb/XML/XMLDocumentBuilder.cpp

@@ -245,7 +245,7 @@ void XMLDocumentBuilder::document_end()
         document->set_page_showing(true);
 
         // Fire a page transition event named pageshow at window with false.
-        window->fire_a_page_transition_event(HTML::EventNames::pageshow.to_deprecated_fly_string(), false);
+        window->fire_a_page_transition_event(HTML::EventNames::pageshow, false);
 
         // Completely finish loading the Document.
         document->completely_finish_loading();