
This patch implements basic support for presentational hints, which are old-school HTML attributes that affect style. You add support for a presentational hint attribute by overriding Element::apply_presentational_hints(StyleProperties&) and setting all of the corresponding CSS properties as appropriate. To make the background color fill the entire document, not just the bounds of the <body> element's LayoutNode, we special-case it in the HtmlView::paint_event() code for now. I'm not entirely sure what the nicest solution would be, but I'm sure we'll discover it eventually.
56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <AK/NonnullRefPtrVector.h>
|
|
#include <AK/OwnPtr.h>
|
|
#include <AK/String.h>
|
|
#include <AK/WeakPtr.h>
|
|
#include <LibHTML/CSS/StyleResolver.h>
|
|
#include <LibHTML/CSS/StyleSheet.h>
|
|
#include <LibHTML/DOM/ParentNode.h>
|
|
|
|
class Frame;
|
|
class HTMLBodyElement;
|
|
class HTMLHtmlElement;
|
|
class HTMLHeadElement;
|
|
class LayoutNode;
|
|
class StyleResolver;
|
|
class StyleSheet;
|
|
|
|
class Document : public ParentNode {
|
|
public:
|
|
Document();
|
|
virtual ~Document() override;
|
|
|
|
void normalize();
|
|
|
|
StyleResolver& style_resolver();
|
|
|
|
void add_sheet(const StyleSheet& sheet) { m_sheets.append(sheet); }
|
|
const NonnullRefPtrVector<StyleSheet>& stylesheets() const { return m_sheets; }
|
|
|
|
virtual String tag_name() const override { return "#document"; }
|
|
|
|
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; }
|
|
|
|
const HTMLHtmlElement* document_element() const;
|
|
const HTMLHeadElement* head() const;
|
|
const HTMLBodyElement* body() const;
|
|
|
|
String title() const;
|
|
|
|
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(); }
|
|
|
|
Color background_color() const;
|
|
|
|
private:
|
|
OwnPtr<StyleResolver> m_style_resolver;
|
|
NonnullRefPtrVector<StyleSheet> m_sheets;
|
|
RefPtr<Node> m_hovered_node;
|
|
WeakPtr<Frame> m_frame;
|
|
};
|