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

Unified Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2740823003: [PasswordGeneration] Makes generated passwords copyable (Closed)
Patch Set: Changes in the test addressed to reviewer comments 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/Editor.cpp
diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
index e4e310ba992fcf14ebfbcff1c3287c593e68e7e1..00be47ddd064b6e42079e02b2811908908def864 100644
--- a/third_party/WebKit/Source/core/editing/Editor.cpp
+++ b/third_party/WebKit/Source/core/editing/Editor.cpp
@@ -30,6 +30,7 @@
#include "core/CSSPropertyNames.h"
#include "core/EventNames.h"
#include "core/HTMLNames.h"
+#include "core/InputTypeNames.h"
#include "core/clipboard/DataObject.h"
#include "core/clipboard/DataTransfer.h"
#include "core/clipboard/Pasteboard.h"
@@ -135,6 +136,15 @@ InputEvent::EventIsComposing isComposingFromCommand(
return InputEvent::EventIsComposing::NotComposing;
}
+bool isInPasswordFieldWithUnrevealedPassword(const Position& position) {
+ TextControlElement* textControl = enclosingTextControl(position);
+ if (!isHTMLInputElement(textControl))
+ return false;
+ HTMLInputElement* input = toHTMLInputElement(textControl);
+ return (input->type() == InputTypeNames::password) &&
+ !input->shouldRevealPassword();
+}
+
} // anonymous namespace
Editor::RevealSelectionScope::RevealSelectionScope(Editor* editor)
@@ -325,7 +335,7 @@ bool Editor::canCopy() const {
return true;
FrameSelection& selection = frame().selection();
return selection.computeVisibleSelectionInDOMTreeDeprecated().isRange() &&
- !isInPasswordField(
+ !isInPasswordFieldWithUnrevealedPassword(
frame().selection().computeVisibleSelectionInDOMTree().start());
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/EditorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698