ComputedValues.h 27 KB

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