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

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLInputElement.cpp

Issue 1615003002: Fix behavior of HTMLInputElement.maxLength/minLength getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: V2 Created 4 years, 11 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 unified diff | Download patch
OLDNEW
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 1337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1348 return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidFileExtensi on); 1348 return parseAcceptAttribute(fastGetAttribute(acceptAttr), isValidFileExtensi on);
1349 } 1349 }
1350 1350
1351 const AtomicString& HTMLInputElement::alt() const 1351 const AtomicString& HTMLInputElement::alt() const
1352 { 1352 {
1353 return fastGetAttribute(altAttr); 1353 return fastGetAttribute(altAttr);
1354 } 1354 }
1355 1355
1356 int HTMLInputElement::maxLength() const 1356 int HTMLInputElement::maxLength() const
1357 { 1357 {
1358 if (!hasAttribute(maxlengthAttr))
1359 return -1;
1358 return m_maxLength; 1360 return m_maxLength;
1359 } 1361 }
1360 1362
1361 int HTMLInputElement::minLength() const 1363 int HTMLInputElement::minLength() const
1362 { 1364 {
1365 if (!hasAttribute(minlengthAttr))
1366 return -1;
1363 return m_minLength; 1367 return m_minLength;
1364 } 1368 }
1365 1369
1366 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat e) 1370 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat e)
1367 { 1371 {
1368 if (maxLength < 0) 1372 if (maxLength < 0)
1369 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(maxLength) + ") is negative."); 1373 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(maxLength) + ") is negative.");
1370 else if (maxLength < m_minLength) 1374 else if (maxLength < m_minLength)
1371 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMinimumBound("maxLength", maxLength, m_minLength)); 1375 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMinimumBound("maxLength", maxLength, m_minLength));
1372 else 1376 else
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 void HTMLInputElement::ensurePrimaryContent() 1925 void HTMLInputElement::ensurePrimaryContent()
1922 { 1926 {
1923 m_inputTypeView->ensurePrimaryContent(); 1927 m_inputTypeView->ensurePrimaryContent();
1924 } 1928 }
1925 1929
1926 bool HTMLInputElement::hasFallbackContent() const 1930 bool HTMLInputElement::hasFallbackContent() const
1927 { 1931 {
1928 return m_inputTypeView->hasFallbackContent(); 1932 return m_inputTypeView->hasFallbackContent();
1929 } 1933 }
1930 } // namespace 1934 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698