normal-flow-overconstrained-vrl-002.xht (5096B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 3 <html xmlns="http://www.w3.org/1999/xhtml"> 4 5 <head> 6 7 <title>CSS Writing Modes Test: non-replaced block in normal flow with 'direction: ltr' in vertical-rl (overconstrained)</title> 8 9 <link rel="author" title="Gérard Talbot" href="http://www.gtalbot.org/BrowserBugsSection/css21testsuite/" /> 10 <link rel="help" href="http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout" title="7.4 Flow-Relative Mappings" /> 11 <link rel="match" href="abs-pos-non-replaced-vrl-006-ref.xht" /> 12 13 <meta name="flags" content="ahem image" /> 14 <meta name="assert" content="This test checks that when an inline dimension of a non-replaced block in normal flow is over-constrained, the inline-end margin is dropped and recalculated so that the equation involving inline-size is balanced; such equation takes under account the inline's direction (ltr or rtl). In this test, the inline-end margin (physical margin-bottom) is recalculated." /> 15 16 <!-- 17 " 18 the margin that is dropped when a box’s inline dimension is over-constrained is the end margin as determined by the writing mode of the containing block. 19 " 20 7.4 Flow-Relative Mappings 21 http://www.w3.org/TR/css-writing-modes-3/#logical-direction-layout 22 23 " 24 'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block 25 26 If all of the above have a computed value other than 'auto', the values are said to be "over-constrained" and one of the used values will have to be different from its computed value. If the 'direction' property of the containing block has the value 'ltr', the specified value of 'margin-right' is ignored and the value is calculated so as to make the equality true. If the value of 'direction' is 'rtl', this happens to 'margin-left' instead. 27 " 28 CSS 2.1, section 10.3.3 Block-level, non-replaced elements in normal flow 29 http://www.w3.org/TR/CSS21/visudet.html#blockwidth 30 --> 31 32 <meta name="DC.date.created" content="2015-10-16T09:54:03+11:00" scheme="W3CDTF" /> 33 <meta name="DC.date.modified" content="2017-02-18T09:54:03+11:00" scheme="W3CDTF" /> 34 35 <style type="text/css"><![CDATA[ 36 html 37 { 38 writing-mode: vertical-rl; 39 } 40 41 body#containing-block 42 { 43 background-image: url("support/bg-red-3col-3row-320x320.png"); 44 background-position: -152px 8px; 45 /* first value represents the horizontal position and the second represents the vertical position */ 46 47 /* 48 8px (body's margin-left) 49 - 50 80px (4th column width) 51 - 52 80px (3rd column width) 53 ======== 54 -152px 55 */ 56 background-repeat: no-repeat; 57 direction: ltr; 58 height: 320px; 59 margin: 8px; 60 } 61 62 p 63 { 64 margin-left: 16px; 65 margin-right: 16px; 66 } 67 68 div 69 { 70 background-color: green; 71 margin-top: 160px; 72 border-top: green solid 20px; 73 padding-top: 20px; 74 height: 0px; 75 padding-bottom: 20px; 76 border-bottom: green solid 20px; 77 margin-bottom: -160px; 78 79 margin-right: 96px; /* 80px + 16px necessary so that we can reuse an already created and available reference file */ 80 width: 80px; 81 } 82 83 /* 84 " 85 Layout calculation rules (such as those in CSS2.1, Section 10.3) that apply to the horizontal dimension in horizontal writing modes instead apply to the vertical dimension in vertical writing modes. 86 " 87 7.1 Principles of Layout in Vertical Writing Modes 88 http://www.w3.org/TR/css-writing-modes-3/#vertical-layout 89 90 So here, *-top and *-bottom properties are input into the §10.3.3 algorithms where *-top properties refer to *-left properties in the layout rules and where *-bottom properties refer to *-right properties in the layout rules. 91 92 'margin-top' + 'border-top-width' + 'padding-top' + 'height' + 'padding-bottom' + 'border-bottom-width' + 'margin-bottom' = height of containing block 93 94 So: 95 96 160px : margin-top 97 + 98 20px : border-top-width 99 + 100 20px : padding-top 101 + 102 0px : height 103 + 104 20px : padding-bottom 105 + 106 20px : border-bottom-width 107 + 108 -160px : margin-bottom 109 ======================== 110 80px : while the height of containing block of div is 320px 111 112 So, here, the specified value of 'margin-bottom' is ignored and the value is calculated so as to make the equality true 113 114 160px : margin-top 115 + 116 20px : border-top-width 117 + 118 20px : padding-top 119 + 120 0px : height 121 + 122 20px : padding-bottom 123 + 124 20px : border-bottom-width 125 + 126 (solve) : margin-bottom 127 ======================== 128 320px : height of containing block 129 130 And so computed margin-bottom value must be 80px . 131 */ 132 133 ]]></style> 134 135 </head> 136 137 <body id="containing-block"> 138 139 <p><img src="support/pass-cdts-abs-pos-non-replaced.png" width="246" height="36" alt="Image download support must be enabled" /></p> 140 <!-- 141 The image says: 142 Test passes if there is a filled 143 green square and <strong>no red</strong>. 144 --> 145 146 <div></div> 147 148 </body> 149 </html>