20#include <libcss/libcss.h>
35#define NSCSS_ABS(x) (uint32_t)((x) < 0 ? -(x) : (x))
36 uint32_t uintpart = FIXTOINT(
NSCSS_ABS(f));
38 uint32_t fracpart = ((
NSCSS_ABS(f) & 0x3ff) * 1000 + 500) / (1 << 10);
41 fprintf(stream,
"%s%"PRIu32
".%03"PRIu32, f < 0 ?
"-" :
"", uintpart, fracpart);
52 if (INTTOFIX(FIXTOINT(val)) == val)
53 fprintf(stream,
"%"PRId32, FIXTOINT(val));
71 fprintf(stream,
"px");
74 fprintf(stream,
"ex");
77 fprintf(stream,
"em");
80 fprintf(stream,
"in");
83 fprintf(stream,
"cm");
86 fprintf(stream,
"mm");
89 fprintf(stream,
"pt");
92 fprintf(stream,
"pc");
95 fprintf(stream,
"%%");
98 fprintf(stream,
"deg");
101 fprintf(stream,
"grad");
104 fprintf(stream,
"rad");
107 fprintf(stream,
"ms");
110 fprintf(stream,
"s");
113 fprintf(stream,
"Hz");
116 fprintf(stream,
"kHz");
119 fprintf(stream,
"ch");
122 fprintf(stream,
"rem");
125 fprintf(stream,
"lh");
128 fprintf(stream,
"vh");
131 fprintf(stream,
"vw");
134 fprintf(stream,
"vi");
137 fprintf(stream,
"vb");
140 fprintf(stream,
"vmin");
143 fprintf(stream,
"vmax");
146 fprintf(stream,
"q");
149 fprintf(stream,
"calc()");
159 lwc_string *url = NULL;
160 css_fixed len1 = 0, len2 = 0;
161 css_unit unit1 = CSS_UNIT_PX, unit2 = CSS_UNIT_PX;
162 css_computed_clip_rect
rect = { 0, 0, 0, 0, CSS_UNIT_PX, CSS_UNIT_PX,
163 CSS_UNIT_PX, CSS_UNIT_PX,
true,
true,
165 const css_computed_content_item *
content = NULL;
166 const css_computed_counter *counter = NULL;
167 lwc_string **string_list = NULL;
170 fprintf(stream,
"{ ");
173 val = css_computed_background_attachment(style);
175 case CSS_BACKGROUND_ATTACHMENT_FIXED:
176 fprintf(stream,
"background-attachment: fixed ");
178 case CSS_BACKGROUND_ATTACHMENT_SCROLL:
179 fprintf(stream,
"background-attachment: scroll ");
186 val = css_computed_background_color(style, &color);
188 case CSS_BACKGROUND_COLOR_COLOR:
189 fprintf(stream,
"background-color: #%08"PRIx32
" ", color);
196 val = css_computed_background_image(style, &url);
197 if (val == CSS_BACKGROUND_IMAGE_IMAGE && url != NULL) {
198 fprintf(stream,
"background-image: url('%.*s') ",
199 (
int) lwc_string_length(url),
200 lwc_string_data(url));
201 }
else if (val == CSS_BACKGROUND_IMAGE_NONE) {
202 fprintf(stream,
"background-image: none ");
206 val = css_computed_background_position(style, &len1, &unit1,
208 if (val == CSS_BACKGROUND_POSITION_SET) {
209 fprintf(stream,
"background-position: ");
211 fprintf(stream,
" ");
213 fprintf(stream,
" ");
217 val = css_computed_background_repeat(style);
219 case CSS_BACKGROUND_REPEAT_REPEAT_X:
220 fprintf(stream,
"background-repeat: repeat-x ");
222 case CSS_BACKGROUND_REPEAT_REPEAT_Y:
223 fprintf(stream,
"background-repeat: repeat-y ");
225 case CSS_BACKGROUND_REPEAT_REPEAT:
226 fprintf(stream,
"background-repeat: repeat ");
228 case CSS_BACKGROUND_REPEAT_NO_REPEAT:
229 fprintf(stream,
"background-repeat: no-repeat ");
236 val = css_computed_border_collapse(style);
238 case CSS_BORDER_COLLAPSE_SEPARATE:
239 fprintf(stream,
"border-collapse: separate ");
241 case CSS_BORDER_COLLAPSE_COLLAPSE:
242 fprintf(stream,
"border-collapse: collapse ");
250 val = css_computed_border_spacing(style, &len1, &unit1, &len2, &unit2);
251 if (val == CSS_BORDER_SPACING_SET) {
252 fprintf(stream,
"border-spacing: ");
254 fprintf(stream,
" ");
256 fprintf(stream,
" ");
260 val = css_computed_border_top_color(style, &color);
262 case CSS_BORDER_COLOR_COLOR:
263 fprintf(stream,
"border-top-color: #%08"PRIx32
" ", color);
270 val = css_computed_border_right_color(style, &color);
272 case CSS_BORDER_COLOR_COLOR:
273 fprintf(stream,
"border-right-color: #%08"PRIx32
" ", color);
280 val = css_computed_border_bottom_color(style, &color);
282 case CSS_BORDER_COLOR_COLOR:
283 fprintf(stream,
"border-bottom-color: #%08"PRIx32
" ", color);
290 val = css_computed_border_left_color(style, &color);
292 case CSS_BORDER_COLOR_COLOR:
293 fprintf(stream,
"border-left-color: #%08"PRIx32
" ", color);
300 val = css_computed_border_top_style(style);
302 case CSS_BORDER_STYLE_NONE:
303 fprintf(stream,
"border-top-style: none ");
305 case CSS_BORDER_STYLE_HIDDEN:
306 fprintf(stream,
"border-top-style: hidden ");
308 case CSS_BORDER_STYLE_DOTTED:
309 fprintf(stream,
"border-top-style: dotted ");
311 case CSS_BORDER_STYLE_DASHED:
312 fprintf(stream,
"border-top-style: dashed ");
314 case CSS_BORDER_STYLE_SOLID:
315 fprintf(stream,
"border-top-style: solid ");
317 case CSS_BORDER_STYLE_DOUBLE:
318 fprintf(stream,
"border-top-style: double ");
320 case CSS_BORDER_STYLE_GROOVE:
321 fprintf(stream,
"border-top-style: groove ");
323 case CSS_BORDER_STYLE_RIDGE:
324 fprintf(stream,
"border-top-style: ridge ");
326 case CSS_BORDER_STYLE_INSET:
327 fprintf(stream,
"border-top-style: inset ");
329 case CSS_BORDER_STYLE_OUTSET:
330 fprintf(stream,
"border-top-style: outset ");
337 val = css_computed_border_right_style(style);
339 case CSS_BORDER_STYLE_NONE:
340 fprintf(stream,
"border-right-style: none ");
342 case CSS_BORDER_STYLE_HIDDEN:
343 fprintf(stream,
"border-right-style: hidden ");
345 case CSS_BORDER_STYLE_DOTTED:
346 fprintf(stream,
"border-right-style: dotted ");
348 case CSS_BORDER_STYLE_DASHED:
349 fprintf(stream,
"border-right-style: dashed ");
351 case CSS_BORDER_STYLE_SOLID:
352 fprintf(stream,
"border-right-style: solid ");
354 case CSS_BORDER_STYLE_DOUBLE:
355 fprintf(stream,
"border-right-style: double ");
357 case CSS_BORDER_STYLE_GROOVE:
358 fprintf(stream,
"border-right-style: groove ");
360 case CSS_BORDER_STYLE_RIDGE:
361 fprintf(stream,
"border-right-style: ridge ");
363 case CSS_BORDER_STYLE_INSET:
364 fprintf(stream,
"border-right-style: inset ");
366 case CSS_BORDER_STYLE_OUTSET:
367 fprintf(stream,
"border-right-style: outset ");
374 val = css_computed_border_bottom_style(style);
376 case CSS_BORDER_STYLE_NONE:
377 fprintf(stream,
"border-bottom-style: none ");
379 case CSS_BORDER_STYLE_HIDDEN:
380 fprintf(stream,
"border-bottom-style: hidden ");
382 case CSS_BORDER_STYLE_DOTTED:
383 fprintf(stream,
"border-bottom-style: dotted ");
385 case CSS_BORDER_STYLE_DASHED:
386 fprintf(stream,
"border-bottom-style: dashed ");
388 case CSS_BORDER_STYLE_SOLID:
389 fprintf(stream,
"border-bottom-style: solid ");
391 case CSS_BORDER_STYLE_DOUBLE:
392 fprintf(stream,
"border-bottom-style: double ");
394 case CSS_BORDER_STYLE_GROOVE:
395 fprintf(stream,
"border-bottom-style: groove ");
397 case CSS_BORDER_STYLE_RIDGE:
398 fprintf(stream,
"border-bottom-style: ridge ");
400 case CSS_BORDER_STYLE_INSET:
401 fprintf(stream,
"border-bottom-style: inset ");
403 case CSS_BORDER_STYLE_OUTSET:
404 fprintf(stream,
"border-bottom-style: outset ");
411 val = css_computed_border_left_style(style);
413 case CSS_BORDER_STYLE_NONE:
414 fprintf(stream,
"border-left-style: none ");
416 case CSS_BORDER_STYLE_HIDDEN:
417 fprintf(stream,
"border-left-style: hidden ");
419 case CSS_BORDER_STYLE_DOTTED:
420 fprintf(stream,
"border-left-style: dotted ");
422 case CSS_BORDER_STYLE_DASHED:
423 fprintf(stream,
"border-left-style: dashed ");
425 case CSS_BORDER_STYLE_SOLID:
426 fprintf(stream,
"border-left-style: solid ");
428 case CSS_BORDER_STYLE_DOUBLE:
429 fprintf(stream,
"border-left-style: double ");
431 case CSS_BORDER_STYLE_GROOVE:
432 fprintf(stream,
"border-left-style: groove ");
434 case CSS_BORDER_STYLE_RIDGE:
435 fprintf(stream,
"border-left-style: ridge ");
437 case CSS_BORDER_STYLE_INSET:
438 fprintf(stream,
"border-left-style: inset ");
440 case CSS_BORDER_STYLE_OUTSET:
441 fprintf(stream,
"border-left-style: outset ");
448 val = css_computed_border_top_width(style, &len1, &unit1);
450 case CSS_BORDER_WIDTH_THIN:
451 fprintf(stream,
"border-top-width: thin ");
453 case CSS_BORDER_WIDTH_MEDIUM:
454 fprintf(stream,
"border-top-width: medium ");
456 case CSS_BORDER_WIDTH_THICK:
457 fprintf(stream,
"border-top-width: thick ");
459 case CSS_BORDER_WIDTH_WIDTH:
460 fprintf(stream,
"border-top-width: ");
462 fprintf(stream,
" ");
469 val = css_computed_border_right_width(style, &len1, &unit1);
471 case CSS_BORDER_WIDTH_THIN:
472 fprintf(stream,
"border-right-width: thin ");
474 case CSS_BORDER_WIDTH_MEDIUM:
475 fprintf(stream,
"border-right-width: medium ");
477 case CSS_BORDER_WIDTH_THICK:
478 fprintf(stream,
"border-right-width: thick ");
480 case CSS_BORDER_WIDTH_WIDTH:
481 fprintf(stream,
"border-right-width: ");
483 fprintf(stream,
" ");
490 val = css_computed_border_bottom_width(style, &len1, &unit1);
492 case CSS_BORDER_WIDTH_THIN:
493 fprintf(stream,
"border-bottom-width: thin ");
495 case CSS_BORDER_WIDTH_MEDIUM:
496 fprintf(stream,
"border-bottom-width: medium ");
498 case CSS_BORDER_WIDTH_THICK:
499 fprintf(stream,
"border-bottom-width: thick ");
501 case CSS_BORDER_WIDTH_WIDTH:
502 fprintf(stream,
"border-bottom-width: ");
504 fprintf(stream,
" ");
511 val = css_computed_border_left_width(style, &len1, &unit1);
513 case CSS_BORDER_WIDTH_THIN:
514 fprintf(stream,
"border-left-width: thin ");
516 case CSS_BORDER_WIDTH_MEDIUM:
517 fprintf(stream,
"border-left-width: medium ");
519 case CSS_BORDER_WIDTH_THICK:
520 fprintf(stream,
"border-left-width: thick ");
522 case CSS_BORDER_WIDTH_WIDTH:
523 fprintf(stream,
"border-left-width: ");
525 fprintf(stream,
" ");
532 val = css_computed_bottom(style, &len1, &unit1);
534 case CSS_BOTTOM_AUTO:
535 fprintf(stream,
"bottom: auto ");
538 fprintf(stream,
"bottom: ");
540 fprintf(stream,
" ");
547 val = css_computed_caption_side(style);
549 case CSS_CAPTION_SIDE_TOP:
550 fprintf(stream,
"caption_side: top ");
552 case CSS_CAPTION_SIDE_BOTTOM:
553 fprintf(stream,
"caption_side: bottom ");
560 val = css_computed_clear(style);
563 fprintf(stream,
"clear: none ");
566 fprintf(stream,
"clear: left ");
568 case CSS_CLEAR_RIGHT:
569 fprintf(stream,
"clear: right ");
572 fprintf(stream,
"clear: both ");
579 val = css_computed_clip(style, &
rect);
582 fprintf(stream,
"clip: auto ");
585 fprintf(stream,
"clip: rect( ");
588 fprintf(stream,
"auto");
591 fprintf(stream,
", ");
594 fprintf(stream,
"auto");
597 fprintf(stream,
", ");
599 if (
rect.bottom_auto)
600 fprintf(stream,
"auto");
603 fprintf(stream,
", ");
606 fprintf(stream,
"auto");
609 fprintf(stream,
") ");
616 val = css_computed_color(style, &color);
617 if (val == CSS_COLOR_COLOR) {
618 fprintf(stream,
"color: #%08"PRIx32
" ", color);
622 val = css_computed_content(style, &
content);
624 case CSS_CONTENT_NONE:
625 fprintf(stream,
"content: none ");
627 case CSS_CONTENT_NORMAL:
628 fprintf(stream,
"content: normal ");
630 case CSS_CONTENT_SET:
631 fprintf(stream,
"content:");
633 while (
content->type != CSS_COMPUTED_CONTENT_NONE) {
634 fprintf(stream,
" ");
637 case CSS_COMPUTED_CONTENT_STRING:
638 fprintf(stream,
"\"%.*s\"",
639 (
int) lwc_string_length(
644 case CSS_COMPUTED_CONTENT_URI:
645 fprintf(stream,
"uri(\"%.*s\")",
646 (
int) lwc_string_length(
651 case CSS_COMPUTED_CONTENT_COUNTER:
652 fprintf(stream,
"counter(%.*s)",
653 (
int) lwc_string_length(
658 case CSS_COMPUTED_CONTENT_COUNTERS:
659 fprintf(stream,
"counters(%.*s, \"%.*s\")",
660 (
int) lwc_string_length(
664 (
int) lwc_string_length(
669 case CSS_COMPUTED_CONTENT_ATTR:
670 fprintf(stream,
"attr(%.*s)",
671 (
int) lwc_string_length(
676 case CSS_COMPUTED_CONTENT_OPEN_QUOTE:
677 fprintf(stream,
"open-quote");
679 case CSS_COMPUTED_CONTENT_CLOSE_QUOTE:
680 fprintf(stream,
"close-quote");
682 case CSS_COMPUTED_CONTENT_NO_OPEN_QUOTE:
683 fprintf(stream,
"no-open-quote");
685 case CSS_COMPUTED_CONTENT_NO_CLOSE_QUOTE:
686 fprintf(stream,
"no-close-quote");
693 fprintf(stream,
" ");
700 val = css_computed_counter_increment(style, &counter);
701 if ((val == CSS_COUNTER_INCREMENT_NONE) || (counter == NULL)) {
702 fprintf(stream,
"counter-increment: none ");
704 fprintf(stream,
"counter-increment:");
706 while (counter->name != NULL) {
707 fprintf(stream,
" %.*s ",
708 (
int) lwc_string_length(counter->name),
709 lwc_string_data(counter->name));
716 fprintf(stream,
" ");
720 val = css_computed_counter_reset(style, &counter);
721 if ((val == CSS_COUNTER_RESET_NONE) || (counter == NULL)) {
722 fprintf(stream,
"counter-reset: none ");
724 fprintf(stream,
"counter-reset:");
726 while (counter->name != NULL) {
727 fprintf(stream,
" %.*s ",
728 (
int) lwc_string_length(counter->name),
729 lwc_string_data(counter->name));
736 fprintf(stream,
" ");
740 val = css_computed_cursor(style, &string_list);
741 fprintf(stream,
"cursor:");
743 if (string_list != NULL) {
744 while (*string_list != NULL) {
745 fprintf(stream,
" url\"%.*s\")",
746 (
int) lwc_string_length(*string_list),
747 lwc_string_data(*string_list));
753 case CSS_CURSOR_AUTO:
754 fprintf(stream,
" auto ");
756 case CSS_CURSOR_CROSSHAIR:
757 fprintf(stream,
" crosshair ");
759 case CSS_CURSOR_DEFAULT:
760 fprintf(stream,
" default ");
762 case CSS_CURSOR_POINTER:
763 fprintf(stream,
" pointer ");
765 case CSS_CURSOR_MOVE:
766 fprintf(stream,
" move ");
768 case CSS_CURSOR_E_RESIZE:
769 fprintf(stream,
" e-resize ");
771 case CSS_CURSOR_NE_RESIZE:
772 fprintf(stream,
" ne-resize ");
774 case CSS_CURSOR_NW_RESIZE:
775 fprintf(stream,
" nw-resize ");
777 case CSS_CURSOR_N_RESIZE:
778 fprintf(stream,
" n-resize ");
780 case CSS_CURSOR_SE_RESIZE:
781 fprintf(stream,
" se-resize ");
783 case CSS_CURSOR_SW_RESIZE:
784 fprintf(stream,
" sw-resize ");
786 case CSS_CURSOR_S_RESIZE:
787 fprintf(stream,
" s-resize ");
789 case CSS_CURSOR_W_RESIZE:
790 fprintf(stream,
" w-resize ");
792 case CSS_CURSOR_TEXT:
793 fprintf(stream,
" text ");
795 case CSS_CURSOR_WAIT:
796 fprintf(stream,
" wait ");
798 case CSS_CURSOR_HELP:
799 fprintf(stream,
" help ");
801 case CSS_CURSOR_PROGRESS:
802 fprintf(stream,
" progress ");
809 val = css_computed_direction(style);
811 case CSS_DIRECTION_LTR:
812 fprintf(stream,
"direction: ltr ");
814 case CSS_DIRECTION_RTL:
815 fprintf(stream,
"direction: rtl ");
824 case CSS_DISPLAY_INLINE:
825 fprintf(stream,
"display: inline ");
827 case CSS_DISPLAY_BLOCK:
828 fprintf(stream,
"display: block ");
830 case CSS_DISPLAY_LIST_ITEM:
831 fprintf(stream,
"display: list-item ");
833 case CSS_DISPLAY_RUN_IN:
834 fprintf(stream,
"display: run-in ");
836 case CSS_DISPLAY_INLINE_BLOCK:
837 fprintf(stream,
"display: inline-block ");
839 case CSS_DISPLAY_TABLE:
840 fprintf(stream,
"display: table ");
842 case CSS_DISPLAY_INLINE_TABLE:
843 fprintf(stream,
"display: inline-table ");
845 case CSS_DISPLAY_TABLE_ROW_GROUP:
846 fprintf(stream,
"display: table-row-group ");
848 case CSS_DISPLAY_TABLE_HEADER_GROUP:
849 fprintf(stream,
"display: table-header-group ");
851 case CSS_DISPLAY_TABLE_FOOTER_GROUP:
852 fprintf(stream,
"display: table-footer-group ");
854 case CSS_DISPLAY_TABLE_ROW:
855 fprintf(stream,
"display: table-row ");
857 case CSS_DISPLAY_TABLE_COLUMN_GROUP:
858 fprintf(stream,
"display: table-column-group ");
860 case CSS_DISPLAY_TABLE_COLUMN:
861 fprintf(stream,
"display: table-column ");
863 case CSS_DISPLAY_TABLE_CELL:
864 fprintf(stream,
"display: table-cell ");
866 case CSS_DISPLAY_TABLE_CAPTION:
867 fprintf(stream,
"display: table-caption ");
869 case CSS_DISPLAY_NONE:
870 fprintf(stream,
"display: none ");
872 case CSS_DISPLAY_FLEX:
873 fprintf(stream,
"display: flex ");
875 case CSS_DISPLAY_INLINE_FLEX:
876 fprintf(stream,
"display: inline-flex ");
883 val = css_computed_empty_cells(style);
885 case CSS_EMPTY_CELLS_SHOW:
886 fprintf(stream,
"empty-cells: show ");
888 case CSS_EMPTY_CELLS_HIDE:
889 fprintf(stream,
"empty-cells: hide ");
896 val = css_computed_float(style);
899 fprintf(stream,
"float: left ");
901 case CSS_FLOAT_RIGHT:
902 fprintf(stream,
"float: right ");
905 fprintf(stream,
"float: none ");
912 val = css_computed_font_family(style, &string_list);
913 if (val != CSS_FONT_FAMILY_INHERIT) {
914 fprintf(stream,
"font-family:");
916 if (string_list != NULL) {
917 while (*string_list != NULL) {
918 fprintf(stream,
" \"%.*s\"",
919 (
int) lwc_string_length(*string_list),
920 lwc_string_data(*string_list));
926 case CSS_FONT_FAMILY_SERIF:
927 fprintf(stream,
" serif ");
929 case CSS_FONT_FAMILY_SANS_SERIF:
930 fprintf(stream,
" sans-serif ");
932 case CSS_FONT_FAMILY_CURSIVE:
933 fprintf(stream,
" cursive ");
935 case CSS_FONT_FAMILY_FANTASY:
936 fprintf(stream,
" fantasy ");
938 case CSS_FONT_FAMILY_MONOSPACE:
939 fprintf(stream,
" monospace ");
945 val = css_computed_font_size(style, &len1, &unit1);
947 case CSS_FONT_SIZE_XX_SMALL:
948 fprintf(stream,
"font-size: xx-small ");
950 case CSS_FONT_SIZE_X_SMALL:
951 fprintf(stream,
"font-size: x-small ");
953 case CSS_FONT_SIZE_SMALL:
954 fprintf(stream,
"font-size: small ");
956 case CSS_FONT_SIZE_MEDIUM:
957 fprintf(stream,
"font-size: medium ");
959 case CSS_FONT_SIZE_LARGE:
960 fprintf(stream,
"font-size: large ");
962 case CSS_FONT_SIZE_X_LARGE:
963 fprintf(stream,
"font-size: x-large ");
965 case CSS_FONT_SIZE_XX_LARGE:
966 fprintf(stream,
"font-size: xx-large ");
968 case CSS_FONT_SIZE_LARGER:
969 fprintf(stream,
"font-size: larger ");
971 case CSS_FONT_SIZE_SMALLER:
972 fprintf(stream,
"font-size: smaller ");
974 case CSS_FONT_SIZE_DIMENSION:
975 fprintf(stream,
"font-size: ");
979 fprintf(stream,
" ");
986 val = css_computed_font_style(style);
988 case CSS_FONT_STYLE_NORMAL:
989 fprintf(stream,
"font-style: normal ");
991 case CSS_FONT_STYLE_ITALIC:
992 fprintf(stream,
"font-style: italic ");
994 case CSS_FONT_STYLE_OBLIQUE:
995 fprintf(stream,
"font-style: oblique ");
1002 val = css_computed_font_variant(style);
1004 case CSS_FONT_VARIANT_NORMAL:
1005 fprintf(stream,
"font-variant: normal ");
1007 case CSS_FONT_VARIANT_SMALL_CAPS:
1008 fprintf(stream,
"font-variant: small-caps ");
1015 val = css_computed_font_weight(style);
1017 case CSS_FONT_WEIGHT_NORMAL:
1018 fprintf(stream,
"font-weight: normal ");
1020 case CSS_FONT_WEIGHT_BOLD:
1021 fprintf(stream,
"font-weight: bold ");
1023 case CSS_FONT_WEIGHT_BOLDER:
1024 fprintf(stream,
"font-weight: bolder ");
1026 case CSS_FONT_WEIGHT_LIGHTER:
1027 fprintf(stream,
"font-weight: lighter ");
1029 case CSS_FONT_WEIGHT_100:
1030 fprintf(stream,
"font-weight: 100 ");
1032 case CSS_FONT_WEIGHT_200:
1033 fprintf(stream,
"font-weight: 200 ");
1035 case CSS_FONT_WEIGHT_300:
1036 fprintf(stream,
"font-weight: 300 ");
1038 case CSS_FONT_WEIGHT_400:
1039 fprintf(stream,
"font-weight: 400 ");
1041 case CSS_FONT_WEIGHT_500:
1042 fprintf(stream,
"font-weight: 500 ");
1044 case CSS_FONT_WEIGHT_600:
1045 fprintf(stream,
"font-weight: 600 ");
1047 case CSS_FONT_WEIGHT_700:
1048 fprintf(stream,
"font-weight: 700 ");
1050 case CSS_FONT_WEIGHT_800:
1051 fprintf(stream,
"font-weight: 800 ");
1053 case CSS_FONT_WEIGHT_900:
1054 fprintf(stream,
"font-weight: 900 ");
1061 val = css_computed_height(style, &len1, &unit1);
1063 case CSS_HEIGHT_AUTO:
1064 fprintf(stream,
"height: auto ");
1066 case CSS_HEIGHT_SET:
1067 fprintf(stream,
"height: ");
1071 fprintf(stream,
" ");
1078 val = css_computed_left(style, &len1, &unit1);
1081 fprintf(stream,
"left: auto ");
1084 fprintf(stream,
"left: ");
1088 fprintf(stream,
" ");
1095 val = css_computed_letter_spacing(style, &len1, &unit1);
1097 case CSS_LETTER_SPACING_NORMAL:
1098 fprintf(stream,
"letter-spacing: normal ");
1100 case CSS_LETTER_SPACING_SET:
1101 fprintf(stream,
"letter-spacing: ");
1105 fprintf(stream,
" ");
1112 val = css_computed_line_height(style, &len1, &unit1);
1114 case CSS_LINE_HEIGHT_NORMAL:
1115 fprintf(stream,
"line-height: normal ");
1117 case CSS_LINE_HEIGHT_NUMBER:
1118 fprintf(stream,
"line-height: ");
1122 fprintf(stream,
" ");
1124 case CSS_LINE_HEIGHT_DIMENSION:
1125 fprintf(stream,
"line-height: ");
1129 fprintf(stream,
" ");
1136 val = css_computed_list_style_image(style, &url);
1138 fprintf(stream,
"list-style-image: url('%.*s') ",
1139 (
int) lwc_string_length(url),
1140 lwc_string_data(url));
1141 }
else if (val == CSS_LIST_STYLE_IMAGE_NONE) {
1142 fprintf(stream,
"list-style-image: none ");
1146 val = css_computed_list_style_position(style);
1148 case CSS_LIST_STYLE_POSITION_INSIDE:
1149 fprintf(stream,
"list-style-position: inside ");
1151 case CSS_LIST_STYLE_POSITION_OUTSIDE:
1152 fprintf(stream,
"list-style-position: outside ");
1159 val = css_computed_list_style_type(style);
1161 case CSS_LIST_STYLE_TYPE_DISC:
1162 fprintf(stream,
"list-style-type: disc ");
1164 case CSS_LIST_STYLE_TYPE_CIRCLE:
1165 fprintf(stream,
"list-style-type: circle ");
1167 case CSS_LIST_STYLE_TYPE_SQUARE:
1168 fprintf(stream,
"list-style-type: square ");
1170 case CSS_LIST_STYLE_TYPE_DECIMAL:
1171 fprintf(stream,
"list-style-type: decimal ");
1173 case CSS_LIST_STYLE_TYPE_DECIMAL_LEADING_ZERO:
1174 fprintf(stream,
"list-style-type: decimal-leading-zero ");
1176 case CSS_LIST_STYLE_TYPE_LOWER_ROMAN:
1177 fprintf(stream,
"list-style-type: lower-roman ");
1179 case CSS_LIST_STYLE_TYPE_UPPER_ROMAN:
1180 fprintf(stream,
"list-style-type: upper-roman ");
1182 case CSS_LIST_STYLE_TYPE_LOWER_GREEK:
1183 fprintf(stream,
"list-style-type: lower-greek ");
1185 case CSS_LIST_STYLE_TYPE_LOWER_LATIN:
1186 fprintf(stream,
"list-style-type: lower-latin ");
1188 case CSS_LIST_STYLE_TYPE_UPPER_LATIN:
1189 fprintf(stream,
"list-style-type: upper-latin ");
1191 case CSS_LIST_STYLE_TYPE_ARMENIAN:
1192 fprintf(stream,
"list-style-type: armenian ");
1194 case CSS_LIST_STYLE_TYPE_GEORGIAN:
1195 fprintf(stream,
"list-style-type: georgian ");
1197 case CSS_LIST_STYLE_TYPE_LOWER_ALPHA:
1198 fprintf(stream,
"list-style-type: lower-alpha ");
1200 case CSS_LIST_STYLE_TYPE_UPPER_ALPHA:
1201 fprintf(stream,
"list-style-type: upper-alpha ");
1203 case CSS_LIST_STYLE_TYPE_NONE:
1204 fprintf(stream,
"list-style-type: none ");
1211 val = css_computed_margin_top(style, &len1, &unit1);
1213 case CSS_MARGIN_AUTO:
1214 fprintf(stream,
"margin-top: auto ");
1216 case CSS_MARGIN_SET:
1217 fprintf(stream,
"margin-top: ");
1221 fprintf(stream,
" ");
1228 val = css_computed_margin_right(style, &len1, &unit1);
1230 case CSS_MARGIN_AUTO:
1231 fprintf(stream,
"margin-right: auto ");
1233 case CSS_MARGIN_SET:
1234 fprintf(stream,
"margin-right: ");
1238 fprintf(stream,
" ");
1245 val = css_computed_margin_bottom(style, &len1, &unit1);
1247 case CSS_MARGIN_AUTO:
1248 fprintf(stream,
"margin-bottom: auto ");
1250 case CSS_MARGIN_SET:
1251 fprintf(stream,
"margin-bottom: ");
1255 fprintf(stream,
" ");
1262 val = css_computed_margin_left(style, &len1, &unit1);
1264 case CSS_MARGIN_AUTO:
1265 fprintf(stream,
"margin-left: auto ");
1267 case CSS_MARGIN_SET:
1268 fprintf(stream,
"margin-left: ");
1272 fprintf(stream,
" ");
1279 val = css_computed_max_height(style, &len1, &unit1);
1281 case CSS_MAX_HEIGHT_NONE:
1282 fprintf(stream,
"max-height: none ");
1284 case CSS_MAX_HEIGHT_SET:
1285 fprintf(stream,
"max-height: ");
1289 fprintf(stream,
" ");
1296 val = css_computed_max_width(style, &len1, &unit1);
1298 case CSS_MAX_WIDTH_NONE:
1299 fprintf(stream,
"max-width: none ");
1301 case CSS_MAX_WIDTH_SET:
1302 fprintf(stream,
"max-width: ");
1306 fprintf(stream,
" ");
1315 case CSS_MIN_HEIGHT_SET:
1316 fprintf(stream,
"min-height: ");
1320 fprintf(stream,
" ");
1329 case CSS_MIN_WIDTH_SET:
1330 fprintf(stream,
"min-width: ");
1334 fprintf(stream,
" ");
1341 val = css_computed_opacity(style, &len1);
1343 case CSS_OPACITY_SET:
1344 fprintf(stream,
"opacity: ");
1348 fprintf(stream,
" ");
1355 val = css_computed_outline_color(style, &color);
1357 case CSS_OUTLINE_COLOR_INVERT:
1358 fprintf(stream,
"outline-color: invert ");
1360 case CSS_OUTLINE_COLOR_COLOR:
1361 fprintf(stream,
"outline-color: #%08"PRIx32
" ", color);
1368 val = css_computed_outline_style(style);
1370 case CSS_OUTLINE_STYLE_NONE:
1371 fprintf(stream,
"outline-style: none ");
1373 case CSS_OUTLINE_STYLE_DOTTED:
1374 fprintf(stream,
"outline-style: dotted ");
1376 case CSS_OUTLINE_STYLE_DASHED:
1377 fprintf(stream,
"outline-style: dashed ");
1379 case CSS_OUTLINE_STYLE_SOLID:
1380 fprintf(stream,
"outline-style: solid ");
1382 case CSS_OUTLINE_STYLE_DOUBLE:
1383 fprintf(stream,
"outline-style: double ");
1385 case CSS_OUTLINE_STYLE_GROOVE:
1386 fprintf(stream,
"outline-style: groove ");
1388 case CSS_OUTLINE_STYLE_RIDGE:
1389 fprintf(stream,
"outline-style: ridge ");
1391 case CSS_OUTLINE_STYLE_INSET:
1392 fprintf(stream,
"outline-style: inset ");
1394 case CSS_OUTLINE_STYLE_OUTSET:
1395 fprintf(stream,
"outline-style: outset ");
1402 val = css_computed_outline_width(style, &len1, &unit1);
1404 case CSS_OUTLINE_WIDTH_THIN:
1405 fprintf(stream,
"outline-width: thin ");
1407 case CSS_OUTLINE_WIDTH_MEDIUM:
1408 fprintf(stream,
"outline-width: medium ");
1410 case CSS_OUTLINE_WIDTH_THICK:
1411 fprintf(stream,
"outline-width: thick ");
1413 case CSS_OUTLINE_WIDTH_WIDTH:
1414 fprintf(stream,
"outline-width: ");
1418 fprintf(stream,
" ");
1425 val = css_computed_overflow_x(style);
1427 case CSS_OVERFLOW_VISIBLE:
1428 fprintf(stream,
"overflow-x: visible ");
1430 case CSS_OVERFLOW_HIDDEN:
1431 fprintf(stream,
"overflow-x: hidden ");
1433 case CSS_OVERFLOW_SCROLL:
1434 fprintf(stream,
"overflow-x: scroll ");
1436 case CSS_OVERFLOW_AUTO:
1437 fprintf(stream,
"overflow-x auto ");
1444 val = css_computed_overflow_y(style);
1446 case CSS_OVERFLOW_VISIBLE:
1447 fprintf(stream,
"overflow-y: visible ");
1449 case CSS_OVERFLOW_HIDDEN:
1450 fprintf(stream,
"overflow-y: hidden ");
1452 case CSS_OVERFLOW_SCROLL:
1453 fprintf(stream,
"overflow-y: scroll ");
1455 case CSS_OVERFLOW_AUTO:
1456 fprintf(stream,
"overflow-y: auto ");
1463 val = css_computed_padding_top(style, &len1, &unit1);
1465 case CSS_PADDING_SET:
1466 fprintf(stream,
"padding-top: ");
1470 fprintf(stream,
" ");
1477 val = css_computed_padding_right(style, &len1, &unit1);
1479 case CSS_PADDING_SET:
1480 fprintf(stream,
"padding-right: ");
1484 fprintf(stream,
" ");
1491 val = css_computed_padding_bottom(style, &len1, &unit1);
1493 case CSS_PADDING_SET:
1494 fprintf(stream,
"padding-bottom: ");
1498 fprintf(stream,
" ");
1505 val = css_computed_padding_left(style, &len1, &unit1);
1507 case CSS_PADDING_SET:
1508 fprintf(stream,
"padding-left: ");
1512 fprintf(stream,
" ");
1519 val = css_computed_position(style);
1521 case CSS_POSITION_STATIC:
1522 fprintf(stream,
"position: static ");
1524 case CSS_POSITION_RELATIVE:
1525 fprintf(stream,
"position: relative ");
1527 case CSS_POSITION_ABSOLUTE:
1528 fprintf(stream,
"position: absolute ");
1530 case CSS_POSITION_FIXED:
1531 fprintf(stream,
"position: fixed ");
1538 val = css_computed_quotes(style, &string_list);
1539 if (val == CSS_QUOTES_STRING && string_list != NULL) {
1540 fprintf(stream,
"quotes:");
1542 while (*string_list != NULL) {
1543 fprintf(stream,
" \"%.*s\"",
1544 (
int) lwc_string_length(*string_list),
1545 lwc_string_data(*string_list));
1550 fprintf(stream,
" ");
1553 case CSS_QUOTES_NONE:
1554 fprintf(stream,
"quotes: none ");
1562 val = css_computed_right(style, &len1, &unit1);
1564 case CSS_RIGHT_AUTO:
1565 fprintf(stream,
"right: auto ");
1568 fprintf(stream,
"right: ");
1572 fprintf(stream,
" ");
1579 val = css_computed_table_layout(style);
1581 case CSS_TABLE_LAYOUT_AUTO:
1582 fprintf(stream,
"table-layout: auto ");
1584 case CSS_TABLE_LAYOUT_FIXED:
1585 fprintf(stream,
"table-layout: fixed ");
1592 val = css_computed_text_align(style);
1594 case CSS_TEXT_ALIGN_LEFT:
1595 fprintf(stream,
"text-align: left ");
1597 case CSS_TEXT_ALIGN_RIGHT:
1598 fprintf(stream,
"text-align: right ");
1600 case CSS_TEXT_ALIGN_CENTER:
1601 fprintf(stream,
"text-align: center ");
1603 case CSS_TEXT_ALIGN_JUSTIFY:
1604 fprintf(stream,
"text-align: justify ");
1606 case CSS_TEXT_ALIGN_DEFAULT:
1607 fprintf(stream,
"text-align: default ");
1609 case CSS_TEXT_ALIGN_LIBCSS_LEFT:
1610 fprintf(stream,
"text-align: -libcss-left ");
1612 case CSS_TEXT_ALIGN_LIBCSS_CENTER:
1613 fprintf(stream,
"text-align: -libcss-center ");
1615 case CSS_TEXT_ALIGN_LIBCSS_RIGHT:
1616 fprintf(stream,
"text-align: -libcss-right ");
1623 val = css_computed_text_decoration(style);
1624 if (val == CSS_TEXT_DECORATION_NONE) {
1625 fprintf(stream,
"text-decoration: none ");
1627 fprintf(stream,
"text-decoration:");
1629 if (val & CSS_TEXT_DECORATION_BLINK) {
1630 fprintf(stream,
" blink");
1632 if (val & CSS_TEXT_DECORATION_LINE_THROUGH) {
1633 fprintf(stream,
" line-through");
1635 if (val & CSS_TEXT_DECORATION_OVERLINE) {
1636 fprintf(stream,
" overline");
1638 if (val & CSS_TEXT_DECORATION_UNDERLINE) {
1639 fprintf(stream,
" underline");
1642 fprintf(stream,
" ");
1646 val = css_computed_text_indent(style, &len1, &unit1);
1648 case CSS_TEXT_INDENT_SET:
1649 fprintf(stream,
"text-indent: ");
1653 fprintf(stream,
" ");
1660 val = css_computed_text_transform(style);
1662 case CSS_TEXT_TRANSFORM_CAPITALIZE:
1663 fprintf(stream,
"text-transform: capitalize ");
1665 case CSS_TEXT_TRANSFORM_UPPERCASE:
1666 fprintf(stream,
"text-transform: uppercase ");
1668 case CSS_TEXT_TRANSFORM_LOWERCASE:
1669 fprintf(stream,
"text-transform: lowercase ");
1671 case CSS_TEXT_TRANSFORM_NONE:
1672 fprintf(stream,
"text-transform: none ");
1679 val = css_computed_top(style, &len1, &unit1);
1682 fprintf(stream,
"top: auto ");
1685 fprintf(stream,
"top: ");
1689 fprintf(stream,
" ");
1696 val = css_computed_unicode_bidi(style);
1698 case CSS_UNICODE_BIDI_NORMAL:
1699 fprintf(stream,
"unicode-bidi: normal ");
1701 case CSS_UNICODE_BIDI_EMBED:
1702 fprintf(stream,
"unicode-bidi: embed ");
1704 case CSS_UNICODE_BIDI_BIDI_OVERRIDE:
1705 fprintf(stream,
"unicode-bidi: bidi-override ");
1712 val = css_computed_vertical_align(style, &len1, &unit1);
1714 case CSS_VERTICAL_ALIGN_BASELINE:
1715 fprintf(stream,
"vertical-align: baseline ");
1717 case CSS_VERTICAL_ALIGN_SUB:
1718 fprintf(stream,
"vertical-align: sub ");
1720 case CSS_VERTICAL_ALIGN_SUPER:
1721 fprintf(stream,
"vertical-align: super ");
1723 case CSS_VERTICAL_ALIGN_TOP:
1724 fprintf(stream,
"vertical-align: top ");
1726 case CSS_VERTICAL_ALIGN_TEXT_TOP:
1727 fprintf(stream,
"vertical-align: text-top ");
1729 case CSS_VERTICAL_ALIGN_MIDDLE:
1730 fprintf(stream,
"vertical-align: middle ");
1732 case CSS_VERTICAL_ALIGN_BOTTOM:
1733 fprintf(stream,
"vertical-align: bottom ");
1735 case CSS_VERTICAL_ALIGN_TEXT_BOTTOM:
1736 fprintf(stream,
"vertical-align: text-bottom ");
1738 case CSS_VERTICAL_ALIGN_SET:
1739 fprintf(stream,
"vertical-align: ");
1743 fprintf(stream,
" ");
1750 val = css_computed_visibility(style);
1752 case CSS_VISIBILITY_VISIBLE:
1753 fprintf(stream,
"visibility: visible ");
1755 case CSS_VISIBILITY_HIDDEN:
1756 fprintf(stream,
"visibility: hidden ");
1758 case CSS_VISIBILITY_COLLAPSE:
1759 fprintf(stream,
"visibility: collapse ");
1766 val = css_computed_white_space(style);
1768 case CSS_WHITE_SPACE_NORMAL:
1769 fprintf(stream,
"white-space: normal ");
1771 case CSS_WHITE_SPACE_PRE:
1772 fprintf(stream,
"white-space: pre ");
1774 case CSS_WHITE_SPACE_NOWRAP:
1775 fprintf(stream,
"white-space: nowrap ");
1777 case CSS_WHITE_SPACE_PRE_WRAP:
1778 fprintf(stream,
"white-space: pre-wrap ");
1780 case CSS_WHITE_SPACE_PRE_LINE:
1781 fprintf(stream,
"white-space: pre-line ");
1788 val = css_computed_width(style, &len1, &unit1);
1790 case CSS_WIDTH_AUTO:
1791 fprintf(stream,
"width: auto ");
1794 fprintf(stream,
"width: ");
1798 fprintf(stream,
" ");
1805 val = css_computed_word_spacing(style, &len1, &unit1);
1807 case CSS_WORD_SPACING_NORMAL:
1808 fprintf(stream,
"word-spacing: normal ");
1810 case CSS_WORD_SPACING_SET:
1811 fprintf(stream,
"word-spacing: ");
1815 fprintf(stream,
" ");
1822 val = css_computed_z_index(style, &zindex);
1824 case CSS_Z_INDEX_AUTO:
1825 fprintf(stream,
"z-index: auto ");
1827 case CSS_Z_INDEX_SET:
1828 fprintf(stream,
"z-index: %"PRId32
" ", zindex);
1834 fprintf(stream,
"}");
static uint8_t ns_computed_min_height(const css_computed_style *style, css_fixed *length, css_unit *unit)
static uint8_t ns_computed_min_width(const css_computed_style *style, css_fixed *length, css_unit *unit)
static uint8_t ns_computed_display_static(const css_computed_style *style)
Temporary helper wrappers for for libcss computed style getter, while we don't support all values of ...
static void dump_css_fixed(FILE *stream, css_fixed f)
Dump a fixed point value to the stream in a textual form.
static void dump_css_unit(FILE *stream, css_fixed val, css_unit unit)
Dump a dimension to the stream in a textual form.
static void dump_css_number(FILE *stream, css_fixed val)
Dump a numeric value to the stream in a textual form.
void nscss_dump_computed_style(FILE *stream, const css_computed_style *style)
Dump a computed style style to the give file handle stream.
Netsurf additional integer type formatting macros.
Content which corresponds to a single URL.