File: content-visibility-svg-path.html

package info (click to toggle)
thunderbird 1%3A140.4.0esr-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 4,609,432 kB
  • sloc: cpp: 7,672,442; javascript: 5,901,613; ansic: 3,898,954; python: 1,413,343; xml: 653,997; asm: 462,286; java: 180,927; sh: 113,489; makefile: 20,460; perl: 14,288; objc: 13,059; yacc: 4,583; pascal: 3,352; lex: 1,720; ruby: 1,222; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 70; csh: 10
file content (101 lines) | stat: -rw-r--r-- 3,563 bytes parent folder | download | duplicates (13)
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>
<link rel="author" href="mailto:rbuis@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-contain/#content-visibility">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<style>
body {
  margin: 0;
  padding: 0;
}
div {
  content-visibility:hidden;
}
path {
  stroke-width: 5px;
  stroke:green;
}
</style>

<div>
  <svg xmlns="http://www.w3.org/2000/svg">
    <path id="path" d="M5 5 L 10 5 L 10 10 L 5 10 Z"/>
  </svg>
</div>

<script>
  test(() => {
    const pathElement = document.getElementById('path');
    const length = pathElement.getTotalLength();
    assert_greater_than(length, 0, 'length');
  }, `getTotalLength() should return nonzero value in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    const point = pathElement.getPointAtLength(0);
    assert_greater_than(point.x, 0, 'point.x');
    assert_greater_than(point.y, 0, 'point.y');
  }, `getPointAtLength() should return nonzero values in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    const inFill = pathElement.isPointInFill({ x: 7, y: 7});
    assert_true(inFill, 'fill');
  }, `isPointInFill() should return true in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    const inStroke = pathElement.isPointInStroke({ x: 7, y: 7});
    assert_true(inStroke, 'stroke');
  }, `isPointInStroke() should return true in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    var rect = pathElement.ownerSVGElement.createSVGRect();
    rect.x = 10;
    rect.y = 10;
    rect.width = 50;
    rect.height = 50;
    const intersection = pathElement.ownerSVGElement.checkIntersection(pathElement, rect);
    assert_true(intersection, 'intersection');
  }, `checkIntersection() should return true in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    var rect = pathElement.ownerSVGElement.createSVGRect();
    rect.width = 50;
    rect.height = 50;
    const enclosed = pathElement.ownerSVGElement.checkEnclosure(pathElement, rect);
    assert_true(enclosed, 'enclosure');
  }, `checkEnclosure() should return true in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    var rect = pathElement.ownerSVGElement.createSVGRect();
    rect.x = 10;
    rect.y = 10;
    rect.width = 50;
    rect.height = 50;
    const intersectionList = pathElement.ownerSVGElement.getIntersectionList(rect, null);
    assert_greater_than(intersectionList.length, 0, 'intersection');
  }, `getIntersectionList() should return items in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    var rect = pathElement.ownerSVGElement.createSVGRect();
    rect.width = 50;
    rect.height = 50;
    const enclusureList = pathElement.ownerSVGElement.getEnclosureList(rect, null);
    assert_greater_than(enclusureList.length, 0, 'intersection');
  }, `getEnclosureList() should return items in a c-v:hidden subtree.`);

  test(() => {
    const pathElement = document.getElementById('path');
    const bbox = pathElement.getBBox();
    assert_not_equals(bbox.x, 0, 'x');
    assert_not_equals(bbox.y, 0, 'y');
    assert_not_equals(bbox.width, 0, 'width');
    assert_not_equals(bbox.height, 0, 'height');
  }, `path getBBox() should return nonzero values in a c-v:hidden subtree.`);
</script>