public void Add(AutofillFieldMetadata data)
        {
            _size++;
            SaveType |= data.SaveType;
            Ids.Add(data.Id);
            AutofillIds.Add(data.AutofillId);
            IdToFieldMap.Add(data.Id, data);

            if ((data.AutofillHints?.Count ?? 0) > 0)
            {
                AutofillHints.AddRange(data.AutofillHints);
                if (data.IsFocused)
                {
                    FocusedAutofillHints.AddRange(data.AutofillHints);
                }

                foreach (var hint in data.AutofillHints)
                {
                    if (!AutofillHintsToFieldsMap.ContainsKey(hint))
                    {
                        AutofillHintsToFieldsMap.Add(hint, new List <AutofillFieldMetadata>());
                    }

                    AutofillHintsToFieldsMap[hint].Add(data);
                }
            }
        }
示例#2
0
        public void Add(AutofillFieldMetadata autofillFieldMetadata)
        {
            SaveType |= autofillFieldMetadata.SaveType;
            Size++;
            AutofillIds.Add(autofillFieldMetadata.AutofillId);
            var hintsList = autofillFieldMetadata.AutofillHints;

            AllAutofillHints.AddRange(hintsList);
            if (autofillFieldMetadata.Focused)
            {
                FocusedAutofillHints.AddRange(hintsList);
            }
            foreach (var hint in autofillFieldMetadata.AutofillHints)
            {
                // TODO: we should check the value as well
                if (!AutofillHintsToFieldsMap.ContainsKey(hint))
                {
                    AutofillHintsToFieldsMap.Add(hint, new List <AutofillFieldMetadata>());
                }
                AutofillHintsToFieldsMap[hint].Add(autofillFieldMetadata);
            }
        }