Photon 1.0.0
Loading...
Searching...
No Matches
css_properties.h
Go to the documentation of this file.
1#ifndef LITEHTML_CSS_PROPERTIES_H
2#define LITEHTML_CSS_PROPERTIES_H
3
4#include "os_types.h"
5#include "types.h"
6#include "css_margins.h"
7#include "borders.h"
8#include "css_offsets.h"
9#include "background.h"
10
11namespace litehtml
12{
13 class html_tag;
14 class document;
15
17 {
18 private:
58 string m_cursor;
59 string m_content;
63
73
75
77
78 private:
79 void compute_font(const html_tag* el, const std::shared_ptr<document>& doc);
80 void compute_background(const html_tag* el, const std::shared_ptr<document>& doc);
81 void compute_flex(const html_tag* el, const std::shared_ptr<document>& doc);
82 web_color get_color_property(const html_tag* el, string_id name, bool inherited, web_color default_value, uint_ptr member_offset) const;
83
84 public:
131
132 void compute(const html_tag* el, const std::shared_ptr<document>& doc);
133 std::vector<std::tuple<string, string>> dump_get_attrs();
134
136 void set_position(element_position mElPosition);
137
139 void set_text_align(text_align mTextAlign);
140
141 overflow get_overflow() const;
142 void set_overflow(overflow mOverflow);
143
145 void set_white_space(white_space mWhiteSpace);
146
148 void set_display(style_display mDisplay);
149
151 void set_visibility(visibility mVisibility);
152
154 void set_appearance(appearance mAppearance);
155
157 void set_box_sizing(box_sizing mBoxSizing);
158
159 int get_z_index() const;
160 void set_z_index(int mZIndex);
161
163 void set_vertical_align(vertical_align mVerticalAlign);
164
165 element_float get_float() const;
166 void set_float(element_float mFloat);
167
168 element_clear get_clear() const;
169 void set_clear(element_clear mClear);
170
171 const css_margins &get_margins() const;
172 void set_margins(const css_margins &mCssMargins);
173
174 const css_margins &get_padding() const;
175 void set_padding(const css_margins &mCssPadding);
176
177 const css_borders &get_borders() const;
178 void set_borders(const css_borders &mCssBorders);
179
180 const css_length &get_width() const;
181 void set_width(const css_length &mCssWidth);
182
183 const css_length &get_height() const;
184 void set_height(const css_length &mCssHeight);
185
186 const css_length &get_min_width() const;
187 void set_min_width(const css_length &mCssMinWidth);
188
189 const css_length &get_min_height() const;
190 void set_min_height(const css_length &mCssMinHeight);
191
192 const css_length &get_max_width() const;
193 void set_max_width(const css_length &mCssMaxWidth);
194
195 const css_length &get_max_height() const;
196 void set_max_height(const css_length &mCssMaxHeight);
197
198 const css_offsets &get_offsets() const;
199 void set_offsets(const css_offsets &mCssOffsets);
200
201 const css_length &get_text_indent() const;
202 void set_text_indent(const css_length &mCssTextIndent);
203
204 int get_line_height() const;
205 void set_line_height(int mLineHeight);
206
208 void set_list_style_type(list_style_type mListStyleType);
209
211 void set_list_style_position(list_style_position mListStylePosition);
212
213 string get_list_style_image() const;
214 void set_list_style_image(const string& url);
215
216 string get_list_style_image_baseurl() const;
217 void set_list_style_image_baseurl(const string& url);
218
219 const background &get_bg() const;
220 void set_bg(const background &mBg);
221
222 int get_font_size() const;
223 void set_font_size(int mFontSize);
224
225 uint_ptr get_font() const;
226 void set_font(uint_ptr mFont);
227
228 const font_metrics& get_font_metrics() const;
229 void set_font_metrics(const font_metrics& mFontMetrics);
230
232 void set_text_transform(text_transform mTextTransform);
233
234 web_color get_color() const;
236
237 string get_cursor() const;
238 void set_cursor(const string& cursor);
239
240 string get_content() const;
241 void set_content(const string& content);
242
244 void set_border_collapse(border_collapse mBorderCollapse);
245
246 const css_length& get_border_spacing_x() const ;
247 void set_border_spacing_x(const css_length& mBorderSpacingX);
248
249 const css_length& get_border_spacing_y() const;
250 void set_border_spacing_y(const css_length& mBorderSpacingY);
251
254
255 float get_flex_grow() const;
256 float get_flex_shrink() const;
257 const css_length& get_flex_basis() const;
259 flex_wrap get_flex_wrap() const;
264
265 int get_order() const;
266 void set_order(int order);
267 };
268
270 {
271 return m_el_position;
272 }
273
275 {
276 m_el_position = mElPosition;
277 }
278
280 {
281 return m_text_align;
282 }
283
285 {
286 m_text_align = mTextAlign;
287 }
288
290 {
291 return m_overflow;
292 }
293
295 {
296 m_overflow = mOverflow;
297 }
298
300 {
301 return m_white_space;
302 }
303
305 {
306 m_white_space = mWhiteSpace;
307 }
308
310 {
311 return m_display;
312 }
313
315 {
316 m_display = mDisplay;
317 }
318
320 {
321 return m_visibility;
322 }
323
325 {
326 m_visibility = mVisibility;
327 }
328
330 {
331 return m_appearance;
332 }
333
335 {
336 m_appearance = mAppearance;
337 }
338
340 {
341 return m_box_sizing;
342 }
343
345 {
346 m_box_sizing = mBoxSizing;
347 }
348
350 {
351 return (int)m_z_index.val();
352 }
353
354 inline void css_properties::set_z_index(int mZIndex)
355 {
356 m_z_index.set_value((float)mZIndex, css_units_none);
357 }
358
363
365 {
366 m_vertical_align = mVerticalAlign;
367 }
368
370 {
371 return m_float;
372 }
373
375 {
376 m_float = mFloat;
377 }
378
380 {
381 return m_clear;
382 }
383
385 {
386 m_clear = mClear;
387 }
388
390 {
391 return m_css_margins;
392 }
393
394 inline void css_properties::set_margins(const css_margins &mCssMargins)
395 {
396 m_css_margins = mCssMargins;
397 }
398
400 {
401 return m_css_padding;
402 }
403
404 inline void css_properties::set_padding(const css_margins &mCssPadding)
405 {
406 m_css_padding = mCssPadding;
407 }
408
410 {
411 return m_css_borders;
412 }
413
414 inline void css_properties::set_borders(const css_borders &mCssBorders)
415 {
416 m_css_borders = mCssBorders;
417 }
418
420 {
421 return m_css_width;
422 }
423
424 inline void css_properties::set_width(const css_length &mCssWidth)
425 {
426 m_css_width = mCssWidth;
427 }
428
430 {
431 return m_css_height;
432 }
433
434 inline void css_properties::set_height(const css_length &mCssHeight)
435 {
436 m_css_height = mCssHeight;
437 }
438
440 {
441 return m_css_min_width;
442 }
443
444 inline void css_properties::set_min_width(const css_length &mCssMinWidth)
445 {
446 m_css_min_width = mCssMinWidth;
447 }
448
450 {
451 return m_css_min_height;
452 }
453
454 inline void css_properties::set_min_height(const css_length &mCssMinHeight)
455 {
456 m_css_min_height = mCssMinHeight;
457 }
458
460 {
461 return m_css_max_width;
462 }
463
464 inline void css_properties::set_max_width(const css_length &mCssMaxWidth)
465 {
466 m_css_max_width = mCssMaxWidth;
467 }
468
470 {
471 return m_css_max_height;
472 }
473
474 inline void css_properties::set_max_height(const css_length &mCssMaxHeight)
475 {
476 m_css_max_height = mCssMaxHeight;
477 }
478
480 {
481 return m_css_offsets;
482 }
483
484 inline void css_properties::set_offsets(const css_offsets &mCssOffsets)
485 {
486 m_css_offsets = mCssOffsets;
487 }
488
490 {
491 return m_css_text_indent;
492 }
493
494 inline void css_properties::set_text_indent(const css_length &mCssTextIndent)
495 {
496 m_css_text_indent = mCssTextIndent;
497 }
498
500 {
501 return m_line_height;
502 }
503
504 inline void css_properties::set_line_height(int mLineHeight)
505 {
506 m_line_height = mLineHeight;
507 }
508
513
515 {
516 m_list_style_type = mListStyleType;
517 }
518
523
525 {
526 m_list_style_position = mListStylePosition;
527 }
528
531
534
535 inline const background &css_properties::get_bg() const
536 {
537 return m_bg;
538 }
539
540 inline void css_properties::set_bg(const background &mBg)
541 {
542 m_bg = mBg;
543 }
544
546 {
547 return (int)m_font_size.val();
548 }
549
550 inline void css_properties::set_font_size(int mFontSize)
551 {
552 m_font_size = (float)mFontSize;
553 }
554
556 {
557 return m_font;
558 }
559
561 {
562 m_font = mFont;
563 }
564
566 {
567 return m_font_metrics;
568 }
569
570 inline void css_properties::set_font_metrics(const font_metrics& mFontMetrics)
571 {
572 m_font_metrics = mFontMetrics;
573 }
574
579
581 {
582 m_text_transform = mTextTransform;
583 }
584
585 inline web_color css_properties::get_color() const { return m_color; }
587
588 inline string css_properties::get_cursor() const { return m_cursor; }
589 inline void css_properties::set_cursor(const string& cursor) { m_cursor = cursor; }
590
591 inline string css_properties::get_content() const { return m_content; }
592 inline void css_properties::set_content(const string& content) { m_content = content; }
593
598
600 {
601 m_border_collapse = mBorderCollapse;
602 }
603
605 {
607 }
608
609 inline void css_properties::set_border_spacing_x(const css_length& mBorderSpacingX)
610 {
611 m_css_border_spacing_x = mBorderSpacingX;
612 }
613
615 {
617 }
618
619 inline void css_properties::set_border_spacing_y(const css_length& mBorderSpacingY)
620 {
621 m_css_border_spacing_y = mBorderSpacingY;
622 }
623
624 inline float css_properties::get_flex_grow() const
625 {
626 return m_flex_grow;
627 }
628
630 {
631 return m_flex_shrink;
632 }
633
635 {
636 return m_flex_basis;
637 }
638
643
645 {
646 return m_flex_wrap;
647 }
648
653
658
663
668
670 {
671 return m_caption_side;
672 }
674 {
675 m_caption_side = side;
676 }
677
678 inline int css_properties::get_order() const
679 {
680 return m_order;
681 }
682
683 inline void css_properties::set_order(int order)
684 {
685 m_order = order;
686 }
687}
688
689#endif //LITEHTML_CSS_PROPERTIES_H
Definition background.h:91
Definition css_length.h:22
void set_value(float val, css_units units)
Definition css_length.h:94
float val() const
Definition css_length.h:101
Definition css_properties.h:17
const css_length & get_width() const
Definition css_properties.h:419
box_sizing get_box_sizing() const
Definition css_properties.h:339
css_length m_z_index
Definition css_properties.h:27
css_length m_font_size
Definition css_properties.h:50
const css_length & get_min_width() const
Definition css_properties.h:439
web_color m_color
Definition css_properties.h:57
border_collapse m_border_collapse
Definition css_properties.h:60
flex_align_items m_flex_align_items
Definition css_properties.h:70
string m_cursor
Definition css_properties.h:58
void set_padding(const css_margins &mCssPadding)
Definition css_properties.h:404
css_margins m_css_margins
Definition css_properties.h:31
uint_ptr get_font() const
Definition css_properties.h:555
void set_overflow(overflow mOverflow)
Definition css_properties.h:294
css_length m_css_min_width
Definition css_properties.h:36
flex_direction get_flex_direction() const
Definition css_properties.h:639
void set_max_height(const css_length &mCssMaxHeight)
Definition css_properties.h:474
style_display get_display() const
Definition css_properties.h:309
void set_font_metrics(const font_metrics &mFontMetrics)
Definition css_properties.h:570
int get_line_height() const
Definition css_properties.h:499
void set_visibility(visibility mVisibility)
Definition css_properties.h:324
void set_offsets(const css_offsets &mCssOffsets)
Definition css_properties.h:484
css_offsets m_css_offsets
Definition css_properties.h:40
void set_list_style_image_baseurl(const string &url)
Definition css_properties.h:533
void set_position(element_position mElPosition)
Definition css_properties.h:274
css_length m_flex_basis
Definition css_properties.h:66
css_length m_css_border_spacing_x
Definition css_properties.h:61
style_display m_display
Definition css_properties.h:23
css_length m_css_line_height
Definition css_properties.h:42
void set_box_sizing(box_sizing mBoxSizing)
Definition css_properties.h:344
void set_content(const string &content)
Definition css_properties.h:592
const css_length & get_max_width() const
Definition css_properties.h:459
void set_font(uint_ptr mFont)
Definition css_properties.h:560
void set_border_spacing_y(const css_length &mBorderSpacingY)
Definition css_properties.h:619
flex_align_items get_flex_align_items() const
Definition css_properties.h:654
string m_font_family
Definition css_properties.h:51
visibility m_visibility
Definition css_properties.h:24
flex_direction m_flex_direction
Definition css_properties.h:67
font_style m_font_style
Definition css_properties.h:53
box_sizing m_box_sizing
Definition css_properties.h:26
text_transform get_text_transform() const
Definition css_properties.h:575
appearance get_appearance() const
Definition css_properties.h:329
css_length m_css_max_height
Definition css_properties.h:39
const css_length & get_min_height() const
Definition css_properties.h:449
int get_z_index() const
Definition css_properties.h:349
void set_clear(element_clear mClear)
Definition css_properties.h:384
string m_list_style_image_baseurl
Definition css_properties.h:47
std::vector< std::tuple< string, string > > dump_get_attrs()
Definition css_properties.cpp:455
float m_flex_grow
Definition css_properties.h:64
void set_border_collapse(border_collapse mBorderCollapse)
Definition css_properties.h:599
void set_list_style_image(const string &url)
Definition css_properties.h:530
void set_text_align(text_align mTextAlign)
Definition css_properties.h:284
int m_line_height
Definition css_properties.h:43
element_float get_float() const
Definition css_properties.h:369
web_color get_color() const
Definition css_properties.h:585
border_collapse get_border_collapse() const
Definition css_properties.h:594
css_length m_css_text_indent
Definition css_properties.h:41
int m_order
Definition css_properties.h:76
element_clear get_clear() const
Definition css_properties.h:379
void compute_background(const html_tag *el, const std::shared_ptr< document > &doc)
Definition css_properties.cpp:369
void set_float(element_float mFloat)
Definition css_properties.h:374
void set_borders(const css_borders &mCssBorders)
Definition css_properties.h:414
const css_margins & get_margins() const
Definition css_properties.h:389
const css_length & get_border_spacing_y() const
Definition css_properties.h:614
void set_max_width(const css_length &mCssMaxWidth)
Definition css_properties.h:464
void set_height(const css_length &mCssHeight)
Definition css_properties.h:434
void set_list_style_position(list_style_position mListStylePosition)
Definition css_properties.h:524
vertical_align m_vertical_align
Definition css_properties.h:28
flex_align_items get_flex_align_self() const
Definition css_properties.h:659
css_length m_css_width
Definition css_properties.h:34
void compute_flex(const html_tag *el, const std::shared_ptr< document > &doc)
Definition css_properties.cpp:418
css_properties()
Definition css_properties.h:85
void set_border_spacing_x(const css_length &mBorderSpacingX)
Definition css_properties.h:609
list_style_position get_list_style_position() const
Definition css_properties.h:519
flex_justify_content m_flex_justify_content
Definition css_properties.h:69
css_borders m_css_borders
Definition css_properties.h:33
float get_flex_shrink() const
Definition css_properties.h:629
int get_order() const
Definition css_properties.h:678
const css_length & get_flex_basis() const
Definition css_properties.h:634
const css_length & get_max_height() const
Definition css_properties.h:469
void set_min_width(const css_length &mCssMinWidth)
Definition css_properties.h:444
float get_flex_grow() const
Definition css_properties.h:624
void compute_font(const html_tag *el, const std::shared_ptr< document > &doc)
Definition css_properties.cpp:270
void set_appearance(appearance mAppearance)
Definition css_properties.h:334
white_space get_white_space() const
Definition css_properties.h:299
white_space m_white_space
Definition css_properties.h:22
int get_font_size() const
Definition css_properties.h:545
flex_wrap get_flex_wrap() const
Definition css_properties.h:644
string m_content
Definition css_properties.h:59
void set_bg(const background &mBg)
Definition css_properties.h:540
web_color get_color_property(const html_tag *el, string_id name, bool inherited, web_color default_value, uint_ptr member_offset) const
Definition css_properties.cpp:251
void set_color(web_color color)
Definition css_properties.h:586
flex_align_content get_flex_align_content() const
Definition css_properties.h:664
css_length m_font_weight
Definition css_properties.h:52
flex_align_items m_flex_align_self
Definition css_properties.h:71
list_style_type get_list_style_type() const
Definition css_properties.h:509
void set_caption_side(caption_side side)
Definition css_properties.h:673
void set_white_space(white_space mWhiteSpace)
Definition css_properties.h:304
caption_side get_caption_side() const
Definition css_properties.h:669
void set_margins(const css_margins &mCssMargins)
Definition css_properties.h:394
flex_wrap m_flex_wrap
Definition css_properties.h:68
const css_offsets & get_offsets() const
Definition css_properties.h:479
void set_line_height(int mLineHeight)
Definition css_properties.h:504
element_position get_position() const
Definition css_properties.h:269
const css_length & get_text_indent() const
Definition css_properties.h:489
void set_text_transform(text_transform mTextTransform)
Definition css_properties.h:580
void compute(const html_tag *el, const std::shared_ptr< document > &doc)
Definition css_properties.cpp:7
list_style_position m_list_style_position
Definition css_properties.h:45
css_length m_css_min_height
Definition css_properties.h:37
text_align m_text_align
Definition css_properties.h:20
background m_bg
Definition css_properties.h:48
string get_list_style_image_baseurl() const
Definition css_properties.h:532
const background & get_bg() const
Definition css_properties.h:535
flex_align_content m_flex_align_content
Definition css_properties.h:72
list_style_type m_list_style_type
Definition css_properties.h:44
void set_font_size(int mFontSize)
Definition css_properties.h:550
const css_length & get_height() const
Definition css_properties.h:429
css_length m_css_max_width
Definition css_properties.h:38
text_transform m_text_transform
Definition css_properties.h:56
void set_min_height(const css_length &mCssMinHeight)
Definition css_properties.h:454
vertical_align get_vertical_align() const
Definition css_properties.h:359
text_align get_text_align() const
Definition css_properties.h:279
void set_z_index(int mZIndex)
Definition css_properties.h:354
overflow get_overflow() const
Definition css_properties.h:289
void set_display(style_display mDisplay)
Definition css_properties.h:314
void set_vertical_align(vertical_align mVerticalAlign)
Definition css_properties.h:364
void set_text_indent(const css_length &mCssTextIndent)
Definition css_properties.h:494
float m_flex_shrink
Definition css_properties.h:65
element_position m_el_position
Definition css_properties.h:19
string m_list_style_image
Definition css_properties.h:46
caption_side m_caption_side
Definition css_properties.h:74
element_clear m_clear
Definition css_properties.h:30
const font_metrics & get_font_metrics() const
Definition css_properties.h:565
css_length m_css_height
Definition css_properties.h:35
string get_cursor() const
Definition css_properties.h:588
string m_text_decoration
Definition css_properties.h:54
void set_list_style_type(list_style_type mListStyleType)
Definition css_properties.h:514
string get_content() const
Definition css_properties.h:591
css_margins m_css_padding
Definition css_properties.h:32
void set_order(int order)
Definition css_properties.h:683
const css_margins & get_padding() const
Definition css_properties.h:399
overflow m_overflow
Definition css_properties.h:21
visibility get_visibility() const
Definition css_properties.h:319
const css_length & get_border_spacing_x() const
Definition css_properties.h:604
element_float m_float
Definition css_properties.h:29
appearance m_appearance
Definition css_properties.h:25
const css_borders & get_borders() const
Definition css_properties.h:409
uint_ptr m_font
Definition css_properties.h:49
flex_justify_content get_flex_justify_content() const
Definition css_properties.h:649
font_metrics m_font_metrics
Definition css_properties.h:55
css_length m_css_border_spacing_y
Definition css_properties.h:62
string get_list_style_image() const
Definition css_properties.h:529
void set_width(const css_length &mCssWidth)
Definition css_properties.h:424
void set_cursor(const string &cursor)
Definition css_properties.h:589
Definition html_tag.h:18
Definition url.h:41
Definition background.h:12
element_position
Definition types.h:562
@ element_position_static
Definition types.h:563
text_transform
Definition types.h:582
@ text_transform_none
Definition types.h:583
border_collapse
Definition types.h:633
@ border_collapse_separate
Definition types.h:635
box_sizing
Definition types.h:858
@ box_sizing_content_box
Definition types.h:859
std::uintptr_t uint_ptr
Definition types.h:17
white_space
Definition types.h:592
@ white_space_normal
Definition types.h:593
flex_wrap
Definition types.h:928
@ flex_wrap_nowrap
Definition types.h:929
element_float
Definition types.h:481
@ float_none
Definition types.h:482
caption_side
Definition types.h:1004
flex_align_items
Definition types.h:956
@ flex_align_items_stretch
Definition types.h:959
@ flex_align_items_auto
Definition types.h:957
const char * name
Definition encodings.cpp:1358
flex_align_content
Definition types.h:979
@ flex_align_content_stretch
Definition types.h:987
font_style
Definition types.h:374
list_style_type
Definition types.h:402
@ list_style_type_none
Definition types.h:403
appearance
Definition types.h:836
@ appearance_none
Definition types.h:837
vertical_align
Definition types.h:437
@ va_baseline
Definition types.h:438
list_style_position
Definition types.h:429
@ list_style_position_outside
Definition types.h:431
flex_justify_content
Definition types.h:937
@ flex_justify_content_flex_start
Definition types.h:939
flex_direction
Definition types.h:918
@ flex_direction_row
Definition types.h:919
visibility
Definition types.h:624
@ visibility_visible
Definition types.h:625
element_clear
Definition types.h:490
@ clear_none
Definition types.h:491
overflow
Definition types.h:603
@ overflow_visible
Definition types.h:604
style_display
Definition types.h:328
@ display_inline
Definition types.h:331
text_align
Definition types.h:572
@ text_align_left
Definition types.h:573
@ css_units_none
Definition types.h:501
Definition Bitmap.h:10
Definition borders.h:216
Definition css_margins.h:9
Definition css_offsets.h:9
Definition types.h:197
Definition web_color.h:9