@@ -1043,59 +1043,85 @@ <h3 id=text-underline-position-property><span class=secno>2.6. </span> Text
1043
1043
1044
1044
< h3 id =line-position > < span class =secno > 2.7. </ span > Determining the
1045
1045
Position and Thickness of Line Decorations</ h3 >
1046
+ <!--
1047
+ <p>Since line decorations can span elements with varying font sizes and
1048
+ vertical alignments, the best position for a line decoration is not
1049
+ necessarily the ideal position dictated by the <i>decorating box</i>.
1050
+ In determining the position of text decoration lines within a given line box,
1051
+ user agents must consider, for each <i>decorating box</i> on that line,
1052
+ the “ideal” positions of such line decorations of each
1053
+ run of text decorated by that <i>decorating box</i>
1054
+ (each <dfn>considered run</dfn>).
1055
+ However, descendants of the <i>decorating box</i>
1056
+ that are skipped due to 'text-decoration-skip',
1057
+ descendant inlines with ''text-decoration-skip: ink'',
1058
+ and any descendants that do not participate in the <i>decorating box</i>’s inline formatting context
1059
+ are excluded from the set of <i>considered fragments</i>.
1060
+
1061
+ <p>
1062
+ <dfn>Decoration-affecting text</dfn> is any text decorated by a <i>decorating box</i>
1063
+ that can affect the size and position of the decoration;
1064
+ descendants that are skipped due to 'text-decoration-skip',
1065
+ descendant inlines with ''text-decoration-skip: ink'',
1066
+ and any descendants that do not participate in the <i>decorating box</i>’s inline formatting context
1067
+ are not <i>considered fragments</i>.
1068
+ The position and thickness of decorations on <i>considered fragments</i> are calculated by looking at sets of <i>considered fragments</i>:
1069
+ each set is composed of all the <i>considered fragments</i> in a single line box
1070
+ and decorated by the same <i>decorating box</i>.
1071
+ -->
1046
1072
1047
1073
< p > Since line decorations can span elements with varying font sizes and
1048
1074
vertical alignments, the best position for a line decoration is not
1049
1075
necessarily the ideal position dictated by the < a
1050
1076
href ="#decorating-box "> < i > decorating box</ i > </ a > . Instead, it's
1051
1077
calculated, per line, from all text decorated by the < a
1052
- href ="#decorating-box "> < i > decorating box</ i > </ a > on that line, the
1053
- < i > considered text</ i > . However, descendants of the < a
1078
+ href ="#decorating-box "> < i > decorating box</ i > </ a > on that line, the < dfn
1079
+ id = considered-text > considered text</ dfn > . However, descendants of the < a
1054
1080
href ="#decorating-box "> < i > decorating box</ i > </ a > that are skipped due to
1055
1081
‘< a href ="#text-decoration-skip "> < code
1056
1082
class =property > text-decoration-skip</ code > </ a > ’, descendant inlines with
1057
1083
‘< code class =css > text-decoration-skip: ink</ code > ’, and any
1058
1084
descendants that do not participate in the < a
1059
1085
href ="#decorating-box "> < i > decorating box</ i > </ a > ’s inline formatting
1060
- context are excluded from the set of < i > considered text</ i > .
1086
+ context are excluded from the set of < a
1087
+ href ="#considered-text "> < i > considered text</ i > </ a > .
1061
1088
1062
- < p > The line decoration positions are then calculated per set of
1063
- < i > considered fragments</ i > as follows (treating < a
1064
- href ="#underline-left "> < i > over</ i > -positioned underlines</ a > as
1065
- < i > over</ i > lines and < a href ="#underline-left "> < i > under</ i > -positioned
1089
+ < p > The line decoration positions are then calculated per line as follows
1090
+ (treating < a href ="#underline-left "> < i > over</ i > -positioned underlines</ a >
1091
+ as < i > over</ i > lines and < a href ="#underline-left "> < i > under</ i > -positioned
1066
1092
overlines</ a > as < i > under</ i > lines):
1067
1093
1068
1094
< dl >
1069
- < dt > < a
1070
- href ="http://www.w3.org/TR/css3-writing-modes/#over "> < i > over</ i > </ a >
1095
+ < dt > < a href ="http://www.w3.org/TR/css-writing-modes/#over "> < i > over</ i > </ a >
1071
1096
lines
1072
1097
1073
1098
< dd > Align the line decoration with respect to the highest
1074
1099
<!-- <i>text-over</i> baseline of the considered fragments. --> < a
1075
- href ="http://www.w3.org/TR/css3 -writing-modes/#over "> < i > over</ i > </ a > edge
1076
- of the < i > considered fragments </ i > ’ content boxes .
1100
+ href ="http://www.w3.org/TR/css -writing-modes/#over "> < i > over</ i > </ a >
1101
+ EM-box edge of the < a href =" #considered-text " > < i > considered text </ i > </ a > .
1077
1102
1078
1103
< dt > < a href ="#underline-alphabetic "> < i > alphabetic</ i > </ a > underlines
1079
1104
1080
1105
< dd >
1081
1106
< p > The alphabetic underline position is calculated by taking the ideal
1082
- offset (from the alphabetic baseline) of each < i > considered
1083
- fragment</ i > , averaging those, and then using the lowest alphabetic
1084
- baseline to actually position the line. (Alphabetic baselines can differ
1085
- between ‘< code class =css > baseline</ code > ’-aligned boxes if the
1086
- dominant baseline is non-alphabetic.) To prevent superscripts and
1087
- subscripts from throwing this position off-kilter, an inline with a
1088
- non-initial computed ‘< code class =property > vertical-align</ code > ’ is
1089
- treated as having the ideal underline position of their parent.
1107
+ offset (from the alphabetic baseline) of each run of < a
1108
+ href ="#considered-text "> < i > considered text</ i > </ a > , averaging those, and
1109
+ then using the lowest alphabetic baseline to actually position the line.
1110
+ (Alphabetic baselines can differ between ‘< code
1111
+ class =css > baseline</ code > ’-aligned boxes if the dominant baseline is
1112
+ non-alphabetic.) To prevent superscripts and subscripts from throwing
1113
+ this position off-kilter, an inline with a non-initial computed ‘< code
1114
+ class =property > vertical-align</ code > ’ is treated as having the ideal
1115
+ underline position of its parent.
1090
1116
1091
1117
< dt > non-alphabetic < a
1092
- href ="http://www.w3.org/TR/css3 -writing-modes/#under "> < i > under</ i > </ a >
1118
+ href ="http://www.w3.org/TR/css -writing-modes/#under "> < i > under</ i > </ a >
1093
1119
lines
1094
1120
1095
1121
< dd > Position the line decoration with respect to the lowest
1096
1122
<!-- <i>text-under</i> baseline of the considered fragments. --> < a
1097
- href ="http://www.w3.org/TR/css3 -writing-modes/#under "> < i > under</ i > </ a >
1098
- edge of the < i > considered fragments </ i > ’ content boxes .
1123
+ href ="http://www.w3.org/TR/css -writing-modes/#under "> < i > under</ i > </ a >
1124
+ EM-box edge of the < a href =" #considered-text " > < i > considered text </ i > </ a > .
1099
1125
1100
1126
< dt > line-throughs
1101
1127
@@ -1104,12 +1130,20 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
1104
1130
descendant with a different computed ‘< code
1105
1131
class =property > font-size</ code > ’. (This ensures that the text remains
1106
1132
effectively “crossed out” despite any font size changes.) For each
1107
- set of < i > considered fragments</ i > with the same ‘< code
1108
- class =property > font-size</ code > ’, compute an ideal position averaged
1109
- from their direct contents and font metrics (assigning any fragment with
1110
- non-initial ‘< code class =property > vertical-align</ code > ’ the ideal
1111
- position of its parent). Position the portion of the line across each
1112
- decorated fragment at that position.
1133
+ run of < a href ="#considered-text "> < i > considered text</ i > </ a > with the
1134
+ same ‘< code class =property > font-size</ code > ’, compute an ideal
1135
+ position averaged from its font metrics. To prevent superscripts and
1136
+ subscripts from throwing this position off-kilter, an inline with a
1137
+ non-initial computed ‘< code class =property > vertical-align</ code > ’ is
1138
+ treated as having the ideal underline position of its parent. Position
1139
+ the portion of the line across each decorated fragment at that position.
1140
+ < p class =issue > For simplicity, line-throughs should draw over each
1141
+ element at that element's preferred/averaged position. This can produce
1142
+ some undesirable jumpiness, but there doesn't appear to be any way to
1143
+ avoid that which is correct in all instances, and all attempts are
1144
+ worryingly complex. What position should line-throughts adopt over
1145
+ elements that have a different font-size, but no < a
1146
+ href ="#considered-text "> < i > considered text</ i > </ a > ?
1113
1147
</ dl >
1114
1148
1115
1149
< p > CSS does not define the thickness of line decorations. In determining
0 commit comments