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

Side by Side Diff: Source/core/html/HTMLInputElement.h

Issue 435753003: Implement minlength for <input> and <textarea>. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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) 2000 Dirk Mueller (mueller@kde.org) 4 * (C) 2000 Dirk Mueller (mueller@kde.org)
5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved. 5 * Copyright (C) 2004, 2005, 2006, 2007, 2010 Apple Inc. All rights reserved.
6 * Copyright (C) 2012 Samsung Electronics. All rights reserved. 6 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 virtual bool shouldAutocomplete() const OVERRIDE FINAL; 55 virtual bool shouldAutocomplete() const OVERRIDE FINAL;
56 56
57 // For ValidityState 57 // For ValidityState
58 virtual bool hasBadInput() const OVERRIDE FINAL; 58 virtual bool hasBadInput() const OVERRIDE FINAL;
59 virtual bool patternMismatch() const OVERRIDE FINAL; 59 virtual bool patternMismatch() const OVERRIDE FINAL;
60 virtual bool rangeUnderflow() const OVERRIDE FINAL; 60 virtual bool rangeUnderflow() const OVERRIDE FINAL;
61 virtual bool rangeOverflow() const OVERRIDE FINAL; 61 virtual bool rangeOverflow() const OVERRIDE FINAL;
62 virtual bool stepMismatch() const OVERRIDE FINAL; 62 virtual bool stepMismatch() const OVERRIDE FINAL;
63 virtual bool tooLong() const OVERRIDE FINAL; 63 virtual bool tooLong() const OVERRIDE FINAL;
64 virtual bool tooShort() const OVERRIDE FINAL;
64 virtual bool typeMismatch() const OVERRIDE FINAL; 65 virtual bool typeMismatch() const OVERRIDE FINAL;
65 virtual bool valueMissing() const OVERRIDE FINAL; 66 virtual bool valueMissing() const OVERRIDE FINAL;
66 virtual String validationMessage() const OVERRIDE FINAL; 67 virtual String validationMessage() const OVERRIDE FINAL;
67 68
68 // Returns the minimum value for type=date, number, or range. Don't call th is for other types. 69 // Returns the minimum value for type=date, number, or range. Don't call th is for other types.
69 double minimum() const; 70 double minimum() const;
70 // Returns the maximum value for type=date, number, or range. Don't call th is for other types. 71 // Returns the maximum value for type=date, number, or range. Don't call th is for other types.
71 // This always returns a value which is >= minimum(). 72 // This always returns a value which is >= minimum().
72 double maximum() const; 73 double maximum() const;
73 // Sets the "allowed value step" defined in the HTML spec to the specified d ouble pointer. 74 // Sets the "allowed value step" defined in the HTML spec to the specified d ouble pointer.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 Vector<String> acceptMIMETypes(); 186 Vector<String> acceptMIMETypes();
186 Vector<String> acceptFileExtensions(); 187 Vector<String> acceptFileExtensions();
187 const AtomicString& alt() const; 188 const AtomicString& alt() const;
188 189
189 void setSize(unsigned); 190 void setSize(unsigned);
190 void setSize(unsigned, ExceptionState&); 191 void setSize(unsigned, ExceptionState&);
191 192
192 KURL src() const; 193 KURL src() const;
193 194
194 int maxLength() const; 195 int maxLength() const;
196 int minLength() const;
195 void setMaxLength(int, ExceptionState&); 197 void setMaxLength(int, ExceptionState&);
198 void setMinLength(int, ExceptionState&);
196 199
197 bool multiple() const; 200 bool multiple() const;
198 201
199 FileList* files(); 202 FileList* files();
200 void setFiles(PassRefPtrWillBeRawPtr<FileList>); 203 void setFiles(PassRefPtrWillBeRawPtr<FileList>);
201 204
202 // Returns true if the given DragData has more than one dropped files. 205 // Returns true if the given DragData has more than one dropped files.
203 bool receiveDroppedFiles(const DragData*); 206 bool receiveDroppedFiles(const DragData*);
204 207
205 String droppedFileSystemId(); 208 String droppedFileSystemId();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch) OVE RRIDE FINAL; 335 virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch) OVE RRIDE FINAL;
333 336
334 virtual bool isURLAttribute(const Attribute&) const OVERRIDE FINAL; 337 virtual bool isURLAttribute(const Attribute&) const OVERRIDE FINAL;
335 virtual bool hasLegalLinkAttribute(const QualifiedName&) const OVERRIDE FINA L; 338 virtual bool hasLegalLinkAttribute(const QualifiedName&) const OVERRIDE FINA L;
336 virtual const QualifiedName& subResourceAttributeName() const OVERRIDE FINAL ; 339 virtual const QualifiedName& subResourceAttributeName() const OVERRIDE FINAL ;
337 virtual bool isInRange() const OVERRIDE FINAL; 340 virtual bool isInRange() const OVERRIDE FINAL;
338 virtual bool isOutOfRange() const OVERRIDE FINAL; 341 virtual bool isOutOfRange() const OVERRIDE FINAL;
339 342
340 bool isTextType() const; 343 bool isTextType() const;
341 bool tooLong(const String&, NeedsToCheckDirtyFlag) const; 344 bool tooLong(const String&, NeedsToCheckDirtyFlag) const;
345 bool tooShort(const String&, NeedsToCheckDirtyFlag) const;
342 346
343 virtual bool supportsPlaceholder() const OVERRIDE FINAL; 347 virtual bool supportsPlaceholder() const OVERRIDE FINAL;
344 virtual void updatePlaceholderText() OVERRIDE FINAL; 348 virtual void updatePlaceholderText() OVERRIDE FINAL;
345 virtual bool isEmptyValue() const OVERRIDE FINAL { return innerEditorValue() .isEmpty(); } 349 virtual bool isEmptyValue() const OVERRIDE FINAL { return innerEditorValue() .isEmpty(); }
346 virtual bool isEmptySuggestedValue() const OVERRIDE FINAL { return suggested Value().isEmpty(); } 350 virtual bool isEmptySuggestedValue() const OVERRIDE FINAL { return suggested Value().isEmpty(); }
347 virtual void handleFocusEvent(Element* oldFocusedElement, FocusType) OVERRID E FINAL; 351 virtual void handleFocusEvent(Element* oldFocusedElement, FocusType) OVERRID E FINAL;
348 virtual void handleBlurEvent() OVERRIDE FINAL; 352 virtual void handleBlurEvent() OVERRIDE FINAL;
349 353
350 virtual bool isOptionalFormControl() const OVERRIDE FINAL { return !isRequir edFormControl(); } 354 virtual bool isOptionalFormControl() const OVERRIDE FINAL { return !isRequir edFormControl(); }
351 virtual bool isRequiredFormControl() const OVERRIDE FINAL; 355 virtual bool isRequiredFormControl() const OVERRIDE FINAL;
352 virtual bool recalcWillValidate() const OVERRIDE FINAL; 356 virtual bool recalcWillValidate() const OVERRIDE FINAL;
353 virtual void requiredAttributeChanged() OVERRIDE FINAL; 357 virtual void requiredAttributeChanged() OVERRIDE FINAL;
354 358
355 void updateType(); 359 void updateType();
356 360
357 virtual void subtreeHasChanged() OVERRIDE FINAL; 361 virtual void subtreeHasChanged() OVERRIDE FINAL;
358 362
359 void setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<ListAttributeTarg etObserver>); 363 void setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<ListAttributeTarg etObserver>);
360 void resetListAttributeTargetObserver(); 364 void resetListAttributeTargetObserver();
361 void parseMaxLengthAttribute(const AtomicString&); 365 void parseMaxLengthAttribute(const AtomicString&);
366 void parseMinLengthAttribute(const AtomicString&);
362 void updateValueIfNeeded(); 367 void updateValueIfNeeded();
363 368
364 // Returns null if this isn't associated with any radio button group. 369 // Returns null if this isn't associated with any radio button group.
365 RadioButtonGroupScope* radioButtonGroupScope() const; 370 RadioButtonGroupScope* radioButtonGroupScope() const;
366 void addToRadioButtonGroup(); 371 void addToRadioButtonGroup();
367 void removeFromRadioButtonGroup(); 372 void removeFromRadioButtonGroup();
368 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 373 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
369 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE; 374 virtual PassRefPtr<RenderStyle> customStyleForRenderer() OVERRIDE;
370 #endif 375 #endif
371 376
372 virtual bool shouldDispatchFormControlChangeEvent(String&, String&) OVERRIDE ; 377 virtual bool shouldDispatchFormControlChangeEvent(String&, String&) OVERRIDE ;
373 378
374 AtomicString m_name; 379 AtomicString m_name;
375 String m_valueIfDirty; 380 String m_valueIfDirty;
376 String m_suggestedValue; 381 String m_suggestedValue;
377 int m_size; 382 int m_size;
378 int m_maxLength; 383 int m_maxLength;
384 int m_minLength;
379 short m_maxResults; 385 short m_maxResults;
380 bool m_isChecked : 1; 386 bool m_isChecked : 1;
381 bool m_reflectsCheckedAttribute : 1; 387 bool m_reflectsCheckedAttribute : 1;
382 bool m_isIndeterminate : 1; 388 bool m_isIndeterminate : 1;
383 bool m_isActivatedSubmit : 1; 389 bool m_isActivatedSubmit : 1;
384 unsigned m_autocomplete : 2; // AutoCompleteSetting 390 unsigned m_autocomplete : 2; // AutoCompleteSetting
385 bool m_hasNonEmptyList : 1; 391 bool m_hasNonEmptyList : 1;
386 bool m_stateRestored : 1; 392 bool m_stateRestored : 1;
387 bool m_parsingInProgress : 1; 393 bool m_parsingInProgress : 1;
388 bool m_valueAttributeWasUpdatedAfterParsing : 1; 394 bool m_valueAttributeWasUpdatedAfterParsing : 1;
389 bool m_canReceiveDroppedFiles : 1; 395 bool m_canReceiveDroppedFiles : 1;
390 bool m_hasTouchEventHandler : 1; 396 bool m_hasTouchEventHandler : 1;
391 bool m_shouldRevealPassword : 1; 397 bool m_shouldRevealPassword : 1;
392 bool m_needsToUpdateViewValue : 1; 398 bool m_needsToUpdateViewValue : 1;
393 RefPtrWillBeMember<InputType> m_inputType; 399 RefPtrWillBeMember<InputType> m_inputType;
394 RefPtrWillBeMember<InputTypeView> m_inputTypeView; 400 RefPtrWillBeMember<InputTypeView> m_inputTypeView;
395 // The ImageLoader must be owned by this element because the loader code ass umes 401 // The ImageLoader must be owned by this element because the loader code ass umes
396 // that it lives as long as its owning element lives. If we move the loader into 402 // that it lives as long as its owning element lives. If we move the loader into
397 // the ImageInput object we may delete the loader while this element lives o n. 403 // the ImageInput object we may delete the loader while this element lives o n.
398 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; 404 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader;
399 OwnPtrWillBeMember<ListAttributeTargetObserver> m_listAttributeTargetObserve r; 405 OwnPtrWillBeMember<ListAttributeTargetObserver> m_listAttributeTargetObserve r;
400 }; 406 };
401 407
402 } //namespace 408 } //namespace
403 #endif 409 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698