Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / images / element-gcd-while-generating-alt-content.html
blob337549fe67c3dcc283de7bffd2318600f87030ed
1 <!-- crbug.com/440834: Protect an image's element while generating its alt content as it can get gc'd when the asynchronous image load fails asyncrhonously. -->
2 <style dir="rtl" title="a AxBxC">
3 *{text-rendering:geometricPrecision;text-transform:uppercase;}
4 visibility:visible;min-width:intrinsic;</style>
5 <body>
6 <table dir="ltr">
7 <caption title="b">
8 <abbr>
9 <ruby>
10 <rbc title="AA">
11 </rbc>
12 <rt>
13 </ruby>
14 </abbr>
15 </caption>
16 <colgroup xml:space="preserve" charoff="1mm">
17 <th rowspan="1">
19 <td char="a" charoff="100">
20 </td>
21 <td dir="rtl">
23 <th xml:lang="nl" charoff="1px">
24 <th valign="middle">
25 <img alt="AxBxC" width="1cm"/>
26 <textarea>
27 </textarea>
28 </th>
29 </tr>
30 </table>
31 <div title="a A" xml:space="preserve">
32 <select tabindex="-1" size="1">
33 <optgroup label="AxBxC" dir="ltr" xml:space="preserve">
34 <option value="AxBxC" selected="selected">
35 </option>
36 </optgroup>
37 <option dir="rtl">
38 AxBxC c
39 </option>
40 <option label="x" title="AxBxC AxBxC">
41 </option>
42 <optgroup label="A" xml:space="preserve">
43 <option value="AxBxC"</optgroup>
44 <option title="AxBxC AxBxC" label="c a">
45 C a
46 </option>
47 <optgroup label="AxBxC AxBxC" dir="ltr">
48 </optgroup>
49 </select>
50 <ruby dir="rtl" xml:space="preserve">
51 <rb title="A" dir="ltr">
52 <rt xml:space="preserve" dir="rtl">
53 </rt>
54 <rtc dir="ltr">
55 <svg>
56 <foreignObject>
57 <script>
58 if (window.testRunner) {
59 testRunner.waitUntilDone();
60 testRunner.dumpAsText();
62 var aoScriptElements = document.getElementsByTagName("script");
63 for(var i = 0; i < aoScriptElements.length; i++) {
64 aoScriptElements[i].parentNode.removeChild(aoScriptElements[i]);
66 var event_handler_inserted_active = false;
68 function cloneRandomElement(num) {
69 var aoElements = document.getElementsByTagName("*");
70 return aoElements[num % aoElements.length].cloneNode(true);
73 function getRandomElement(num) {
74 var aoElements = document.getElementsByTagName("*");
75 return aoElements[num % aoElements.length];
78 function event_handler_inserted() {
79 if (event_handler_inserted_active) return ;
80 event_handler_inserted_active = true;
81 var oElement = event.srcElement;
82 document.execCommand('SelectAll',false,false);
83 var oSelection=window.getSelection();
84 var oRange = oSelection.rangeCount ? oSelection.getRangeAt(84 % oSelection.rangeCount) : null;
85 if (oRange) {
86 var oInsertedElement = getRandomElement(60);
87 if (oInsertedElement) {
88 try{oRange.insertNode(oInsertedElement)}
89 catch(e){}
92 if (oElement.parentNode) {
93 var oNewElement = document.createElementNS('http://www.w3.org/2000/svg', 'feMergeNode');
94 oElement.parentNode.replaceChild(cloneRandomElement(66), oElement);
96 oSelection.collapseToStart();
97 oSelection.modify('extend', 'forward', 'character');
98 var oRange = oSelection.rangeCount ? oSelection.getRangeAt(95 % oSelection.rangeCount) : null;
99 if (oRange) {
100 var oParentElement = getRandomElement(37);
101 if (oParentElement) {
102 try{oRange.surroundContents(oParentElement)}
103 catch(e){}
106 if (oRange) {
107 var oInsertedElement = getRandomElement(61);
108 if (oInsertedElement) {
109 try{oRange.insertNode(oInsertedElement)}
110 catch(e){}
113 event_handler_inserted_active = false;
115 document.addEventListener("DOMNodeInsertedIntoDocument", event_handler_inserted, true);
116 document.addEventListener("load", true);
117 var event_handler_modified_active = false;
118 var event_handler_modified_fired_count = 0;
119 function event_handler_modified() {
120 if (event_handler_modified_active) return ;
121 event_handler_modified_active = true;
122 var oElement = event.srcElement;
123 if (oElement.parentNode) {
124 var oNewElement = document.createElementNS('http://www.w3.org/2000/svg', 'font-face');
125 if (oNewElement) {
126 try{oElement.parentNode.replaceChild(cloneRandomElement(1), oElement)}
127 catch(e){}
130 oElement.contentEditable = true;
131 var oSelection=window.getSelection();
132 var oRange = oSelection.rangeCount ? oSelection.getRangeAt(39 % oSelection.rangeCount) : null;
133 oSelection.modify('move', 'forward', 'line');
134 var oInsertedElement = getRandomElement(84);
135 oRange.insertNode(oInsertedElement);
136 if (!oSelection.rangeCount) {
137 document.execCommand("SelectAll", false)
139 var oRange = oSelection.rangeCount ? oSelection.getRangeAt(53 % oSelection.rangeCount) : null;
140 var oParentElement = getRandomElement(18);
141 if (oParentElement) {
142 try{oRange.surroundContents(oParentElement)}
143 catch(e){}
145 event_handler_modified_active = false;
147 document.addEventListener("DOMCharacterDataModified", event_handler_modified, true);
148 window.onload=function(){
149 var oElement = document.createElementNS('http://www.w3.org/2000/svg', 'feConvolveMatrix');
150 var oSelection=window.getSelection();
151 document.execCommand("SelectAll", false)
152 var oRange = oSelection.rangeCount ? oSelection.getRangeAt(4 % oSelection.rangeCount) : null;
153 var oElement = getRandomElement(80);
154 oElement.appendChild(document.createElementNS('http://www.w3.org/2000/svg', 'animateColor'));
155 oElement.outerHTML = "";
156 var oElement = getRandomElement(100);
157 oElement = document.adoptNode(oElement);
158 var oElement = getRandomElement(81);
159 oElement.textContent = '))))))V]]]~/GU}k-FFFFFFFFF??????';
160 var oElement = getRandomElement(71);
161 oElement.innerHTML = '<hgroup></hgroup><bdi>';
162 oElement.outerHTML = "";
163 oElement.insertAdjacentElement('beforeend', document.createElementNS('http://www.w3.org/2000/svg', 'tspan'));
164 if (window.testRunner) {
165 testRunner.notifyDone();
168 </script>
169 </svg>
170 </rt>
171 </div>
172 <h1>
173 <input type="image">
174 <select>
175 <optgroup>
176 <option>
178 </optgroup>
179 <option>
181 <option>
183 <optgroup>
184 <option>
185 a AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
186 </option>
187 </select>
188 <br>