1 /**
2 * Phoebe DOM Implementation.
3 *
4 * This is a C++ approximation of the W3C DOM model, which follows
5 * fairly closely the specifications in the various .idl files, copies of
6 * which are provided for reference. Most important is this one:
7 *
8 * http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/idl-definitions.html
9 *
10 * Authors:
11 * Bob Jamison
12 *
13 * Copyright (C) 2005 Bob Jamison
14 *
15 * This library is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU Lesser General Public
17 * License as published by the Free Software Foundation; either
18 * version 2.1 of the License, or (at your option) any later version.
19 *
20 * This library is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23 * Lesser General Public License for more details.
24 *
25 * You should have received a copy of the GNU Lesser General Public
26 * License along with this library; if not, write to the Free Software
27 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28 */
29 #include <stdio.h>
32 struct CssProp_def
33 {
34 const char *name;
35 const char *values;
36 const char *defaultValue;
37 const char *appliesTo;
38 bool inherited;
39 const char *percentages;
40 const char *mediaGroups;
41 };
43 typedef struct CssProp_def CssProp;
45 static CssProp cssProps[] =
46 {
48 {
49 "azimuth",
50 "<angle> | [[ left-side | far-left | left | center-left | center | center-right | right | far-right | right-side ] || behind ] | leftwards | rightwards | inherit",
51 "center",
52 "",
53 true,
54 "",
55 "aural"
56 },
59 {
60 "background-attachment",
61 "scroll | fixed | inherit",
62 "scroll",
63 "",
64 false,
65 "",
66 "visual"
67 },
70 {
71 "background-color",
72 "<color> | transparent | inherit",
73 "transparent",
74 "",
75 false,
76 "",
77 "visual"
78 },
81 {
82 "background-image",
83 "<uri> | none | inherit",
84 "none",
85 "",
86 false,
87 "",
88 "visual"
89 },
92 {
93 "background-position",
94 "[ [ <percentage> | <length> | left | center | right ] [ <percentage> | <length> | top | center | bottom ]? ] | [ [ left | center | right ] || [ top | center | bottom ] ] | inherit",
95 "0% 0%",
96 "",
97 false,
98 "refer to the size of the box itself",
99 "visual"
100 },
103 {
104 "background-repeat",
105 "repeat | repeat-x | repeat-y | no-repeat | inherit",
106 "repeat",
107 "",
108 false,
109 "",
110 "visual"
111 },
114 {
115 "background",
116 "['background-color' || 'background-image' || 'background-repeat' || 'background-attachment' || 'background-position'] | inherit",
117 "see individual properties",
118 "",
119 false,
120 "allowed on 'background-position",
121 "visual"
122 },
125 {
126 "border-collapse",
127 "collapse | separate | inherit",
128 "separate",
129 "table' and 'inline-table' elements",
130 true,
131 "",
132 "visual"
133 },
136 {
137 "border-color",
138 "[ <color> | transparent ]{1,4} | inherit",
139 "see individual properties",
140 "",
141 false,
142 "",
143 "visual"
144 },
147 {
148 "border-spacing",
149 "<length> <length>? | inherit",
150 "0",
151 "table' and 'inline-table' elements",
152 true,
153 "",
154 "visual"
155 },
158 {
159 "border-style",
160 "<border-style>{1,4} | inherit",
161 "see individual properties",
162 "",
163 false,
164 "",
165 "visual"
166 },
169 {
170 "border-top' 'border-right' 'border-bottom' 'border-left",
171 "[ <border-width> || <border-style> || 'border-top-color' ] | inherit",
172 "see individual properties",
173 "",
174 false,
175 "",
176 "visual"
177 },
180 {
181 "border-top-color' 'border-right-color' 'border-bottom-color' 'border-left-color",
182 "<color> | transparent | inherit",
183 "the value of the 'color' property",
184 "",
185 false,
186 "",
187 "visual"
188 },
191 {
192 "border-top-style' 'border-right-style' 'border-bottom-style' 'border-left-style",
193 "<border-style> | inherit",
194 "none",
195 "",
196 false,
197 "",
198 "visual"
199 },
202 {
203 "border-top-width' 'border-right-width' 'border-bottom-width' 'border-left-width",
204 "<border-width> | inherit",
205 "medium",
206 "",
207 false,
208 "",
209 "visual"
210 },
213 {
214 "border-width",
215 "<border-width>{1,4} | inherit",
216 "see individual properties",
217 "",
218 false,
219 "",
220 "visual"
221 },
224 {
225 "border",
226 "[ <border-width> || <border-style> || 'border-top-color' ] | inherit",
227 "see individual properties",
228 "",
229 false,
230 "",
231 "visual"
232 },
235 {
236 "bottom",
237 "<length> | <percentage> | auto | inherit",
238 "auto",
239 "positioned elements",
240 false,
241 "refer to height of containing block",
242 "visual"
243 },
246 {
247 "caption-side",
248 "top | bottom | inherit",
249 "top",
250 "table-caption' elements",
251 true,
252 "",
253 "visual"
254 },
257 {
258 "clear",
259 "none | left | right | both | inherit",
260 "none",
261 "block-level elements",
262 false,
263 "",
264 "visual"
265 },
268 {
269 "clip",
270 "<shape> | auto | inherit",
271 "auto",
272 "absolutely positioned elements",
273 false,
274 "",
275 "visual"
276 },
279 {
280 "color",
281 "<color> | inherit",
282 "depends on user agent",
283 "",
284 true,
285 "",
286 "visual"
287 },
290 {
291 "content",
292 "normal | [ <string> | <uri> | <counter> | attr(<identifier>) | open-quote | close-quote | no-open-quote | no-close-quote ]+ | inherit",
293 "normal",
294 ":before and :after pseudo-elements",
295 false,
296 "",
297 "all "
298 },
301 {
302 "counter-increment",
303 "[ <identifier> <integer>? ]+ | none | inherit",
304 "none",
305 "",
306 false,
307 "",
308 "all "
309 },
312 {
313 "counter-reset",
314 "[ <identifier> <integer>? ]+ | none | inherit",
315 "none",
316 "",
317 false,
318 "",
319 "all "
320 },
323 {
324 "cue-after",
325 "<uri> | none | inherit",
326 "none",
327 "",
328 false,
329 "",
330 "aural"
331 },
334 {
335 "cue-before",
336 "<uri> | none | inherit",
337 "none",
338 "",
339 false,
340 "",
341 "aural"
342 },
345 {
346 "cue",
347 "[ 'cue-before' || 'cue-after' ] | inherit",
348 "see individual properties",
349 "",
350 false,
351 "",
352 "aural"
353 },
356 {
357 "cursor",
358 "[ [<uri> ,]* [ auto | crosshair | default | pointer | move | e-resize | ne-resize | nw-resize | n-resize | se-resize | sw-resize | s-resize | w-resize | text | wait | help | progress ] ] | inherit",
359 "auto",
360 "",
361 true,
362 "",
363 "visual, interactive "
364 },
367 {
368 "direction",
369 "ltr | rtl | inherit",
370 "ltr",
371 "all elements, but see prose",
372 true,
373 "",
374 "visual"
375 },
378 {
379 "display",
380 "inline | block | list-item | run-in | inline-block | table | inline-table | table-row-group | table-header-group | table-footer-group | table-row | table-column-group | table-column | table-cell | table-caption | none | inherit",
381 "inline",
382 "",
383 false,
384 "",
385 "all "
386 },
389 {
390 "elevation",
391 "<angle> | below | level | above | higher | lower | inherit",
392 "level",
393 "",
394 true,
395 "",
396 "aural"
397 },
400 {
401 "empty-cells",
402 "show | hide | inherit",
403 "show",
404 "table-cell' elements",
405 true,
406 "",
407 "visual"
408 },
411 {
412 "float",
413 "left | right | none | inherit",
414 "none",
415 "all, but see 9.7",
416 false,
417 "",
418 "visual"
419 },
422 {
423 "font-family",
424 "[[ <family-name> | <generic-family> ] [, <family-name>| <generic-family>]* ] | inherit",
425 "depends on user agent",
426 "",
427 true,
428 "",
429 "visual"
430 },
433 {
434 "font-size",
435 "<absolute-size> | <relative-size> | <length> | <percentage> | inherit",
436 "medium",
437 "",
438 true,
439 "refer to parent element's font size",
440 "visual"
441 },
444 {
445 "font-style",
446 "normal | italic | oblique | inherit",
447 "normal",
448 "",
449 true,
450 "",
451 "visual"
452 },
455 {
456 "font-variant",
457 "normal | small-caps | inherit",
458 "normal",
459 "",
460 true,
461 "",
462 "visual"
463 },
466 {
467 "font-weight",
468 "normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit",
469 "normal",
470 "",
471 true,
472 "",
473 "visual"
474 },
477 {
478 "font",
479 "[ [ 'font-style' || 'font-variant' || 'font-weight' ]? 'font-size' [ / 'line-height' ]? 'font-family' ] | caption | icon | menu | message-box | small-caption | status-bar | inherit",
480 "see individual properties",
481 "",
482 true,
483 "see individual properties",
484 "visual"
485 },
488 {
489 "height",
490 "<length> | <percentage> | auto | inherit",
491 "auto",
492 "all elements but non-replaced inline elements, table columns, and column groups",
493 false,
494 "see prose",
495 "visual"
496 },
499 {
500 "left",
501 "<length> | <percentage> | auto | inherit",
502 "auto",
503 "positioned elements",
504 false,
505 "refer to width of containing block",
506 "visual"
507 },
510 {
511 "letter-spacing",
512 "normal | <length> | inherit",
513 "normal",
514 "",
515 true,
516 "",
517 "visual"
518 },
521 {
522 "line-height",
523 "normal | <number> | <length> | <percentage> | inherit",
524 "normal",
525 "",
526 true,
527 "refer to the font size of the element itself",
528 "visual"
529 },
532 {
533 "list-style-image",
534 "<uri> | none | inherit",
535 "none",
536 "elements with 'display: list-item",
537 true,
538 "",
539 "visual"
540 },
543 {
544 "list-style-position",
545 "inside | outside | inherit",
546 "outside",
547 "elements with 'display: list-item",
548 true,
549 "",
550 "visual"
551 },
554 {
555 "list-style-type",
556 "disc | circle | square | decimal | decimal-leading-zero | lower-roman | upper-roman | lower-greek | lower-latin | upper-latin | armenian | georgian | none | inherit",
557 "disc",
558 "elements with 'display: list-item",
559 true,
560 "",
561 "visual"
562 },
565 {
566 "list-style",
567 "[ 'list-style-type' || 'list-style-position' || 'list-style-image' ] | inherit",
568 "see individual properties",
569 "elements with 'display: list-item",
570 true,
571 "",
572 "visual"
573 },
576 {
577 "margin-right' 'margin-left",
578 "<margin-width> | inherit",
579 "0",
580 "all elements except elements with table display types other than table and inline-table",
581 false,
582 "refer to width of containing block",
583 "visual"
584 },
587 {
588 "margin-top' 'margin-bottom",
589 "<margin-width> | inherit",
590 "0",
591 "all elements except elements with table display types other than table and inline-table",
592 false,
593 "refer to width of containing block",
594 "visual"
595 },
598 {
599 "margin",
600 "<margin-width>{1,4} | inherit",
601 "see individual properties",
602 "all elements except elements with table display types other than table and inline-table",
603 false,
604 "refer to width of containing block",
605 "visual"
606 },
609 {
610 "max-height",
611 "<length> | <percentage> | none | inherit",
612 "none",
613 "all elements except non-replaced inline elements and table elements",
614 false,
615 "see prose",
616 "visual"
617 },
620 {
621 "max-width",
622 "<length> | <percentage> | none | inherit",
623 "none",
624 "all elements except non-replaced inline elements and table elements",
625 false,
626 "refer to width of containing block",
627 "visual"
628 },
631 {
632 "min-height",
633 "<length> | <percentage> | inherit",
634 "0",
635 "all elements except non-replaced inline elements and table elements",
636 false,
637 "see prose",
638 "visual"
639 },
642 {
643 "min-width",
644 "<length> | <percentage> | inherit",
645 "0",
646 "all elements except non-replaced inline elements and table elements",
647 false,
648 "refer to width of containing block",
649 "visual"
650 },
653 {
654 "orphans",
655 "<integer> | inherit",
656 "2",
657 "block-level elements",
658 true,
659 "",
660 "visual, paged "
661 },
664 {
665 "outline-color",
666 "<color> | invert | inherit",
667 "invert",
668 "",
669 false,
670 "",
671 "visual, interactive "
672 },
675 {
676 "outline-style",
677 "<border-style> | inherit",
678 "none",
679 "",
680 false,
681 "",
682 "visual, interactive "
683 },
686 {
687 "outline-width",
688 "<border-width> | inherit",
689 "medium",
690 "",
691 false,
692 "",
693 "visual, interactive "
694 },
697 {
698 "outline",
699 "[ 'outline-color' || 'outline-style' || 'outline-width' ] | inherit",
700 "see individual properties",
701 "",
702 false,
703 "",
704 "visual, interactive "
705 },
708 {
709 "overflow",
710 "visible | hidden | scroll | auto | inherit",
711 "visible",
712 "block-level and replaced elements, table cells, inline blocks",
713 false,
714 "",
715 "visual"
716 },
719 {
720 "padding-top' 'padding-right' 'padding-bottom' 'padding-left",
721 "<padding-width> | inherit",
722 "0",
723 "all elements except elements with table display types other than table, inline-table, and table-cell",
724 false,
725 "refer to width of containing block",
726 "visual"
727 },
730 {
731 "padding",
732 "<padding-width>{1,4} | inherit",
733 "see individual properties",
734 "all elements except elements with table display types other than table, inline-table, and table-cell",
735 false,
736 "refer to width of containing block",
737 "visual"
738 },
741 {
742 "page-break-after",
743 "auto | always | avoid | left | right | inherit",
744 "auto",
745 "block-level elements",
746 false,
747 "",
748 "visual, paged "
749 },
752 {
753 "page-break-before",
754 "auto | always | avoid | left | right | inherit",
755 "auto",
756 "block-level elements",
757 false,
758 "",
759 "visual, paged "
760 },
763 {
764 "page-break-inside",
765 "avoid | auto | inherit",
766 "auto",
767 "block-level elements",
768 true,
769 "",
770 "visual, paged "
771 },
774 {
775 "pause-after",
776 "<time> | <percentage> | inherit",
777 "0",
778 "",
779 false,
780 "see prose",
781 "aural"
782 },
785 {
786 "pause-before",
787 "<time> | <percentage> | inherit",
788 "0",
789 "",
790 false,
791 "see prose",
792 "aural"
793 },
796 {
797 "pause",
798 "[ [<time> | <percentage>]{1,2} ] | inherit",
799 "see individual properties",
800 "",
801 false,
802 "see descriptions of 'pause-before' and 'pause-after",
803 "aural"
804 },
807 {
808 "pitch-range",
809 "<number> | inherit",
810 "50",
811 "",
812 true,
813 "",
814 "aural"
815 },
818 {
819 "pitch",
820 "<frequency> | x-low | low | medium | high | x-high | inherit",
821 "medium",
822 "",
823 true,
824 "",
825 "aural"
826 },
829 {
830 "play-during",
831 "<uri> [ mix || repeat ]? | auto | none | inherit",
832 "auto",
833 "",
834 false,
835 "",
836 "aural"
837 },
840 {
841 "position",
842 "static | relative | absolute | fixed | inherit",
843 "static",
844 "",
845 false,
846 "",
847 "visual"
848 },
851 {
852 "quotes",
853 "[<string> <string>]+ | none | inherit",
854 "depends on user agent",
855 "",
856 true,
857 "",
858 "visual"
859 },
862 {
863 "richness",
864 "<number> | inherit",
865 "50",
866 "",
867 true,
868 "",
869 "aural"
870 },
873 {
874 "right",
875 "<length> | <percentage> | auto | inherit",
876 "auto",
877 "positioned elements",
878 false,
879 "refer to width of containing block",
880 "visual"
881 },
884 {
885 "speak-header",
886 "once | always | inherit",
887 "once",
888 "elements that have table header information",
889 true,
890 "",
891 "aural"
892 },
895 {
896 "speak-numeral",
897 "digits | continuous | inherit",
898 "continuous",
899 "",
900 true,
901 "",
902 "aural"
903 },
906 {
907 "speak-punctuation",
908 "code | none | inherit",
909 "none",
910 "",
911 true,
912 "",
913 "aural"
914 },
917 {
918 "speak",
919 "normal | none | spell-out | inherit",
920 "normal",
921 "",
922 true,
923 "",
924 "aural"
925 },
928 {
929 "speech-rate",
930 "<number> | x-slow | slow | medium | fast | x-fast | faster | slower | inherit",
931 "medium",
932 "",
933 true,
934 "",
935 "aural"
936 },
939 {
940 "stress",
941 "<number> | inherit",
942 "50",
943 "",
944 true,
945 "",
946 "aural"
947 },
950 {
951 "table-layout",
952 "auto | fixed | inherit",
953 "auto",
954 "table' and 'inline-table' elements",
955 false,
956 "",
957 "visual"
958 },
961 {
962 "text-align",
963 "left | right | center | justify | inherit",
964 "left' if 'direction' is 'ltr'; 'right' if 'direction' is 'rtl",
965 "block-level elements, table cells and inline blocks",
966 true,
967 "",
968 "visual"
969 },
972 {
973 "text-decoration",
974 "none | [ underline || overline || line-through || blink ] | inherit",
975 "none",
976 "",
977 "no (see prose)",
978 "",
979 "visual"
980 },
983 {
984 "text-indent",
985 "<length> | <percentage> | inherit",
986 "0",
987 "block-level elements, table cells and inline blocks",
988 true,
989 "refer to width of containing block",
990 "visual"
991 },
994 {
995 "text-transform",
996 "capitalize | uppercase | lowercase | none | inherit",
997 "none",
998 "",
999 true,
1000 "",
1001 "visual"
1002 },
1005 {
1006 "top",
1007 "<length> | <percentage> | auto | inherit",
1008 "auto",
1009 "positioned elements",
1010 false,
1011 "refer to height of containing block",
1012 "visual"
1013 },
1016 {
1017 "unicode-bidi",
1018 "normal | embed | bidi-override | inherit",
1019 "normal",
1020 "all elements, but see prose",
1021 false,
1022 "",
1023 "visual"
1024 },
1027 {
1028 "vertical-align",
1029 "baseline | sub | super | top | text-top | middle | bottom | text-bottom | <percentage> | <length> | inherit",
1030 "baseline",
1031 "inline-level and 'table-cell' elements",
1032 false,
1033 "refer to the 'line-height' of the element itself",
1034 "visual"
1035 },
1038 {
1039 "visibility",
1040 "visible | hidden | collapse | inherit",
1041 "visible",
1042 "",
1043 true,
1044 "",
1045 "visual"
1046 },
1049 {
1050 "voice-family",
1051 "[[<specific-voice> | <generic-voice> ],]* [<specific-voice> | <generic-voice> ] | inherit",
1052 "depends on user agent",
1053 "",
1054 true,
1055 "",
1056 "aural"
1057 },
1060 {
1061 "volume",
1062 "<number> | <percentage> | silent | x-soft | soft | medium | loud | x-loud | inherit",
1063 "medium",
1064 "",
1065 true,
1066 "refer to inherited value",
1067 "aural"
1068 },
1071 {
1072 "white-space",
1073 "normal | pre | nowrap | pre-wrap | pre-line | inherit",
1074 "normal",
1075 "",
1076 true,
1077 "",
1078 "visual"
1079 },
1082 {
1083 "widows",
1084 "<integer> | inherit",
1085 "2",
1086 "block-level elements",
1087 true,
1088 "",
1089 "visual, paged"
1090 },
1093 {
1094 "width",
1095 "<length> | <percentage> | auto | inherit",
1096 "auto",
1097 "all elements but non-replaced inline elements, table rows, and row groups",
1098 false,
1099 "refer to width of containing block",
1100 "visual"
1101 },
1104 {
1105 "word-spacing",
1106 "normal | <length> | inherit",
1107 "normal",
1108 "",
1109 true,
1110 "",
1111 "visual"
1112 },
1115 {
1116 "z-index",
1117 "auto | <integer> | inherit",
1118 "auto",
1119 "positioned elements",
1120 false,
1121 "",
1122 "visual"
1123 },
1125 {
1126 NULL,
1127 NULL,
1128 NULL,
1129 NULL,
1130 false,
1131 NULL,
1132 NULL
1133 }
1135 };
1140 bool printTable()
1141 {
1142 for (CssProp *prop=cssProps; prop->name ; prop++)
1143 {
1144 printf("#### Prop: %s ####\n", prop->name);
1145 printf("values : %s\n", prop->values);
1146 printf("defaultValue: %s\n", prop->defaultValue);
1147 printf("appliesTo : %s\n", prop->appliesTo);
1148 printf("inherited : %s\n", ( prop->inherited ? "true" : "false" ));
1149 printf("percentages : %s\n", prop->percentages);
1150 printf("groups : %s\n", prop->mediaGroups);
1151 printf("\n");
1152 }
1153 return true;
1154 }
1157 int main(int /*argc*/, char **/*argv*/)
1158 {
1159 printTable();
1160 return 0;
1161 }