Skip to content

Commit dd04e8e

Browse files
committed
Bug 1731541 - Implement text-wrap: balance for nsBlockFrame reflow. r=emilio
A simple form of balance for short blocks, implemented by incrementally reducing the effective inline-size used during line-breaking, up to the point where an extra line would be created. This fails the test text-wrap-balance-line-clamp-001.html, but it's unclear to me if that test is correct (see w3c/csswg-drafts#9310). If we do want the behavior expected by that test, an additional patch to handle the interaction with line-clamp will be required. Depends on D187543 Differential Revision: https://phabricator.services.mozilla.com/D187544 UltraBlame original commit: 0fd4431f527935234d764a167cc5a20acfc323eb
1 parent 75ecd7f commit dd04e8e

File tree

12 files changed

+3867
-2697
lines changed

12 files changed

+3867
-2697
lines changed

layout/generic/BlockReflowState.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ aConsumedBSize
265265
const
266266
nscoord
267267
aEffectiveContentBoxBSize
268+
const
269+
nscoord
270+
aInset
268271
)
269272
:
270273
mBlock
@@ -287,6 +290,10 @@ GetWritingMode
287290
(
288291
)
289292
)
293+
mInsetForBalance
294+
(
295+
aInset
296+
)
290297
mPushedFloats
291298
(
292299
nullptr

layout/generic/BlockReflowState.h

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,11 @@ aConsumedBSize
776776
const
777777
nscoord
778778
aEffectiveContentBoxBSize
779+
const
780+
nscoord
781+
aInset
782+
=
783+
0
779784
)
780785
;
781786
/
@@ -1797,10 +1802,12 @@ this
17971802
object
17981803
nsBlockFrame
17991804
*
1805+
const
18001806
mBlock
18011807
;
18021808
nsPresContext
18031809
*
1810+
const
18041811
mPresContext
18051812
;
18061813
const
@@ -2231,6 +2238,42 @@ wm
22312238
}
22322239
/
22332240
/
2241+
Amount
2242+
of
2243+
inset
2244+
to
2245+
apply
2246+
during
2247+
line
2248+
-
2249+
breaking
2250+
used
2251+
by
2252+
text
2253+
-
2254+
wrap
2255+
:
2256+
balance
2257+
/
2258+
/
2259+
to
2260+
adjust
2261+
line
2262+
-
2263+
breaks
2264+
for
2265+
more
2266+
consistent
2267+
lengths
2268+
throughout
2269+
the
2270+
block
2271+
.
2272+
nscoord
2273+
mInsetForBalance
2274+
;
2275+
/
2276+
/
22342277
Physical
22352278
size
22362279
.
@@ -2646,6 +2689,7 @@ nsIFrame
26462689
PreReflowBlockLevelLogicalSkipSides
26472690
)
26482691
.
2692+
const
26492693
LogicalMargin
26502694
mBorderPadding
26512695
;
@@ -2990,6 +3034,7 @@ nsIFrame
29903034
>
29913035
mNoWrapFloats
29923036
;
3037+
const
29933038
nscoord
29943039
mMinLineHeight
29953040
;

0 commit comments

Comments
 (0)