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