diff options
author | Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> | 2022-10-23 21:05:34 +0300 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-11-14 14:47:37 +0000 |
commit | 93238edf8f5c207b5c1145d3745e97e2136abd65 (patch) | |
tree | 967e8ca846601ae4b57f3984bfabaeacc2381186 /Userland/Libraries/LibWeb/CSS/StyleSheet.h | |
parent | bd4bb4fd512408ae44f19887a9282aa297b58c27 (diff) | |
download | serenity-93238edf8f5c207b5c1145d3745e97e2136abd65.zip |
LibWeb: Respect media attribute of style tag
Diffstat (limited to 'Userland/Libraries/LibWeb/CSS/StyleSheet.h')
-rw-r--r-- | Userland/Libraries/LibWeb/CSS/StyleSheet.h | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/StyleSheet.h b/Userland/Libraries/LibWeb/CSS/StyleSheet.h index 4aaf056b9e..b851bc5b18 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleSheet.h +++ b/Userland/Libraries/LibWeb/CSS/StyleSheet.h @@ -8,6 +8,7 @@ #pragma once #include <LibWeb/Bindings/PlatformObject.h> +#include <LibWeb/CSS/MediaList.h> #include <LibWeb/Forward.h> namespace Web::CSS { @@ -32,7 +33,16 @@ public: void set_title(String title) { m_title = move(title); } void set_type(String type) { m_type_string = move(type); } - void set_media(String media) { m_media_string = move(media); } + + MediaList* media() const + { + return &m_media; + } + + void set_media(String media) + { + m_media.set_media_text(media); + } bool is_alternate() const { return m_alternate; } void set_alternate(bool alternate) { m_alternate = alternate; } @@ -46,9 +56,11 @@ public: void set_parent_css_style_sheet(CSSStyleSheet*); protected: - explicit StyleSheet(JS::Realm&); + explicit StyleSheet(JS::Realm&, MediaList& media); virtual void visit_edges(Cell::Visitor&) override; + MediaList& m_media; + private: JS::GCPtr<DOM::Element> m_owner_node; JS::GCPtr<CSSStyleSheet> m_parent_style_sheet; @@ -56,7 +68,6 @@ private: String m_location; String m_title; String m_type_string; - String m_media_string; bool m_disabled { false }; bool m_alternate { false }; |