Bug 1587472 - [1.1] Allocate space for children before adding them to ViewStructure. r=agi,geckoview-reviewers,droeh

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Eugen Sawin 2019-10-10 17:51:21 +00:00
Родитель 7064471d78
Коммит b75521375d
4 изменённых файлов: 10 добавлений и 7 удалений

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

@ -44,7 +44,6 @@ import java.lang.Class;
import java.lang.Exception;
import java.lang.Float;
import java.lang.Integer;
import java.lang.Iterable;
import java.lang.Long;
import java.lang.Object;
import java.lang.Runnable;
@ -55,6 +54,7 @@ import java.lang.Void;
import java.net.InetAddress;
import java.nio.ByteBuffer;
import java.util.AbstractSequentialList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.json.JSONObject;
@ -117,7 +117,7 @@ package org.mozilla.geckoview {
field public static final int INPUT_TYPE_PHONE = 2;
field public static final int INPUT_TYPE_TEXT = 0;
field @NonNull public final Map<String,String> attributes;
field @NonNull public final Iterable<AutofillElement> children;
field @NonNull public final Collection<AutofillElement> children;
field @NonNull public final Rect dimensions;
field @NonNull public final String domain;
field public final boolean enabled;

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

@ -13,6 +13,7 @@ import android.view.View;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
@ -86,9 +87,9 @@ public class AutofillElement {
public final @NonNull Rect dimensions;
/**
* The list of child elements for this element.
* The collection of child elements for this element.
*/
public final @NonNull Iterable<AutofillElement> children;
public final @NonNull Collection<AutofillElement> children;
/**
* The HTML attributes for this element.

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

@ -757,15 +757,15 @@ public class GeckoView extends FrameLayout {
structure.setHtmlInfo(htmlBuilder.build());
}
structure.setChildCount(element.children.size());
int childCount = 0;
for (final AutofillElement child : element.children) {
final ViewStructure childStructure = structure.newChild(childCount);
fillViewStructure(child, childStructure, flags);
childCount++;
}
structure.setChildCount(childCount);
switch (element.tag) {
case "input":
case "textarea":

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

@ -54,6 +54,8 @@ exclude: true
- Added [`GeckoView.setAutofillEnabled`][71.21] for controlling whether or not the `GeckoView`
instance participates in Android autofill. When enabled, this connects an `AutofillDelegate`
to the session it holds.
- Changed [`AutofillElement.children`][71.20] interface to `Collection` to provide
an efficient way to pre-allocate memory when filling `ViewStructure`.
[71.1]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onBooleanScalar-org.mozilla.geckoview.RuntimeTelemetry.Metric-
[71.2]: {{javadoc_uri}}/RuntimeTelemetry.Delegate.html#onLongScalar-org.mozilla.geckoview.RuntimeTelemetry.Metric-
@ -397,4 +399,4 @@ exclude: true
[65.24]: {{javadoc_uri}}/CrashReporter.html#sendCrashReport-android.content.Context-android.os.Bundle-java.lang.String-
[65.25]: {{javadoc_uri}}/GeckoResult.html
[api-version]: ed4a802bc348a8df4b2103cf0dd8d63e76e841bb
[api-version]: ee3ceb65db78c3a801f525465ff3c6e9eca22ae9