Преглед на файлове

LibWeb: Update `Window::length()` to use navigables

Aliaksandr Kalenik преди 1 година
родител
ревизия
089a23a1f2
променени са 2 файла, в които са добавени 3 реда и са изтрити 3 реда
  1. 2 2
      Userland/Libraries/LibWeb/HTML/Window.cpp
  2. 1 1
      Userland/Libraries/LibWeb/HTML/Window.h

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

@@ -880,10 +880,10 @@ JS::NonnullGCPtr<WindowProxy> Window::frames() const
 }
 
 // https://html.spec.whatwg.org/multipage/window-object.html#dom-length
-u32 Window::length() const
+u32 Window::length()
 {
     // The length getter steps are to return this's associated Document's document-tree child navigables's size.
-    return static_cast<u32>(document_tree_child_browsing_context_count());
+    return associated_document().document_tree_child_navigables().size();
 }
 
 // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-top

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

@@ -136,7 +136,7 @@ public:
     void focus();
 
     JS::NonnullGCPtr<WindowProxy> frames() const;
-    u32 length() const;
+    u32 length();
     JS::GCPtr<WindowProxy const> top() const;
     JS::GCPtr<WindowProxy const> parent() const;
     JS::GCPtr<DOM::Element const> frame_element() const;