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

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

Issue 2769023003: [Password Manager] Check node visibility with isFocusable instead of hasNonEmptyLayoutSize (Closed)
Patch Set: Added comment to IsWebElementVisible Created 3 years, 9 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
Index: components/autofill/content/renderer/form_autofill_util.cc
diff --git a/components/autofill/content/renderer/form_autofill_util.cc b/components/autofill/content/renderer/form_autofill_util.cc
index 51c745fdb5253cc1f0c28c746ea1f677beb2a098..cd23f2d587f3ac72613ea9b9b4e807e977e0036c 100644
--- a/components/autofill/content/renderer/form_autofill_util.cc
+++ b/components/autofill/content/renderer/form_autofill_util.cc
@@ -1258,7 +1258,7 @@ bool IsFormVisible(blink::WebFrame* frame,
bool IsSomeControlElementVisible(
const WebVector<WebFormControlElement>& control_elements) {
for (const WebFormControlElement& control_element : control_elements) {
- if (IsWebNodeVisible(control_element))
+ if (IsWebElementVisible(control_element))
return true;
}
return false;
@@ -1333,14 +1333,13 @@ const base::string16 GetFormIdentifier(const WebFormElement& form) {
return identifier;
}
-bool IsWebNodeVisible(const blink::WebNode& node) {
- // TODO(esprehn): This code doesn't really check if the node is visible, just
- // if the node takes up space in the layout. Does it want to check opacity,
- // transform, and visibility too?
- if (!node.isElementNode())
- return false;
- const WebElement element = node.toConst<WebElement>();
- return element.hasNonEmptyLayoutSize();
+bool IsWebElementVisible(const blink::WebElement& element) {
+ // hasNonEmptyLayoutSize might trigger layout, but it didn't cause problems so
+ // far. If the layout is prohibited, hasNonEmptyLayoutSize is still used. See
+ // details in crbug.com/595078.
+ bool res = g_prevent_layout ? element.hasNonEmptyLayoutSize()
+ : element.isFocusable();
+ return res;
}
std::vector<blink::WebFormControlElement> ExtractAutofillableElementsFromSet(
« no previous file with comments | « components/autofill/content/renderer/form_autofill_util.h ('k') | components/autofill/content/renderer/form_classifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698