summaryrefslogtreecommitdiffstats
path: root/layout/style/test/test_non_content_accessible_values.html
blob: 633427f8e12f91254530d469fedfdd693e20b578 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="sheet"></style>
<div></div>
<script>
const NON_CONTENT_ACCESSIBLE_VALUES = {
  "color": [
    "-moz-buttonactivetext",
    "-moz-buttonactiveface",
    "-moz-buttondisabledface",
    "-moz-disabledfield",
    "-moz-colheaderhovertext",
    "-moz-colheadertext",
    "-moz-nativevisitedhyperlinktext",
    "text-select-disabled-background",
    "text-select-attention-background",
    "text-select-attention-foreground",
    "-moz-autofill-background",
  ],
  "display": [
    "-moz-box",
    "-moz-inline-box",
  ],
  "font": [
      "-moz-pull-down-menu",
      "-moz-button",
      "-moz-list",
      "-moz-field",
  ],
  "-moz-appearance": [
    "button-arrow-down",
    "button-arrow-next",
    "button-arrow-previous",
    "button-arrow-up",
    "button-focus",
    "dualbutton",
    "groupbox",
    "menubar",
    "menuitem",
    "checkmenuitem",
    "radiomenuitem",
    "menuitemtext",
    "menupopup",
    "menucheckbox",
    "menuradio",
    "menuseparator",
    "menuimage",
    "-moz-menulist-arrow-button",
    "checkbox-container",
    "radio-container",
    "checkbox-label",
    "radio-label",
    "resizerpanel",
    "resizer",
    "scrollbar",
    "scrollbar-small",
    "scrollbar-horizontal",
    "scrollbar-vertical",
    "scrollbarbutton-up",
    "scrollbarbutton-down",
    "scrollbarbutton-left",
    "scrollbarbutton-right",
    "scrollcorner",
    "separator",
    "spinner",
    "spinner-upbutton",
    "spinner-downbutton",
    "spinner-textfield",
    "splitter",
    "statusbar",
    "statusbarpanel",
    "tab",
    "tabpanel",
    "tabpanels",
    "tab-scroll-arrow-back",
    "tab-scroll-arrow-forward",
    "toolbar",
    "toolbarbutton",
    "toolbarbutton-dropdown",
    "toolbargripper",
    "toolbox",
    "tooltip",
    "treeheader",
    "treeheadercell",
    "treeheadersortarrow",
    "treeitem",
    "treeline",
    "treetwisty",
    "treetwistyopen",
    "treeview",
    "window",
    "dialog",
    "-moz-win-communications-toolbox",
    "-moz-win-media-toolbox",
    "-moz-win-browsertabbar-toolbox",
    "-moz-win-borderless-glass",
    "-moz-win-exclude-glass",
    "-moz-mac-help-button",
    "-moz-window-button-box",
    "-moz-window-button-box-maximized",
    "-moz-window-button-close",
    "-moz-window-button-maximize",
    "-moz-window-button-minimize",
    "-moz-window-button-restore",
    "-moz-window-titlebar",
    "-moz-window-titlebar-maximized",
    "-moz-mac-active-source-list-selection",
    "-moz-mac-disclosure-button-closed",
    "-moz-mac-disclosure-button-open",
    "-moz-mac-source-list",
    "-moz-mac-source-list-selection",

    "button-bevel",
    "caret",
    "listitem",
    "menulist-textfield",
    "menulist-text",
  ],
  "user-select": [
    "-moz-text",
  ],
  "line-height": [
    "-moz-block-height",
  ],
  "text-align": [
    "-moz-center-or-inherit",
  ],
};

const sheet = document.getElementById("sheet");
const div = document.querySelector("div");

test(function() {
  sheet.textContent = `div { color: initial }`;
  assert_equals(sheet.sheet.cssRules[0].style.length, 1);
}, "sanity");

for (const prop in NON_CONTENT_ACCESSIBLE_VALUES) {
  const values = NON_CONTENT_ACCESSIBLE_VALUES[prop];
  test(function() {
    for (const value of values) {
      sheet.textContent = `div { ${prop}: ${value} }`;
      const block = sheet.sheet.cssRules[0].style;
      assert_equals(
        block.length,
        0,
        `${prop}: ${value} should not be parsed in content`
      );
      block.setProperty(prop, value);
      assert_equals(
        block.length,
        0,
        `${prop}: ${value} should not be settable via CSSOM in content`
      );
      div.style.setProperty(prop, value);
      assert_equals(
        div.style.length,
        0,
        `${prop}: ${value} should not be settable via CSSOM in content (inline style)`
      );
      assert_not_equals(
        getComputedStyle(div).getPropertyValue(prop),
        value,
        `${prop}: ${value} should not be settable via CSSOM in content (gcs)`
      );

      assert_false(CSS.supports(prop, value), `${prop}: ${value} should not claim to be supported`)
    }
  }, prop + " non-accessible values: " + values.join(", "))
}
</script>