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

Unified Diff: Source/core/html/HTMLInputElement.cpp

Issue 225853005: Add support for setting password value gated on user's gesture in a page (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | « Source/core/html/HTMLInputElement.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/HTMLInputElement.cpp
diff --git a/Source/core/html/HTMLInputElement.cpp b/Source/core/html/HTMLInputElement.cpp
index 7952c58f83be743b8803e9610ed433ab59f45558..57ace97980b52e2793d98996333dfad5d796c927 100644
--- a/Source/core/html/HTMLInputElement.cpp
+++ b/Source/core/html/HTMLInputElement.cpp
@@ -68,6 +68,7 @@
#include "core/html/shadow/ShadowElementNames.h"
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
+#include "core/page/Page.h"
#include "core/rendering/RenderTextControlSingleLine.h"
#include "core/rendering/RenderTheme.h"
#include "platform/DateTimeChooser.h"
@@ -918,6 +919,12 @@ void HTMLInputElement::copyNonAttributePropertiesFromElement(const Element& sour
String HTMLInputElement::value() const
{
+ if (m_inputType->canSetValueAfterUserGesture() && !m_valueGatedOnUserGesture.isEmpty()) {
+ if (document().page()->userGestureSeenSinceLastNavigation())
+ return m_valueGatedOnUserGesture;
+ return String();
+ }
+
String value;
if (m_inputType->getTypeSpecificValue(value))
return value;
@@ -949,6 +956,14 @@ void HTMLInputElement::setValueForUser(const String& value)
setValue(value, DispatchChangeEvent);
}
+void HTMLInputElement::setValueAfterUserGesture(const String& value)
+{
+ if (m_inputType->canSetValueAfterUserGesture())
+ m_valueGatedOnUserGesture = value;
+ else
+ setValueForUser(value);
+}
+
const String& HTMLInputElement::suggestedValue() const
{
return m_suggestedValue;
@@ -1022,6 +1037,7 @@ void HTMLInputElement::setValue(const String& value, TextFieldEventBehavior even
void HTMLInputElement::setValueInternal(const String& sanitizedValue, TextFieldEventBehavior eventBehavior)
{
+ m_valueGatedOnUserGesture = String();
m_valueIfDirty = sanitizedValue;
setNeedsValidityCheck();
if (document().focusedElement() == this)
« no previous file with comments | « Source/core/html/HTMLInputElement.h ('k') | Source/core/html/forms/InputType.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698