summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/HTMLInputElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/WebCore/html/HTMLInputElement.cpp
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebCore/html/HTMLInputElement.cpp')
-rw-r--r--Source/WebCore/html/HTMLInputElement.cpp34
1 files changed, 33 insertions, 1 deletions
diff --git a/Source/WebCore/html/HTMLInputElement.cpp b/Source/WebCore/html/HTMLInputElement.cpp
index 59c6205a8..e07067c66 100644
--- a/Source/WebCore/html/HTMLInputElement.cpp
+++ b/Source/WebCore/html/HTMLInputElement.cpp
@@ -313,6 +313,13 @@ StepRange HTMLInputElement::createStepRange(AnyStepHandling anyStepHandling) con
return m_inputType->createStepRange(anyStepHandling);
}
+#if ENABLE(DATALIST_ELEMENT)
+Decimal HTMLInputElement::findClosestTickMarkValue(const Decimal& value)
+{
+ return m_inputType->findClosestTickMarkValue(value);
+}
+#endif
+
void HTMLInputElement::stepUp(int n, ExceptionCode& ec)
{
m_inputType->stepUp(n, ec);
@@ -619,6 +626,12 @@ void HTMLInputElement::parseAttribute(const Attribute& attribute)
} else if (attribute.name() == typeAttr) {
updateType();
} else if (attribute.name() == valueAttr) {
+ // Changes to the value attribute may change whether or not this element has a default value.
+ // If this field is autocomplete=off that might affect the return value of needsSuspensionCallback.
+ if (m_autocomplete == Off) {
+ unregisterForSuspensionCallbackIfNeeded();
+ registerForSuspensionCallbackIfNeeded();
+ }
// We only need to setChanged if the form is looking at the default value right now.
if (!hasDirtyValue()) {
updatePlaceholderVisibility(false);
@@ -1160,6 +1173,15 @@ void HTMLInputElement::defaultEventHandler(Event* evt)
HTMLTextFormControlElement::defaultEventHandler(evt);
}
+bool HTMLInputElement::willRespondToMouseClickEvents()
+{
+ // FIXME: Consider implementing willRespondToMouseClickEvents() in InputType if more accurate results are necessary.
+ if (!disabled())
+ return true;
+
+ return HTMLTextFormControlElement::willRespondToMouseClickEvents();
+}
+
bool HTMLInputElement::isURLAttribute(const Attribute& attribute) const
{
return attribute.name() == srcAttr || attribute.name() == formactionAttr || HTMLTextFormControlElement::isURLAttribute(attribute);
@@ -1363,7 +1385,17 @@ bool HTMLInputElement::isOutOfRange() const
bool HTMLInputElement::needsSuspensionCallback()
{
- return m_autocomplete == Off || m_inputType->shouldResetOnDocumentActivation();
+ if (m_inputType->shouldResetOnDocumentActivation())
+ return true;
+
+ // Sensitive input elements are marked with autocomplete=off, and we want to wipe them out
+ // when going back; returning true here arranges for us to call reset at the time
+ // the page is restored. Non-empty textual default values indicate that the field
+ // is not really sensitive -- there's no default value for an account number --
+ // and we would see unexpected results if we reset to something other than blank.
+ bool isSensitive = m_autocomplete == Off && !(m_inputType->isTextType() && !defaultValue().isEmpty());
+
+ return isSensitive;
}
void HTMLInputElement::registerForSuspensionCallbackIfNeeded()