| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All r
ights reserved. |
| 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 6 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 7 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 8 * Copyright (C) 2010 Google Inc. All rights reserved. | 8 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 9 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // get rather sluggish when a text field has a larger number of characters than | 96 // get rather sluggish when a text field has a larger number of characters than |
| 97 // this, even when just clicking in the text field. | 97 // this, even when just clicking in the text field. |
| 98 const int HTMLInputElement::maximumLength = 524288; | 98 const int HTMLInputElement::maximumLength = 524288; |
| 99 const int defaultSize = 20; | 99 const int defaultSize = 20; |
| 100 const int maxSavedResults = 256; | 100 const int maxSavedResults = 256; |
| 101 | 101 |
| 102 HTMLInputElement::HTMLInputElement(Document& document, HTMLFormElement* form, bo
ol createdByParser) | 102 HTMLInputElement::HTMLInputElement(Document& document, HTMLFormElement* form, bo
ol createdByParser) |
| 103 : HTMLTextFormControlElement(inputTag, document, form) | 103 : HTMLTextFormControlElement(inputTag, document, form) |
| 104 , m_size(defaultSize) | 104 , m_size(defaultSize) |
| 105 , m_maxLength(maximumLength) | 105 , m_maxLength(maximumLength) |
| 106 , m_minLength(0) | 106 , m_minLength(-1) |
| 107 , m_maxResults(-1) | 107 , m_maxResults(-1) |
| 108 , m_isChecked(false) | 108 , m_isChecked(false) |
| 109 , m_reflectsCheckedAttribute(true) | 109 , m_reflectsCheckedAttribute(true) |
| 110 , m_isIndeterminate(false) | 110 , m_isIndeterminate(false) |
| 111 , m_isActivatedSubmit(false) | 111 , m_isActivatedSubmit(false) |
| 112 , m_autocomplete(Uninitialized) | 112 , m_autocomplete(Uninitialized) |
| 113 , m_hasNonEmptyList(false) | 113 , m_hasNonEmptyList(false) |
| 114 , m_stateRestored(false) | 114 , m_stateRestored(false) |
| 115 , m_parsingInProgress(createdByParser) | 115 , m_parsingInProgress(createdByParser) |
| 116 , m_valueAttributeWasUpdatedAfterParsing(false) | 116 , m_valueAttributeWasUpdatedAfterParsing(false) |
| (...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidFileExtensi
on); | 1358 return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidFileExtensi
on); |
| 1359 } | 1359 } |
| 1360 | 1360 |
| 1361 const AtomicString& HTMLInputElement::alt() const | 1361 const AtomicString& HTMLInputElement::alt() const |
| 1362 { | 1362 { |
| 1363 return fastGetAttribute(altAttr); | 1363 return fastGetAttribute(altAttr); |
| 1364 } | 1364 } |
| 1365 | 1365 |
| 1366 int HTMLInputElement::maxLength() const | 1366 int HTMLInputElement::maxLength() const |
| 1367 { | 1367 { |
| 1368 if (!hasAttribute(maxlengthAttr)) |
| 1369 return -1; |
| 1368 return m_maxLength; | 1370 return m_maxLength; |
| 1369 } | 1371 } |
| 1370 | 1372 |
| 1371 int HTMLInputElement::minLength() const | 1373 int HTMLInputElement::minLength() const |
| 1372 { | 1374 { |
| 1373 return m_minLength; | 1375 return m_minLength; |
| 1374 } | 1376 } |
| 1375 | 1377 |
| 1376 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat
e) | 1378 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat
e) |
| 1377 { | 1379 { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 } | 1674 } |
| 1673 | 1675 |
| 1674 void HTMLInputElement::updatePlaceholderText() | 1676 void HTMLInputElement::updatePlaceholderText() |
| 1675 { | 1677 { |
| 1676 return m_inputTypeView->updatePlaceholderText(); | 1678 return m_inputTypeView->updatePlaceholderText(); |
| 1677 } | 1679 } |
| 1678 | 1680 |
| 1679 void HTMLInputElement::parseMaxLengthAttribute(const AtomicString& value) | 1681 void HTMLInputElement::parseMaxLengthAttribute(const AtomicString& value) |
| 1680 { | 1682 { |
| 1681 int maxLength; | 1683 int maxLength; |
| 1682 if (!parseHTMLInteger(value, maxLength)) | 1684 if (!parseHTMLInteger(value, maxLength) || maxLength < 0) |
| 1683 maxLength = maximumLength; | 1685 maxLength = -1; |
| 1684 if (maxLength < 0 || maxLength > maximumLength) | 1686 if (maxLength > maximumLength) |
| 1685 maxLength = maximumLength; | 1687 maxLength = maximumLength; |
| 1686 int oldMaxLength = m_maxLength; | 1688 int oldMaxLength = m_maxLength; |
| 1687 m_maxLength = maxLength; | 1689 m_maxLength = maxLength; |
| 1688 if (oldMaxLength != maxLength) | 1690 if (oldMaxLength != maxLength) |
| 1689 updateValueIfNeeded(); | 1691 updateValueIfNeeded(); |
| 1690 setNeedsValidityCheck(); | 1692 setNeedsValidityCheck(); |
| 1691 } | 1693 } |
| 1692 | 1694 |
| 1693 void HTMLInputElement::parseMinLengthAttribute(const AtomicString& value) | 1695 void HTMLInputElement::parseMinLengthAttribute(const AtomicString& value) |
| 1694 { | 1696 { |
| 1695 int minLength; | 1697 int minLength; |
| 1696 if (!parseHTMLInteger(value, minLength)) | 1698 if (!parseHTMLInteger(value, minLength) || minLength < 0) |
| 1697 minLength = 0; | 1699 minLength = -1; |
| 1698 if (minLength < 0) | |
| 1699 minLength = 0; | |
| 1700 m_minLength = minLength; | 1700 m_minLength = minLength; |
| 1701 setNeedsValidityCheck(); | 1701 setNeedsValidityCheck(); |
| 1702 } | 1702 } |
| 1703 | 1703 |
| 1704 void HTMLInputElement::updateValueIfNeeded() | 1704 void HTMLInputElement::updateValueIfNeeded() |
| 1705 { | 1705 { |
| 1706 String newValue = sanitizeValue(m_valueIfDirty); | 1706 String newValue = sanitizeValue(m_valueIfDirty); |
| 1707 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); | 1707 ASSERT(!m_valueIfDirty.isNull() || newValue.isNull()); |
| 1708 if (newValue != m_valueIfDirty) | 1708 if (newValue != m_valueIfDirty) |
| 1709 setValue(newValue); | 1709 setValue(newValue); |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1931 void HTMLInputElement::ensurePrimaryContent() | 1931 void HTMLInputElement::ensurePrimaryContent() |
| 1932 { | 1932 { |
| 1933 m_inputTypeView->ensurePrimaryContent(); | 1933 m_inputTypeView->ensurePrimaryContent(); |
| 1934 } | 1934 } |
| 1935 | 1935 |
| 1936 bool HTMLInputElement::hasFallbackContent() const | 1936 bool HTMLInputElement::hasFallbackContent() const |
| 1937 { | 1937 { |
| 1938 return m_inputTypeView->hasFallbackContent(); | 1938 return m_inputTypeView->hasFallbackContent(); |
| 1939 } | 1939 } |
| 1940 } // namespace blink | 1940 } // namespace blink |
| OLD | NEW |