StyleSheet.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, the SerenityOS developers.
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibWeb/Bindings/PlatformObject.h>
  9. #include <LibWeb/Forward.h>
  10. namespace Web::CSS {
  11. class StyleSheet : public Bindings::PlatformObject {
  12. WEB_PLATFORM_OBJECT(StyleSheet, Bindings::PlatformObject);
  13. public:
  14. virtual ~StyleSheet() = default;
  15. virtual String type() const = 0;
  16. DOM::Element* owner_node() { return m_owner_node; }
  17. void set_owner_node(DOM::Element*);
  18. String href() const { return m_location; }
  19. String location() const { return m_location; }
  20. void set_location(String location) { m_location = move(location); }
  21. String title() const { return m_title; }
  22. void set_title(String title) { m_title = move(title); }
  23. void set_type(String type) { m_type_string = move(type); }
  24. void set_media(String media) { m_media_string = move(media); }
  25. bool is_alternate() const { return m_alternate; }
  26. void set_alternate(bool alternate) { m_alternate = alternate; }
  27. void set_origin_clean(bool origin_clean) { m_origin_clean = origin_clean; }
  28. bool disabled() const { return m_disabled; }
  29. void set_disabled(bool disabled) { m_disabled = disabled; }
  30. CSSStyleSheet* parent_style_sheet() { return m_parent_style_sheet; }
  31. void set_parent_css_style_sheet(CSSStyleSheet*);
  32. protected:
  33. explicit StyleSheet(HTML::Window&);
  34. virtual void visit_edges(Cell::Visitor&) override;
  35. private:
  36. JS::GCPtr<DOM::Element> m_owner_node;
  37. JS::GCPtr<CSSStyleSheet> m_parent_style_sheet;
  38. String m_location;
  39. String m_title;
  40. String m_type_string;
  41. String m_media_string;
  42. bool m_disabled { false };
  43. bool m_alternate { false };
  44. bool m_origin_clean { true };
  45. };
  46. }