Commit graph

1733 commits

Author SHA1 Message Date
Jan-Niklas Jaeschke
12f5099c54 Bug 1838262, part 3: Removed ServoStyleSet::ProbeHighlightPseudoElementStyle(). r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184709
2023-07-31 13:47:55 +00:00
Emilio Cobos Álvarez
7bf3b0e527 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-26 06:46:32 +00:00
Iulian Moraru
0c0945174b Backed out changeset f3394bd0f554 (bug 1844195) for causing conflicts with another backout. 2023-07-26 04:00:57 +03:00
Emilio Cobos Álvarez
e56bda6fd8 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-25 21:14:39 +00:00
Iulian Moraru
da43d00caa Backed out changeset 3a3f2d5937c4 (bug 1844195) for causing mass failures. CLOSED TREE 2023-07-25 23:07:30 +03:00
Emilio Cobos Álvarez
c70814ab25 Bug 1844195 - Avoid duplicating rust and C++ display definitions. r=layout-reviewers,jfkthame
We need to inline Self::new() so cbindgen generates the constants, which
is kinda lame, but seems better than duplicating the values and type
definitions.

Differential Revision: https://phabricator.services.mozilla.com/D183921
2023-07-25 18:40:30 +00:00
Jonathan Kew
28f4536791 Bug 1845203 - Remove assertion that is fragile in the face of coordinate overflow. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D184462
2023-07-25 10:27:03 +00:00
Jonathan Kew
e965e3e508 Bug 1843863 - Fix the rendering of RTL text in a text-combine-upright element. r=emilio
Basically, we need to account for the right-to-left-ness when setting the origin
for applying the scale factor.

Differential Revision: https://phabricator.services.mozilla.com/D183767
2023-07-17 21:58:29 +00:00
Jonathan Kew
be1289d750 Bug 1843608 - Correct the handling of IsTextCombined in nsTextFrame::GetPointFromIterator and GetCharacterRectsInRange. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183749
2023-07-17 21:37:51 +00:00
Jonathan Kew
90a0aae39c Bug 1838250 - Avoid O(n^2) behavior in nsTextFrame::GetCharacterRectsInRange. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D183382
2023-07-13 09:47:59 +00:00
Jan-Niklas Jaeschke
7518e2e9bc Bug 1811823, part 2: Add correct prioritization for custom highlights. r=emilio
Due to the prioritization rules for custom highlights, it is not feasible to rely on cascading.
Instead, highlights need to be stacked by their priority (and order of insertion).
Text and background color of the highest-prioritized highlight which defines that property should be used.

Since highlights are implemented as special `Selection`s, the algorithm that determines the prevailing selection for a text frame needed to be adapted to instead return a list of selections.

Differential Revision: https://phabricator.services.mozilla.com/D181143
2023-06-23 15:22:44 +00:00
Jonathan Kew
0dcfbe4373 Bug 1835850 - CSS ::first-letter should select Dutch 'ij' or 'IJ' as a unit, but not mixed-case 'Ij'. r=emilio,jwatt
Differential Revision: https://phabricator.services.mozilla.com/D179526
2023-05-31 22:17:19 +00:00
Jonathan Kew
8109de8531 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
Jonathan Kew
d76893ccc8 Bug 1253840 - patch 1 - Allow text-align:justify to take effect when using white-space:pre-wrap. r=emilio
The CSS Text 3 spec allows this (CSS2 didn't), and other browsers
support it, so for better webcompat/interoperability, we should do the
same. Tests will need updating accordingly.

This first patch enables the property to take effect, but the resulting
layout is not yet correct because the (non-collapsed) whitespace at line
wrap positions needs to be forcibly "hung" into the margin for correct
justification; see following patch.

Differential Revision: https://phabricator.services.mozilla.com/D178210
2023-05-21 13:17:42 +00:00
Stanca Serban
403e698e38 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
8b24f65b6e 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
Jonathan Kew
6c867424b9 Bug 1253840 - patch 1 - Allow text-align:justify to take effect when using white-space:pre-wrap. r=emilio
The CSS Text 3 spec allows this (CSS2 didn't), and other browsers
support it, so for better webcompat/interoperability, we should do the
same. Tests will need updating accordingly.

This first patch enables the property to take effect, but the resulting
layout is not yet correct because the (non-collapsed) whitespace at line
wrap positions needs to be forcibly "hung" into the margin for correct
justification; see following patch.

Differential Revision: https://phabricator.services.mozilla.com/D178210
2023-05-19 16:44:09 +00:00
David Shin
267a479339 Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-17 12:56:54 +00:00
Sandor Molnar
71c2b3db49 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
1eefa9a516 Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-16 20:48:18 +00:00
Sandor Molnar
a50a2052fe 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
30a10fdbc6 Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-16 19:02:11 +00:00
Cristian Tuns
4d57ea669d 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
c4f2c2237b Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-15 14:34:26 +00:00
Cosmin Sabou
543905e105 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
d2ebe93a83 Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 17:04:27 +00:00
Iulian Moraru
c9ffb3ffa8 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
8ff73f5fcc Bug 1809568 - Part 2: Provide GetNaturalBaselineBOffset with baseline export context. r=emilio
Some baseline exports are context-sensitive. One example: In line-layout scenario,
the last baseline of a scroll container is always the margin-end. In other (e.g.
flex, grid) scenarios, it's the border-box clamped offset to the last line in the
container.
This enables the required 3 different behaviours for `inline-block` scroll containers
for 3 different `baseline-source` values:
- `auto`: Last baseline, margin-end
- `first`: Border-box clamped offset to the first line
- `last`: Border-box clamped offset to the last line

Differential Revision: https://phabricator.services.mozilla.com/D173886
2023-05-01 13:44:43 +00:00
Jonathan Kew
9c1b2512f5 Bug 1826629 - Implement CSS and rendering (but not copy/paste) support for the (non-standard) -webkit-text-security property. r=dholbert
Differential Revision: https://phabricator.services.mozilla.com/D174951
2023-04-18 11:47:07 +00:00
Jonathan Kew
489d96aeb1 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
4583632812 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
1c77c30705 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
Jonathan Kew
a920605e79 Bug 1825394 - Backed out changeset fcc38c48c35a (bug 1824531) due to tscrollx regressions. r=layout-reviewers,emilio,tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D174437
2023-04-03 10:11:04 +00:00
Jonathan Kew
045b620d20 Bug 1826013 - Tidy up BreakAndMeasureText params, and replace some never-NULL pointers with references. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D174383
2023-04-03 08:19:49 +00:00
Jonathan Kew
dccd8a928e Bug 1825983 - Refactor handling of trailing trimmable whitespace. r=emilio
This slightly simplifies gfxTextRun::BreakAndMeasureText, and should make it less confusing
to reason about trailing whitespace in nsTextFrame/nsLineLayout.

Differential Revision: https://phabricator.services.mozilla.com/D174377
2023-04-03 06:41:22 +00:00
Robert Longson
7e65e06613 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
Jonathan Kew
ee1583a0a9 Bug 1824531 - Remove baseline-snapping from nsTextFrame::PaintText, as it may interact poorly with APZ. r=emilio
In my local testing, this seems to be harmless, but we should be alert for reports of any erratic
or poorly-rasterized text that results.

Differential Revision: https://phabricator.services.mozilla.com/D173633
2023-03-26 21:44:32 +00:00
Cristian Tuns
f7b9131c3f Backed out changeset 5f36e53be4cf (bug 1824531) for causing reftest failures in colrv1-01.html CLOSED TREE 2023-03-26 14:35:18 -04:00
Jonathan Kew
f0e6bbc4b5 Bug 1824531 - Remove baseline-snapping from nsTextFrame::PaintText, as it may interact poorly with APZ. r=emilio
In my local testing, this seems to be harmless, but we should be alert for reports of any erratic
or poorly-rasterized text that results.

Differential Revision: https://phabricator.services.mozilla.com/D173633
2023-03-26 17:03:07 +00:00
David Shin
a47e766d75 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
97050950be 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
6cb3b01af3 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
7c4f609327 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
2f94be9968 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
Jonathan Kew
612bf9c124 Bug 1819957 - Split out nsTextPaintStyle into its own source file. r=emilio
This lets us instantiate it on the stack in nsDisplayText::Paint.

Differential Revision: https://phabricator.services.mozilla.com/D171635
2023-03-05 22:24:10 +00:00
Jonathan Kew
bbb315c6c5 Bug 1818654 - Don't give up on clipping to the visible rect in nsDisplayText when selection or shadow is present. r=emilio
Although I haven't been able to reproduce the reporter's OOM crash here, I hope this will avoid
the issue; it certainly improves performance characteristics in my local build.

On the example here, my laptop happily scrolls the text field at 60fps when nothing is selected;
but if the text is selected it can only manage around 40fps, because we lose the clipping
optimization here.

With this change, it maintains 60fps regardless of whether the text is selected (or text-shadow
is present), and memory footprint is substantially reduced.

Differential Revision: https://phabricator.services.mozilla.com/D171318
2023-03-01 11:37:27 +00:00
David Shin
f5a42005e2 Bug 1811311 - Part 3: Refactor GetNaturalBaselineBOffset to return Maybe<nscoord>. r=layout-reviewers,emilio
Changed from returning `bool` & taking an out parameter.

Differential Revision: https://phabricator.services.mozilla.com/D168998
2023-02-23 14:53:27 +00:00
David Shin
5c7c22165f Bug 1811311 - Part 1: Unite baseline-related functions in nsIFrame into one. r=emilio
Before, there existed 3 virtual functions that calculated baselines:

- `GetLogicalBaseline`
- `GetVerticalAlignBaseline`
- `GetNaturalBaselineBOffset`

Each of them had slightly different behaviours:

- `GetLogicalBaseline` would synthesize a baseline if there is no baseline.
  Others would simply return `false`.
- `GetNaturalBaselineBOffset` requires the caller to pick which of first/last
  baseline to calculate. Others pick on on their own.
- `GetNaturalBaselineBOffset`'s result can be either offset from border box
   start/end edge, depending on the caller-supplied baseline. Others always
   return offset from border box start edge.

Now:

- `GetNaturalBaselineBOffset` is the sole virtual function.
- `GetLogicalBaseline` exists to support its use, with 2 virtual helper functions:
  - `SynthesizeFallbackBaseline` to generate a baseline for elements that
    doesn't have one.
  - `GetBaselineSharingGroup` to preserve the default baseline picking behaviour.

Differential Revision: https://phabricator.services.mozilla.com/D167990
2023-02-23 14:53:26 +00:00
Jonathan Kew
89530bf362 Bug 1818172 - Use nsTextFrame::ResolveSelections and a SelectionRangeIterator to optimize PaintTextSelectionDecorations. r=emilio
With this, the old SelectionIterator that expects a per-character array of
SelectionDetails pointers is no longer used anywhere.

Differential Revision: https://phabricator.services.mozilla.com/D170588
2023-02-23 11:14:27 +00:00
Jonathan Kew
cc1e7449f8 Bug 1816927 - Improve performance of nsTextFrame::PaintTextWithSelectionColors on very large textframes. r=emilio
This significantly improves performance and reduces memory usage when painting a very long textframe
with some or all of the text selected.

Differential Revision: https://phabricator.services.mozilla.com/D170530
2023-02-23 09:36:13 +00:00