소스 검색

LibWeb: Add getter for history-action activation

Jamie Mansfield 1 년 전
부모
커밋
34b2a4f7ca
2개의 변경된 파일10개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      Userland/Libraries/LibWeb/HTML/Window.cpp
  2. 3 0
      Userland/Libraries/LibWeb/HTML/Window.h

+ 7 - 0
Userland/Libraries/LibWeb/HTML/Window.cpp

@@ -631,6 +631,13 @@ bool Window::has_transient_activation() const
     return false;
 }
 
+// https://html.spec.whatwg.org/multipage/interaction.html#history-action-activation
+bool Window::has_history_action_activation() const
+{
+    // When the last history-action activation timestamp of W is not equal to the last activation timestamp of W, then W is said to have history-action activation.
+    return m_last_history_action_activation_timestamp != m_last_activation_timestamp;
+}
+
 // https://w3c.github.io/requestidlecallback/#start-an-idle-period-algorithm
 void Window::start_an_idle_period()
 {

+ 3 - 0
Userland/Libraries/LibWeb/HTML/Window.h

@@ -122,6 +122,9 @@ public:
     // https://html.spec.whatwg.org/multipage/interaction.html#transient-activation
     bool has_transient_activation() const;
 
+    // https://html.spec.whatwg.org/multipage/interaction.html#history-action-activation
+    bool has_history_action_activation() const;
+
     WebIDL::ExceptionOr<void> initialize_web_interfaces(Badge<WindowEnvironmentSettingsObject>);
 
     Vector<JS::NonnullGCPtr<Plugin>> pdf_viewer_plugin_objects();