Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
| 2 <script src="../resources/js-test.js"></script> | 2 <script src="../resources/testharness.js"></script> |
| 3 <script src="../resources/testharnessreport.js"></script> | |
| 3 <iframe id="i" frameborder="0" style="margin-top: 10px"></iframe> | 4 <iframe id="i" frameborder="0" style="margin-top: 10px"></iframe> |
| 4 <div id="content" style="display: none"> | 5 <div id="content" style="display: none"> |
| 5 <div id="block1" style='background-color: #ccc'>100% width</div><br> | 6 <div id="block1" style='background-color: #ccc'>100% width</div><br> |
| 6 <div style='background-color: #ddf; width: 400px; height: 300px'></div> | 7 <div style='background-color: #ddf; width: 400px; height: 300px'></div> |
| 7 </div> | 8 </div> |
| 8 <script> | 9 <script> |
| 10 test(function(){ | |
|
Srirama
2016/08/10 11:04:39
nit: space between () and {.
MuVen
2016/08/10 11:40:59
Done.
| |
| 11 var idoc = document.querySelector("#i").contentDocument; | |
|
Srirama
2016/08/10 11:04:39
you can remove id from iframe element and directly
Srirama
2016/08/10 11:04:39
s/idoc/iframeDocument for better readability.
MuVen
2016/08/10 11:40:59
Done.
MuVen
2016/08/10 11:40:59
Done.
| |
| 12 var sheet = idoc.head.appendChild(idoc.createElement("style")).sheet; | |
| 13 idoc.body.style.margin = '0'; | |
|
Srirama
2016/08/10 11:04:39
nit: use double quotes to be consistent within the
MuVen
2016/08/10 11:40:59
Done.
| |
| 14 idoc.body.innerHTML = document.querySelector('#content').innerHTML; | |
|
Srirama
2016/08/10 11:04:39
nit: change it to double quotes here as well.
MuVen
2016/08/10 11:40:59
Done.
| |
| 15 var block = idoc.querySelector("#block1"); | |
| 16 var origWidth = block.offsetWidth; | |
| 17 sheet.insertRule("::-webkit-scrollbar { width: 50px; height: 20px; }", 0); | |
| 18 sheet.insertRule("::-webkit-scrollbar-thumb { background: #cce; }", 1); | |
| 19 var width = block.offsetWidth; | |
| 9 | 20 |
| 10 var idoc = document.querySelector("#i").contentDocument; | 21 assert_equals(250, width); |
| 11 var sheet = idoc.head.appendChild(idoc.createElement("style")).sheet; | 22 assert_less_than(width, origWidth); |
| 12 | 23 }); |
| 13 idoc.body.style.margin = '0'; | |
| 14 idoc.body.innerHTML = document.querySelector('#content').innerHTML; | |
| 15 | |
| 16 var block = idoc.querySelector("#block1"); | |
| 17 var origWidth = block.offsetWidth; | |
| 18 | |
| 19 sheet.insertRule("::-webkit-scrollbar { width: 50px; height: 20px; }", 0); | |
| 20 sheet.insertRule("::-webkit-scrollbar-thumb { background: #cce; }", 1); | |
| 21 | |
| 22 var width = block.offsetWidth; | |
| 23 | |
| 24 shouldBe("250", String(width)); | |
| 25 shouldBeTrue("width < origWidth"); | |
| 26 | |
| 27 </script> | 24 </script> |
| OLD | NEW |