Commit 5d63f6cd authored by Tao Bai's avatar Tao Bai Committed by Commit Bot

WA Autofill: Add bounds into FormFieldData

Make bounds passed through mojo.

Bug: 1064420
Change-Id: Ib54220a70907c4506acf46479d51a8a79416a7e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2118832Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Commit-Queue: Tao Bai <michaelbai@chromium.org>
Cr-Commit-Position: refs/heads/master@{#754069}
parent aeaabe9d
......@@ -419,7 +419,8 @@ std::ostream& operator<<(std::ostream& os, const FormFieldData& field) {
<< "is_readonly=" << field.is_readonly << " "
<< "typed_value=" << field.typed_value << " "
<< "properties_mask=" << field.properties_mask << " "
<< "label_source=" << field.label_source;
<< "label_source=" << field.label_source << " "
<< "bounds=" << field.bounds.ToString();
}
LogBuffer& operator<<(LogBuffer& buffer, const FormFieldData& field) {
......
......@@ -14,6 +14,7 @@
#include "base/strings/string16.h"
#include "build/build_config.h"
#include "components/autofill/core/common/mojom/autofill_types.mojom-shared.h"
#include "ui/gfx/geometry/rect_f.h"
namespace base {
class Pickle;
......@@ -180,6 +181,11 @@ struct FormFieldData {
// Password Manager doesn't use labels nor client side nor server side, so
// label_source isn't in serialize methods.
LabelSource label_source = LabelSource::kUnknown;
// The bounds of this field in current frame coordinates at the parse time. It
// is valid if not empty, will not be synced to the server side or be used for
// field comparison and isn't in serialize methods.
gfx::RectF bounds;
};
// Serialize and deserialize FormFieldData. These are used when FormData objects
......
......@@ -138,6 +138,8 @@ struct FormFieldData {
array<mojo_base.mojom.String16> option_contents;
LabelSource label_source;
gfx.mojom.RectF bounds;
};
struct ButtonTitleInfo {
......
......@@ -80,6 +80,9 @@ bool StructTraits<
if (!data.ReadLabelSource(&out->label_source))
return false;
if (!data.ReadBounds(&out->bounds))
return false;
return true;
}
......
......@@ -153,6 +153,10 @@ struct StructTraits<autofill::mojom::FormFieldDataDataView,
return r.label_source;
}
static gfx::RectF bounds(const autofill::FormFieldData& r) {
return r.bounds;
}
static bool Read(autofill::mojom::FormFieldDataDataView data,
autofill::FormFieldData* out);
};
......
......@@ -318,6 +318,7 @@ TEST_F(AutofillTypeTraitsTestImpl, PassFormFieldData) {
input.text_direction = base::i18n::RIGHT_TO_LEFT;
input.properties_mask = FieldPropertiesFlags::HAD_FOCUS;
input.typed_value = base::ASCIIToUTF16("TestTypedValue");
input.bounds = gfx::RectF(1, 2, 10, 100);
base::RunLoop loop;
mojo::Remote<mojom::TypeTraitsTest> remote(GetTypeTraitsTestRemote());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment