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