2019-06-15 18:55:47 +02:00
|
|
|
#pragma once
|
|
|
|
|
2019-06-29 21:42:07 +02:00
|
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
|
|
#include <AK/OwnPtr.h>
|
2019-09-29 16:24:57 +02:00
|
|
|
#include <AK/String.h>
|
2019-10-04 15:50:04 +02:00
|
|
|
#include <AK/WeakPtr.h>
|
2019-06-29 21:42:07 +02:00
|
|
|
#include <LibHTML/CSS/StyleResolver.h>
|
|
|
|
#include <LibHTML/CSS/StyleSheet.h>
|
2019-06-15 23:41:15 +02:00
|
|
|
#include <LibHTML/DOM/ParentNode.h>
|
2019-06-15 18:55:47 +02:00
|
|
|
|
2019-10-04 15:50:04 +02:00
|
|
|
class Frame;
|
2019-10-04 21:05:52 +02:00
|
|
|
class HTMLBodyElement;
|
2019-09-29 16:24:57 +02:00
|
|
|
class HTMLHtmlElement;
|
|
|
|
class HTMLHeadElement;
|
2019-06-15 22:49:44 +02:00
|
|
|
class LayoutNode;
|
2019-06-29 21:42:07 +02:00
|
|
|
class StyleResolver;
|
|
|
|
class StyleSheet;
|
2019-06-15 22:49:44 +02:00
|
|
|
|
2019-06-15 18:55:47 +02:00
|
|
|
class Document : public ParentNode {
|
|
|
|
public:
|
|
|
|
Document();
|
|
|
|
virtual ~Document() override;
|
|
|
|
|
2019-09-25 12:26:26 +03:00
|
|
|
void normalize();
|
|
|
|
|
2019-06-29 21:42:07 +02:00
|
|
|
StyleResolver& style_resolver();
|
2019-06-15 22:49:44 +02:00
|
|
|
|
2019-06-29 21:42:07 +02:00
|
|
|
void add_sheet(const StyleSheet& sheet) { m_sheets.append(sheet); }
|
|
|
|
const NonnullRefPtrVector<StyleSheet>& stylesheets() const { return m_sheets; }
|
2019-06-15 22:49:44 +02:00
|
|
|
|
2019-09-28 22:59:16 +02:00
|
|
|
virtual String tag_name() const override { return "#document"; }
|
|
|
|
|
2019-09-29 11:50:35 +02:00
|
|
|
void set_hovered_node(Node* node) { m_hovered_node = node; }
|
|
|
|
Node* hovered_node() { return m_hovered_node; }
|
|
|
|
const Node* hovered_node() const { return m_hovered_node; }
|
|
|
|
|
2019-09-29 16:24:57 +02:00
|
|
|
const HTMLHtmlElement* document_element() const;
|
|
|
|
const HTMLHeadElement* head() const;
|
2019-10-04 21:05:52 +02:00
|
|
|
const HTMLBodyElement* body() const;
|
2019-09-29 16:24:57 +02:00
|
|
|
|
|
|
|
String title() const;
|
|
|
|
|
2019-10-04 15:50:04 +02:00
|
|
|
void attach_to_frame(Badge<Frame>, Frame&);
|
|
|
|
void detach_from_frame(Badge<Frame>, Frame&);
|
|
|
|
|
|
|
|
Frame* frame() { return m_frame.ptr(); }
|
|
|
|
const Frame* frame() const { return m_frame.ptr(); }
|
|
|
|
|
2019-10-04 21:05:52 +02:00
|
|
|
Color background_color() const;
|
|
|
|
|
2019-06-15 18:55:47 +02:00
|
|
|
private:
|
2019-06-29 21:42:07 +02:00
|
|
|
OwnPtr<StyleResolver> m_style_resolver;
|
|
|
|
NonnullRefPtrVector<StyleSheet> m_sheets;
|
2019-09-29 11:50:35 +02:00
|
|
|
RefPtr<Node> m_hovered_node;
|
2019-10-04 15:50:04 +02:00
|
|
|
WeakPtr<Frame> m_frame;
|
2019-06-15 18:55:47 +02:00
|
|
|
};
|