mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 19:25:10 +00:00
LibHTML: Add a Frame class and use it for document layout width
Each HtmlView now has a main_frame(), which represents the main frame of the web page. Frame inherits from TreeNode<Frame>, which will allow us to someday implement a Frame tree (to support the <frame> element.)
This commit is contained in:
parent
b1758ae2b3
commit
7bc9310170
9 changed files with 101 additions and 8 deletions
31
Libraries/LibHTML/Frame.cpp
Normal file
31
Libraries/LibHTML/Frame.cpp
Normal file
|
@ -0,0 +1,31 @@
|
|||
#include <LibHTML/DOM/Document.h>
|
||||
#include <LibHTML/Frame.h>
|
||||
|
||||
Frame::Frame()
|
||||
{
|
||||
}
|
||||
|
||||
Frame::~Frame()
|
||||
{
|
||||
}
|
||||
|
||||
void Frame::set_document(Document* document)
|
||||
{
|
||||
if (m_document == document)
|
||||
return;
|
||||
|
||||
if (m_document)
|
||||
m_document->detach_from_frame({}, *this);
|
||||
|
||||
m_document = document;
|
||||
|
||||
if (m_document)
|
||||
m_document->attach_to_frame({}, *this);
|
||||
}
|
||||
|
||||
void Frame::set_size(const Size& size)
|
||||
{
|
||||
if (m_size == size)
|
||||
return;
|
||||
m_size = size;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue