xref: /aosp_15_r20/external/skia/tools/unicode_comparison/html/tbody.html (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1{{ define "formattedText" }}
2    <div class="grapheme invisible missing">
3    {{ range $text := .FormattedMissingGraphemes }}
4        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
5    {{ end }}
6    </div>
7    <div class="grapheme invisible extra">
8        {{ range $text := .FormattedExtraGraphemes }}
9        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
10        {{ end }}
11    </div>
12
13    <div class="softBreak invisible missing">
14    {{ range $text := .FormattedMissingSoftBreaks }}
15        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
16    {{ end }}
17    </div>
18    <div class="softBreak invisible extra">
19        {{ range $text := .FormattedExtraSoftBreaks }}
20        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
21        {{ end }}
22    </div>
23
24    <div class="hardBreak invisible missing">
25    {{ range $text := .FormattedMissingHardBreaks }}
26        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
27    {{ end }}
28    </div>
29    <div class="hardBreak invisible extra">
30        {{ range $text := .FormattedExtraHardBreaks }}
31        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
32        {{ end }}
33    </div>
34
35    <div class="word invisible missing">
36    {{ range $text := .FormattedMissingWords }}
37        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
38    {{ end }}
39    </div>
40    <div class="word invisible extra">
41        {{ range $text := .FormattedExtraWords }}
42        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
43        {{ end }}
44    </div>
45
46    <div class="whitespace invisible missing">
47    {{ range $text := .FormattedMissingWhitespaces }}
48        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
49    {{ end }}
50    </div>
51    <div class="whitespace invisible extra">
52        {{ range $text := .FormattedExtraWhitespaces }}
53        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
54        {{ end }}
55    </div>
56
57    <div class="control invisible missing">
58    {{ range $text := .FormattedMissingControls }}
59        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
60    {{ end }}
61    </div>
62    <div class="control invisible extra">
63        {{ range $text := .FormattedExtraControls }}
64        <span class="{{ .Classes }} {{ .Indexes.Type }}">{{ .Text }}</span>
65        {{ end }}
66    </div>
67
68{{ end }}
69{{ define "rows" }}
70    {{ range $child := . }}
71        {{ if $child.IsImplementation }}
72            <tr class="{{ .Level }}" id="{{ .Id }}">
73                {{ if .HasChildren }}
74                <td><a href="#{{ .Id }}">+</a>{{ .Name }}</td>
75                {{/*
76                <td>{{ printf "%.6f" .Delta.Memory }}</td>
77                <td>{{ printf "%.6f" .Delta.Disk }}</td>
78                */}}
79                <td></td>
80                <td></td>
81                <td>{{ .Delta.Performance.Percents }}</td>
82                <td>{{ .Delta.Graphemes.Divide }}</td>
83                <td>{{ .Delta.SoftBreaks.Divide }}</td>
84                <td>{{ .Delta.HardBreaks.Divide }}</td>
85                <td>{{ .Delta.Whitespaces.Divide }}</td>
86                <td>{{ .Delta.Words.Divide }}</td>
87                <td>{{ .Delta.Controls.Divide }}</td>
88                {{ else }}
89                <td>{{ .Name }}</td>
90                <td></td>
91                <td></td>
92                <td></td>
93                <td></td>
94                <td></td>
95                <td></td>
96                <td></td>
97                <td></td>
98                <td></td>
99                {{ end }}
100            </tr>
101        {{ else if $child.IsFile }}
102            {{ if $child.HasNoDifferences }}
103            {{ else }}
104            <tr class="{{ .Level }} {{ .ParentId }}">
105                <td> {{ .Name }} </td>
106                <td colspan="3"></td>
107
108                {{ if .HasNoGraphemes }}
109                <td>{{ .Delta.Graphemes.Divide }}</td>
110                {{ else }}
111                <td class="one_line">
112                    {{ if .HasMissingGraphemes }}
113                    <input type="button" class="grapheme inactive" id='grapheme_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'grapheme', 'missing')" value="-{{ .MissingGraphemeNum }}"/>
114                    {{ end }}
115                    {{ if .HasExtraGraphemes }}
116                    <input type="button" class="grapheme inactive" id='grapheme_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'grapheme', 'extra')" value="+{{ .ExtraGraphemeNum }}"/>
117                    {{ end }}
118                </td>
119                {{ end }}
120
121                {{ if .HasNoSoftBreaks }}
122                <td>{{ .Delta.SoftBreaks.Divide }}</td>
123                {{ else }}
124                <td class="one_line">
125                    {{ if .HasMissingSoftBreaks }}
126                    <input type="button" class="softBreak inactive" id='softBreak_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'softBreak', 'missing')" value="-{{ .MissingSoftBreakNum }}"/>
127                    {{ end }}
128                    {{ if .HasExtraSoftBreaks }}
129                    <input type="button" class="softBreak inactive" id='softBreak_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'softBreak', 'extra')" value="+{{ .ExtraSoftBreakNum }}"/>
130                    {{ end }}
131                </td>
132                {{ end }}
133
134                {{ if .HasNoHardBreaks }}
135                <td>{{ .Delta.HardBreaks.Divide }}</td>
136                {{ else }}
137                <td class="one_line">
138                    {{ if .HasMissingHardBreaks }}
139                    <input type="button" class="hardBreak inactive" id='hardBreak_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'hardBreak', 'missing')" value="+{{ .MissingHardBreakNum }}"/>
140                    {{ end }}
141                    {{ if .HasExtraHardBreaks }}
142                    <input type="button" class="hardBreak inactive" id='hardBreak_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'hardBreak', 'extra')" value="-{{ .ExtraHardBreakNum }}"/>
143                    {{ end }}
144                </td>
145                {{ end }}
146
147                {{ if .HasNoWhitespaces }}
148                <td>{{ .Delta.Whitespaces.Divide }}</td>
149                {{ else }}
150                <td class="one_line">
151                    {{ if .HasMissingWhitespaces }}
152                    <input type="button" class="whitespace inactive" id='whitespace_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'whitespace', 'missing')" value="-{{ .MissingWhitespaceNum }}"/>
153                    {{ end }}
154                    {{ if .HasExtraWhitespaces }}
155                    <input type="button" class="whitespace inactive" id='whitespace_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'whitespace')" value="+{{ .ExtraWhitespaceNum }}"/>
156                    {{ end }}
157                </td>
158                {{ end }}
159
160                {{ if .HasNoWords }}
161                <td>{{ .Delta.Words.Divide }}</td>
162                {{ else }}
163                <td class="one_line">
164                    {{ if .HasMissingWords }}
165                    <input type="button" class="word inactive" id='word_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'word', 'missing')" value="-{{ .MissingWordNum }}"/>
166                    {{ end }}
167                    {{ if .HasExtraWords }}
168                    <input type="button" class="word inactive" id='word_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'word', 'extra')" value="+{{ .ExtraWordNum }}"/>
169                    {{ end }}
170                </td>
171                {{ end }}
172
173                {{ if .HasNoControls }}
174                <td>{{ .Delta.Controls.Divide }}</td>
175                {{ else }}
176                <td class="one_line">
177                    {{ if .HasMissingControls }}
178                    <input type="button" class="control inactive" id='control_missing{{ .Num }}' onClick="showDiff('{{ .Num }}', 'control', 'missing')" value="-{{ .MissingControlNum }}"/>
179                    {{ end }}
180                    {{ if .HasExtraControls }}
181                    <input type="button" class="control inactive" id='control_extra{{ .Num }}' onClick="showDiff('{{ .Num }}', 'control', 'extra')" value="+{{ .ExtraControlNum }}"/>
182                    {{ end }}
183                </td>
184                {{ end }}
185            </tr>
186            <tr class="{{ .Level }} {{ .ParentId }}" id="{{ .Id }}">
187                <td class="results results1">{{ .Implementation }} results</td>
188                <td colspan="9" class="results1">
189                    {{ template "formattedText" . }}
190                </td>
191            </tr>
192            <tr class="{{ .Level }} {{ .ParentId }}" id="{{ .Id }}a">
193                <td class="results results2">Chrome results</td>
194                <td colspan="9" class="results2">
195                    <div>
196                        <span>{{ .Text }}</span>
197                    </div>
198                </td>
199            </tr>
200            {{ end }}
201        {{ else }}
202            <tr class="{{ .Level }} {{ .ParentId }}" id="{{ .Id }}">
203                {{ if .HasChildren }}
204                <td><a href="#{{ .Id }}">+</a> {{ .Name }} </td>
205                <td></td>
206                <td></td>
207                <td>{{ .Delta.Performance.Percents }}</td>
208                <td>{{ .Delta.Graphemes.Divide }}</td>
209                <td>{{ .Delta.SoftBreaks.Divide }}</td>
210                <td>{{ .Delta.HardBreaks.Divide }}</td>
211                <td>{{ .Delta.Whitespaces.Divide }}</td>
212                <td>{{ .Delta.Words.Divide }}</td>
213                <td>{{ .Delta.Controls.Divide }}</td>
214                {{ else }}
215                <td>{{ .Name }} </td>
216                <td></td>
217                <td></td>
218                <td>{{ .Delta.Performance.Percents }}</td>
219                <td></td>
220                <td></td>
221                <td></td>
222                <td></td>
223                <td></td>
224                <td></td>
225                {{ end }}
226            </tr>
227        {{ end}}
228        {{ template "rows" $child.Children }}
229    {{ end }}
230{{ end }}
231