Skip to content

Commit 83b8296

Browse files
committed
[css-text-decor] Try to make text decoration positioning text more clear
--HG-- extra : rebase_source : 6b3ac91346c9c520c9d5fc2c9f097eaeda74e1f5
1 parent e115318 commit 83b8296

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

css-text-decor/Overview.html

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,22 +1047,21 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
10471047
<p>Since line decorations can span elements with varying font sizes and
10481048
vertical alignments, the best position for a line decoration is not
10491049
necessarily the ideal position dictated by the <a
1050-
href="#decorating-box"><i>decorating box</i></a>. In determining the
1051-
position of text decoration lines, user agents must consider, for each <a
1052-
href="#decorating-box"><i>decorating box</i></a>, the “ideal”
1053-
positions of such line decorations per fragment of the <a
1054-
href="#decorating-box"><i>decorating box</i></a>—or its in-flow inline
1055-
descendant—that draws the text decoration. However, descendants of the
1056-
<a href="#decorating-box"><i>decorating box</i></a> that are skipped due
1057-
to ‘<a href="#text-decoration-skip"><code
1050+
href="#decorating-box"><i>decorating box</i></a>. Instead, it's
1051+
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
1054+
href="#decorating-box"><i>decorating box</i></a> that are skipped due to
1055+
<a href="#text-decoration-skip"><code
10581056
class=property>text-decoration-skip</code></a>’, descendant inlines with
10591057
<code class=css>text-decoration-skip: ink</code>’, and any
10601058
descendants that do not participate in the <a
10611059
href="#decorating-box"><i>decorating box</i></a>’s inline formatting
1062-
context are excluded from consideration.
1060+
context are excluded from the set of <i>considered text</i>.
10631061

1064-
<p> The line decoration positions are then calculated as follows (treating
1065-
<a href="#underline-left"><i>over</i>-positioned underlines</a> as
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
10661065
<i>over</i> lines and <a href="#underline-left"><i>under</i>-positioned
10671066
overlines</a> as <i>under</i> lines):
10681067

@@ -1074,20 +1073,20 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
10741073
<dd> Align the line decoration with respect to the highest
10751074
<!-- <i>text-over</i> baseline of the considered fragments. --> <a
10761075
href="http://www.w3.org/TR/css3-writing-modes/#over"><i>over</i></a> edge
1077-
of the considered fragments’ content boxes.
1076+
of the <i>considered fragments</i>’ content boxes.
10781077

10791078
<dt><a href="#underline-alphabetic"><i>alphabetic</i></a> underlines
10801079

10811080
<dd>
10821081
<p>The alphabetic underline position is calculated by taking the ideal
1083-
offset (from the alphabetic baseline) of each considered fragment,
1084-
averaging those, and then using the lowest alphabetic baseline to
1085-
actually position the line. (Alphabetic baselines can differ between
1086-
<code class=css>baseline</code>’-aligned boxes if the dominant
1087-
baseline is non-alphabetic.) To prevent superscripts and subscripts from
1088-
throwing this position off-kilter, an inline with a non-initial computed
1089-
<code class=property>vertical-align</code>’ is treated as having
1090-
the ideal underline position of their parent.
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.
10911090

10921091
<dt>non-alphabetic <a
10931092
href="http://www.w3.org/TR/css3-writing-modes/#under"><i>under</i></a>
@@ -1096,7 +1095,7 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
10961095
<dd> Position the line decoration with respect to the lowest
10971096
<!-- <i>text-under</i> baseline of the considered fragments. --> <a
10981097
href="http://www.w3.org/TR/css3-writing-modes/#under"><i>under</i></a>
1099-
edge of the considered fragments’ content boxes.
1098+
edge of the <i>considered fragments</i>’ content boxes.
11001099

11011100
<dt>line-throughs
11021101

@@ -1105,7 +1104,7 @@ <h3 id=line-position><span class=secno>2.7. </span> Determining the
11051104
descendant with a different computed ‘<code
11061105
class=property>font-size</code>’. (This ensures that the text remains
11071106
effectively “crossed out” despite any font size changes.) For each
1108-
set of considered fragments with the same ‘<code
1107+
set of <i>considered fragments</i> with the same ‘<code
11091108
class=property>font-size</code>’, compute an ideal position averaged
11101109
from their direct contents and font metrics (assigning any fragment with
11111110
non-initial ‘<code class=property>vertical-align</code>’ the ideal

css-text-decor/Overview.src.html

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -687,19 +687,17 @@ <h3 id="line-position">
687687
<p>Since line decorations can span elements with varying font sizes and
688688
vertical alignments, the best position for a line decoration is not
689689
necessarily the ideal position dictated by the <i>decorating box</i>.
690-
In determining the position of text decoration lines,
691-
user agents must consider, for each <i>decorating box</i>,
692-
the “ideal” positions of such line decorations per fragment
693-
of the <i>decorating box</i>&mdash;or its in-flow inline descendant&mdash;that
694-
draws the text decoration.
690+
Instead, it's calculated, per line, from all text decorated by the <i>decorating box</i> on that line,
691+
the <i>considered text</i>.
695692
However, descendants of the <i>decorating box</i>
696693
that are skipped due to 'text-decoration-skip',
697694
descendant inlines with ''text-decoration-skip: ink'',
698695
and any descendants that do not participate in the <i>decorating box</i>’s inline formatting context
699-
are excluded from consideration.
696+
are excluded from the set of <i>considered text</i>.
700697

701698
<p>
702699
The line decoration positions are then calculated
700+
per set of <i>considered fragments</i>
703701
as follows
704702
(treating <a href="#underline-left"><i>over</i>-positioned underlines</a> as <i>over</i> lines
705703
and <a href="#underline-left"><i>under</i>-positioned overlines</a> as <i>under</i> lines):
@@ -710,12 +708,12 @@ <h3 id="line-position">
710708
Align the line decoration with respect to the highest
711709
<!-- <i>text-over</i> baseline of the considered fragments. -->
712710
<a href="http://www.w3.org/TR/css3-writing-modes/#over"><i>over</i></a> edge
713-
of the considered fragments’ content boxes.
711+
of the <i>considered fragments</i>’ content boxes.
714712

715713
<dt><a href="#underline-alphabetic"><i>alphabetic</i></a> underlines
716714
<dd>
717715
<p>The alphabetic underline position is calculated by taking
718-
the ideal offset (from the alphabetic baseline) of each considered fragment,
716+
the ideal offset (from the alphabetic baseline) of each <i>considered fragment</i>,
719717
averaging those, and then using the lowest alphabetic baseline to actually position the line.
720718
(Alphabetic baselines can differ between ''baseline''-aligned boxes
721719
if the dominant baseline is non-alphabetic.)
@@ -728,14 +726,14 @@ <h3 id="line-position">
728726
Position the line decoration with respect to the lowest
729727
<!-- <i>text-under</i> baseline of the considered fragments. -->
730728
<a href="http://www.w3.org/TR/css3-writing-modes/#under"><i>under</i></a> edge
731-
of the considered fragments’ content boxes.
729+
of the <i>considered fragments</i>’ content boxes.
732730

733731
<dt>line-throughs
734732
<dd>
735733
Line-throughs essentially use the same sort of averaging as for alphabetic underlines,
736734
but recompute the position when drawing across a descendant with a different computed 'font-size'.
737735
(This ensures that the text remains effectively “crossed out” despite any font size changes.)
738-
For each set of considered fragments with the same 'font-size',
736+
For each set of <i>considered fragments</i> with the same 'font-size',
739737
compute an ideal position averaged from their direct contents and font metrics
740738
(assigning any fragment with non-initial 'vertical-align' the ideal position of its parent).
741739
Position the portion of the line across each decorated fragment at that position.

0 commit comments

Comments
 (0)