ComputedValues.h 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831
  1. /*
  2. * Copyright (c) 2020-2023, Andreas Kling <andreas@ladybird.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/FlyString.h>
  8. #include <AK/HashMap.h>
  9. #include <AK/Optional.h>
  10. #include <LibGfx/FontCascadeList.h>
  11. #include <LibGfx/ScalingMode.h>
  12. #include <LibWeb/CSS/BackdropFilter.h>
  13. #include <LibWeb/CSS/CalculatedOr.h>
  14. #include <LibWeb/CSS/Clip.h>
  15. #include <LibWeb/CSS/ColumnCount.h>
  16. #include <LibWeb/CSS/CountersSet.h>
  17. #include <LibWeb/CSS/Display.h>
  18. #include <LibWeb/CSS/GridTrackPlacement.h>
  19. #include <LibWeb/CSS/GridTrackSize.h>
  20. #include <LibWeb/CSS/LengthBox.h>
  21. #include <LibWeb/CSS/PercentageOr.h>
  22. #include <LibWeb/CSS/Ratio.h>
  23. #include <LibWeb/CSS/Size.h>
  24. #include <LibWeb/CSS/StyleValues/AbstractImageStyleValue.h>
  25. #include <LibWeb/CSS/StyleValues/BasicShapeStyleValue.h>
  26. #include <LibWeb/CSS/StyleValues/PositionStyleValue.h>
  27. #include <LibWeb/CSS/StyleValues/ShadowStyleValue.h>
  28. #include <LibWeb/CSS/Transformation.h>
  29. namespace Web::CSS {
  30. using ClipRule = FillRule;
  31. struct FlexBasisContent { };
  32. using FlexBasis = Variant<FlexBasisContent, Size>;
  33. struct AspectRatio {
  34. bool use_natural_aspect_ratio_if_available;
  35. Optional<Ratio> preferred_ratio;
  36. };
  37. struct GridAutoFlow {
  38. bool row { true };
  39. bool dense { false };
  40. };
  41. struct QuotesData {
  42. enum class Type {
  43. None,
  44. Auto,
  45. Specified,
  46. } type;
  47. Vector<Array<FlyString, 2>> strings {};
  48. };
  49. struct ResolvedBackdropFilter {
  50. struct Blur {
  51. float radius;
  52. };
  53. struct DropShadow {
  54. double offset_x;
  55. double offset_y;
  56. double radius;
  57. Color color;
  58. };
  59. struct HueRotate {
  60. float angle_degrees;
  61. };
  62. struct ColorOperation {
  63. Filter::Color::Operation operation;
  64. float amount;
  65. };
  66. using FilterFunction = Variant<Blur, DropShadow, HueRotate, ColorOperation>;
  67. bool is_none() const { return filters.size() == 0; }
  68. Vector<FilterFunction> filters;
  69. };
  70. struct ObjectPosition {
  71. PositionEdge edge_x { PositionEdge::Left };
  72. CSS::LengthPercentage offset_x { Percentage(50) };
  73. PositionEdge edge_y { PositionEdge::Top };
  74. CSS::LengthPercentage offset_y { Percentage(50) };
  75. };
  76. class InitialValues {
  77. public:
  78. static AspectRatio aspect_ratio() { return AspectRatio { true, {} }; }
  79. static CSSPixels font_size() { return 16; }
  80. static int font_weight() { return 400; }
  81. static CSS::FontVariant font_variant() { return CSS::FontVariant::Normal; }
  82. static CSSPixels line_height() { return 0; }
  83. static CSS::Float float_() { return CSS::Float::None; }
  84. static CSS::Length border_spacing() { return CSS::Length::make_px(0); }
  85. static CSS::CaptionSide caption_side() { return CSS::CaptionSide::Top; }
  86. static CSS::Clear clear() { return CSS::Clear::None; }
  87. static CSS::Clip clip() { return CSS::Clip::make_auto(); }
  88. static CSS::ContentVisibility content_visibility() { return CSS::ContentVisibility::Visible; }
  89. static CSS::Cursor cursor() { return CSS::Cursor::Auto; }
  90. static CSS::WhiteSpace white_space() { return CSS::WhiteSpace::Normal; }
  91. static Variant<LengthOrCalculated, NumberOrCalculated> tab_size() { return NumberOrCalculated(8.0f); }
  92. static CSS::TextAlign text_align() { return CSS::TextAlign::Start; }
  93. static CSS::TextJustify text_justify() { return CSS::TextJustify::Auto; }
  94. static CSS::Positioning position() { return CSS::Positioning::Static; }
  95. static CSS::TextDecorationLine text_decoration_line() { return CSS::TextDecorationLine::None; }
  96. static CSS::Length text_decoration_thickness() { return Length::make_auto(); }
  97. static CSS::TextDecorationStyle text_decoration_style() { return CSS::TextDecorationStyle::Solid; }
  98. static CSS::TextTransform text_transform() { return CSS::TextTransform::None; }
  99. static CSS::TextOverflow text_overflow() { return CSS::TextOverflow::Clip; }
  100. static CSS::LengthPercentage text_indent() { return CSS::Length::make_px(0); }
  101. static CSS::Display display() { return CSS::Display { CSS::DisplayOutside::Inline, CSS::DisplayInside::Flow }; }
  102. static Color color() { return Color::Black; }
  103. static Color stop_color() { return Color::Black; }
  104. static CSS::ResolvedBackdropFilter backdrop_filter() { return ResolvedBackdropFilter { .filters = {} }; }
  105. static Color background_color() { return Color::Transparent; }
  106. static CSS::ListStyleType list_style_type() { return CSS::ListStyleType::Disc; }
  107. static CSS::ListStylePosition list_style_position() { return CSS::ListStylePosition::Outside; }
  108. static CSS::Visibility visibility() { return CSS::Visibility::Visible; }
  109. static CSS::FlexDirection flex_direction() { return CSS::FlexDirection::Row; }
  110. static CSS::FlexWrap flex_wrap() { return CSS::FlexWrap::Nowrap; }
  111. static CSS::FlexBasis flex_basis() { return CSS::Size::make_auto(); }
  112. static CSS::ImageRendering image_rendering() { return CSS::ImageRendering::Auto; }
  113. static CSS::JustifyContent justify_content() { return CSS::JustifyContent::FlexStart; }
  114. static CSS::JustifyItems justify_items() { return CSS::JustifyItems::Legacy; }
  115. static CSS::JustifySelf justify_self() { return CSS::JustifySelf::Auto; }
  116. static CSS::AlignContent align_content() { return CSS::AlignContent::Stretch; }
  117. static CSS::AlignItems align_items() { return CSS::AlignItems::Stretch; }
  118. static CSS::AlignSelf align_self() { return CSS::AlignSelf::Auto; }
  119. static CSS::Appearance appearance() { return CSS::Appearance::Auto; }
  120. static CSS::Overflow overflow() { return CSS::Overflow::Visible; }
  121. static CSS::BoxSizing box_sizing() { return CSS::BoxSizing::ContentBox; }
  122. static CSS::PointerEvents pointer_events() { return CSS::PointerEvents::Auto; }
  123. static float flex_grow() { return 0.0f; }
  124. static float flex_shrink() { return 1.0f; }
  125. static int order() { return 0; }
  126. static float opacity() { return 1.0f; }
  127. static float fill_opacity() { return 1.0f; }
  128. static CSS::FillRule fill_rule() { return CSS::FillRule::Nonzero; }
  129. static CSS::ClipRule clip_rule() { return CSS::ClipRule::Nonzero; }
  130. static CSS::StrokeLinecap stroke_linecap() { return CSS::StrokeLinecap::Butt; }
  131. static float stroke_opacity() { return 1.0f; }
  132. static float stop_opacity() { return 1.0f; }
  133. static CSS::TextAnchor text_anchor() { return CSS::TextAnchor::Start; }
  134. static CSS::Length border_radius() { return Length::make_px(0); }
  135. static Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align() { return CSS::VerticalAlign::Baseline; }
  136. static CSS::LengthBox inset() { return { CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto(), CSS::Length::make_auto() }; }
  137. 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) }; }
  138. 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) }; }
  139. static CSS::Size width() { return CSS::Size::make_auto(); }
  140. static CSS::Size min_width() { return CSS::Size::make_auto(); }
  141. static CSS::Size max_width() { return CSS::Size::make_none(); }
  142. static CSS::Size height() { return CSS::Size::make_auto(); }
  143. static CSS::Size min_height() { return CSS::Size::make_auto(); }
  144. static CSS::Size max_height() { return CSS::Size::make_none(); }
  145. static CSS::GridTrackSizeList grid_template_columns() { return CSS::GridTrackSizeList::make_none(); }
  146. static CSS::GridTrackSizeList grid_template_rows() { return CSS::GridTrackSizeList::make_none(); }
  147. static CSS::GridTrackPlacement grid_column_end() { return CSS::GridTrackPlacement::make_auto(); }
  148. static CSS::GridTrackPlacement grid_column_start() { return CSS::GridTrackPlacement::make_auto(); }
  149. static CSS::GridTrackPlacement grid_row_end() { return CSS::GridTrackPlacement::make_auto(); }
  150. static CSS::GridTrackPlacement grid_row_start() { return CSS::GridTrackPlacement::make_auto(); }
  151. static CSS::GridAutoFlow grid_auto_flow() { return CSS::GridAutoFlow {}; }
  152. static ColumnCount column_count() { return ColumnCount::make_auto(); }
  153. static CSS::Size column_gap() { return CSS::Size::make_auto(); }
  154. static CSS::ColumnSpan column_span() { return CSS::ColumnSpan::None; }
  155. static CSS::Size column_width() { return CSS::Size::make_auto(); }
  156. static CSS::Size row_gap() { return CSS::Size::make_auto(); }
  157. static CSS::BorderCollapse border_collapse() { return CSS::BorderCollapse::Separate; }
  158. static Vector<Vector<String>> grid_template_areas() { return {}; }
  159. static CSS::Time transition_delay() { return CSS::Time::make_seconds(0); }
  160. static CSS::ObjectFit object_fit() { return CSS::ObjectFit::Fill; }
  161. static CSS::ObjectPosition object_position() { return {}; }
  162. static Color outline_color() { return Color::Black; }
  163. static CSS::Length outline_offset() { return CSS::Length::make_px(0); }
  164. static CSS::OutlineStyle outline_style() { return CSS::OutlineStyle::None; }
  165. static CSS::Length outline_width() { return CSS::Length::make_px(3); }
  166. static CSS::TableLayout table_layout() { return CSS::TableLayout::Auto; }
  167. static QuotesData quotes() { return QuotesData { .type = QuotesData::Type::Auto }; }
  168. static CSS::TransformBox transform_box() { return CSS::TransformBox::ViewBox; }
  169. static CSS::Direction direction() { return CSS::Direction::Ltr; }
  170. static CSS::UnicodeBidi unicode_bidi() { return CSS::UnicodeBidi::Normal; }
  171. // https://www.w3.org/TR/SVG/geometry.html
  172. static LengthPercentage cx() { return CSS::Length::make_px(0); }
  173. static LengthPercentage cy() { return CSS::Length::make_px(0); }
  174. static LengthPercentage r() { return CSS::Length::make_px(0); }
  175. static LengthPercentage rx() { return CSS::Length::make_auto(); }
  176. static LengthPercentage ry() { return CSS::Length::make_auto(); }
  177. static LengthPercentage x() { return CSS::Length::make_px(0); }
  178. static LengthPercentage y() { return CSS::Length::make_px(0); }
  179. static CSS::MaskType mask_type() { return CSS::MaskType::Luminance; }
  180. static CSS::MathShift math_shift() { return CSS::MathShift::Normal; }
  181. static CSS::MathStyle math_style() { return CSS::MathStyle::Normal; }
  182. static int math_depth() { return 0; }
  183. static CSS::ScrollbarWidth scrollbar_width() { return CSS::ScrollbarWidth::Auto; }
  184. };
  185. enum class BackgroundSize {
  186. Contain,
  187. Cover,
  188. LengthPercentage,
  189. };
  190. // https://svgwg.org/svg2-draft/painting.html#SpecifyingPaint
  191. class SVGPaint {
  192. public:
  193. SVGPaint(Color color)
  194. : m_value(color)
  195. {
  196. }
  197. SVGPaint(URL::URL const& url)
  198. : m_value(url)
  199. {
  200. }
  201. bool is_color() const { return m_value.has<Color>(); }
  202. bool is_url() const { return m_value.has<URL::URL>(); }
  203. Color as_color() const { return m_value.get<Color>(); }
  204. URL::URL const& as_url() const { return m_value.get<URL::URL>(); }
  205. private:
  206. Variant<URL::URL, Color> m_value;
  207. };
  208. // https://drafts.fxtf.org/css-masking-1/#typedef-mask-reference
  209. class MaskReference {
  210. public:
  211. // TODO: Support other mask types.
  212. MaskReference(URL::URL const& url)
  213. : m_url(url)
  214. {
  215. }
  216. URL::URL const& url() const { return m_url; }
  217. private:
  218. URL::URL m_url;
  219. };
  220. // https://drafts.fxtf.org/css-masking/#the-clip-path
  221. // TODO: Support clip sources.
  222. class ClipPathReference {
  223. public:
  224. ClipPathReference(URL::URL const& url)
  225. : m_clip_source(url)
  226. {
  227. }
  228. ClipPathReference(BasicShapeStyleValue const& basic_shape)
  229. : m_clip_source(basic_shape)
  230. {
  231. }
  232. bool is_basic_shape() const { return m_clip_source.has<BasicShape>(); }
  233. bool is_url() const { return m_clip_source.has<URL::URL>(); }
  234. URL::URL const& url() const { return m_clip_source.get<URL::URL>(); }
  235. BasicShapeStyleValue const& basic_shape() const { return *m_clip_source.get<BasicShape>(); }
  236. private:
  237. using BasicShape = NonnullRefPtr<BasicShapeStyleValue const>;
  238. Variant<URL::URL, BasicShape> m_clip_source;
  239. };
  240. struct BackgroundLayerData {
  241. RefPtr<CSS::AbstractImageStyleValue const> background_image { nullptr };
  242. CSS::BackgroundAttachment attachment { CSS::BackgroundAttachment::Scroll };
  243. CSS::BackgroundBox origin { CSS::BackgroundBox::PaddingBox };
  244. CSS::BackgroundBox clip { CSS::BackgroundBox::BorderBox };
  245. CSS::PositionEdge position_edge_x { CSS::PositionEdge::Left };
  246. CSS::LengthPercentage position_offset_x { CSS::Length::make_px(0) };
  247. CSS::PositionEdge position_edge_y { CSS::PositionEdge::Top };
  248. CSS::LengthPercentage position_offset_y { CSS::Length::make_px(0) };
  249. CSS::BackgroundSize size_type { CSS::BackgroundSize::LengthPercentage };
  250. CSS::LengthPercentage size_x { CSS::Length::make_auto() };
  251. CSS::LengthPercentage size_y { CSS::Length::make_auto() };
  252. CSS::Repeat repeat_x { CSS::Repeat::Repeat };
  253. CSS::Repeat repeat_y { CSS::Repeat::Repeat };
  254. };
  255. struct BorderData {
  256. public:
  257. Color color { Color::Transparent };
  258. CSS::LineStyle line_style { CSS::LineStyle::None };
  259. CSSPixels width { 0 };
  260. bool operator==(BorderData const&) const = default;
  261. };
  262. struct TransformOrigin {
  263. CSS::LengthPercentage x { Percentage(50) };
  264. CSS::LengthPercentage y { Percentage(50) };
  265. };
  266. struct ShadowData {
  267. Color color {};
  268. CSS::Length offset_x { Length::make_px(0) };
  269. CSS::Length offset_y { Length::make_px(0) };
  270. CSS::Length blur_radius { Length::make_px(0) };
  271. CSS::Length spread_distance { Length::make_px(0) };
  272. CSS::ShadowPlacement placement { CSS::ShadowPlacement::Outer };
  273. };
  274. struct ContentData {
  275. enum class Type {
  276. Normal,
  277. None,
  278. String,
  279. } type { Type::Normal };
  280. // FIXME: Data is a list of identifiers, strings and image values.
  281. String data {};
  282. String alt_text {};
  283. };
  284. struct CounterData {
  285. FlyString name;
  286. bool is_reversed;
  287. Optional<CounterValue> value;
  288. };
  289. struct BorderRadiusData {
  290. CSS::LengthPercentage horizontal_radius { InitialValues::border_radius() };
  291. CSS::LengthPercentage vertical_radius { InitialValues::border_radius() };
  292. };
  293. // FIXME: Find a better place for this helper.
  294. inline Gfx::ScalingMode to_gfx_scaling_mode(CSS::ImageRendering css_value, Gfx::IntRect source, Gfx::IntRect target)
  295. {
  296. switch (css_value) {
  297. case CSS::ImageRendering::Auto:
  298. case CSS::ImageRendering::HighQuality:
  299. case CSS::ImageRendering::Smooth:
  300. if (target.width() < source.width() || target.height() < source.height())
  301. return Gfx::ScalingMode::BoxSampling;
  302. return Gfx::ScalingMode::BilinearBlend;
  303. case CSS::ImageRendering::CrispEdges:
  304. return Gfx::ScalingMode::NearestNeighbor;
  305. case CSS::ImageRendering::Pixelated:
  306. return Gfx::ScalingMode::SmoothPixels;
  307. }
  308. VERIFY_NOT_REACHED();
  309. }
  310. class ComputedValues {
  311. AK_MAKE_NONCOPYABLE(ComputedValues);
  312. AK_MAKE_NONMOVABLE(ComputedValues);
  313. public:
  314. ComputedValues() = default;
  315. ~ComputedValues() = default;
  316. AspectRatio aspect_ratio() const { return m_noninherited.aspect_ratio; }
  317. CSS::Float float_() const { return m_noninherited.float_; }
  318. CSS::Length border_spacing_horizontal() const { return m_inherited.border_spacing_horizontal; }
  319. CSS::Length border_spacing_vertical() const { return m_inherited.border_spacing_vertical; }
  320. CSS::CaptionSide caption_side() const { return m_inherited.caption_side; }
  321. CSS::Clear clear() const { return m_noninherited.clear; }
  322. CSS::Clip clip() const { return m_noninherited.clip; }
  323. CSS::ContentVisibility content_visibility() const { return m_inherited.content_visibility; }
  324. CSS::Cursor cursor() const { return m_inherited.cursor; }
  325. CSS::ContentData content() const { return m_noninherited.content; }
  326. CSS::PointerEvents pointer_events() const { return m_inherited.pointer_events; }
  327. CSS::Display display() const { return m_noninherited.display; }
  328. Optional<int> const& z_index() const { return m_noninherited.z_index; }
  329. Variant<LengthOrCalculated, NumberOrCalculated> tab_size() const { return m_inherited.tab_size; }
  330. CSS::TextAlign text_align() const { return m_inherited.text_align; }
  331. CSS::TextJustify text_justify() const { return m_inherited.text_justify; }
  332. CSS::LengthPercentage const& text_indent() const { return m_inherited.text_indent; }
  333. Vector<CSS::TextDecorationLine> const& text_decoration_line() const { return m_noninherited.text_decoration_line; }
  334. CSS::LengthPercentage const& text_decoration_thickness() const { return m_noninherited.text_decoration_thickness; }
  335. CSS::TextDecorationStyle text_decoration_style() const { return m_noninherited.text_decoration_style; }
  336. Color text_decoration_color() const { return m_noninherited.text_decoration_color; }
  337. CSS::TextTransform text_transform() const { return m_inherited.text_transform; }
  338. CSS::TextOverflow text_overflow() const { return m_noninherited.text_overflow; }
  339. Vector<ShadowData> const& text_shadow() const { return m_inherited.text_shadow; }
  340. CSS::Positioning position() const { return m_noninherited.position; }
  341. CSS::WhiteSpace white_space() const { return m_inherited.white_space; }
  342. CSS::FlexDirection flex_direction() const { return m_noninherited.flex_direction; }
  343. CSS::FlexWrap flex_wrap() const { return m_noninherited.flex_wrap; }
  344. FlexBasis const& flex_basis() const { return m_noninherited.flex_basis; }
  345. float flex_grow() const { return m_noninherited.flex_grow; }
  346. float flex_shrink() const { return m_noninherited.flex_shrink; }
  347. int order() const { return m_noninherited.order; }
  348. Optional<Color> accent_color() const { return m_inherited.accent_color; }
  349. CSS::AlignContent align_content() const { return m_noninherited.align_content; }
  350. CSS::AlignItems align_items() const { return m_noninherited.align_items; }
  351. CSS::AlignSelf align_self() const { return m_noninherited.align_self; }
  352. CSS::Appearance appearance() const { return m_noninherited.appearance; }
  353. float opacity() const { return m_noninherited.opacity; }
  354. CSS::Visibility visibility() const { return m_inherited.visibility; }
  355. CSS::ImageRendering image_rendering() const { return m_inherited.image_rendering; }
  356. CSS::JustifyContent justify_content() const { return m_noninherited.justify_content; }
  357. CSS::JustifySelf justify_self() const { return m_noninherited.justify_self; }
  358. CSS::JustifyItems justify_items() const { return m_noninherited.justify_items; }
  359. CSS::ResolvedBackdropFilter const& backdrop_filter() const { return m_noninherited.backdrop_filter; }
  360. Vector<ShadowData> const& box_shadow() const { return m_noninherited.box_shadow; }
  361. CSS::BoxSizing box_sizing() const { return m_noninherited.box_sizing; }
  362. CSS::Size const& width() const { return m_noninherited.width; }
  363. CSS::Size const& min_width() const { return m_noninherited.min_width; }
  364. CSS::Size const& max_width() const { return m_noninherited.max_width; }
  365. CSS::Size const& height() const { return m_noninherited.height; }
  366. CSS::Size const& min_height() const { return m_noninherited.min_height; }
  367. CSS::Size const& max_height() const { return m_noninherited.max_height; }
  368. Variant<CSS::VerticalAlign, CSS::LengthPercentage> const& vertical_align() const { return m_noninherited.vertical_align; }
  369. CSS::GridTrackSizeList const& grid_auto_columns() const { return m_noninherited.grid_auto_columns; }
  370. CSS::GridTrackSizeList const& grid_auto_rows() const { return m_noninherited.grid_auto_rows; }
  371. CSS::GridAutoFlow const& grid_auto_flow() const { return m_noninherited.grid_auto_flow; }
  372. CSS::GridTrackSizeList const& grid_template_columns() const { return m_noninherited.grid_template_columns; }
  373. CSS::GridTrackSizeList const& grid_template_rows() const { return m_noninherited.grid_template_rows; }
  374. CSS::GridTrackPlacement const& grid_column_end() const { return m_noninherited.grid_column_end; }
  375. CSS::GridTrackPlacement const& grid_column_start() const { return m_noninherited.grid_column_start; }
  376. CSS::GridTrackPlacement const& grid_row_end() const { return m_noninherited.grid_row_end; }
  377. CSS::GridTrackPlacement const& grid_row_start() const { return m_noninherited.grid_row_start; }
  378. CSS::ColumnCount column_count() const { return m_noninherited.column_count; }
  379. CSS::Size const& column_gap() const { return m_noninherited.column_gap; }
  380. CSS::ColumnSpan const& column_span() const { return m_noninherited.column_span; }
  381. CSS::Size const& column_width() const { return m_noninherited.column_width; }
  382. CSS::Size const& row_gap() const { return m_noninherited.row_gap; }
  383. CSS::BorderCollapse border_collapse() const { return m_inherited.border_collapse; }
  384. Vector<Vector<String>> const& grid_template_areas() const { return m_noninherited.grid_template_areas; }
  385. CSS::ObjectFit object_fit() const { return m_noninherited.object_fit; }
  386. CSS::ObjectPosition object_position() const { return m_noninherited.object_position; }
  387. CSS::Direction direction() const { return m_inherited.direction; }
  388. CSS::UnicodeBidi unicode_bidi() const { return m_noninherited.unicode_bidi; }
  389. CSS::LengthBox const& inset() const { return m_noninherited.inset; }
  390. const CSS::LengthBox& margin() const { return m_noninherited.margin; }
  391. const CSS::LengthBox& padding() const { return m_noninherited.padding; }
  392. BorderData const& border_left() const { return m_noninherited.border_left; }
  393. BorderData const& border_top() const { return m_noninherited.border_top; }
  394. BorderData const& border_right() const { return m_noninherited.border_right; }
  395. BorderData const& border_bottom() const { return m_noninherited.border_bottom; }
  396. const CSS::BorderRadiusData& border_bottom_left_radius() const { return m_noninherited.border_bottom_left_radius; }
  397. const CSS::BorderRadiusData& border_bottom_right_radius() const { return m_noninherited.border_bottom_right_radius; }
  398. const CSS::BorderRadiusData& border_top_left_radius() const { return m_noninherited.border_top_left_radius; }
  399. const CSS::BorderRadiusData& border_top_right_radius() const { return m_noninherited.border_top_right_radius; }
  400. CSS::Overflow overflow_x() const { return m_noninherited.overflow_x; }
  401. CSS::Overflow overflow_y() const { return m_noninherited.overflow_y; }
  402. Color color() const { return m_inherited.color; }
  403. Color background_color() const { return m_noninherited.background_color; }
  404. Vector<BackgroundLayerData> const& background_layers() const { return m_noninherited.background_layers; }
  405. Color webkit_text_fill_color() const { return m_inherited.webkit_text_fill_color; }
  406. CSS::ListStyleType list_style_type() const { return m_inherited.list_style_type; }
  407. CSS::ListStylePosition list_style_position() const { return m_inherited.list_style_position; }
  408. Optional<SVGPaint> const& fill() const { return m_inherited.fill; }
  409. CSS::FillRule fill_rule() const { return m_inherited.fill_rule; }
  410. Optional<SVGPaint> const& stroke() const { return m_inherited.stroke; }
  411. float fill_opacity() const { return m_inherited.fill_opacity; }
  412. CSS::StrokeLinecap stroke_linecap() const { return m_inherited.stroke_linecap; }
  413. float stroke_opacity() const { return m_inherited.stroke_opacity; }
  414. LengthPercentage const& stroke_width() const { return m_inherited.stroke_width; }
  415. Color stop_color() const { return m_noninherited.stop_color; }
  416. float stop_opacity() const { return m_noninherited.stop_opacity; }
  417. CSS::TextAnchor text_anchor() const { return m_inherited.text_anchor; }
  418. Optional<MaskReference> const& mask() const { return m_noninherited.mask; }
  419. CSS::MaskType mask_type() const { return m_noninherited.mask_type; }
  420. Optional<ClipPathReference> const& clip_path() const { return m_noninherited.clip_path; }
  421. CSS::ClipRule clip_rule() const { return m_inherited.clip_rule; }
  422. LengthPercentage const& cx() const { return m_noninherited.cx; }
  423. LengthPercentage const& cy() const { return m_noninherited.cy; }
  424. LengthPercentage const& r() const { return m_noninherited.r; }
  425. LengthPercentage const& rx() const { return m_noninherited.ry; }
  426. LengthPercentage const& ry() const { return m_noninherited.ry; }
  427. LengthPercentage const& x() const { return m_noninherited.x; }
  428. LengthPercentage const& y() const { return m_noninherited.y; }
  429. Vector<CSS::Transformation> const& transformations() const { return m_noninherited.transformations; }
  430. CSS::TransformBox const& transform_box() const { return m_noninherited.transform_box; }
  431. CSS::TransformOrigin const& transform_origin() const { return m_noninherited.transform_origin; }
  432. Gfx::FontCascadeList const& font_list() const { return *m_inherited.font_list; }
  433. CSSPixels font_size() const { return m_inherited.font_size; }
  434. int font_weight() const { return m_inherited.font_weight; }
  435. CSS::FontVariant font_variant() const { return m_inherited.font_variant; }
  436. Optional<FlyString> font_language_override() const { return m_inherited.font_language_override; }
  437. Optional<HashMap<FlyString, IntegerOrCalculated>> font_feature_settings() const { return m_inherited.font_feature_settings; }
  438. Optional<HashMap<FlyString, NumberOrCalculated>> font_variation_settings() const { return m_inherited.font_variation_settings; }
  439. CSSPixels line_height() const { return m_inherited.line_height; }
  440. CSS::Time transition_delay() const { return m_noninherited.transition_delay; }
  441. Color outline_color() const { return m_noninherited.outline_color; }
  442. CSS::Length outline_offset() const { return m_noninherited.outline_offset; }
  443. CSS::OutlineStyle outline_style() const { return m_noninherited.outline_style; }
  444. CSS::Length outline_width() const { return m_noninherited.outline_width; }
  445. CSS::TableLayout table_layout() const { return m_noninherited.table_layout; }
  446. CSS::QuotesData quotes() const { return m_inherited.quotes; }
  447. CSS::MathShift math_shift() const { return m_inherited.math_shift; }
  448. CSS::MathStyle math_style() const { return m_inherited.math_style; }
  449. int math_depth() const { return m_inherited.math_depth; }
  450. CSS::ScrollbarWidth scrollbar_width() const { return m_noninherited.scrollbar_width; }
  451. NonnullOwnPtr<ComputedValues> clone_inherited_values() const
  452. {
  453. auto clone = make<ComputedValues>();
  454. clone->m_inherited = m_inherited;
  455. return clone;
  456. }
  457. protected:
  458. struct {
  459. RefPtr<Gfx::FontCascadeList> font_list {};
  460. CSSPixels font_size { InitialValues::font_size() };
  461. int font_weight { InitialValues::font_weight() };
  462. CSS::FontVariant font_variant { InitialValues::font_variant() };
  463. Optional<FlyString> font_language_override;
  464. Optional<HashMap<FlyString, IntegerOrCalculated>> font_feature_settings;
  465. Optional<HashMap<FlyString, NumberOrCalculated>> font_variation_settings;
  466. CSSPixels line_height { InitialValues::line_height() };
  467. CSS::BorderCollapse border_collapse { InitialValues::border_collapse() };
  468. CSS::Length border_spacing_horizontal { InitialValues::border_spacing() };
  469. CSS::Length border_spacing_vertical { InitialValues::border_spacing() };
  470. CSS::CaptionSide caption_side { InitialValues::caption_side() };
  471. Color color { InitialValues::color() };
  472. Optional<Color> accent_color {};
  473. Color webkit_text_fill_color { InitialValues::color() };
  474. CSS::ContentVisibility content_visibility { InitialValues::content_visibility() };
  475. CSS::Cursor cursor { InitialValues::cursor() };
  476. CSS::ImageRendering image_rendering { InitialValues::image_rendering() };
  477. CSS::PointerEvents pointer_events { InitialValues::pointer_events() };
  478. Variant<LengthOrCalculated, NumberOrCalculated> tab_size { InitialValues::tab_size() };
  479. CSS::TextAlign text_align { InitialValues::text_align() };
  480. CSS::TextJustify text_justify { InitialValues::text_justify() };
  481. CSS::TextTransform text_transform { InitialValues::text_transform() };
  482. CSS::LengthPercentage text_indent { InitialValues::text_indent() };
  483. CSS::WhiteSpace white_space { InitialValues::white_space() };
  484. CSS::ListStyleType list_style_type { InitialValues::list_style_type() };
  485. CSS::ListStylePosition list_style_position { InitialValues::list_style_position() };
  486. CSS::Visibility visibility { InitialValues::visibility() };
  487. CSS::QuotesData quotes { InitialValues::quotes() };
  488. CSS::Direction direction { InitialValues::direction() };
  489. Optional<SVGPaint> fill;
  490. CSS::FillRule fill_rule { InitialValues::fill_rule() };
  491. Optional<SVGPaint> stroke;
  492. float fill_opacity { InitialValues::fill_opacity() };
  493. CSS::StrokeLinecap stroke_linecap { InitialValues::stroke_linecap() };
  494. float stroke_opacity { InitialValues::stroke_opacity() };
  495. LengthPercentage stroke_width { Length::make_px(1) };
  496. CSS::TextAnchor text_anchor { InitialValues::text_anchor() };
  497. CSS::ClipRule clip_rule { InitialValues::clip_rule() };
  498. Vector<ShadowData> text_shadow;
  499. CSS::MathShift math_shift { InitialValues::math_shift() };
  500. CSS::MathStyle math_style { InitialValues::math_style() };
  501. int math_depth { InitialValues::math_depth() };
  502. } m_inherited;
  503. struct {
  504. AspectRatio aspect_ratio { InitialValues::aspect_ratio() };
  505. CSS::Float float_ { InitialValues::float_() };
  506. CSS::Clear clear { InitialValues::clear() };
  507. CSS::Clip clip { InitialValues::clip() };
  508. CSS::Display display { InitialValues::display() };
  509. Optional<int> z_index;
  510. // FIXME: Store this as flags in a u8.
  511. Vector<CSS::TextDecorationLine> text_decoration_line { InitialValues::text_decoration_line() };
  512. CSS::LengthPercentage text_decoration_thickness { InitialValues::text_decoration_thickness() };
  513. CSS::TextDecorationStyle text_decoration_style { InitialValues::text_decoration_style() };
  514. Color text_decoration_color { InitialValues::color() };
  515. CSS::TextOverflow text_overflow { InitialValues::text_overflow() };
  516. CSS::Positioning position { InitialValues::position() };
  517. CSS::Size width { InitialValues::width() };
  518. CSS::Size min_width { InitialValues::min_width() };
  519. CSS::Size max_width { InitialValues::max_width() };
  520. CSS::Size height { InitialValues::height() };
  521. CSS::Size min_height { InitialValues::min_height() };
  522. CSS::Size max_height { InitialValues::max_height() };
  523. CSS::LengthBox inset { InitialValues::inset() };
  524. CSS::LengthBox margin { InitialValues::margin() };
  525. CSS::LengthBox padding { InitialValues::padding() };
  526. CSS::ResolvedBackdropFilter backdrop_filter { InitialValues::backdrop_filter() };
  527. BorderData border_left;
  528. BorderData border_top;
  529. BorderData border_right;
  530. BorderData border_bottom;
  531. BorderRadiusData border_bottom_left_radius;
  532. BorderRadiusData border_bottom_right_radius;
  533. BorderRadiusData border_top_left_radius;
  534. BorderRadiusData border_top_right_radius;
  535. Color background_color { InitialValues::background_color() };
  536. Vector<BackgroundLayerData> background_layers;
  537. CSS::FlexDirection flex_direction { InitialValues::flex_direction() };
  538. CSS::FlexWrap flex_wrap { InitialValues::flex_wrap() };
  539. CSS::FlexBasis flex_basis { InitialValues::flex_basis() };
  540. float flex_grow { InitialValues::flex_grow() };
  541. float flex_shrink { InitialValues::flex_shrink() };
  542. int order { InitialValues::order() };
  543. CSS::AlignContent align_content { InitialValues::align_content() };
  544. CSS::AlignItems align_items { InitialValues::align_items() };
  545. CSS::AlignSelf align_self { InitialValues::align_self() };
  546. CSS::Appearance appearance { InitialValues::appearance() };
  547. CSS::JustifyContent justify_content { InitialValues::justify_content() };
  548. CSS::JustifyItems justify_items { InitialValues::justify_items() };
  549. CSS::JustifySelf justify_self { InitialValues::justify_self() };
  550. CSS::Overflow overflow_x { InitialValues::overflow() };
  551. CSS::Overflow overflow_y { InitialValues::overflow() };
  552. float opacity { InitialValues::opacity() };
  553. Vector<ShadowData> box_shadow {};
  554. Vector<CSS::Transformation> transformations {};
  555. CSS::TransformBox transform_box { InitialValues::transform_box() };
  556. CSS::TransformOrigin transform_origin {};
  557. CSS::BoxSizing box_sizing { InitialValues::box_sizing() };
  558. CSS::ContentData content;
  559. Variant<CSS::VerticalAlign, CSS::LengthPercentage> vertical_align { InitialValues::vertical_align() };
  560. CSS::GridTrackSizeList grid_auto_columns;
  561. CSS::GridTrackSizeList grid_auto_rows;
  562. CSS::GridTrackSizeList grid_template_columns;
  563. CSS::GridTrackSizeList grid_template_rows;
  564. CSS::GridAutoFlow grid_auto_flow { InitialValues::grid_auto_flow() };
  565. CSS::GridTrackPlacement grid_column_end { InitialValues::grid_column_end() };
  566. CSS::GridTrackPlacement grid_column_start { InitialValues::grid_column_start() };
  567. CSS::GridTrackPlacement grid_row_end { InitialValues::grid_row_end() };
  568. CSS::GridTrackPlacement grid_row_start { InitialValues::grid_row_start() };
  569. CSS::ColumnCount column_count { InitialValues::column_count() };
  570. CSS::Size column_gap { InitialValues::column_gap() };
  571. CSS::ColumnSpan column_span { InitialValues::column_span() };
  572. CSS::Size column_width { InitialValues::column_width() };
  573. CSS::Size row_gap { InitialValues::row_gap() };
  574. Vector<Vector<String>> grid_template_areas { InitialValues::grid_template_areas() };
  575. Gfx::Color stop_color { InitialValues::stop_color() };
  576. float stop_opacity { InitialValues::stop_opacity() };
  577. CSS::Time transition_delay { InitialValues::transition_delay() };
  578. Color outline_color { InitialValues::outline_color() };
  579. CSS::Length outline_offset { InitialValues::outline_offset() };
  580. CSS::OutlineStyle outline_style { InitialValues::outline_style() };
  581. CSS::Length outline_width { InitialValues::outline_width() };
  582. CSS::TableLayout table_layout { InitialValues::table_layout() };
  583. CSS::ObjectFit object_fit { InitialValues::object_fit() };
  584. CSS::ObjectPosition object_position { InitialValues::object_position() };
  585. CSS::UnicodeBidi unicode_bidi { InitialValues::unicode_bidi() };
  586. Optional<MaskReference> mask;
  587. CSS::MaskType mask_type { InitialValues::mask_type() };
  588. Optional<ClipPathReference> clip_path;
  589. LengthPercentage cx { InitialValues::cx() };
  590. LengthPercentage cy { InitialValues::cy() };
  591. LengthPercentage r { InitialValues::r() };
  592. LengthPercentage rx { InitialValues::rx() };
  593. LengthPercentage ry { InitialValues::ry() };
  594. LengthPercentage x { InitialValues::x() };
  595. LengthPercentage y { InitialValues::x() };
  596. CSS::ScrollbarWidth scrollbar_width { InitialValues::scrollbar_width() };
  597. Vector<CounterData, 0> counter_increment;
  598. Vector<CounterData, 0> counter_reset;
  599. Vector<CounterData, 0> counter_set;
  600. } m_noninherited;
  601. };
  602. class ImmutableComputedValues final : public ComputedValues {
  603. };
  604. class MutableComputedValues final : public ComputedValues {
  605. public:
  606. void inherit_from(ComputedValues const& other)
  607. {
  608. m_inherited = static_cast<MutableComputedValues const&>(other).m_inherited;
  609. }
  610. void set_aspect_ratio(AspectRatio aspect_ratio) { m_noninherited.aspect_ratio = aspect_ratio; }
  611. void set_font_list(NonnullRefPtr<Gfx::FontCascadeList> font_list) { m_inherited.font_list = move(font_list); }
  612. void set_font_size(CSSPixels font_size) { m_inherited.font_size = font_size; }
  613. void set_font_weight(int font_weight) { m_inherited.font_weight = font_weight; }
  614. void set_font_variant(CSS::FontVariant font_variant) { m_inherited.font_variant = font_variant; }
  615. void set_font_language_override(Optional<FlyString> font_language_override) { m_inherited.font_language_override = font_language_override; }
  616. void set_font_feature_settings(Optional<HashMap<FlyString, IntegerOrCalculated>> value) { m_inherited.font_feature_settings = move(value); }
  617. void set_font_variation_settings(Optional<HashMap<FlyString, NumberOrCalculated>> value) { m_inherited.font_variation_settings = move(value); }
  618. void set_line_height(CSSPixels line_height) { m_inherited.line_height = line_height; }
  619. void set_border_spacing_horizontal(CSS::Length border_spacing_horizontal) { m_inherited.border_spacing_horizontal = border_spacing_horizontal; }
  620. void set_border_spacing_vertical(CSS::Length border_spacing_vertical) { m_inherited.border_spacing_vertical = border_spacing_vertical; }
  621. void set_caption_side(CSS::CaptionSide caption_side) { m_inherited.caption_side = caption_side; }
  622. void set_color(Color color) { m_inherited.color = color; }
  623. void set_clip(CSS::Clip const& clip) { m_noninherited.clip = clip; }
  624. void set_content(ContentData const& content) { m_noninherited.content = content; }
  625. void set_content_visibility(CSS::ContentVisibility content_visibility) { m_inherited.content_visibility = content_visibility; }
  626. void set_cursor(CSS::Cursor cursor) { m_inherited.cursor = cursor; }
  627. void set_image_rendering(CSS::ImageRendering value) { m_inherited.image_rendering = value; }
  628. void set_pointer_events(CSS::PointerEvents value) { m_inherited.pointer_events = value; }
  629. void set_background_color(Color color) { m_noninherited.background_color = color; }
  630. void set_background_layers(Vector<BackgroundLayerData>&& layers) { m_noninherited.background_layers = move(layers); }
  631. void set_float(CSS::Float value) { m_noninherited.float_ = value; }
  632. void set_clear(CSS::Clear value) { m_noninherited.clear = value; }
  633. void set_z_index(Optional<int> value) { m_noninherited.z_index = value; }
  634. void set_tab_size(Variant<LengthOrCalculated, NumberOrCalculated> value) { m_inherited.tab_size = value; }
  635. void set_text_align(CSS::TextAlign text_align) { m_inherited.text_align = text_align; }
  636. void set_text_justify(CSS::TextJustify text_justify) { m_inherited.text_justify = text_justify; }
  637. void set_text_decoration_line(Vector<CSS::TextDecorationLine> value) { m_noninherited.text_decoration_line = move(value); }
  638. void set_text_decoration_thickness(CSS::LengthPercentage value) { m_noninherited.text_decoration_thickness = move(value); }
  639. void set_text_decoration_style(CSS::TextDecorationStyle value) { m_noninherited.text_decoration_style = value; }
  640. void set_text_decoration_color(Color value) { m_noninherited.text_decoration_color = value; }
  641. void set_text_transform(CSS::TextTransform value) { m_inherited.text_transform = value; }
  642. void set_text_shadow(Vector<ShadowData>&& value) { m_inherited.text_shadow = move(value); }
  643. void set_text_indent(CSS::LengthPercentage value) { m_inherited.text_indent = move(value); }
  644. void set_text_overflow(CSS::TextOverflow value) { m_noninherited.text_overflow = value; }
  645. void set_webkit_text_fill_color(Color value) { m_inherited.webkit_text_fill_color = value; }
  646. void set_position(CSS::Positioning position) { m_noninherited.position = position; }
  647. void set_white_space(CSS::WhiteSpace value) { m_inherited.white_space = value; }
  648. void set_width(CSS::Size const& width) { m_noninherited.width = width; }
  649. void set_min_width(CSS::Size const& width) { m_noninherited.min_width = width; }
  650. void set_max_width(CSS::Size const& width) { m_noninherited.max_width = width; }
  651. void set_height(CSS::Size const& height) { m_noninherited.height = height; }
  652. void set_min_height(CSS::Size const& height) { m_noninherited.min_height = height; }
  653. void set_max_height(CSS::Size const& height) { m_noninherited.max_height = height; }
  654. void set_inset(CSS::LengthBox const& inset) { m_noninherited.inset = inset; }
  655. void set_margin(const CSS::LengthBox& margin) { m_noninherited.margin = margin; }
  656. void set_padding(const CSS::LengthBox& padding) { m_noninherited.padding = padding; }
  657. void set_overflow_x(CSS::Overflow value) { m_noninherited.overflow_x = value; }
  658. void set_overflow_y(CSS::Overflow value) { m_noninherited.overflow_y = value; }
  659. void set_list_style_type(CSS::ListStyleType value) { m_inherited.list_style_type = value; }
  660. void set_list_style_position(CSS::ListStylePosition value) { m_inherited.list_style_position = value; }
  661. void set_display(CSS::Display value) { m_noninherited.display = value; }
  662. void set_backdrop_filter(CSS::ResolvedBackdropFilter backdrop_filter) { m_noninherited.backdrop_filter = move(backdrop_filter); }
  663. void set_border_bottom_left_radius(CSS::BorderRadiusData value) { m_noninherited.border_bottom_left_radius = move(value); }
  664. void set_border_bottom_right_radius(CSS::BorderRadiusData value) { m_noninherited.border_bottom_right_radius = move(value); }
  665. void set_border_top_left_radius(CSS::BorderRadiusData value) { m_noninherited.border_top_left_radius = move(value); }
  666. void set_border_top_right_radius(CSS::BorderRadiusData value) { m_noninherited.border_top_right_radius = move(value); }
  667. BorderData& border_left() { return m_noninherited.border_left; }
  668. BorderData& border_top() { return m_noninherited.border_top; }
  669. BorderData& border_right() { return m_noninherited.border_right; }
  670. BorderData& border_bottom() { return m_noninherited.border_bottom; }
  671. void set_flex_direction(CSS::FlexDirection value) { m_noninherited.flex_direction = value; }
  672. void set_flex_wrap(CSS::FlexWrap value) { m_noninherited.flex_wrap = value; }
  673. void set_flex_basis(FlexBasis value) { m_noninherited.flex_basis = move(value); }
  674. void set_flex_grow(float value) { m_noninherited.flex_grow = value; }
  675. void set_flex_shrink(float value) { m_noninherited.flex_shrink = value; }
  676. void set_order(int value) { m_noninherited.order = value; }
  677. void set_accent_color(Color value) { m_inherited.accent_color = value; }
  678. void set_align_content(CSS::AlignContent value) { m_noninherited.align_content = value; }
  679. void set_align_items(CSS::AlignItems value) { m_noninherited.align_items = value; }
  680. void set_align_self(CSS::AlignSelf value) { m_noninherited.align_self = value; }
  681. void set_appearance(CSS::Appearance value) { m_noninherited.appearance = value; }
  682. void set_opacity(float value) { m_noninherited.opacity = value; }
  683. void set_justify_content(CSS::JustifyContent value) { m_noninherited.justify_content = value; }
  684. void set_justify_items(CSS::JustifyItems value) { m_noninherited.justify_items = value; }
  685. void set_justify_self(CSS::JustifySelf value) { m_noninherited.justify_self = value; }
  686. void set_box_shadow(Vector<ShadowData>&& value) { m_noninherited.box_shadow = move(value); }
  687. void set_transformations(Vector<CSS::Transformation> value) { m_noninherited.transformations = move(value); }
  688. void set_transform_box(CSS::TransformBox value) { m_noninherited.transform_box = value; }
  689. void set_transform_origin(CSS::TransformOrigin value) { m_noninherited.transform_origin = value; }
  690. void set_box_sizing(CSS::BoxSizing value) { m_noninherited.box_sizing = value; }
  691. void set_vertical_align(Variant<CSS::VerticalAlign, CSS::LengthPercentage> value) { m_noninherited.vertical_align = move(value); }
  692. void set_visibility(CSS::Visibility value) { m_inherited.visibility = value; }
  693. void set_grid_auto_columns(CSS::GridTrackSizeList value) { m_noninherited.grid_auto_columns = move(value); }
  694. void set_grid_auto_rows(CSS::GridTrackSizeList value) { m_noninherited.grid_auto_rows = move(value); }
  695. void set_grid_template_columns(CSS::GridTrackSizeList value) { m_noninherited.grid_template_columns = move(value); }
  696. void set_grid_template_rows(CSS::GridTrackSizeList value) { m_noninherited.grid_template_rows = move(value); }
  697. void set_grid_column_end(CSS::GridTrackPlacement value) { m_noninherited.grid_column_end = value; }
  698. void set_grid_column_start(CSS::GridTrackPlacement value) { m_noninherited.grid_column_start = value; }
  699. void set_grid_row_end(CSS::GridTrackPlacement value) { m_noninherited.grid_row_end = value; }
  700. void set_grid_row_start(CSS::GridTrackPlacement value) { m_noninherited.grid_row_start = value; }
  701. void set_column_count(CSS::ColumnCount value) { m_noninherited.column_count = value; }
  702. void set_column_gap(CSS::Size const& column_gap) { m_noninherited.column_gap = column_gap; }
  703. void set_column_span(CSS::ColumnSpan const& column_span) { m_noninherited.column_span = column_span; }
  704. void set_column_width(CSS::Size const& column_width) { m_noninherited.column_width = column_width; }
  705. void set_row_gap(CSS::Size const& row_gap) { m_noninherited.row_gap = row_gap; }
  706. void set_border_collapse(CSS::BorderCollapse const& border_collapse) { m_inherited.border_collapse = border_collapse; }
  707. void set_grid_template_areas(Vector<Vector<String>> const& grid_template_areas) { m_noninherited.grid_template_areas = grid_template_areas; }
  708. void set_grid_auto_flow(CSS::GridAutoFlow grid_auto_flow) { m_noninherited.grid_auto_flow = grid_auto_flow; }
  709. void set_transition_delay(CSS::Time const& transition_delay) { m_noninherited.transition_delay = transition_delay; }
  710. void set_table_layout(CSS::TableLayout value) { m_noninherited.table_layout = value; }
  711. void set_quotes(CSS::QuotesData value) { m_inherited.quotes = value; }
  712. void set_object_fit(CSS::ObjectFit value) { m_noninherited.object_fit = value; }
  713. void set_object_position(CSS::ObjectPosition value) { m_noninherited.object_position = value; }
  714. void set_direction(CSS::Direction value) { m_inherited.direction = value; }
  715. void set_unicode_bidi(CSS::UnicodeBidi value) { m_noninherited.unicode_bidi = value; }
  716. void set_fill(SVGPaint value) { m_inherited.fill = value; }
  717. void set_stroke(SVGPaint value) { m_inherited.stroke = value; }
  718. void set_fill_rule(CSS::FillRule value) { m_inherited.fill_rule = value; }
  719. void set_fill_opacity(float value) { m_inherited.fill_opacity = value; }
  720. void set_stroke_linecap(CSS::StrokeLinecap value) { m_inherited.stroke_linecap = value; }
  721. void set_stroke_opacity(float value) { m_inherited.stroke_opacity = value; }
  722. void set_stroke_width(LengthPercentage value) { m_inherited.stroke_width = value; }
  723. void set_stop_color(Color value) { m_noninherited.stop_color = value; }
  724. void set_stop_opacity(float value) { m_noninherited.stop_opacity = value; }
  725. void set_text_anchor(CSS::TextAnchor value) { m_inherited.text_anchor = value; }
  726. void set_outline_color(Color value) { m_noninherited.outline_color = value; }
  727. void set_outline_offset(CSS::Length value) { m_noninherited.outline_offset = value; }
  728. void set_outline_style(CSS::OutlineStyle value) { m_noninherited.outline_style = value; }
  729. void set_outline_width(CSS::Length value) { m_noninherited.outline_width = value; }
  730. void set_mask(MaskReference value) { m_noninherited.mask = value; }
  731. void set_mask_type(CSS::MaskType value) { m_noninherited.mask_type = value; }
  732. void set_clip_path(ClipPathReference value) { m_noninherited.clip_path = value; }
  733. void set_clip_rule(CSS::ClipRule value) { m_inherited.clip_rule = value; }
  734. void set_cx(LengthPercentage cx) { m_noninherited.cx = cx; }
  735. void set_cy(LengthPercentage cy) { m_noninherited.cy = cy; }
  736. void set_r(LengthPercentage r) { m_noninherited.r = r; }
  737. void set_rx(LengthPercentage rx) { m_noninherited.rx = rx; }
  738. void set_ry(LengthPercentage ry) { m_noninherited.ry = ry; }
  739. void set_x(LengthPercentage x) { m_noninherited.x = x; }
  740. void set_y(LengthPercentage y) { m_noninherited.y = y; }
  741. void set_math_shift(CSS::MathShift value) { m_inherited.math_shift = value; }
  742. void set_math_style(CSS::MathStyle value) { m_inherited.math_style = value; }
  743. void set_math_depth(int value) { m_inherited.math_depth = value; }
  744. void set_scrollbar_width(CSS::ScrollbarWidth value) { m_noninherited.scrollbar_width = value; }
  745. void set_counter_increment(Vector<CounterData> value) { m_noninherited.counter_increment = move(value); }
  746. void set_counter_reset(Vector<CounterData> value) { m_noninherited.counter_reset = move(value); }
  747. void set_counter_set(Vector<CounterData> value) { m_noninherited.counter_set = move(value); }
  748. };
  749. }