Граф коммитов

195 Коммитов

Автор SHA1 Сообщение Дата
Masayuki Nakano 82e2013683 Bug 1735446 - part 4: Make `Selection::GetRangeAt()` take `uint32_t` instead of `int32_t` r=smaug
It's an internal API corresponding to `Selection.getRangeAt` DOM API.
I think that it should use `uint32_t` rather than `size_t` because of the
consistency with the DOM API and `Selection::RangeCount()`.

This patch fixes all callers of `GetRangeAt()`, and rewrites it with ranged-
loops unless original ones do not refer `RangeCount()` every time and may run
script in the loop.

Differential Revision: https://phabricator.services.mozilla.com/D128848
2021-12-09 07:35:09 +00:00
Dan Minor e12c3387e8 Bug 1719554 - Unify most of nsUnicodeProperties.h; r=platform-i18n-reviewers,jfkthame,gregtatum,necko-reviewers,valentin
This unifies most of the calls in nsUnicodeProperties.h. CharType and Script
will be handled in subsequent patches on this bug.

Differential Revision: https://phabricator.services.mozilla.com/D132273
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 c0ebed22d3 Bug 1719554 - Unify most of nsUnicodeProperties.h; r=platform-i18n-reviewers,jfkthame,gregtatum,necko-reviewers,valentin
This unifies most of the calls in nsUnicodeProperties.h. CharType and Script
will be handled in subsequent patches on this bug.

Differential Revision: https://phabricator.services.mozilla.com/D132273
2021-12-03 20:49:31 +00:00
Ting-Yu Lin c2f6ef7a09 Bug 1736938 Part 3 - Make all WordBreaker's methods static, and adapt the callers. r=jfkthame
The motivation is the same as the previous part.

Differential Revision: https://phabricator.services.mozilla.com/D129109
2021-10-25 19:00:22 +00:00
Ting-Yu Lin f8152b2b24 Bug 1730084 Part 5 - Remove WordBreaker::BreakInBetween(). r=jfkthame
The motivation of this patch is to remove rarely used API in
WordBreaker. WordBreaker::BreakInBetween() is used only in
nsFind::BreakInBetween() in production, and it can be replaced by
Next().

If the user wants to know whether there is a word break between two
strings such as the use cases in gtest, joining the two strings and
passing the result to Next() is the preferred way.

Note: I delete the buggy forward word search algorithm in
TestFindWordBreakFromPosition() because from the test expectations, it
doesn't expect to continue the search in previous fragments. Also, the
buggy part comes from the following code, which had undefined behavior
before Part 4, and does nothing after Part 4.

```
wbk->FindWord(prevFragText.get(), prevFragText.Length(), prevFragText.Length());
```

Differential Revision: https://phabricator.services.mozilla.com/D125151
2021-09-13 23:55:33 +00:00
Ting-Yu Lin d801856fe0 Bug 1730084 Part 3 - Remove unused declaration in nsFind.h. r=jfkthame
nsFindContentIterator was removed in Bug 1455891.
https://hg.mozilla.org/mozilla-central/rev/2eca66a467ee

Differential Revision: https://phabricator.services.mozilla.com/D125150
2021-09-13 23:55:33 +00:00
Ting-Yu Lin 1cb1be5597 Bug 1730084 Part 2 - Change nextChar from char16_t to char32_t in nsFind::Find(). r=jfkthame
nextChar gets its value from DecodeChar() and PeekNextChar(), and both
functions return char32_t. It also passes as a char32_t argument to
BreakInBetween(). Therefore it really should have 32 bits to avoid
potential truncation.

Differential Revision: https://phabricator.services.mozilla.com/D125149
2021-09-13 23:55:32 +00:00
Andi-Bogdan Postelnicu 2fc4f70e9b Bug 1725145 - Preparation for the hybrid build env. r=necko-reviewers,firefox-build-system-reviewers,valentin,glandium
Automatically generated path that adds flag `REQUIRES_UNIFIED_BUILD = True` to `moz.build`
when the module governed by the build config file is not buildable outside on the unified environment.

This needs to be done in order to have a hybrid build system that adds the possibility of combing
unified build components with ones that are built outside of the unified eco system.

Differential Revision: https://phabricator.services.mozilla.com/D122345
2021-08-25 10:46:17 +00:00
Emilio Cobos Álvarez 2b0eae6061 Bug 1715134 - Make form control type an enum class. r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D117087
2021-06-08 09:43:59 +00:00
Emilio Cobos Álvarez 9d38e5590e Bug 1704167 - When a pattern ends in whitespace, try to collapse adjacent white-space. r=jfkthame
This I'm not 100% sure. Should be harmless, but it's a bit subtle.
Maybe we should special-case it with "we're at the beginning of the
pattern"? Reasoning below:

The previous patch restores the performance of the original test-case.

However, if you go to the reduced test-case and try to type " re" in the
findbar, we still take a long time. The reason for that is not that the
previous patch is not effective, but that the findbar sends find
requests as soon as you type, and thus we end up with a request to find
" ", which matches a gazillion spaces in the page and causes us to use
tons of memory and time. Finding " re" is actually super-fast :-)

This fixes it, but it is a bit subtle, so thoughts? Perhaps the findbar
should wait a bit to perform the search before sending a query for " "
instead or something? But I'd rather make it fast.

Differential Revision: https://phabricator.services.mozilla.com/D111634
2021-04-12 16:11:21 +00:00
Emilio Cobos Álvarez f31b6993b8 Bug 1704167 - Don't rewind if we're still at the beginning of the pattern. r=jfkthame
This can happen with whitespace, and can cause us to scan whitespace
exponentially. Should be straight-forward and have no behavior change.

This restores the performance characteristics of the findbar before
the regressing bug.

Differential Revision: https://phabricator.services.mozilla.com/D111633
2021-04-12 16:04:02 +00:00
Alex Henrie f8f015b22e Bug 1649187 - Fix diacritic stripping for characters outside the BMP. r=jfkthame
Due to an unfortunate typo I made in base_chars.py, I thought that there
were no mappings we care about outside of the basic multilingual plane.
This patch adds back the non-BMP mappings that we do care about.

Differential Revision: https://phabricator.services.mozilla.com/D107404
2021-03-10 12:08:49 +00:00
Alex Henrie 0686831376 Bug 1649187 - Use a fallback table to strip diacritics from non-decomposable characters. r=jfkthame
Implement the design suggested at
https://bugzilla.mozilla.org/show_bug.cgi?id=1652910#c5

Differential Revision: https://phabricator.services.mozilla.com/D106674
2021-03-07 16:17:41 +00:00
Kagami Sascha Rosylight 717d5d2aa5 Bug 1671768 - Part 4: Use MOZ_CAN_RUN_SCRIPT for Selection::RemoveAllRanges r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D103780
2021-02-03 21:52:48 +00:00
Kagami Sascha Rosylight 9fc2fee9e3 Bug 1680167 - Part 8: MOZ_CAN_RUN_SCRIPT_BOUNDARY in toolkit r=masayuki
Differential Revision: https://phabricator.services.mozilla.com/D98631
2020-12-03 22:58:14 +00:00
Simon Giesecke 971b645fe3 Bug 1660470 - Add missing include directives/forward declarations. r=nika
Differential Revision: https://phabricator.services.mozilla.com/D87865
2020-11-23 16:21:38 +00:00
Ricky Stewart 02a7b4ebdf Bug 1654103: Standardize on Black for Python code in `mozilla-central`.
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-26 18:34:53 +00:00
Bogdan Tara da1098d4aa Backed out 10 changesets (bug 1654103, bug 1672023, bug 1518999) for PanZoomControllerTest.touchEventForResult gv-junit failures CLOSED TREE
Backed out changeset ff3fb0b4a512 (bug 1672023)
Backed out changeset e7834b600201 (bug 1654103)
Backed out changeset 807893ca8069 (bug 1518999)
Backed out changeset 13e6b92440e9 (bug 1518999)
Backed out changeset 8b2ac5a6c98a (bug 1518999)
Backed out changeset 575748295752 (bug 1518999)
Backed out changeset 65f07ce7b39b (bug 1518999)
Backed out changeset 4bb80556158d (bug 1518999)
Backed out changeset 8ac8461d7bd7 (bug 1518999)
Backed out changeset e8ba13ee17f5 (bug 1518999)
2020-10-24 03:36:18 +03:00
Ricky Stewart c0cea3b0fa Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Make some ad-hoc manual updates to `testing/marionette/client/setup.py`, `testing/marionette/harness/setup.py`, and `testing/firefox-ui/harness/setup.py`, which have hard-coded regexes that break after the reformat.

5. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-23 20:40:42 +00:00
Dorel Luca 1ff59cb7a3 Backed out changeset 7558c8821a07 (bug 1654103) for multiple failures. CLOSED TREE 2020-10-22 03:51:06 +03:00
Ricky Stewart 50762dacab Bug 1654103: Standardize on Black for Python code in `mozilla-central`. r=remote-protocol-reviewers,marionette-reviewers,webdriver-reviewers,perftest-reviewers,devtools-backward-compat-reviewers,jgilbert,preferences-reviewers,sylvestre,maja_zf,webcompat-reviewers,denschub,ntim,whimboo,sparky
Allow-list all Python code in tree for use with the black linter, and re-format all code in-tree accordingly.

To produce this patch I did all of the following:

1. Make changes to tools/lint/black.yml to remove include: stanza and update list of source extensions.

2. Run ./mach lint --linter black --fix

3. Make some ad-hoc manual updates to python/mozbuild/mozbuild/test/configure/test_configure.py -- it has some hard-coded line numbers that the reformat breaks.

4. Add a set of exclusions to black.yml. These will be deleted in a follow-up bug (1672023).

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D94045
2020-10-21 21:27:27 +00:00
Emilio Cobos Álvarez 29b27e6d30 Bug 389651 - Make find-in-page ignore non-matching default-ignorable characters. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D90461
2020-09-16 22:54:38 +00:00
Emilio Cobos Álvarez 4efeec4b9d Bug 1663411 - Improve the speed of find-in-page when ending a pseudo-element mid-match. r=jfkthame
So what's going on here is that there are pseudo-elements that contain
stuff like content: "Note" or content: "Example".

So when you're searching for "entry", we find the `e`, and then all the
text nodes afterwards are of course in a different subtree... So we end
up ignoring them, but after having iterated through all the DOM first.

To avoid this, change a bit the code so that we check for different
blocks _before_ checking for different subtrees. There's no point to
keep matching once you're done with a block.

Differential Revision: https://phabricator.services.mozilla.com/D89365
2020-09-07 13:40:36 +00:00
Emilio Cobos Álvarez b595041e81 Bug 1659897 - Rewind if needed when hitting a forced break in find-in-page. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D87584
2020-08-28 09:46:15 +00:00
Razvan Maries 695a7a469b Backed out changeset 0d8222cd72dc (bug 1659897) for perma failures on browser_ext_find.js. CLOSED TREE 2020-08-20 22:59:03 +03:00
Emilio Cobos Álvarez 920d957119 Bug 1659897 - Rewind if needed when hitting a forced break in find-in-page. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D87584
2020-08-20 17:52:16 +00:00
Emilio Cobos Álvarez 36cd507c54 Bug 1654683 - Avoid failing to set the search range for find due to nsRange security checks. r=smaug
We should probably switch nsRange to use CallerType instead of implicit
JSContext checks?

Differential Revision: https://phabricator.services.mozilla.com/D84803
2020-07-24 16:52:33 +00:00
Emilio Cobos Álvarez 388222cf6a Bug 1654270 - Properly restart after a partial match if we reach the end of the document. r=jfkthame
This was kind of a pre-existing bug, though not surfaced because we
didn't have conditionally-appearing text nodes I guess.

If we are doing a match in a non-anonymous subtree, we'd skip the
anonymous text (that's alright). But if we actually reach the end of the
document (as it is the case on the test that starts failing with the
other patch in this bug), we'd just early-return, rather than restarting
where we left off, which is not fine and means that potential matches in
anonymous subtrees that were skipped won't show up.

This fixes the bug... Eventually we should probably come up with a
better structure than this gigantic while (true), probably moving all
these variables into their own struct, but today is not that day :)

Differential Revision: https://phabricator.services.mozilla.com/D84425
2020-07-22 15:32:44 +00:00
Emilio Cobos Álvarez c21099505b Bug 1654270 - When an ongoing match crosses an anonymous boundary, ignore it instead of forcing the end of the match. r=jfkthame
This restores our previous behavior when matching across anonymous
boundaries, as that's not something we currently can support because DOM
ranges can't represent that.

Differential Revision: https://phabricator.services.mozilla.com/D84397
2020-07-22 15:32:44 +00:00
Dorel Luca d5bec2cd58 Backed out changeset f91b6b609218 (bug 1654270) for Mochitest failure in chrome/test_bug451540.xhtml. CLOSED TREE 2020-07-21 22:28:09 +03:00
Emilio Cobos Álvarez b77f0756a2 Bug 1654270 - When an ongoing match crosses an anonymous boundary, ignore it instead of forcing the end of the match. r=jfkthame
This restores our previous behavior when matching across anonymous
boundaries, as that's not something we currently can support because DOM
ranges can't represent that.

Differential Revision: https://phabricator.services.mozilla.com/D84397
2020-07-21 17:32:39 +00:00
Emilio Cobos Álvarez 69bd04067f Bug 1650444 - Explicitly disallow finding in <input type=password>. r=jfkthame
Maybe if / when we have a native way to allow showing the password we
can lift this if the password is visible or what not. Until then this is
just confusing.

Differential Revision: https://phabricator.services.mozilla.com/D82296
2020-07-06 15:05:47 +00:00
Emilio Cobos Álvarez 77e8fe49d3 Bug 1650444 - Remove browser.find.anonymous_content.enabled. r=jfkthame
Other than this, there hasn't been any other major regression since we
introduced that switch. I don't think there's a point in keeping it
around.

Differential Revision: https://phabricator.services.mozilla.com/D82297
2020-07-06 15:05:49 +00:00
Tilden Windsor 6f2e45cfda Bug 1629604 - Fixed phrase not found in visible <script> and added a test for visible <script>. r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D75824
2020-05-18 21:28:46 +00:00
Mirko Brodesser b547d18451 Bug 1634663: part 5) Declare callers of `Selection::GetRangeAt` around toolkit/components/find `const`. r=masayuki
Depends on D73447

Differential Revision: https://phabricator.services.mozilla.com/D73448
2020-05-02 23:48:06 +00:00
Emilio Cobos Álvarez 5ab0ed1477 Bug 1633828 - Check for empty text nodes in nsFind::PeekNextChar. r=jfkthame
This check was done in GetNextNonEmptyTextFragmentInSameBlock which I
removed in bug 1627643.

Hopefully the fuzzer finds an easy reduced test-case to land as a
crashtest, otherwise I can try to construct one.

Differential Revision: https://phabricator.services.mozilla.com/D72926
2020-05-01 14:26:25 +00:00
Emilio Cobos Álvarez 5bb31e3f1d Bug 1633195 - Make sure <br> forces a break even if there's no whitespace in between. r=jfkthame
Wrote this on top of bug 1627643. Should be easy to rebase if needed,
though.

Differential Revision: https://phabricator.services.mozilla.com/D72541
2020-04-28 10:31:22 +00:00
Emilio Cobos Álvarez 8cfb840466 Bug 1627643 - Allow to find and display selection native anonymous content. r=jfkthame
The check for generated content in nsTextFrame is to the best of my
knowledge useless: We don't display generated content as selected when
the parent is selected anyhow, and the offsets would be wrong.

We special-case text inputs and textarea because of ::placeholder, see
the comment, but otherwise there's no reason you shouldn't be able to
find-in-page generated content / fallback / etc.

I added ForceBreakBetween so as to not create ranges that span across
shadow / anonymous content boundaries. They don't work anyway (see the
TODO in test_find.html), so it seems better to make that explicit until
we properly handle them (bug 1590379).

I added a pref just to be safe since this is long-standing behavior, but
I think it should be uncontroversial.

Differential Revision: https://phabricator.services.mozilla.com/D72447
2020-04-27 13:56:04 +00:00
Sylvestre Ledru 34acbb653a Bug 1619165 - Reformat recent changes to the Google coding style r=andi
First reformat with clang-format 10

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D68802
2020-04-25 09:40:08 +00:00
Emilio Cobos Álvarez 142b7d3c57 Bug 1629096 - Always honor scroll-margin / scroll-padding from nsFocusManager. r=masayuki
We should always do this, otherwise stuff may not end up being visible which is
not acceptable for focus navigation.

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

--HG--
extra : moz-landing-system : lando
2020-04-13 11:34:48 +00:00
Mirko Brodesser ec9cb4d8ef Bug 1622199: annotate `Selection::AddRangeAndSelectFramesAndNotifyListeners` with `MOZ_CAN_RUN_SCRIPT`. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D66759

--HG--
extra : moz-landing-system : lando
2020-03-13 15:46:13 +00:00
Simon Giesecke 8ad76c7e47 Bug 1613985 - Use default for equivalent-to-default constructors/destructors in toolkit. r=mossop
Depends on D66008

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

--HG--
extra : moz-landing-system : lando
2020-03-10 08:48:24 +00:00
Simon Van Accoleyen 3006ffb76d Bug 1619619 - DeCOMtaminate accesses to nsFocusManager r=Gijs
Differential Revision: https://phabricator.services.mozilla.com/D65884

--HG--
extra : moz-landing-system : lando
2020-03-09 09:51:46 +00:00
Sylvestre Ledru ca6530131a Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan,kvark
# ignore-this-changeset

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

--HG--
extra : moz-landing-system : lando
2020-02-24 15:33:38 +00:00
Emilio Cobos Álvarez 7ee58cb469 Bug 1601118 - Fix nsFind state initialization logic. r=smaug
We should start seeking from the child-at-start/end-offset, rather than the
selection container.

The logic to select the starting node was backwards too...

If we're finding backwards we want to start looking from the beginning of the
range and vice versa. But I think that doesn't really matter since
nsWebBrowserFind always gives us a start range with start == end.

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

--HG--
extra : moz-landing-system : lando
2020-02-21 17:41:34 +00:00
Mihai Alexandru Michis 1c3183cf0a Backed out changeset 9a03944aff45 (bug 1601118) for causing AssertionError in geckoview.test.FinderTest
CLOSED TREE
2020-02-21 16:14:06 +02:00
Emilio Cobos Álvarez aa5e974d27 Bug 1601118 - Fix nsFind state initialization logic. r=smaug
We should start seeking from the child-at-start/end-offset, rather than the
selection container.

The logic to select the starting node was backwards too...

If we're finding backwards we want to start looking from the beginning of the
range and vice versa. But I think that doesn't really matter since
nsWebBrowserFind always gives us a start range with start == end.

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

--HG--
extra : moz-landing-system : lando
2020-02-21 13:19:37 +00:00
Alex Henrie d346ee224f Bug 1611568 - Ignore combining diacritic characters when "Match Diacritics" is off. r=jfkthame
Differential Revision: https://phabricator.services.mozilla.com/D61081

--HG--
extra : moz-landing-system : lando
2020-02-10 18:09:05 +00:00
Masayuki Nakano 450b71f763 Bug 1612085 - part 1: Hide constructor of `nsRange` r=smaug
`nsRange` instances are allocated a lot in the heap especially by editor and
spellchecker.  The allocation cost is too bad for benchmarks.  Therefore,
we should reuse released instances as far as possible.  For managing it in
static factory methods of `nsRange`, we need to hide `nsRange` constructor.

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

--HG--
extra : moz-landing-system : lando
2020-01-30 13:23:35 +00:00