Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: components/autofill/content/renderer/form_autofill_util.h

Issue 2009823003: Do not trigger layout in PasswordAutofillAgent::DidFinishDocumentLoad (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/renderer/form_autofill_util.h
diff --git a/components/autofill/content/renderer/form_autofill_util.h b/components/autofill/content/renderer/form_autofill_util.h
index d7cb557b05c8928406762778381efc677ca34af9..7f2391dcbf731582d143896e87c92f456e35e664 100644
--- a/components/autofill/content/renderer/form_autofill_util.h
+++ b/components/autofill/content/renderer/form_autofill_util.h
@@ -9,6 +9,7 @@
#include <vector>
+#include "base/macros.h"
#include "base/strings/string16.h"
#include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/password_form_field_prediction_map.h"
@@ -57,6 +58,22 @@ enum ExtractMask {
// Copied to components/autofill/ios/browser/resources/autofill_controller.js.
extern const size_t kMaxParseableFields;
+// Create an instance of ScopedLayoutPreventer to stop form_util code from
+// triggering layout as a side-effect. For example, when creating a
+// FormFieldData, a call to WebNode::isFocusable is normally made, which may
+// trigger a layout computation. When an instance of ScopedLayoutPreventer is
+// alive, that call will not be made. On destruction, this class allows
+// layout-triggering calls again. It is not thread safe and multiple instances
+// should not be created at the same time in the same process.
+class ScopedLayoutPreventer {
+ public:
+ ScopedLayoutPreventer();
+ ~ScopedLayoutPreventer();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ScopedLayoutPreventer);
+};
+
// Extract FormData from the form element and return whether the operation was
// successful.
bool ExtractFormData(const blink::WebFormElement& form_element, FormData* data);
« no previous file with comments | « no previous file | components/autofill/content/renderer/form_autofill_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698