Commit graph

459 commits

Author SHA1 Message Date
Emilio Cobos Álvarez
39aeca9d9c Bug 1449669 - Remove IsNodeOfType. r=longsonr
Depends on D172893

Differential Revision: https://phabricator.services.mozilla.com/D172894
2023-03-17 19:22:14 +00:00
Daniel Holbert
5e1fae40b6 Bug 1821797: Don't bother storing an unused value in nsBidiPresUtils::ProcessText's "dir" local variable. r=jfkthame
This patch doesn't change behavior.

Before this patch, we're calling GetVisualRun and storing its return value (a
BidiDirection), but really we only care about the function's outparam (captured
in 'start'), and we never use the return value.

So, let's just stop capturing the return value.  This addresses a clang-tidy
automated review nit.

Differential Revision: https://phabricator.services.mozilla.com/D172325
2023-03-11 20:12:50 +00:00
Daniel Holbert
30e124c2ef Bug 1821735 part 3: Change nsBidiPresUtils::ProcessText aBidiEngine param to a reference instead of a pointer. r=jfkthame
The function requires this arg to be non-null; and at all of the callsites,
we're working with a reference or an actual instance, so there's no reason for
us to convert to a pointer at the API boundary.

Differential Revision: https://phabricator.services.mozilla.com/D172302
2023-03-10 21:58:44 +00:00
Daniel Holbert
1f9c5e8d05 Bug 1821735 part 2: Drop 'Get' prefix from 'nsPresContext::GetBidiEngine' since it's infallible. r=jfkthame
For pointer-type getters, we have a convention that a "Get" prefix implies
"warning, this might return null" , whereas lack-of-a-"Get" implies that the
return value is guaranteed to be non-null.

In the case of this `GetBidiEngine` API, this convention doesn't directly apply
since the return value isn't pointer-typed. But it's still backed by a
dynamically-allocated resource which we dereference at the return statement,
and some of the callers take the pointer-value of what's returned and pass that
along elsewhere. So it's helpful (and more concise) to drop "Get" to convey
that yes, we're sure the returned thing is indeed a real object.

Differential Revision: https://phabricator.services.mozilla.com/D172301
2023-03-10 21:58:44 +00:00
Jonathan Kew
cdd8362576 Bug 1821469 - Ensure separator characters etc are removed before calling nsBidiPresUtils::ProcessText. r=dholbert
This used to be done within ProcessText itself, but that was semi-redundant when called from Canvas2d;
so we now consistently expect the caller to have removed unwanted separator/control characters.

Differential Revision: https://phabricator.services.mozilla.com/D172286
2023-03-10 17:56:14 +00:00
Jonathan Kew
29b7c0030c Bug 1820988 followup, use nsDependentSubstring in the assertion, because the text may not be null-terminated.
Differential Revision: https://phabricator.services.mozilla.com/D172042
2023-03-08 20:52:42 +00:00
Jonathan Kew
d4acd4cc3e Bug 1820988 - Rename ProcessOneChar to ProcessSimpleRun, and allow it to also handle purely-LTR strings. r=emilio
This is the significant change here: extend the single-character fast-path that skips
bidi processing to also handle strings that are confirmed to have no bidi content.
In such cases, we don't need to pass the text to a Bidi engine for analysis at all.

Depends on D171988

Differential Revision: https://phabricator.services.mozilla.com/D171989
2023-03-08 18:28:09 +00:00
Jonathan Kew
126501f7b5 Bug 1820988 - Use 'using' to eliminate a bunch of explicit namespace-prefix usage in nsBidiPresUtils. r=emilio
Just to reduce visual clutter in the code, for readability.

Depends on D171987

Differential Revision: https://phabricator.services.mozilla.com/D171988
2023-03-08 18:28:09 +00:00
Jonathan Kew
e746d47f7e Bug 1820988 - Handle separator characters in canvas2d TextReplaceWhitespaceCharacters, to avoid a second preprocessing of the string in ProcessText. r=gfx-reviewers,aosmond
This avoids an extra string copy/scan in ProcessText, by including the block/segment
separators it cares about in the preprocessing that's already being done to normalize
whitespace characters by the caller.

Depends on D171986

Differential Revision: https://phabricator.services.mozilla.com/D171987
2023-03-08 18:28:08 +00:00
Jonathan Kew
533e50d65c Bug 1820988 - Remove unused bidiEngine parameter to CalculateBidiClass. r=emilio
This function doesn't need a Bidi engine, it just does property lookups
via the intl API. So drop the redundant parameter.

Depends on D171985

Differential Revision: https://phabricator.services.mozilla.com/D171986
2023-03-08 18:28:08 +00:00
Jonathan Kew
bf79ec48b8 Bug 1820988 - The width parameter to BidiProcessor::DrawText is not used by any implementation, so remove it. r=emilio
I guess this used to be needed somewhere, but it's long dead now.
Removing the parameter makes it clear that the caller doesn't need
to compute and pass it.

Depends on D171984

Differential Revision: https://phabricator.services.mozilla.com/D171985
2023-03-08 18:28:08 +00:00
Jonathan Kew
2a37b7c81c Bug 1819726 - Handle bidi for rb and rt boxes. r=emilio
Patch proposed by Xidorn appears to work as expected. Added testcase to WPT.

Differential Revision: https://phabricator.services.mozilla.com/D171445
2023-03-02 15:52:44 +00:00
Ben Freist
a0881d2bec Bug 1801458 - [refactor] Migrate NS_STYLE_UNICODE_BIDI_* defines r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D162487
2022-11-22 18:37:02 +00:00
Ting-Yu Lin
514d412f9b Bug 1799732 Part 3 - Convert FrameChildListID to enum class. r=emilio
This patch is first generated by the following script under gecko root folder.

```
#!/bin/bash

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "kPrincipalList" "FrameChildListID::Principal"
rename "kPopupList" "FrameChildListID::Popup"
rename "kCaptionList" "FrameChildListID::Caption"
rename "kColGroupList" "FrameChildListID::ColGroup"
rename "kAbsoluteList" "FrameChildListID::Absolute"
rename "kFixedList" "FrameChildListID::Fixed"
rename "kOverflowList" "FrameChildListID::Overflow"
rename "kOverflowContainersList" "FrameChildListID::OverflowContainers"
rename "kExcessOverflowContainersList" "FrameChildListID::ExcessOverflowContainers"
rename "kOverflowOutOfFlowList" "FrameChildListID::OverflowOutOfFlow"
rename "kFloatList" "FrameChildListID::Float"
rename "kBulletList" "FrameChildListID::Bullet"
rename "kPushedFloatsList" "FrameChildListID::PushedFloats"
rename "kBackdropList" "FrameChildListID::Backdrop"
rename "kNoReflowPrincipalList" "FrameChildListID::NoReflowPrincipal"
```

And then:
1. Manually fix `FrameChildListID` definition in nsFrameList.h.
2. Apply clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D161864
2022-11-12 04:38:53 +00:00
Ting-Yu Lin
c565d29604 Bug 1799732 Part 2 - Flatten the namespace for FrameChildList and co. by removing namespace layout. r=emilio
After moving FrameChildListID into mozilla namespace, `kPrincipalList` etc. are
also exposed in the mozilla namespace. In the next part, I'll convert
FrameChildListID enum into an enum class, so the naming pollution shouldn't be
an issue.

This patch has a nice side effect that it is now easier to remove all the
aliases of FrameChildListID (`kPrincipalList` etc.) defined in multiple places
since it is confusion to have the same thing written in different ways, e.g.
`nsIFrame::kPrincipalList`, `mozilla::layout::kPrincipalList`,
`FrameChildListID::kPrincipalList`, `kPrincipalList`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D161863
2022-11-12 04:38:53 +00:00
Noemi Erli
7c40c0e983 Backed out 3 changesets (bug 1799732) for causing build bustages in nsIFrame.cpp CLOSED TREE
Backed out changeset e559f9dbc76f (bug 1799732)
Backed out changeset c40fda7a8b0b (bug 1799732)
Backed out changeset 1f84bfb41ab8 (bug 1799732)
2022-11-12 02:16:45 +02:00
Ting-Yu Lin
192956df1b Bug 1799732 Part 3 - Convert FrameChildListID to enum class. r=emilio
This patch is first generated by the following script under gecko root folder.

```
#!/bin/bash

function rename() {
    echo "Renaming $1 to $2"
    rg -l "$1" | xargs sed -i -E -e s/"$1"/"$2"/g
}

rename "kPrincipalList" "FrameChildListID::Principal"
rename "kPopupList" "FrameChildListID::Popup"
rename "kCaptionList" "FrameChildListID::Caption"
rename "kColGroupList" "FrameChildListID::ColGroup"
rename "kAbsoluteList" "FrameChildListID::Absolute"
rename "kFixedList" "FrameChildListID::Fixed"
rename "kOverflowList" "FrameChildListID::Overflow"
rename "kOverflowContainersList" "FrameChildListID::OverflowContainers"
rename "kExcessOverflowContainersList" "FrameChildListID::ExcessOverflowContainers"
rename "kOverflowOutOfFlowList" "FrameChildListID::OverflowOutOfFlow"
rename "kFloatList" "FrameChildListID::Float"
rename "kBulletList" "FrameChildListID::Bullet"
rename "kPushedFloatsList" "FrameChildListID::PushedFloats"
rename "kBackdropList" "FrameChildListID::Backdrop"
rename "kNoReflowPrincipalList" "FrameChildListID::NoReflowPrincipal"
```

And then:
1. Manually fix `FrameChildListID` definition in nsFrameList.h.
2. Apply clang-format.

Differential Revision: https://phabricator.services.mozilla.com/D161864
2022-11-11 23:44:17 +00:00
Ting-Yu Lin
75940b1777 Bug 1799732 Part 2 - Flatten the namespace for FrameChildList and co. by removing namespace layout. r=emilio
After moving FrameChildListID into mozilla namespace, `kPrincipalList` etc. are
also exposed in the mozilla namespace. In the next part, I'll convert
FrameChildListID enum into an enum class, so the naming pollution shouldn't be
an issue.

This patch has a nice side effect that it is now easier to remove all the
aliases of FrameChildListID (`kPrincipalList` etc.) defined in multiple places
since it is confusion to have the same thing written in different ways, e.g.
`nsIFrame::kPrincipalList`, `mozilla::layout::kPrincipalList`,
`FrameChildListID::kPrincipalList`, `kPrincipalList`.

This patch doesn't change behavior.

Differential Revision: https://phabricator.services.mozilla.com/D161863
2022-11-11 23:44:16 +00:00
Ting-Yu Lin
040feb02dd Bug 1798373 Part 7 - Change nsContainerFrame::InsertFrames() to take rvalue reference of nsFrameList. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D160843
2022-11-01 21:15:55 +00:00
Ting-Yu Lin
ce9040c985 Bug 1794035 Part 4 - Use range-based for loops to iterate nsFrameList. r=emilio
After this patch, we still need nsFrameList::Enumerator to iterate
nsFrameList::Slice. We might enhance nsFrameList::Iterator to support Slice, but
I'll leave this for another day.

Differential Revision: https://phabricator.services.mozilla.com/D158809
2022-10-07 01:41:41 +00:00
Jonathan Kew
de80d21977 Bug 1110580 - patch 2 - Provide a simplified codepath for nsBidiPresUtils::ProcessText in the case where it is handling a single Unicode character. r=lsalzman
Specifically, pdf.js does a lot of single-character fillText calls, which will hit this path.

Differential Revision: https://phabricator.services.mozilla.com/D145427
2022-05-05 08:14:11 +00:00
Jonathan Kew
c94c08270b Bug 1759686 - patch 5 - Adapt canvas2d text methods to allow use from worker threads without a Document or PresShell. r=aosmond
This enables an offscreen-canvas Worker to do text rendering, but only with system-installed fonts
because we don't yet have a FontFaceSet available in the Worker. (That's bug 1758946.)

Differential Revision: https://phabricator.services.mozilla.com/D144188
2022-05-04 17:13:16 +00:00
Dan Minor
d7fc551211 Bug 1719554 - Unify nsCharType as intl::BidiClass; r=platform-i18n-reviewers,jfkthame,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132275
2021-12-06 18:15:49 +00:00
Butkovits Atila
56c46d06a1 Backed out 3 changesets (bug 1719554) for causing bustages complaining about gfxTextRun.cpp.
Backed out changeset 6181e40d4da1 (bug 1719554)
Backed out changeset c261ede6ae81 (bug 1719554)
Backed out changeset 221ec418475c (bug 1719554)
2021-12-04 00:58:15 +02:00
Dan Minor
8d9076933e Bug 1719554 - Unify nsCharType as intl::BidiClass; r=platform-i18n-reviewers,jfkthame,gregtatum
Differential Revision: https://phabricator.services.mozilla.com/D132275
2021-12-03 20:49:31 +00:00
Greg Tatum
ec908112f4 Bug 1738057 - Split out BidiEmbeddingLevel into its own file; r=platform-i18n-reviewers,dminor
This should speed up re-compile times, as mozilla/intl/Bidi.h will only
be included in a few places.

Differential Revision: https://phabricator.services.mozilla.com/D129662
2021-11-16 15:11:58 +00:00
Greg Tatum
ee2694c97d Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-20 14:01:21 +00:00
Butkovits Atila
01c5e2aed8 Backed out 3 changesets (bug 1719546) for causing SM bustages at Bidi.h. CLOSED TREE
Backed out changeset c4d6ffc7e445 (bug 1719546)
Backed out changeset a1f7ed6c4251 (bug 1719546)
Backed out changeset e69fc596f2c3 (bug 1719546)
2021-10-19 21:09:47 +03:00
Greg Tatum
f250d90114 Bug 1719546 - Replace nsBidi with mozilla::intl::Bidi; r=platform-i18n-reviewers,dminor
Differential Revision: https://phabricator.services.mozilla.com/D128793
2021-10-19 16:55:36 +00:00
Kagami Sascha Rosylight
55dbc99e55 Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 23:54:06 +00:00
Butkovits Atila
53cb932555 Backed out changeset aa6c7477c4d2 (bug 1713491) for causing build bustages on nsIFrame.cpp. CLOSED TREE 2021-06-12 00:12:06 +03:00
Kagami Sascha Rosylight
9d0b659349 Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 18:53:28 +00:00
Dorel Luca
e1f4d9bb38 Backed out changeset 17e7b969b830 (bug 1713491) for Linux build bustage in gecko/dom/events/ContentEventHandler.cpp. CLOSED TREE 2021-06-11 17:52:10 +03:00
Kagami Sascha Rosylight
74760a9a0e Bug 1713491 - Return std::pair from nsIFrame::GetOffsets r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D117520
2021-06-11 11:37:11 +00:00
Simon Giesecke
ad01a10a3b Bug 1634281 - Use nsTHashMap instead of nsDataHashtable. r=xpcom-reviewers,necko-reviewers,jgilbert,nika,valentin
Note that this patch only transforms the use of the nsDataHashtable type alias
to a directly equivalent use of nsTHashMap. It does not change the specification
of the hash key type to make use of the key class deduction that nsTHashMap
allows for in some cases. That can be done in a separate step, but requires more
attention.

Differential Revision: https://phabricator.services.mozilla.com/D106008
2021-03-10 10:47:47 +00:00
Simon Giesecke
be7dc83fa6 Bug 1691913 - Mark nsBaseHashtable (and its subclasses') member functions nodiscard where appropriate. r=xpcom-reviewers,necko-reviewers,dragana,nika
Differential Revision: https://phabricator.services.mozilla.com/D105474
2021-02-26 09:22:53 +00:00
Simon Giesecke
9af107a839 Bug 1691913 - Rename nsBaseHashtable::Put to InsertOrUpdate. r=xpcom-reviewers,necko-reviewers,jgilbert,dragana,nika
This makes the naming more consistent with other functions called
Insert and/or Update. Also, it removes the ambiguity whether
Put expects that an entry already exists or not, in particular because
it differed from nsTHashtable::PutEntry in that regard.

Differential Revision: https://phabricator.services.mozilla.com/D105473
2021-02-26 09:11:46 +00:00
tanweerali
8cdf45f9f7 Bug 1688502 - [Core] Remove else if condition after break in layout/base/nsBidiPresUtils.cpp#1338. r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D103701
2021-02-02 21:50:42 +00:00
Simon Giesecke
1e02318b49 Bug 1653335 - Replace MakeSpan uses by constructor calls. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D83817
2020-08-07 07:49:47 +00:00
Philipp Zech
3d4be168ae Bug 1648938 - Convert writing-modes #defines to an enum class. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D84016
2020-07-23 21:31:23 +00:00
Jonathan Kew
b56c4b385c Bug 1646639 - Don't recursively apply the line's start-offset and text-indent to children of a first-line frame. r=dholbert
But do apply any adjustment needed for text-align to the first-line frame itself.

Differential Revision: https://phabricator.services.mozilla.com/D82725
2020-07-11 22:52:41 +00:00
Razvan Maries
d80f844cba Backed out 2 changesets (bug 1646639) for perma failures on first-line-bidi-002.html. CLOSED TREE
Backed out changeset e1d587422484 (bug 1646639)
Backed out changeset 5caaf51dac99 (bug 1646639)
2020-07-12 01:34:31 +03:00
Jonathan Kew
953fcef392 Bug 1646639 - Don't recursively apply the line's start-offset and text-indent to children of a first-line frame. r=dholbert
But do apply any adjustment needed for text-align to the first-line frame itself.

Differential Revision: https://phabricator.services.mozilla.com/D82725
2020-07-11 21:26:02 +00:00
Kagami Sascha Rosylight
874fc4b1a7 Bug 1647525 - Use HasAnyStateBits() in nsBidiPresUtils r=emilio
Depends on D81090

Differential Revision: https://phabricator.services.mozilla.com/D81091
2020-06-25 14:07:33 +00:00
Simon Giesecke
82dc9b2271 Bug 1642949 - Replace uses of RemoveElementAt by RemoveLastElement/PopLastElement where possible. r=necko-reviewers,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78027
2020-06-10 10:46:14 +00:00
Butkovits Atila
e3dce68834 Backed out 3 changesets (bug 1643289, bug 1642949) for causing failure at test_headless_screenshot.html. CLOSED TREE
Backed out changeset 98c420f73380 (bug 1643289)
Backed out changeset 9447ea8910aa (bug 1643289)
Backed out changeset 0c827da9d847 (bug 1642949)
2020-06-10 10:07:23 +03:00
Simon Giesecke
d419f0ff08 Bug 1642949 - Replace uses of RemoveElementAt by RemoveLastElement/PopLastElement where possible. r=necko-reviewers,froydnj
Differential Revision: https://phabricator.services.mozilla.com/D78027
2020-06-10 05:49:28 +00:00
Mirko Brodesser
33bac859bb Bug 1626665: part 3) Declare more methods around nsTextFrame const. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D69573

--HG--
extra : moz-landing-system : lando
2020-04-06 08:36:30 +00:00
Ting-Yu Lin
afe9123179 Bug 1622008 Part 3 - Remove nsPresContext* and PresShell* from the argument list of some continuing-frame-creation methods. r=dholbert
Both PresShell() and PresContext() are cached in nsIFrame. This
simplifies the setup for the callers to
nsCSSFrameConstructor::CreateContinuingFrame().

Differential Revision: https://phabricator.services.mozilla.com/D66600

--HG--
extra : moz-landing-system : lando
2020-03-12 21:50:23 +00:00
Emilio Cobos Álvarez
a25126cd0d Bug 1611181 - Make direction use an enum class. r=boris
Differential Revision: https://phabricator.services.mozilla.com/D60857

--HG--
extra : moz-landing-system : lando
2020-01-24 11:46:14 +00:00