PageRenderTime 1612ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/third_party/WebKit/LayoutTests/imported/csswg-test/css-writing-modes-3/orthogonal-parent-shrink-to-fit-001f.html

https://gitlab.com/jonnialva90/iridium-browser
HTML | 85 lines | 84 code | 1 blank | 0 comment | 0 complexity | b743d1117bdb70df859c7512a9cc3dd9 MD5 | raw file
  1. <!DOCTYPE html>
  2. <title>CSS Writing Modes Test: Shrink-to-fit inline-block with a child of orthogonal inline in inline-block</title>
  3. <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#orthogonal-flows">
  4. <meta name="assert" content="Shrink-to-fit inline-block with a child of orthogonal inline in inline-block">
  5. <meta name="flags" content="ahem">
  6. <link rel="author" title="Koji Ishii" href="mailto:kojiishi@gmail.com">
  7. <script src="../../../resources/testharness.js"></script>
  8. <script src="../../../resources/testharnessreport.js"></script>
  9. <link rel="stylesheet" href="../../../resources/testharness.css">
  10. <style>
  11. .test {
  12. border:thin solid;
  13. font:20px/1 Ahem;
  14. }
  15. .target {
  16. color:blue;
  17. height:3em;
  18. -webkit-writing-mode:vertical-rl;
  19. }
  20. .border {
  21. border-right:blue solid .5em;
  22. }
  23. .next {
  24. color:orange;
  25. }
  26. .inline-block {
  27. display:inline-block;
  28. }
  29. .float {
  30. float:left;
  31. }
  32. h3 {
  33. clear:both;
  34. }
  35. h3.fail {
  36. color:red;
  37. }
  38. table {
  39. border-spacing:0px;
  40. }
  41. td {
  42. padding:0px;
  43. }
  44. </style>
  45. <div id="log"></div>
  46. <div id="container">
  47. <p>Test passes if the X-position of the <b>left</b> edge of the orange box and the <b>right</b> edge of the blue box are the same.
  48. <p>If script is enabled, there should be one or more PASS and no FAIL.
  49. <h3>6: Shrink-to-fit inline-block with a child of orthogonal inline in inline-block</h3>
  50. <div class="test">
  51. <div class="inline-block"><div class="inline-block"><span class="target">XX</span></div></div><span class="next">YY</span>
  52. </div>
  53. </div>
  54. <script>
  55. if (window.location.search == "?wait") {
  56. console.log("Sleeping 5 secs for debug");
  57. setup({explicit_done:true});
  58. window.setTimeout(run, 5000);
  59. } else {
  60. run();
  61. }
  62. function run() {
  63. Array.prototype.forEach.call(document.querySelectorAll(".test"), function (node) {
  64. var title = node.previousElementSibling.textContent;
  65. test(function () {
  66. try {
  67. var targetNode = node.querySelector(".target");
  68. var fontSize = parseFloat(getComputedStyle(targetNode).fontSize);
  69. var targetBounds = targetNode.getBoundingClientRect();
  70. assert_less_than_equal(targetBounds.width, fontSize * 2.01, "writing-mode is vertical")
  71. var nextNode = node.querySelector(".next");
  72. var nextBounds = nextNode.getBoundingClientRect();
  73. assert_equals(nextBounds.left - targetBounds.right, 0, "the left edge of the orange box touches the right edge of the blue box");
  74. } catch (e) {
  75. node.previousElementSibling.classList.add("fail");
  76. throw e;
  77. }
  78. }, title);
  79. });
  80. if (window.testRunner)
  81. container.style.display = "none";
  82. done();
  83. }
  84. </script>