#include "components/autofill/content/renderer/form_autofill_issues.h"
#include <string_view>
#include <vector>
#include "base/no_destructor.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_split.h"
#include "components/autofill/content/renderer/form_autofill_util.h"
#include "components/autofill/core/common/autofill_features.h"
#include "components/autofill/core/common/form_field_data.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_vector.h"
#include "third_party/blink/public/web/web_autofill_client.h"
#include "third_party/blink/public/web/web_document.h"
#include "third_party/blink/public/web/web_element_collection.h"
#include "third_party/blink/public/web/web_form_control_element.h"
#include "third_party/blink/public/web/web_input_element.h"
#include "third_party/blink/public/web/web_label_element.h"
#include "third_party/blink/public/web/web_local_frame.h"
WebDocument;
WebElement;
WebElementCollection;
WebFormControlElement;
WebFormElement;
WebInputElement;
WebLabelElement;
WebLocalFrame;
WebString;
WebVector;
GenericIssueErrorType;
namespace autofill::form_issues {
IsAutofillableElement;
namespace {
constexpr size_t kMaxNumberOfDevtoolsIssuesEmitted = …;
constexpr std::string_view kFor = …;
constexpr std::string_view kAriaLabelledBy = …;
constexpr std::string_view kName = …;
constexpr std::string_view kId = …;
constexpr std::string_view kLabel = …;
constexpr std::string_view kAutocomplete = …;
template <const std::string_view& string>
const WebString& GetWebString() { … }
void MaybeAppendLabelWithoutControlDevtoolsIssue(
WebLabelElement label,
std::vector<FormIssue>& form_issues) { … }
void MaybeAppendAriaLabelledByDevtoolsIssue(
const WebElement& element,
std::vector<FormIssue>& form_issues) { … }
void MaybeAppendInputWithEmptyIdAndNameDevtoolsIssue(
const WebFormControlElement& element,
std::vector<FormIssue>& form_issues) { … }
int GetShadowHostDOMNodeId(const WebFormControlElement& element) { … }
void MaybeAppendDuplicateIdForInputDevtoolsIssue(
const WebVector<WebFormControlElement>& elements,
std::vector<FormIssue>& form_issues) { … }
void MaybeAppendAutocompleteAttributeDevtoolsIssue(
const WebElement& element,
std::vector<FormIssue>& form_issues) { … }
void MaybeAppendInputAssignedAutocompleteValueToIdOrNameAttributesDevtoolsIssue(
const WebFormControlElement& element,
std::vector<FormIssue>& form_issues) { … }
void AppendFormIssuesInternal(const WebVector<WebFormControlElement>& elements,
std::vector<FormIssue>& form_issues) { … }
std::vector<FormIssue> GetFormIssues(
const blink::WebVector<blink::WebFormControlElement>& control_elements,
std::vector<FormIssue> form_issues) { … }
std::vector<FormIssue> CheckForLabelsWithIncorrectForAttribute(
const blink::WebDocument& document,
const std::vector<FormFieldData>& fields,
std::vector<FormIssue> form_issues) { … }
}
void MaybeEmitFormIssuesToDevtools(blink::WebLocalFrame& web_local_frame,
base::span<const FormData> forms) { … }
std::vector<FormIssue> GetFormIssuesForTesting(
const blink::WebVector<blink::WebFormControlElement>& control_elements,
std::vector<FormIssue> form_issues) { … }
std::vector<FormIssue>
CheckForLabelsWithIncorrectForAttributeForTesting(
const blink::WebDocument& document,
const std::vector<FormFieldData>& fields,
std::vector<FormIssue> form_issues) { … }
}