Commit Graph

1833 Commits

Author SHA1 Message Date
Jonathan Kew
26ee40e65a Bug 1885702 - Fix initialization of masked text fragment in ClusterIterator. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D223050
2024-09-25 17:44:22 +00:00
David Shin
1fad4eeb43 Bug 1900232: Part 4 - Add anchor-size() to margin properties. r=firefox-style-system-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222533
2024-09-23 13:58:38 +00:00
Jonathan Kew
b2ea078648 Bug 1919812 - Vertical Mongolian text takes underline on the right, like Japanese & Korean. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222809
2024-09-21 08:38:02 +00:00
Jonathan Kew
3f3a8c3e8d Bug 1919658 - Add support for text-emphasis-position:auto. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D222855
2024-09-20 20:15:19 +00:00
Emilio Cobos Álvarez
3ca9c49882 Bug 1917715 - Rename nsLayoutUtils::GetColor. r=longsonr,dholbert
It's suitable for foreground colors only.

Differential Revision: https://phabricator.services.mozilla.com/D221557
2024-09-09 23:12:05 +00:00
Ting-Yu Lin
116ca76700 Bug 1909761 Part 3 - Use IntrinsicSizeInput for AddInlineMinISize() and AddInlinePrefISize(). r=dholbert
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.

Differential Revision: https://phabricator.services.mozilla.com/D219522
2024-09-03 04:25:42 +00:00
Ting-Yu Lin
6af05a0977 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.

When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-09-03 04:25:41 +00:00
Butkovits Atila
4d06404349 Backed out 6 changesets (bug 1909761) for causing failures at test_contextmenu_rtl.xhtml. CLOSED TREE
Backed out changeset 1e9f47784a54 (bug 1909761)
Backed out changeset d2dcf159185b (bug 1909761)
Backed out changeset 3f48c106bff9 (bug 1909761)
Backed out changeset 38d1e5eda09d (bug 1909761)
Backed out changeset 8de556490289 (bug 1909761)
Backed out changeset 4e7f22f43bb4 (bug 1909761)
2024-08-28 10:44:09 +03:00
Ting-Yu Lin
caac17bc1b Bug 1909761 Part 3 - Use IntrinsicSizeInput for AddInlineMinISize() and AddInlinePrefISize(). r=dholbert
Another preparation patch in order to pass down a percentage basis when
computing intrinsic size.

Differential Revision: https://phabricator.services.mozilla.com/D219522
2024-08-28 06:18:44 +00:00
Ting-Yu Lin
f0ff97db90 Bug 1909761 Part 2 - Create a helper struct IntrinsicSizeInput to aggregate needed data when computing intrinsic inline size. r=dholbert
This patch changes the signature to `GetMinISize()`, `GetPrefISize()`,
`IntrinsicISize` by adding a helper struct as a preparation. Then we can just
add more data such as a percentage basis to the struct without altering the
signature in the future.

When passing `IntrinsicSizeInput` struct down to another helper method, we
generally just pass the original one if the method is computing the intrinsic
size of our own or our anonymous children. If the method is computing our
children's intrinsic contribution, we'll need to create a brand new
`IntrinsicSizeInput` for our children.

Differential Revision: https://phabricator.services.mozilla.com/D219521
2024-08-28 06:18:44 +00:00
Jonathan Kew
899ed77a9f Bug 1912667 - Do not apply text-emphasis marks to punctuation characters (with some exceptions, per css-text-decor spec). r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D219099
2024-08-14 14:23:17 +00:00
Sandor Molnar
bd839a9def Backed out changeset c8f5afbb26a5 (bug 1912667) for causing build bustages @ layout/generic/nsTextFrame.cpp CLOSED TREE 2024-08-14 17:00:07 +03:00
Jonathan Kew
df2f73e279 Bug 1912667 - Do not apply text-emphasis marks to punctuation characters (with some exceptions, per css-text-decor spec). r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D219099
2024-08-14 11:39:06 +00:00
Jan-Niklas Jaeschke
70014fe558 Bug 1867249, part 1: Implemented new cache to determine selected nodes. r=sefeng,dom-core
Determining if a node is selected is a super-hot code path,
which at times introduces jank both in Reflow and Painting.
This is due to each node comparing its position to the range's start and end point,
which even happens several times (`nsINode::IsSelected()` and `Selection::LookupSelection()`).
In worst cases, this can lead to reflow which takes several minutes.

This patch introduces a cache which contains all fully selected nodes,
and lives throughout one `PresShell::DoReflow()` call.
Collecting all selected nodes of a selection is very fast.
The selected nodes are then stored in a hash set.
During reflow the check if a node is selected first checks the cache
if the node is fully selected, and otherwise goes through the existing
code to check if the node is partially selected.

Differential Revision: https://phabricator.services.mozilla.com/D217794
2024-08-05 15:43:27 +00:00
Ting-Yu Lin
9aba34e1fd Bug 1911027 Part 2 - Drop unnecessary nsIFrame:: for InlineMinISizeData and InlinePrefISizeData usages. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D218283
2024-08-01 17:47:07 +00:00
Ting-Yu Lin
bbefead4db Bug 1911027 Part 1 - Clean up for various frame classes. r=layout-reviewers,emilio
- Replace 'Width' with 'ISize'.
- Drop `virtual` on methods already with `override`.
- Define `AddInlineMinISize()` and `AddInlinePrefISize` directly in
  `nsContinuingTextFrame`.
- Rename `ReflowOutpt` parameter to `aReflowOutput`.

Differential Revision: https://phabricator.services.mozilla.com/D218282
2024-08-01 17:47:06 +00:00
Ting-Yu Lin
2969a5e0cb Bug 1909995 Part 2 - Add IntrinsicISize() as a helper to implement GetMinISize() and GetPrefISize(). r=layout-reviewers,emilio
Most frame types have identical or very similar implementation for GetMinISize()
and GetPrefISize(), and many of them already have `IntrinsicISize()` to unify
the implementation. This patch introduces nsIFrame::IntrinsicISize() so that
derived classes only need to override one method.

`nsBlockFrame`, `ColumnSetWrapperFrame`, and `nsColumnSetFrame` are the only
three classes where their `GetMinISize()` and `GetPrefISize()` have significant
differences. Therefore, we rename `GetMinISize()` and `GetPrefISize()` to
`MinISize()` and `PrefISize`, respectively, and use them as helpers to implement
their `IntrinsicISize()`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D217790
2024-07-26 20:54:56 +00:00
Ting-Yu Lin
e67b56ee4c Bug 1909995 Part 1 - Unify MinISizeFromInline and PrefISizeFromInline in nsLayoutUtils, and move it into nsIFrame. r=layout-reviewers,emilio
Differential Revision: https://phabricator.services.mozilla.com/D217789
2024-07-26 20:54:56 +00:00
Jonathan Kew
5fd21294fa Bug 1908512 - Don't set the NS_HAS_FLOWLENGTH_PROPERTY flag if the property setter actually failed. r=layout-reviewers,emilio
Doesn't change observable behavior.

Differential Revision: https://phabricator.services.mozilla.com/D216859
2024-07-19 17:38:27 +00:00
Jonathan Kew
d92b275d01 Bug 1907772 - Don't attempt to trim letter-spacing at start of line in textframes being used for SVG text. r=longsonr
SVG text elements in general don't have a clearly-defined concept of "lines", so we can't
know where it would be appropriate to trim.

Differential Revision: https://phabricator.services.mozilla.com/D216506
2024-07-15 08:02:18 +00:00
Jonathan Kew
759158947b Bug 1892262 - Trim leading letter-spacing at start of line. r=layout-reviewers,dholbert
Differential Revision: https://phabricator.services.mozilla.com/D215015
2024-06-27 15:13:33 +00:00
Ting-Yu Lin
415f61e85f Bug 1903652 Part 1 - Revert Bug 1901515 Part 3 to rework the performance issue. r=dholbert
This patch is a revert of
https://hg.mozilla.org/mozilla-central/rev/8ea9b9da6922 because the correctness
assumption described in the commit message was wrong. Note that this patch does
not revert the documentation improvement for
`nsSplittableFrame::RemoveFromFlow()` because it is worth keeping.

During frame destruction, `nsBlockFrame::MarkIntrinsicISizesDirty()` can be
called and it accesses `FirstContinuation()`. Thus, it is not acceptable to
allow a stale first-continuation cache during frame destruction.

Differential Revision: https://phabricator.services.mozilla.com/D214658
2024-06-23 04:31:36 +00:00
Ting-Yu Lin
b533834cfd Bug 1901515 Part 3 - Add methods to set previous continuation without updating first continuation cache. r=layout-reviewers,dholbert
The correctness assumption for this patch is that we destroy all frame
continuations when removing an element, so any stale first continuation cache
during frame destruction is acceptable.

Differential Revision: https://phabricator.services.mozilla.com/D213686
2024-06-17 16:40:18 +00:00
Jonathan Kew
f4f26ea3a6 Bug 385615 - Avoid creating zero-length textframes when trying to handle ::first-letter. r=dholbert
This fixes the fuzzer-found assertion reported in bug 1899840, as well as the real-world
website hangs reported in bug 1900169.

In addition, it adds a pref (layout.css.intrinsic-size-first-letter.enabled) that gates
the new functionality during intrinsic size computation. This gives us a way to easily
disable it in the event of other regressions showing up.

Also add the testcase from 1899840 as a wpt crashtest.

Differential Revision: https://phabricator.services.mozilla.com/D212699
2024-06-10 16:58:43 +00:00
Jonathan Kew
b22d16002e Bug 385615 - Revert backout changeset 709248f1fc69, to re-land the original patch stack. (no review)
This reverts the backout, effectively re-landing all the original patches here and the test-manifest
followups that were pushed after the original landing.

Differential Revision: https://phabricator.services.mozilla.com/D212698
2024-06-10 16:58:43 +00:00
Jonathan Kew
64b9727f2c Bug 385615 - Backed out 9 changesets (aec1be189f68, f9c2e5707d43, fe82d67b63ef, 07004e2608f3, f6022837406b, 36fc4e06713d, 30718580670d, 82242b2d942d, 5cd51f055a1a) due to reported regressions.
Differential Revision: https://phabricator.services.mozilla.com/D212435
2024-06-03 15:50:57 +00:00
Emilio Cobos Álvarez
716862543d Bug 1899187 - Use cbindgen for initial-letter. r=firefox-style-system-reviewers,layout-reviewers,boris
Differential Revision: https://phabricator.services.mozilla.com/D211782
2024-05-28 09:37:22 +00:00
Jonathan Kew
1b4dfde53d Bug 385615 - patch 3 - Implement nsTextFrame::SetFirstLetterLength to constrain first-letter during intrinsic-size calculation. r=layout-reviewers,emilio
This is an alternative version of SetLength to be used for the child of an nsFirstLetterFrame,
when we may need to create continuations in order to separate the first-letter from its
following text.

With this, the intrinsic sizes of first-letter should be computed correctly.

Differential Revision: https://phabricator.services.mozilla.com/D211597
2024-05-28 09:08:14 +00:00
Jonathan Kew
fe4894cfd4 Bug 385615 - patch 2 - Determine extent of ::first-letter range during intrinsic-width computation. r=layout-reviewers,emilio
If we're querying the intrinsic widths of a first-letter and its continuation
before they have been reflowed, we need to check the extent of the first-letter
text (similarly to what nsTextFrame::ReflowText does) to avoid measuring too
much of the content using the first-letter styling.

This patch checks the first-letter length during intrinsic size computation,
but does not actually work in most cases because nsTextFrame::SetLength will
bail out if there is not already a next-in-flow frame. The following patch
will address that.

Differential Revision: https://phabricator.services.mozilla.com/D211596
2024-05-28 09:08:13 +00:00
Jonathan Kew
6a750b0653 Bug 385615 - patch 1 - Factor out a GetContentNewLineOffset() helper in nsTextFrame. r=layout-reviewers,emilio
No behavior change here, just factoring out a helper that will be wanted
for the following patch.

Differential Revision: https://phabricator.services.mozilla.com/D211595
2024-05-28 09:08:12 +00:00
Emilio Cobos Álvarez
f9b44817e4 Bug 1899126 - Simplify text-transform representation. r=jwatt
Differential Revision: https://phabricator.services.mozilla.com/D211731
2024-05-27 17:24:10 +00:00
Jonathan Kew
10169b1937 Bug 1890773 - Create a pref to control how letter-spacing is inserted around characters. r=layout-reviewers,emilio
With the pref set to 0 by default, this does not change any existing behavior.

My intention is that a following patch will set it to 2 in Nightly. This will affect
a bunch of reftests, and so test/expectation adjustments will also be needed.

Differential Revision: https://phabricator.services.mozilla.com/D207150
2024-04-11 18:41:37 +00:00
Jan-Niklas Jaeschke
dbaf47b1f4 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-04 14:39:32 +00:00
Stanca Serban
ce5dc60809 Backed out 6 changesets (bug 1867939) for causing wpt failures in target-text-010.html. CLOSED TREE
Backed out changeset 44101c258e52 (bug 1867939)
Backed out changeset c53267e1b460 (bug 1867939)
Backed out changeset 0748839408e5 (bug 1867939)
Backed out changeset 38631fbd2f2f (bug 1867939)
Backed out changeset d77b9257c842 (bug 1867939)
Backed out changeset 0d269b891421 (bug 1867939)
2024-04-04 00:50:50 +03:00
Jan-Niklas Jaeschke
3f695f17a9 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-03 15:23:02 +00:00
Sandor Molnar
7a867184d3 Backed out 6 changesets (bug 1867939) for causing a top crash in nightly Bug 1889393 CLOSED TREE
Backed out changeset 2110f57e928c (bug 1867939)
Backed out changeset 51890598ecb4 (bug 1867939)
Backed out changeset 839bc1b11a2c (bug 1867939)
Backed out changeset bb88c4d09e82 (bug 1867939)
Backed out changeset 27c76e65cf58 (bug 1867939)
Backed out changeset c3e3c81f9ceb (bug 1867939)
2024-04-03 17:31:56 +03:00
Ting-Yu Lin
8a77ebbb16 Bug 1888535 Part 5 - Remove DISPLAY_REFLOW. r=layout-reviewers,emilio
It is used in `Reflow()` implementations.

Differential Revision: https://phabricator.services.mozilla.com/D206317
2024-04-02 19:03:05 +00:00
Jan-Niklas Jaeschke
f46900e678 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 13:44:25 +00:00
Cristian Tuns
9a4d6d56af Backed out 6 changesets (bug 1867939) for causing build bustages in Document.h CLOSED TREE
Backed out changeset 0853f9a7a06c (bug 1867939)
Backed out changeset 2279e6577c13 (bug 1867939)
Backed out changeset 1b3af4b6a27b (bug 1867939)
Backed out changeset 2fbe643ca483 (bug 1867939)
Backed out changeset 575873406614 (bug 1867939)
Backed out changeset 82f99c0210b0 (bug 1867939)
2024-04-02 09:15:46 -04:00
Jan-Niklas Jaeschke
9ce335fcb7 Bug 1867939, part 4: Implemented the ::target-text CSS Pseudo Element. r=emilio,devtools-reviewers,nchevobbe
This patch implements the `::target-text` pseudo element.
Similarly to the Custom Highlight API, this is done implementing
a new Selection type.

Differential Revision: https://phabricator.services.mozilla.com/D195687
2024-04-02 11:43:21 +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
Robert Longson
034f3b85c8 Bug 1816628 Part 2 - Make text-shadow react to stroke properties and fill opacity r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200436
2024-02-28 18:51:23 +00:00
Robert Longson
841e079aa9 Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-28 18:51:23 +00:00
Stanca Serban
1b062c0f39 Backed out 2 changesets (bug 1816628) for causing OS X mochitests-plain failures in test_bug1426594.html.
Backed out changeset e32deae0b0b4 (bug 1816628)
Backed out changeset 3ee753e740b9 (bug 1816628)
2024-02-24 06:38:52 +02:00
Robert Longson
74a41ace0a Bug 1816628 Part 2 - Make text-shadow react to stroke properties and fill opacity r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200436
2024-02-23 23:48:24 +00:00
Robert Longson
0d94aa3378 Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-23 23:48:23 +00:00
Stanca Serban
7235cac1d4 Backed out 2 changesets (bug 1816628) for linux related wr failures in SVGTextFrame.cpp. CLOSED TREE
Backed out changeset d58d91582a84 (bug 1816628)
Backed out changeset ddaf27e9243d (bug 1816628)
2024-02-23 21:37:04 +02:00
Robert Longson
06bad336c9 Bug 1816628 Part 2 - Make text-shadow react to stroke properties and fill opacity r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200436
2024-02-23 16:58:58 +00:00
Robert Longson
9631cdc7fb Bug 1816628 Part 1 - Account for horizontal overflow caused by text-shadow r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D200435
2024-02-23 16:58:58 +00:00
Edgar Chen
7c3453d032 Bug 1878976 - Remove plugin-related code in EventStateManager; r=emilio
`nsIFrame::GetCursor()` can never return `Nothing()` after bug 1687239, which
removes `nsPluginFrame`. Therefore `mLastFrameConsumedSetCursor` in
`EventStateManager` can never be true.

Differential Revision: https://phabricator.services.mozilla.com/D200890
2024-02-07 12:35:27 +00:00