Frame.cpp 697 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #include <LibHTML/DOM/Document.h>
  2. #include <LibHTML/Frame.h>
  3. #include <LibHTML/HtmlView.h>
  4. Frame::Frame(HtmlView& html_view)
  5. : m_html_view(html_view.make_weak_ptr())
  6. {
  7. }
  8. Frame::~Frame()
  9. {
  10. }
  11. void Frame::set_document(Document* document)
  12. {
  13. if (m_document == document)
  14. return;
  15. if (m_document)
  16. m_document->detach_from_frame({}, *this);
  17. m_document = document;
  18. if (m_document)
  19. m_document->attach_to_frame({}, *this);
  20. }
  21. void Frame::set_size(const Size& size)
  22. {
  23. if (m_size == size)
  24. return;
  25. m_size = size;
  26. }
  27. void Frame::set_needs_display(const Rect& rect)
  28. {
  29. if (!on_set_needs_display)
  30. return;
  31. on_set_needs_display(rect);
  32. }