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

Side by Side Diff: third_party/WebKit/Source/web/WebInputElement.cpp

Issue 1615003002: Fix behavior of HTMLInputElement.maxLength/minLength getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Set to -1 for invalid attribute or negative 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::radio; 76 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::radio;
77 } 77 }
78 78
79 bool WebInputElement::isCheckbox() const 79 bool WebInputElement::isCheckbox() const
80 { 80 {
81 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::checkbox; 81 return constUnwrap<HTMLInputElement>()->type() == InputTypeNames::checkbox;
82 } 82 }
83 83
84 int WebInputElement::maxLength() const 84 int WebInputElement::maxLength() const
85 { 85 {
86 return constUnwrap<HTMLInputElement>()->maxLength(); 86 int maxLen = constUnwrap<HTMLInputElement>()->maxLength();
87 return maxLen == -1 ? HTMLInputElement::maximumLength : maxLen;
87 } 88 }
88 89
89 void WebInputElement::setActivatedSubmit(bool activated) 90 void WebInputElement::setActivatedSubmit(bool activated)
90 { 91 {
91 unwrap<HTMLInputElement>()->setActivatedSubmit(activated); 92 unwrap<HTMLInputElement>()->setActivatedSubmit(activated);
92 } 93 }
93 94
94 int WebInputElement::size() const 95 int WebInputElement::size() const
95 { 96 {
96 return constUnwrap<HTMLInputElement>()->size(); 97 return constUnwrap<HTMLInputElement>()->size();
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 } 163 }
163 164
164 WebInputElement* toWebInputElement(WebElement* webElement) 165 WebInputElement* toWebInputElement(WebElement* webElement)
165 { 166 {
166 if (!isHTMLInputElement(*webElement->unwrap<Element>())) 167 if (!isHTMLInputElement(*webElement->unwrap<Element>()))
167 return 0; 168 return 0;
168 169
169 return static_cast<WebInputElement*>(webElement); 170 return static_cast<WebInputElement*>(webElement);
170 } 171 }
171 } // namespace blink 172 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLInputElement.cpp ('k') | third_party/WebKit/public/web/WebInputElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698