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

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: Try to fix interactive tests Created 4 years, 10 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 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) || m_maxLength == maximumLength)
tkent 2016/02/08 23:48:21 input.maxLength for <input maxlength="524288"> ret
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 {
1375 if (!hasAttribute(minlengthAttr))
tkent 2016/02/08 23:48:21 We should have a test for this change. I think we
1376 return -1;
1373 return m_minLength; 1377 return m_minLength;
1374 } 1378 }
1375 1379
1376 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat e) 1380 void HTMLInputElement::setMaxLength(int maxLength, ExceptionState& exceptionStat e)
1377 { 1381 {
1378 if (maxLength < 0) 1382 if (maxLength < 0)
1379 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(maxLength) + ") is negative."); 1383 exceptionState.throwDOMException(IndexSizeError, "The value provided (" + String::number(maxLength) + ") is negative.");
1380 else if (maxLength < m_minLength) 1384 else if (maxLength < m_minLength)
1381 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMinimumBound("maxLength", maxLength, m_minLength)); 1385 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde xExceedsMinimumBound("maxLength", maxLength, m_minLength));
1382 else 1386 else
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
1931 void HTMLInputElement::ensurePrimaryContent() 1935 void HTMLInputElement::ensurePrimaryContent()
1932 { 1936 {
1933 m_inputTypeView->ensurePrimaryContent(); 1937 m_inputTypeView->ensurePrimaryContent();
1934 } 1938 }
1935 1939
1936 bool HTMLInputElement::hasFallbackContent() const 1940 bool HTMLInputElement::hasFallbackContent() const
1937 { 1941 {
1938 return m_inputTypeView->hasFallbackContent(); 1942 return m_inputTypeView->hasFallbackContent();
1939 } 1943 }
1940 } // namespace blink 1944 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698