ComputedValues.h 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. /*
  2. * Copyright (c) 2020-2023, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Optional.h>
  8. #include <LibWeb/CSS/BackdropFilter.h>
  9. #include <LibWeb/CSS/Clip.h>
  10. #include <LibWeb/CSS/LengthBox.h>
  11. #include <LibWeb/CSS/Size.h>
  12. #include <LibWeb/CSS/StyleValue.h>
  13. #include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
  14. #include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
  15. namespace Web::CSS {
  16. class InitialValues {
  17. public:
  18. static float font_size() { return 16; }
  19. static int font_weight() { return 400; }
  20. static CSS::FontVariant font_variant() { return CSS::FontVariant::Normal; }
  21. static CSS::Float float_() { return CSS::Float::None; }
  22. static CSS::Clear clear() { return CSS::Clear::None; }
  23. static CSS::Clip clip() { return CSS::Clip::make_auto(); }
  24. static CSS::Cursor cursor() { return CSS::Cursor::Auto; }
  25. static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; }
  26. static CSS::TextAlign text_align() { return CSS::TextAlign::Left; }
  27. static CSS::TextJustify text_justify() { return CSS::TextJustify::Auto; }
  28. static CSS::Position position() { return CSS::Position::Static; }
  29. static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
  30. static CSS::Length text_decoration_thickness() { return Length::make_auto(); }
  31. static CSS::TextDecorationStyle text_decoration_style() { return CSS::TextDecorationStyle::Solid; }
  32. static CSS::TextTransform text_transform() { return CSS::TextTransform::None; }
  33. static CSS::Display display() { return CSS::Display { CSS::Display::Outside::Inline, CSS::Display::Inside::Flow }; }
  34. static Color color() { return Color::Black; }
  35. static CSS::BackdropFilter backdrop_filter() { return BackdropFilter::make_none(); }
  36. static Color background_color() { return Color::Transparent; }
  37. static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
  38. static CSS::Visibility visibility() { return CSS::Visibility::Visible; }
  39. static CSS::FlexDirection flex_direction() { return CSS::FlexDirection::Row; }
  40. static CSS::FlexWrap flex_wrap() { return CSS::FlexWrap::Nowrap; }
  41. static CSS::ImageRendering image_rendering() { return CSS::ImageRendering::Auto; }
  42. static CSS::JustifyContent justify_content() { return CSS::JustifyContent::FlexStart; }
  43. static CSS::AlignContent align_content() { return CSS::AlignContent::Stretch; }
  44. static CSS::AlignItems align_items() { return CSS::AlignItems::Stretch; }
  45. static CSS::AlignSelf align_self() { return CSS::AlignSelf::Auto; }
  46. static CSS::Appearance appearance() { return CSS::Appearance::Auto; }
  47. static CSS::Overflow overflow() { return CSS::Overflow::Visible; }
  48. static CSS::BoxSizing box_sizing() { return CSS::BoxSizing::ContentBox; }
  49. static CSS::PointerEvents pointer_events() { return CSS::PointerEvents::Auto; }
  50. static float flex_grow() { return 0.0f; }
  51. static float flex_shrink() { return 1.0f; }
  52. static int order() { return 0; }
  53. static float opacity() { return 1.0f; }
  54. static CSS::Length border_radius() { return Length::make_px(0); }
  55. static Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align() { return CSS::VerticalAlign::Baseline; }
  56. static CSS::LengthBox inset() { return { CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto() }; }
  57. static CSS::LengthBox margin() { return { CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0) }; }
  58. static CSS::LengthBox padding() { return { CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0), CSS::Length::make_px(0) }; }
  59. static CSS::Size width() { return CSS::Size::make_auto(); }
  60. static CSS::Size min_width() { return CSS::Size::make_auto(); }
  61. static CSS::Size max_width() { return CSS::Size::make_none(); }
  62. static CSS::Size height() { return CSS::Size::make_auto(); }
  63. static CSS::Size min_height() { return CSS::Size::make_auto(); }
  64. static CSS::Size max_height() { return CSS::Size::make_none(); }
  65. static CSS::GridTrackSizeList grid_template_columns() { return CSS::GridTrackSizeList::make_auto(); }
  66. static CSS::GridTrackSizeList grid_template_rows() { return CSS::GridTrackSizeList::make_auto(); }
  67. static CSS::GridTrackPlacement grid_column_end() { return CSS::GridTrackPlacement::make_auto(); }
  68. static CSS::GridTrackPlacement grid_column_start() { return CSS::GridTrackPlacement::make_auto(); }
  69. static CSS::GridTrackPlacement grid_row_end() { return CSS::GridTrackPlacement::make_auto(); }
  70. static CSS::GridTrackPlacement grid_row_start() { return CSS::GridTrackPlacement::make_auto(); }
  71. static CSS::Size column_gap() { return CSS::Size::make_auto(); }
  72. static CSS::Size row_gap() { return CSS::Size::make_auto(); }
  73. static CSS::BorderCollapse border_collapse() { return CSS::BorderCollapse::Separate; }
  74. static Vector<Vector<String>> grid_template_areas() { return {}; }
  75. };
  76. struct BackgroundLayerData {
  77. RefPtr<CSS::AbstractImageStyleValue const> background_image { nullptr };
  78. CSS::BackgroundAttachment attachment { CSS::BackgroundAttachment::Scroll };
  79. CSS::BackgroundBox origin { CSS::BackgroundBox::PaddingBox };
  80. CSS::BackgroundBox clip { CSS::BackgroundBox::BorderBox };
  81. CSS::PositionEdge position_edge_x { CSS::PositionEdge::Left };
  82. CSS::LengthPercentage position_offset_x { CSS::Length::make_px(0) };
  83. CSS::PositionEdge position_edge_y { CSS::PositionEdge::Top };
  84. CSS::LengthPercentage position_offset_y { CSS::Length::make_px(0) };
  85. CSS::BackgroundSize size_type { CSS::BackgroundSize::LengthPercentage };
  86. CSS::LengthPercentage size_x { CSS::Length::make_auto() };
  87. CSS::LengthPercentage size_y { CSS::Length::make_auto() };
  88. CSS::Repeat repeat_x { CSS::Repeat::Repeat };
  89. CSS::Repeat repeat_y { CSS::Repeat::Repeat };
  90. };
  91. struct BorderData {
  92. public:
  93. Color color { Color::Transparent };
  94. CSS::LineStyle line_style { CSS::LineStyle::None };
  95. float width { 0 };
  96. };
  97. using TransformValue = Variant<CSS::Angle, CSS::LengthPercentage, float>;
  98. struct Transformation {
  99. CSS::TransformFunction function;
  100. Vector<TransformValue> values;
  101. };
  102. struct TransformOrigin {
  103. CSS::LengthPercentage x { Percentage(50) };
  104. CSS::LengthPercentage y { Percentage(50) };
  105. };
  106. struct FlexBasisData {
  107. CSS::FlexBasis type { CSS::FlexBasis::Auto };
  108. Optional<CSS::LengthPercentage> length_percentage;
  109. };
  110. struct ShadowData {
  111. Color color {};
  112. CSS::Length offset_x { Length::make_px(0) };
  113. CSS::Length offset_y { Length::make_px(0) };
  114. CSS::Length blur_radius { Length::make_px(0) };
  115. CSS::Length spread_distance { Length::make_px(0) };
  116. CSS::ShadowPlacement placement { CSS::ShadowPlacement::Outer };
  117. };
  118. struct ContentData {
  119. enum class Type {
  120. Normal,
  121. None,
  122. String,
  123. } type { Type::Normal };
  124. // FIXME: Data is a list of identifiers, strings and image values.
  125. String data {};
  126. String alt_text {};
  127. };
  128. struct BorderRadiusData {
  129. CSS::LengthPercentage horizontal_radius { InitialValues::border_radius() };
  130. CSS::LengthPercentage vertical_radius { InitialValues::border_radius() };
  131. };
  132. class ComputedValues {
  133. public:
  134. CSS::Float float_() const { return m_noninherited.float_; }
  135. CSS::Clear clear() const { return m_noninherited.clear; }
  136. CSS::Clip clip() const { return m_noninherited.clip; }
  137. CSS::Cursor cursor() const { return m_inherited.cursor; }
  138. CSS::ContentData content() const { return m_noninherited.content; }
  139. CSS::PointerEvents pointer_events() const { return m_inherited.pointer_events; }
  140. CSS::Display display() const { return m_noninherited.display; }
  141. Optional<int> const& z_index() const { return m_noninherited.z_index; }
  142. CSS::TextAlign text_align() const { return m_inherited.text_align; }
  143. CSS::TextJustify text_justify() const { return m_inherited.text_justify; }
  144. Vector<CSS::TextDecorationLine> const& text_decoration_line() const { return m_noninherited.text_decoration_line; }
  145. CSS::LengthPercentage const& text_decoration_thickness() const { return m_noninherited.text_decoration_thickness; }
  146. CSS::TextDecorationStyle text_decoration_style() const { return m_noninherited.text_decoration_style; }
  147. Color text_decoration_color() const { return m_noninherited.text_decoration_color; }
  148. CSS::TextTransform text_transform() const { return m_inherited.text_transform; }
  149. Vector<ShadowData> const& text_shadow() const { return m_noninherited.text_shadow; }
  150. CSS::Position position() const { return m_noninherited.position; }
  151. CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
  152. CSS::FlexDirection flex_direction() const { return m_noninherited.flex_direction; }
  153. CSS::FlexWrap flex_wrap() const { return m_noninherited.flex_wrap; }
  154. FlexBasisData const& flex_basis() const { return m_noninherited.flex_basis; }
  155. float flex_grow() const { return m_noninherited.flex_grow; }
  156. float flex_shrink() const { return m_noninherited.flex_shrink; }
  157. int order() const { return m_noninherited.order; }
  158. Optional<Color> accent_color() const { return m_inherited.accent_color; }
  159. CSS::AlignContent align_content() const { return m_noninherited.align_content; }
  160. CSS::AlignItems align_items() const { return m_noninherited.align_items; }
  161. CSS::AlignSelf align_self() const { return m_noninherited.align_self; }
  162. CSS::Appearance appearance() const { return m_noninherited.appearance; }
  163. float opacity() const { return m_noninherited.opacity; }
  164. CSS::Visibility visibility() const { return m_inherited.visibility; }
  165. CSS::ImageRendering image_rendering() const { return m_inherited.image_rendering; }
  166. CSS::JustifyContent justify_content() const { return m_noninherited.justify_content; }
  167. CSS::BackdropFilter const& backdrop_filter() const { return m_noninherited.backdrop_filter; }
  168. Vector<ShadowData> const& box_shadow() const { return m_noninherited.box_shadow; }
  169. CSS::BoxSizing box_sizing() const { return m_noninherited.box_sizing; }
  170. CSS::Size const& width() const { return m_noninherited.width; }
  171. CSS::Size const& min_width() const { return m_noninherited.min_width; }
  172. CSS::Size const& max_width() const { return m_noninherited.max_width; }
  173. CSS::Size const& height() const { return m_noninherited.height; }
  174. CSS::Size const& min_height() const { return m_noninherited.min_height; }
  175. CSS::Size const& max_height() const { return m_noninherited.max_height; }
  176. Variant<CSS::VerticalAlign, CSS::LengthPercentage> const& vertical_align() const { return m_noninherited.vertical_align; }
  177. CSS::GridTrackSizeList const& grid_template_columns() const { return m_noninherited.grid_template_columns; }
  178. CSS::GridTrackSizeList const& grid_template_rows() const { return m_noninherited.grid_template_rows; }
  179. CSS::GridTrackPlacement const& grid_column_end() const { return m_noninherited.grid_column_end; }
  180. CSS::GridTrackPlacement const& grid_column_start() const { return m_noninherited.grid_column_start; }
  181. CSS::GridTrackPlacement const& grid_row_end() const { return m_noninherited.grid_row_end; }
  182. CSS::GridTrackPlacement const& grid_row_start() const { return m_noninherited.grid_row_start; }
  183. CSS::Size const& column_gap() const { return m_noninherited.column_gap; }
  184. CSS::Size const& row_gap() const { return m_noninherited.row_gap; }
  185. CSS::BorderCollapse border_collapse() const { return m_noninherited.border_collapse; }
  186. Vector<Vector<String>> const& grid_template_areas() const { return m_noninherited.grid_template_areas; }
  187. CSS::LengthBox const& inset() const { return m_noninherited.inset; }
  188. const CSS::LengthBox& margin() const { return m_noninherited.margin; }
  189. const CSS::LengthBox& padding() const { return m_noninherited.padding; }
  190. BorderData const& border_left() const { return m_noninherited.border_left; }
  191. BorderData const& border_top() const { return m_noninherited.border_top; }
  192. BorderData const& border_right() const { return m_noninherited.border_right; }
  193. BorderData const& border_bottom() const { return m_noninherited.border_bottom; }
  194. const CSS::BorderRadiusData& border_bottom_left_radius() const { return m_noninherited.border_bottom_left_radius; }
  195. const CSS::BorderRadiusData& border_bottom_right_radius() const { return m_noninherited.border_bottom_right_radius; }
  196. const CSS::BorderRadiusData& border_top_left_radius() const { return m_noninherited.border_top_left_radius; }
  197. const CSS::BorderRadiusData& border_top_right_radius() const { return m_noninherited.border_top_right_radius; }
  198. CSS::Overflow overflow_x() const { return m_noninherited.overflow_x; }
  199. CSS::Overflow overflow_y() const { return m_noninherited.overflow_y; }
  200. Color color() const { return m_inherited.color; }
  201. Color background_color() const { return m_noninherited.background_color; }
  202. Vector<BackgroundLayerData> const& background_layers() const { return m_noninherited.background_layers; }
  203. CSS::ListStyleType list_style_type() const { return m_inherited.list_style_type; }
  204. Optional<Color> const& fill() const { return m_inherited.fill; }
  205. Optional<Color> const& stroke() const { return m_inherited.stroke; }
  206. Optional<LengthPercentage> const& stroke_width() const { return m_inherited.stroke_width; }
  207. Vector<CSS::Transformation> const& transformations() const { return m_noninherited.transformations; }
  208. CSS::TransformOrigin const& transform_origin() const { return m_noninherited.transform_origin; }
  209. float font_size() const { return m_inherited.font_size; }
  210. int font_weight() const { return m_inherited.font_weight; }
  211. CSS::FontVariant font_variant() const { return m_inherited.font_variant; }
  212. ComputedValues clone_inherited_values() const
  213. {
  214. ComputedValues clone;
  215. clone.m_inherited = m_inherited;
  216. return clone;
  217. }
  218. protected:
  219. struct {
  220. float font_size { InitialValues::font_size() };
  221. int font_weight { InitialValues::font_weight() };
  222. CSS::FontVariant font_variant { InitialValues::font_variant() };
  223. Color color { InitialValues::color() };
  224. Optional<Color> accent_color {};
  225. CSS::Cursor cursor { InitialValues::cursor() };
  226. CSS::ImageRendering image_rendering { InitialValues::image_rendering() };
  227. CSS::PointerEvents pointer_events { InitialValues::pointer_events() };
  228. CSS::TextAlign text_align { InitialValues::text_align() };
  229. CSS::TextJustify text_justify { InitialValues::text_justify() };
  230. CSS::TextTransform text_transform { InitialValues::text_transform() };
  231. CSS::WhiteSpace white_space { InitialValues::white_space() };
  232. CSS::ListStyleType list_style_type { InitialValues::list_style_type() };
  233. CSS::Visibility visibility { InitialValues::visibility() };
  234. Optional<Color> fill;
  235. Optional<Color> stroke;
  236. Optional<LengthPercentage> stroke_width;
  237. } m_inherited;
  238. struct {
  239. CSS::Float float_ { InitialValues::float_() };
  240. CSS::Clear clear { InitialValues::clear() };
  241. CSS::Clip clip { InitialValues::clip() };
  242. CSS::Display display { InitialValues::display() };
  243. Optional<int> z_index;
  244. // FIXME: Store this as flags in a u8.
  245. Vector<CSS::TextDecorationLine> text_decoration_line { InitialValues::text_decoration_line() };
  246. CSS::LengthPercentage text_decoration_thickness { InitialValues::text_decoration_thickness() };
  247. CSS::TextDecorationStyle text_decoration_style { InitialValues::text_decoration_style() };
  248. Color text_decoration_color { InitialValues::color() };
  249. Vector<ShadowData> text_shadow {};
  250. CSS::Position position { InitialValues::position() };
  251. CSS::Size width { InitialValues::width() };
  252. CSS::Size min_width { InitialValues::min_width() };
  253. CSS::Size max_width { InitialValues::max_width() };
  254. CSS::Size height { InitialValues::height() };
  255. CSS::Size min_height { InitialValues::min_height() };
  256. CSS::Size max_height { InitialValues::max_height() };
  257. CSS::LengthBox inset { InitialValues::inset() };
  258. CSS::LengthBox margin { InitialValues::margin() };
  259. CSS::LengthBox padding { InitialValues::padding() };
  260. CSS::BackdropFilter backdrop_filter { InitialValues::backdrop_filter() };
  261. BorderData border_left;
  262. BorderData border_top;
  263. BorderData border_right;
  264. BorderData border_bottom;
  265. BorderRadiusData border_bottom_left_radius;
  266. BorderRadiusData border_bottom_right_radius;
  267. BorderRadiusData border_top_left_radius;
  268. BorderRadiusData border_top_right_radius;
  269. Color background_color { InitialValues::background_color() };
  270. Vector<BackgroundLayerData> background_layers;
  271. CSS::FlexDirection flex_direction { InitialValues::flex_direction() };
  272. CSS::FlexWrap flex_wrap { InitialValues::flex_wrap() };
  273. CSS::FlexBasisData flex_basis {};
  274. float flex_grow { InitialValues::flex_grow() };
  275. float flex_shrink { InitialValues::flex_shrink() };
  276. int order { InitialValues::order() };
  277. CSS::AlignContent align_content { InitialValues::align_content() };
  278. CSS::AlignItems align_items { InitialValues::align_items() };
  279. CSS::AlignSelf align_self { InitialValues::align_self() };
  280. CSS::Appearance appearance { InitialValues::appearance() };
  281. CSS::JustifyContent justify_content { InitialValues::justify_content() };
  282. CSS::Overflow overflow_x { InitialValues::overflow() };
  283. CSS::Overflow overflow_y { InitialValues::overflow() };
  284. float opacity { InitialValues::opacity() };
  285. Vector<ShadowData> box_shadow {};
  286. Vector<CSS::Transformation> transformations {};
  287. CSS::TransformOrigin transform_origin {};
  288. CSS::BoxSizing box_sizing { InitialValues::box_sizing() };
  289. CSS::ContentData content;
  290. Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align { InitialValues::vertical_align() };
  291. CSS::GridTrackSizeList grid_template_columns;
  292. CSS::GridTrackSizeList grid_template_rows;
  293. CSS::GridTrackPlacement grid_column_end { InitialValues::grid_column_end() };
  294. CSS::GridTrackPlacement grid_column_start { InitialValues::grid_column_start() };
  295. CSS::GridTrackPlacement grid_row_end { InitialValues::grid_row_end() };
  296. CSS::GridTrackPlacement grid_row_start { InitialValues::grid_row_start() };
  297. CSS::Size column_gap { InitialValues::column_gap() };
  298. CSS::Size row_gap { InitialValues::row_gap() };
  299. CSS::BorderCollapse border_collapse { InitialValues::border_collapse() };
  300. Vector<Vector<String>> grid_template_areas { InitialValues::grid_template_areas() };
  301. } m_noninherited;
  302. };
  303. class ImmutableComputedValues final : public ComputedValues {
  304. };
  305. class MutableComputedValues final : public ComputedValues {
  306. public:
  307. void set_font_size(float font_size) { m_inherited.font_size = font_size; }
  308. void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }
  309. void set_font_variant(CSS::FontVariant font_variant) { m_inherited.font_variant = font_variant; }
  310. void set_color(Color color) { m_inherited.color = color; }
  311. void set_clip(CSS::Clip const& clip) { m_noninherited.clip = clip; }
  312. void set_content(ContentData const& content) { m_noninherited.content = content; }
  313. void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; }
  314. void set_image_rendering(CSS::ImageRendering value) { m_inherited.image_rendering = value; }
  315. void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; }
  316. void set_background_color(Color color) { m_noninherited.background_color = color; }
  317. void set_background_layers(Vector<BackgroundLayerData>&& layers) { m_noninherited.background_layers = move(layers); }
  318. void set_float(CSS::Float value) { m_noninherited.float_ = value; }
  319. void set_clear(CSS::Clear value) { m_noninherited.clear = value; }
  320. void set_z_index(Optional<int> value) { m_noninherited.z_index = value; }
  321. void set_text_align(CSS::TextAlign text_align) { m_inherited.text_align = text_align; }
  322. void set_text_justify(CSS::TextJustify text_justify) { m_inherited.text_justify = text_justify; }
  323. void set_text_decoration_line(Vector<CSS::TextDecorationLine> value) { m_noninherited.text_decoration_line = move(value); }
  324. void set_text_decoration_thickness(CSS::LengthPercentage value) { m_noninherited.text_decoration_thickness = move(value); }
  325. void set_text_decoration_style(CSS::TextDecorationStyle value) { m_noninherited.text_decoration_style = value; }
  326. void set_text_decoration_color(Color value) { m_noninherited.text_decoration_color = value; }
  327. void set_text_transform(CSS::TextTransform value) { m_inherited.text_transform = value; }
  328. void set_text_shadow(Vector<ShadowData>&& value) { m_noninherited.text_shadow = move(value); }
  329. void set_position(CSS::Position position) { m_noninherited.position = position; }
  330. void set_white_space(CSS::WhiteSpace value) { m_inherited.white_space = value; }
  331. void set_width(CSS::Size const& width) { m_noninherited.width = width; }
  332. void set_min_width(CSS::Size const& width) { m_noninherited.min_width = width; }
  333. void set_max_width(CSS::Size const& width) { m_noninherited.max_width = width; }
  334. void set_height(CSS::Size const& height) { m_noninherited.height = height; }
  335. void set_min_height(CSS::Size const& height) { m_noninherited.min_height = height; }
  336. void set_max_height(CSS::Size const& height) { m_noninherited.max_height = height; }
  337. void set_inset(CSS::LengthBox const& inset) { m_noninherited.inset = inset; }
  338. void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
  339. void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; }
  340. void set_overflow_x(CSS::Overflow value) { m_noninherited.overflow_x = value; }
  341. void set_overflow_y(CSS::Overflow value) { m_noninherited.overflow_y = value; }
  342. void set_list_style_type(CSS::ListStyleType value) { m_inherited.list_style_type = value; }
  343. void set_display(CSS::Display value) { m_noninherited.display = value; }
  344. void set_backdrop_filter(CSS::BackdropFilter backdrop_filter) { m_noninherited.backdrop_filter = move(backdrop_filter); }
  345. void set_border_bottom_left_radius(CSS::BorderRadiusData value) { m_noninherited.border_bottom_left_radius = move(value); }
  346. void set_border_bottom_right_radius(CSS::BorderRadiusData value) { m_noninherited.border_bottom_right_radius = move(value); }
  347. void set_border_top_left_radius(CSS::BorderRadiusData value) { m_noninherited.border_top_left_radius = move(value); }
  348. void set_border_top_right_radius(CSS::BorderRadiusData value) { m_noninherited.border_top_right_radius = move(value); }
  349. BorderData& border_left() { return m_noninherited.border_left; }
  350. BorderData& border_top() { return m_noninherited.border_top; }
  351. BorderData& border_right() { return m_noninherited.border_right; }
  352. BorderData& border_bottom() { return m_noninherited.border_bottom; }
  353. void set_flex_direction(CSS::FlexDirection value) { m_noninherited.flex_direction = value; }
  354. void set_flex_wrap(CSS::FlexWrap value) { m_noninherited.flex_wrap = value; }
  355. void set_flex_basis(FlexBasisData value) { m_noninherited.flex_basis = move(value); }
  356. void set_flex_grow(float value) { m_noninherited.flex_grow = value; }
  357. void set_flex_shrink(float value) { m_noninherited.flex_shrink = value; }
  358. void set_order(int value) { m_noninherited.order = value; }
  359. void set_accent_color(Color value) { m_inherited.accent_color = value; }
  360. void set_align_content(CSS::AlignContent value) { m_noninherited.align_content = value; }
  361. void set_align_items(CSS::AlignItems value) { m_noninherited.align_items = value; }
  362. void set_align_self(CSS::AlignSelf value) { m_noninherited.align_self = value; }
  363. void set_appearance(CSS::Appearance value) { m_noninherited.appearance = value; }
  364. void set_opacity(float value) { m_noninherited.opacity = value; }
  365. void set_justify_content(CSS::JustifyContent value) { m_noninherited.justify_content = value; }
  366. void set_box_shadow(Vector<ShadowData>&& value) { m_noninherited.box_shadow = move(value); }
  367. void set_transformations(Vector<CSS::Transformation> value) { m_noninherited.transformations = move(value); }
  368. void set_transform_origin(CSS::TransformOrigin value) { m_noninherited.transform_origin = value; }
  369. void set_box_sizing(CSS::BoxSizing value) { m_noninherited.box_sizing = value; }
  370. void set_vertical_align(Variant<CSS::VerticalAlign, CSS::LengthPercentage> value) { m_noninherited.vertical_align = move(value); }
  371. void set_visibility(CSS::Visibility value) { m_inherited.visibility = value; }
  372. void set_grid_template_columns(CSS::GridTrackSizeList value) { m_noninherited.grid_template_columns = move(value); }
  373. void set_grid_template_rows(CSS::GridTrackSizeList value) { m_noninherited.grid_template_rows = move(value); }
  374. void set_grid_column_end(CSS::GridTrackPlacement value) { m_noninherited.grid_column_end = value; }
  375. void set_grid_column_start(CSS::GridTrackPlacement value) { m_noninherited.grid_column_start = value; }
  376. void set_grid_row_end(CSS::GridTrackPlacement value) { m_noninherited.grid_row_end = value; }
  377. void set_grid_row_start(CSS::GridTrackPlacement value) { m_noninherited.grid_row_start = value; }
  378. void set_column_gap(CSS::Size const& column_gap) { m_noninherited.column_gap = column_gap; }
  379. void set_row_gap(CSS::Size const& row_gap) { m_noninherited.row_gap = row_gap; }
  380. void set_border_collapse(CSS::BorderCollapse const& border_collapse) { m_noninherited.border_collapse = border_collapse; }
  381. void set_grid_template_areas(Vector<Vector<String>> const& grid_template_areas) { m_noninherited.grid_template_areas = grid_template_areas; }
  382. void set_fill(Color value) { m_inherited.fill = value; }
  383. void set_stroke(Color value) { m_inherited.stroke = value; }
  384. void set_stroke_width(LengthPercentage value) { m_inherited.stroke_width = value; }
  385. };
  386. }