Commit Graph

799 Commits

Author SHA1 Message Date
Jonathan Kew
1eeec091cd Bug 1910136 - Miscellaneous tidy-up in nsLineLayout. r=layout-reviewers,emilio,TYLin
Differential Revision: https://phabricator.services.mozilla.com/D217839
2024-07-26 19:14:16 +00:00
Jonathan Kew
8926d68321 Bug 1910136 - Use default member initializers in nsLineLayout. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D217836
2024-07-26 19:14:15 +00:00
Emilio Cobos Álvarez
29b1f3c2f8 Bug 1899042 - Remove untested and unimplemented align="char" value for tables. r=jfkthame,layout-reviewers
Other engines also don't implement it, so moderately sure this is safe.

Differential Revision: https://phabricator.services.mozilla.com/D212549
2024-06-04 13:42:36 +00:00
Daniel Holbert
c8e1de6632 Bug 1896208: Initialize PerSpanData members mBaseline and mReflowInput. r=layout-reviewers,emilio
We null-initialize all of the other pointer members in NewPerSpanData; we
should do the same for these ones, for consistency & robustness.

(In practice, the callers end up initializing these members before reading them
anyway, so it's been benign that we weren't initializing them.  But better
for safety & futureproofing to have them reliably initialized.)

Differential Revision: https://phabricator.services.mozilla.com/D210106
2024-05-10 22:10:35 +00:00
flowejam
9d4992fcc6 Bug 1885693: Converted LogicalSide to an enum class, and renamed variables accordingly. r=TYLin
Values were static_casted where required. Some functions in WritingModes.h were
rewritten such that bitwise operations aren't being used. Added static_casts to
avoid (debug) build errors from debugging printfs in layout/tables/nsCellMap.cpp.

Differential Revision: https://phabricator.services.mozilla.com/D205510
2024-03-26 17:55:16 +00:00
Jonathan Kew
91703dcd33 Bug 1881855 - The 'inset' used during text-wrap:balance reflows should only be applied to the root span of each line. r=layout-reviewers,emilio
This was just a silly trivial error in the original implementation. We shouldn't apply
the inset value to nested spans within the line, only to the root span.

Differential Revision: https://phabricator.services.mozilla.com/D203786
2024-03-06 19:52:23 +00:00
Emilio Cobos Álvarez
14c69b2672 Bug 1362907 - Make select use nsHTMLButtonControlFrame for layout. r=jfkthame,dholbert
This simplifies our combobox code a bit more:

 * Reflow() is only needed to compute the label isize.
 * Frame construction uses a setup more similar to <input type=file> to
   get the right frame tree, removing a bunch of special code.
 * Lots of special code removed all over the place.

Differential Revision: https://phabricator.services.mozilla.com/D203010
2024-02-29 11:15:52 +00:00
Jonathan Kew
c5ac190354 Bug 1872929 - Don't allow text-wrap:balance adjustment to cause an overflow-wrap line break to be used. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D199974
2024-01-30 18:58:16 +00:00
Emilio Cobos Álvarez
c27730d3df Bug 1364813 - Remove IsFrameOfType, use non-virtual checks. r=jwatt
Extend the per-frame-class bit we have to devirtualize IsLeaf to also
devirtualize IsFrameOfType. That is, move this data to FrameClasses.py.

This was done by going through all the frame classes, trying to preserve
behavior.

The only quirky thing is that I had to add two more trivial frame
classes, `nsAudioFrame` for audio elements, and
`nsFloatingFirstLetterFrame`. That's because these frame classes were
returning different answers at runtime, but they do this only on
conditions that trigger frame reconstruction (floating, and being an
audio element, respectively).

Differential Revision: https://phabricator.services.mozilla.com/D194703
2023-11-26 22:17:28 +00:00
David Shin
0e315b5e13 Bug 1855583: Empty text line should not give line height even with white-space: pre. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D193807
2023-11-20 23:24:54 +00:00
Narcis Beleuzu
6194cc9312 Backed out changeset f78453d75438 (bug 1855583) for wpt failure on empty-text-baseline-001.html . CLOSED TREE 2023-11-20 22:27:04 +02:00
David Shin
62759301aa Bug 1855583: Empty text line should not give line height even with white-space: pre. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D193807
2023-11-20 16:09:44 +00:00
Jonathan Kew
44cf9fe64c Bug 1861716 - Ensure we don't try to apply text-indent within ruby text container frame. r=TYLin
Differential Revision: https://phabricator.services.mozilla.com/D192164
2023-10-31 08:49:27 +00:00
Jonathan Kew
6a6166267d Bug 1860932 - Check for empty line list in the prev-in-flow. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D191872
2023-10-25 19:03:57 +00:00
Jonathan Kew
68d208c793 Bug 784648 - Implement the 'hanging' and 'each-line' options for CSS text-indent. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D191522
2023-10-23 15:12:23 +00:00
Jonathan Kew
2f9632a6a3 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 https://github.com/w3c/csswg-drafts/issues/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
2023-09-30 15:53:12 +00:00
David Shin
01d5729999 Bug 1855730: Move line-height from text to font style struct. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D189521
2023-09-28 20:07:49 +00:00
Sandor Molnar
53fea6e6ed Backed out 5 changesets (bug 1731541) for causing multiple wpt failures. CLOSED TREE
Backed out changeset c185a38fb335 (bug 1731541)
Backed out changeset 16a3de29e4e6 (bug 1731541)
Backed out changeset 225642ff1de8 (bug 1731541)
Backed out changeset eb0b125d3214 (bug 1731541)
Backed out changeset af42a433722a (bug 1731541)
2023-09-28 23:49:24 +03:00
Jonathan Kew
fa67514884 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 https://github.com/w3c/csswg-drafts/issues/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
2023-09-28 17:28:19 +00:00
Natalia Csoregi
4a88c0e9b1 Backed out 4 changesets (bug 1731541) for causing bustage on nsBlockFrame.cpp. CLOSED TREE
Backed out changeset 7ce2b41bb730 (bug 1731541)
Backed out changeset 71d889de8d97 (bug 1731541)
Backed out changeset 0fd4431f5279 (bug 1731541)
Backed out changeset 5926241957b4 (bug 1731541)
2023-09-28 12:09:30 +03:00
Jonathan Kew
807cb41315 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 https://github.com/w3c/csswg-drafts/issues/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
2023-09-28 08:31:20 +00:00
Emilio Cobos Álvarez
0b366c953e Bug 1851787 - Plumb a DestroyContext through all functions that can destroy frames. r=dholbert
This prevents anonymous content getting destroyed at weird times
during frame destruction.

Differential Revision: https://phabricator.services.mozilla.com/D187693
2023-09-08 15:11:17 +00:00
David Shin
037d27f8b9 Bug 1843086: Line participants use block start ascent, instead of not-yet stored baseline. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183432
2023-07-13 13:40:25 +00:00
Jonathan Kew
a5c21d1079 Bug 1253840 - patch 2 - When justifying, the full advance of any trimmable end-of-line whitespace needs to be hung into the margin. r=emilio
Depends on D178210

Differential Revision: https://phabricator.services.mozilla.com/D178211
2023-05-21 13:17:42 +00:00
Stanca Serban
e0248465e4 Backed out 4 changesets (bug 1253840) for causing multiple failures in nsLineLayout.cpp. CLOSED TREE
Backed out changeset 1a47c4ddf44c (bug 1253840)
Backed out changeset 816a9266d111 (bug 1253840)
Backed out changeset 7ce24f83240a (bug 1253840)
Backed out changeset cf6eff426d61 (bug 1253840)
2023-05-20 00:49:29 +03:00
Jonathan Kew
39322ae348 Bug 1253840 - patch 2 - When justifying, the full advance of any trimmable end-of-line whitespace needs to be hung into the margin. r=emilio
Depends on D178210

Differential Revision: https://phabricator.services.mozilla.com/D178211
2023-05-19 16:44:10 +00:00
David Shin
bc4dd1fa31 Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-17 12:56:54 +00:00
Sandor Molnar
3faee50252 Backed out 3 changesets (bug 1809568) for causing build bustages in layout/generic/nsLineLayout.cpp CLOSED TREE
Backed out changeset 6c5bbcbafce9 (bug 1809568)
Backed out changeset b518133a5c34 (bug 1809568)
Backed out changeset 2407088e9b49 (bug 1809568)
2023-05-17 01:34:42 +03:00
David Shin
6015e07d18 Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-16 20:48:18 +00:00
Sandor Molnar
146a43a1bc Backed out 3 changesets (bug 1809568) for causing node devtools failures in devtools/client/debugger/src/components/test/QuickOpenModal.spec.js CLOSED TREE
Backed out changeset 56ce741da8f5 (bug 1809568)
Backed out changeset 5a91ce4870e4 (bug 1809568)
Backed out changeset cc00422f050a (bug 1809568)
2023-05-16 22:22:31 +03:00
David Shin
70634af885 Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-16 19:02:11 +00:00
Cristian Tuns
aa3e994c56 Backed out 3 changesets (bug 1809568) for causing build bustages on nsLineLayout.cpp CLOSED TREE
Backed out changeset e862b1560caa (bug 1809568)
Backed out changeset 0a20b91de67b (bug 1809568)
Backed out changeset 6060fc7d49d4 (bug 1809568)
2023-05-15 13:03:03 -04:00
David Shin
fa5ccf603e Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-15 14:34:26 +00:00
Cosmin Sabou
44343a085c Backed out 3 changesets (bug 1809568) for causing build bustages on nsBlockFrame.cpp. CLOSED TREE
Backed out changeset eaa7fe280317 (bug 1809568)
Backed out changeset ab0f2bcb2d9b (bug 1809568)
Backed out changeset a481bf06452b (bug 1809568)
2023-05-01 21:42:14 +03:00
David Shin
9078fa45a1 Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-01 17:04:27 +00:00
Iulian Moraru
babc5faa23 Backed out 3 changesets (bug 1809568) for causing build bustages on nsLineLayout.cpp. CLOSED TREE
Backed out changeset 573dc0bd9554 (bug 1809568)
Backed out changeset b8401947aea0 (bug 1809568)
Backed out changeset 7ecabe895121 (bug 1809568)
2023-05-01 17:59:21 +03:00
David Shin
06f50126d3 Bug 1809568 - Part 3: Implement baseline-source behaviour. r=emilio
Existing failures:
* `-webkit-line-clamp` with `baseline-source: last`: Clamped lines are still
  considered for baseline contribution. (e.g. if there are 4 lines with
  `-webkit-line-clamp: 3`, we should pick the third line, but we pick the 4th.
* `table` with 2 captions, one above and another below the table: We seem to
  not draw the latter caption.
* `inline-flex` with `flex-direction: column` and `baseline-source: last`:
  Calculated baseline is the first baseline.

Differential Revision: https://phabricator.services.mozilla.com/D173887
2023-05-01 13:44:43 +00:00
Jonathan Kew
3cdc5d3da3 Bug 1827009 - Don't assume the textrun has necessarily been created already. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D175108
2023-04-11 15:32:57 +00:00
Jonathan Kew
9535408f9b Bug 1712703 - Record the "hangable" advance of trailing whitespace in a textframe property, and use this in nsLineLayout to adjust inline positioning. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D174728
2023-04-05 23:58:08 +00:00
Noemi Erli
914b175f1f Backed out 3 changesets (bug 1712703) for causing nsLineLayout related crashes CLOSED TREE
Backed out changeset 18c753fda684 (bug 1712703)
Backed out changeset e54195c66f87 (bug 1712703)
Backed out changeset fa98b4c11d52 (bug 1712703)
2023-04-06 00:12:05 +03:00
Jonathan Kew
72ac0f18a6 Bug 1712703 - Record the "hangable" advance of trailing whitespace in a textframe property, and use this in nsLineLayout to adjust inline positioning. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D174728
2023-04-05 20:28:08 +00:00
Robert Longson
40b6dc20e5 Bug 1826001 - Change SVGUtils::IsInSVGTextSubtree into a member function on nsIFrame r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D174375
2023-04-02 21:17:07 +00:00
David Shin
286d0b43a7 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-24 16:23:16 +00:00
Norisz Fay
772aed9c55 Backed out changeset 11ba57726279 (bug 1812679) for causing Wr failures on text-combine-upright-value-all-002.html 2023-03-24 01:51:06 +02:00
David Shin
c107e01e84 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-23 17:36:49 +00:00
Stanca Serban
4666d08901 Backed out changeset 49646b0d59aa (bug 1812679) for causing mochitests failures in layout/style/test/test_revert.html. CLOSED TREE 2023-03-23 17:39:13 +02:00
David Shin
751d326ba7 Bug 1812679 - Handle central baseline calculation in GetNaturalBaselineBOffset. r=layout-reviewers,emilio
Previously, for writing-mode using central baseline alignment (i.e. `vertical-(lr|rl)`,
we simply used the center of content-box in `nsLineLayout::VerticalAlignFrames`.
However, this is incorrect for e.g. a `div` with two lines of text - just like how
its alphabetical baseline is the baseline of the second line of text, the central
baseline should be the centerline of the second line.

Differential Revision: https://phabricator.services.mozilla.com/D172165
2023-03-23 14:35:12 +00:00
Emilio Cobos Álvarez
66ce020e08 Bug 1814626 - Expose line-height resolution to style, and use it from ToResolvedValue. r=jfkthame
For ToResolvedValue implementation purposes we wouldn't need to split
out the vertical / font / line-height arguments and we could just pass
around the ComputedStyle, but the lh unit would need that distinction,
(because computing lh on font properties should use the parent style).

Differential Revision: https://phabricator.services.mozilla.com/D168705
2023-02-14 22:36:31 +00:00
David Shin
da801adb93 Bug 1805603: When aligning inline frames for text-align, ignore marker frames. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D165683
2023-01-03 21:30:05 +00:00
Noemi Erli
708f984fa7 Backed out changeset a8628fe4290e (bug 1805603) for causing failures in marker-text-align-002.html CLOSED TREE 2023-01-03 19:47:51 +02:00