Frame.cpp 827 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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_viewport_rect(const Rect& rect)
  28. {
  29. if (m_viewport_rect == rect)
  30. return;
  31. m_viewport_rect = rect;
  32. }
  33. void Frame::set_needs_display(const Rect& rect)
  34. {
  35. if (!on_set_needs_display)
  36. return;
  37. on_set_needs_display(rect);
  38. }