1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 12:25:06 +00:00

LibHTML: Introduce the HtmlView widget

This is a GWidget that can display contents of an HTML document.
It replaces the Frame class.
This commit is contained in:
Sergey Bugaev 2019-09-25 12:44:22 +03:00 committed by Andreas Kling
parent 8a2beaf52b
commit b9493ba783
6 changed files with 119 additions and 70 deletions

View file

@ -1,41 +0,0 @@
#include <AK/Function.h>
#include <LibHTML/CSS/StyleResolver.h>
#include <LibHTML/DOM/Element.h>
#include <LibHTML/Dump.h>
#include <LibHTML/Frame.h>
#include <LibHTML/Layout/LayoutBlock.h>
#include <LibHTML/Layout/LayoutDocument.h>
#include <LibHTML/Layout/LayoutInline.h>
#include <stdio.h>
Frame::Frame()
: m_size(800, 600)
{
}
Frame::~Frame()
{
}
void Frame::set_document(Document* document)
{
m_document = document;
}
void Frame::layout()
{
if (!m_document)
return;
auto layout_root = m_document->create_layout_tree(m_document->style_resolver(), nullptr);
layout_root->style().size().set_width(m_size.width());
printf("\033[33;1mLayout tree before layout:\033[0m\n");
dump_tree(*layout_root);
layout_root->layout();
printf("\033[33;1mLayout tree after layout:\033[0m\n");
dump_tree(*layout_root);
}