Bug 1489528 - FinderFindFlags IntDef annotation should include a zero value as a default r=kaya,geckoview-reviewers,ohall

Differential Revision: https://phabricator.services.mozilla.com/D206824
This commit is contained in:
gela 2024-04-24 20:45:06 +00:00
Родитель 677b4036a4
Коммит b82d189a49
5 изменённых файлов: 13 добавлений и 5 удалений

Просмотреть файл

@ -4,7 +4,6 @@
package mozilla.components.browser.engine.gecko
import android.annotation.SuppressLint
import android.net.Uri
import android.os.Build
import android.view.WindowManager
@ -557,9 +556,8 @@ class GeckoEngineSession(
/**
* See [EngineSession.findNext]
*/
@SuppressLint("WrongConstant") // FinderFindFlags annotation doesn't include a 0 value.
override fun findNext(forward: Boolean) {
val findFlags = if (forward) 0 else GeckoSession.FINDER_FIND_BACKWARDS
val findFlags = if (forward) GeckoSession.FINDER_FIND_FORWARD else GeckoSession.FINDER_FIND_BACKWARDS
geckoSession.finder.find(null, findFlags).then { result: GeckoSession.FinderResult? ->
result?.let {
val activeMatchOrdinal = if (it.current > 0) it.current - 1 else it.current

Просмотреть файл

@ -1078,6 +1078,7 @@ package org.mozilla.geckoview {
field public static final int FINDER_DISPLAY_DRAW_LINK_OUTLINE = 4;
field public static final int FINDER_DISPLAY_HIGHLIGHT_ALL = 1;
field public static final int FINDER_FIND_BACKWARDS = 1;
field public static final int FINDER_FIND_FORWARD = 0;
field public static final int FINDER_FIND_LINKS_ONLY = 8;
field public static final int FINDER_FIND_MATCH_CASE = 2;
field public static final int FINDER_FIND_WHOLE_WORD = 4;

Просмотреть файл

@ -2448,6 +2448,7 @@ public class GeckoSession {
@IntDef(
flag = true,
value = {
FINDER_FIND_FORWARD,
FINDER_FIND_BACKWARDS,
FINDER_FIND_LINKS_ONLY,
FINDER_FIND_MATCH_CASE,
@ -2455,6 +2456,9 @@ public class GeckoSession {
})
public @interface FinderFindFlags {}
/** Go forward when finding the next match. */
public static final int FINDER_FIND_FORWARD = 0;
/** Go backwards when finding the next match. */
public static final int FINDER_FIND_BACKWARDS = 1;

Просмотреть файл

@ -27,6 +27,7 @@ public final class SessionFinder {
private static final List<Pair<Integer, String>> sFlagNames =
Arrays.asList(
new Pair<>(GeckoSession.FINDER_FIND_FORWARD, "forward"),
new Pair<>(GeckoSession.FINDER_FIND_BACKWARDS, "backwards"),
new Pair<>(GeckoSession.FINDER_FIND_LINKS_ONLY, "linksOnly"),
new Pair<>(GeckoSession.FINDER_FIND_MATCH_CASE, "matchCase"),
@ -70,7 +71,8 @@ public final class SessionFinder {
* previous search string.
*
* @param searchString String to search, or null to find again using the previous string.
* @param flags Flags for performing the search; either 0 or a combination of {@link
* @param flags Flags for performing the search; either FINDER_FIND_FORWARD {@link
* GeckoSession#FINDER_FIND_FORWARD} or a combination of {@link
* GeckoSession#FINDER_FIND_BACKWARDS FINDER_FIND_*} constants.
* @return Result of the search operation as a {@link GeckoResult} object.
* @see #clear

Просмотреть файл

@ -15,6 +15,9 @@ exclude: true
## v127
- ⚠️ Removed deprecated [`RuntimeTelemetry`][125.5], [`GeckoRuntimeSettings.getTelemetryDelegate`][125.6] and [`GeckoRuntimeSettings.telemetryDelegate`][125.7].
- Added [FINDER_FIND_FORWARD][127.1]
[127.1]: {{javadoc_uri}}/GeckoSession.html#FINDER_FIND_FORWARD
## v125
- ⚠️ Deprecated [`GeckoSession.NavigationDelegate.onLocationChange`][125.1], to be removed in v127.
@ -1550,4 +1553,4 @@ to allow adding gecko profiler markers.
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport(android.content.Context,android.os.Bundle,java.lang.String)
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: 2de1494e3dcaccbef7c3aeae018c4f657af274e7
[api-version]: e846e2e55edacaa72a2373326e765daeb86fb35c