summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-shapes/spec-examples/shape-outside-003.html
blob: 33045f309f3712191c8336657d0ab43ca72c246e (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
<!DOCTYPE html>
<html>
<head>
    <title>CSS Test: Left and right float with shape-outside with clipped right float</title>
    <link rel="author" title="Rebecca Hauck" href="mailto:rhauck@adobe.com"/>
    <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#relation-to-box-model-and-float-behavior"/>
    <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#supported-basic-shapes"/>
    <link rel="help" href="http://www.w3.org/TR/css-shapes-1/#shape-outside-property"/>
    <link rel="match" href="reference/shape-outside-001-ref.html"/>
    <meta name="flags" content="ahem"/>
    <meta name="assert" content="This test verifies that left floats with a shape-outside
     only allow content wrapping on the right side, and right floats only allow wrapping on
     the left and that the right float shape is clipped to the float's margin box"/>
     <!-- This test is derived from Example 2 in this version of the spec:
          http://www.w3.org/TR/2013/WD-css-shapes-1-20131203/ -->
    <link rel="stylesheet" type="text/css" href="/fonts/ahem.css" />
    <style type="text/css">
        body {
            margin-left: 0;
        }
        .container {
          width: 400px;
          text-align: center;
          font-family: Ahem;
          font-size: 20px;
          line-height: 1em;
        }
        #test {
            color: green;
        }
        #test-float-left {
          shape-outside: polygon(0 0, 200px 200px, 0 200px);
          float: left;
          width: 200px;
          height: 200px;
        }
        #test-float-right {
          shape-outside: polygon(200px 0, -800px 1000px, 200px 1000px);
          float: right;
          width: 200px;
          height: 200px;
        }
        #failure-container {
            color: red;
            z-index: -1;
        }
        #test, #failure-container {
            position: absolute;
            top: 60px;
        }
        .line {
            height: 20px;
        }
        #bottom {
            position: absolute;
            top: 200px;
        }
        #left-triangle, #right-triangle {
            position: absolute;
            top: 60px;
            width: 200px;
            height: 200px;
            background-color: lightblue;
        }
        #left-triangle {
            clip-path: polygon(0 0, 200px 200px, 0 200px);
        }
        #right-triangle {
            left: 200px;
            clip-path: polygon(200px 0, 200px 200px, 0 200px);
        }
    </style>
</head>
<body>
    <p>
        The test passes if the green shape does not intersect either of the triangles and
        there is one green horizontal bar beneath the triangles. There should be no red.
    </p>
    <div id="test" class="container">
        <div id="test-float-left"></div>
        <div id="test-float-right"></div>
        XXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXX XXXXXXXXXXXXX
        XXXXXXXXXXX XXXXXXXXX XXXXXXX XXXXX XXX X
        XXXXXXXXXXXXXXXXX
    </div>
    <div id="failure-container">
       <div class="line container">XXXXXXXXXXXXXXXXX</div>
       <div class="line container">XXXXXXXXXXXXXXX</div>
       <div class="line container">XXXXXXXXXXXXX</div>
       <div class="line container">XXXXXXXXXXX</div>
       <div class="line container">XXXXXXXXX</div>
       <div class="line container">XXXXXXX</div>
       <div class="line container">XXXXX</div>
       <div class="line container">XXX</div>
       <div class="line container">X</div>
       <div class="line container" id="bottom">XXXXXXXXXXXXXXXXX</div>
    </div>
    <div id="left-triangle"></div>
    <div id="right-triangle"></div>
</body>
</html>