Skip to content

Commit d8ccc2d

Browse files
LibWeb: Rename BrowsingContextContainer => NavigableContainer
The "browsing context container" concept in the HTML spec has been replaced with "navigable container". Renaming this is the first step of many towards implementing the new world. Co-authored-by: Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
1 parent 0f9f6ae commit d8ccc2d

17 files changed

+61
-60
lines changed

Userland/Libraries/LibWeb/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,6 @@ set(SOURCES
202202
Geometry/DOMRectReadOnly.cpp
203203
HTML/AttributeNames.cpp
204204
HTML/BrowsingContext.cpp
205-
HTML/BrowsingContextContainer.cpp
206205
HTML/BrowsingContextGroup.cpp
207206
HTML/Canvas/CanvasDrawImage.cpp
208207
HTML/Canvas/CanvasPath.cpp
@@ -314,6 +313,7 @@ set(SOURCES
314313
HTML/MessagePort.cpp
315314
HTML/MimeType.cpp
316315
HTML/MimeTypeArray.cpp
316+
HTML/NavigableContainer.cpp
317317
HTML/Navigator.cpp
318318
HTML/NavigatorID.cpp
319319
HTML/PageTransitionEvent.cpp

Userland/Libraries/LibWeb/DOM/Document.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1706,8 +1706,8 @@ bool Document::is_fully_active() const
17061706
return false;
17071707
if (browsing_context->is_top_level())
17081708
return true;
1709-
if (auto* browsing_context_container_document = browsing_context->container_document()) {
1710-
if (browsing_context_container_document->is_fully_active())
1709+
if (auto* navigable_container_document = browsing_context->container_document()) {
1710+
if (navigable_container_document->is_fully_active())
17111711
return true;
17121712
}
17131713
return false;

Userland/Libraries/LibWeb/DOM/Node.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
#include <LibWeb/DOM/Range.h>
3030
#include <LibWeb/DOM/ShadowRoot.h>
3131
#include <LibWeb/DOM/StaticNodeList.h>
32-
#include <LibWeb/HTML/BrowsingContextContainer.h>
3332
#include <LibWeb/HTML/CustomElements/CustomElementReactionNames.h>
3433
#include <LibWeb/HTML/HTMLAnchorElement.h>
3534
#include <LibWeb/HTML/HTMLStyleElement.h>
35+
#include <LibWeb/HTML/NavigableContainer.h>
3636
#include <LibWeb/HTML/Origin.h>
3737
#include <LibWeb/HTML/Parser/HTMLParser.h>
3838
#include <LibWeb/Infra/CharacterTypes.h>
@@ -1070,8 +1070,8 @@ void Node::serialize_tree_as_json(JsonObjectSerializer<StringBuilder>& object) c
10701070
MUST(attributes.finish());
10711071
}
10721072

1073-
if (element->is_browsing_context_container()) {
1074-
auto const* container = static_cast<HTML::BrowsingContextContainer const*>(element);
1073+
if (element->is_navigable_container()) {
1074+
auto const* container = static_cast<HTML::NavigableContainer const*>(element);
10751075
if (auto const* content_document = container->content_document()) {
10761076
auto children = MUST(object.add_array("children"sv));
10771077
JsonObjectSerializer<StringBuilder> content_document_object = MUST(children.add_object());

Userland/Libraries/LibWeb/DOM/Node.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class Node : public EventTarget {
9090
virtual bool is_html_input_element() const { return false; }
9191
virtual bool is_html_progress_element() const { return false; }
9292
virtual bool is_html_template_element() const { return false; }
93-
virtual bool is_browsing_context_container() const { return false; }
93+
virtual bool is_navigable_container() const { return false; }
9494

9595
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> pre_insert(JS::NonnullGCPtr<Node>, JS::GCPtr<Node>);
9696
WebIDL::ExceptionOr<JS::NonnullGCPtr<Node>> pre_remove(JS::NonnullGCPtr<Node>);

Userland/Libraries/LibWeb/Forward.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ class DOMRectReadOnly;
274274

275275
namespace Web::HTML {
276276
class BrowsingContext;
277-
class BrowsingContextContainer;
278277
class BrowsingContextGroup;
279278
class CanvasRenderingContext2D;
280279
class ClassicScript;
@@ -370,7 +369,9 @@ class MessageEvent;
370369
class MessagePort;
371370
class MimeType;
372371
class MimeTypeArray;
372+
class NavigableContainer;
373373
class Navigator;
374+
struct NavigationParams;
374375
class Origin;
375376
class PageTransitionEvent;
376377
class Path2D;

Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
#include <LibWeb/DOM/Range.h>
1313
#include <LibWeb/Fetch/Infrastructure/HTTP/Requests.h>
1414
#include <LibWeb/HTML/BrowsingContext.h>
15-
#include <LibWeb/HTML/BrowsingContextContainer.h>
1615
#include <LibWeb/HTML/BrowsingContextGroup.h>
1716
#include <LibWeb/HTML/CrossOrigin/CrossOriginOpenerPolicy.h>
1817
#include <LibWeb/HTML/EventLoop/EventLoop.h>
1918
#include <LibWeb/HTML/HTMLAnchorElement.h>
2019
#include <LibWeb/HTML/HTMLInputElement.h>
20+
#include <LibWeb/HTML/NavigableContainer.h>
2121
#include <LibWeb/HTML/RemoteBrowsingContext.h>
2222
#include <LibWeb/HTML/SandboxingFlagSet.h>
2323
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
@@ -87,7 +87,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_top_level_browsi
8787
JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context(Page& page, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, BrowsingContextGroup&)
8888
{
8989
// 1. Let browsingContext be a new browsing context.
90-
BrowsingContextContainer* container = (embedder && is<BrowsingContextContainer>(*embedder)) ? static_cast<BrowsingContextContainer*>(embedder.ptr()) : nullptr;
90+
NavigableContainer* container = (embedder && is<NavigableContainer>(*embedder)) ? static_cast<NavigableContainer*>(embedder.ptr()) : nullptr;
9191
auto browsing_context = Bindings::main_thread_vm().heap().allocate_without_realm<BrowsingContext>(page, container);
9292

9393
// 2. Let unsafeContextCreationTime be the unsafe shared current time.
@@ -226,7 +226,7 @@ JS::NonnullGCPtr<BrowsingContext> BrowsingContext::create_a_new_browsing_context
226226
return *browsing_context;
227227
}
228228

229-
BrowsingContext::BrowsingContext(Page& page, HTML::BrowsingContextContainer* container)
229+
BrowsingContext::BrowsingContext(Page& page, HTML::NavigableContainer* container)
230230
: m_page(page)
231231
, m_loader(*this)
232232
, m_event_handler({}, *this)
@@ -604,9 +604,9 @@ JS::GCPtr<DOM::Node> BrowsingContext::currently_focused_area()
604604
// 3. While candidate's focused area is a browsing context container with a non-null nested browsing context:
605605
// set candidate to the active document of that browsing context container's nested browsing context.
606606
while (candidate->focused_element()
607-
&& is<HTML::BrowsingContextContainer>(candidate->focused_element())
608-
&& static_cast<HTML::BrowsingContextContainer&>(*candidate->focused_element()).nested_browsing_context()) {
609-
candidate = static_cast<HTML::BrowsingContextContainer&>(*candidate->focused_element()).nested_browsing_context()->active_document();
607+
&& is<HTML::NavigableContainer>(candidate->focused_element())
608+
&& static_cast<HTML::NavigableContainer&>(*candidate->focused_element()).nested_browsing_context()) {
609+
candidate = static_cast<HTML::NavigableContainer&>(*candidate->focused_element()).nested_browsing_context()->active_document();
610610
}
611611

612612
// 4. If candidate's focused area is non-null, set candidate to candidate's focused area.

Userland/Libraries/LibWeb/HTML/BrowsingContext.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
#include <LibWeb/DOM/Position.h>
1919
#include <LibWeb/HTML/AbstractBrowsingContext.h>
2020
#include <LibWeb/HTML/ActivateTab.h>
21-
#include <LibWeb/HTML/BrowsingContextContainer.h>
2221
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
22+
#include <LibWeb/HTML/NavigableContainer.h>
2323
#include <LibWeb/HTML/Origin.h>
2424
#include <LibWeb/HTML/SessionHistoryEntry.h>
2525
#include <LibWeb/HTML/TokenizedFeatures.h>
@@ -179,8 +179,8 @@ class BrowsingContext final
179179

180180
bool is_child_of(BrowsingContext const&) const;
181181

182-
HTML::BrowsingContextContainer* container() { return m_container; }
183-
HTML::BrowsingContextContainer const* container() const { return m_container; }
182+
HTML::NavigableContainer* container() { return m_container; }
183+
HTML::NavigableContainer const* container() const { return m_container; }
184184

185185
CSSPixelPoint to_top_level_position(CSSPixelPoint);
186186
CSSPixelRect to_top_level_rect(CSSPixelRect const&);
@@ -266,7 +266,7 @@ class BrowsingContext final
266266
virtual void set_window_handle(String handle) override { m_window_handle = move(handle); }
267267

268268
private:
269-
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);
269+
explicit BrowsingContext(Page&, HTML::NavigableContainer*);
270270

271271
virtual void visit_edges(Cell::Visitor&) override;
272272

@@ -296,7 +296,7 @@ class BrowsingContext final
296296
// https://html.spec.whatwg.org/multipage/browsers.html#creator-origin
297297
Optional<HTML::Origin> m_creator_origin;
298298

299-
JS::GCPtr<HTML::BrowsingContextContainer> m_container;
299+
JS::GCPtr<HTML::NavigableContainer> m_container;
300300
CSSPixelSize m_size;
301301
CSSPixelPoint m_viewport_scroll_offset;
302302

Userland/Libraries/LibWeb/HTML/Focus.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target,
174174
new_focus_target = fallback_target;
175175
}
176176

177-
// 3. If new focus target is a browsing context container with non-null nested browsing context,
177+
// 3. If new focus target is a navigable container with non-null nested browsing context,
178178
// then set new focus target to the nested browsing context's active document.
179-
if (is<HTML::BrowsingContextContainer>(*new_focus_target)) {
180-
auto& browsing_context_container = static_cast<HTML::BrowsingContextContainer&>(*new_focus_target);
181-
if (auto* nested_browsing_context = browsing_context_container.nested_browsing_context())
179+
if (is<HTML::NavigableContainer>(*new_focus_target)) {
180+
auto& navigable_container = static_cast<HTML::NavigableContainer&>(*new_focus_target);
181+
if (auto* nested_browsing_context = navigable_container.nested_browsing_context())
182182
new_focus_target = nested_browsing_context->active_document();
183183
}
184184

Userland/Libraries/LibWeb/HTML/HTMLElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
#include <LibWeb/DOM/IDLEventListener.h>
1313
#include <LibWeb/DOM/ShadowRoot.h>
1414
#include <LibWeb/HTML/BrowsingContext.h>
15-
#include <LibWeb/HTML/BrowsingContextContainer.h>
1615
#include <LibWeb/HTML/DOMStringMap.h>
1716
#include <LibWeb/HTML/EventHandler.h>
1817
#include <LibWeb/HTML/Focus.h>
1918
#include <LibWeb/HTML/HTMLAnchorElement.h>
2019
#include <LibWeb/HTML/HTMLAreaElement.h>
2120
#include <LibWeb/HTML/HTMLBodyElement.h>
2221
#include <LibWeb/HTML/HTMLElement.h>
22+
#include <LibWeb/HTML/NavigableContainer.h>
2323
#include <LibWeb/HTML/VisibilityState.h>
2424
#include <LibWeb/HTML/Window.h>
2525
#include <LibWeb/Layout/Box.h>

Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Web::HTML {
1616

1717
HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, DOM::QualifiedName qualified_name)
18-
: BrowsingContextContainer(document, move(qualified_name))
18+
: NavigableContainer(document, move(qualified_name))
1919
{
2020
}
2121

0 commit comments

Comments
 (0)