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

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: Add layout tests for minlength & maxlength together; fix comments Created 6 years, 2 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 virtual bool shouldAutocomplete() const override final; 56 virtual bool shouldAutocomplete() const override final;
57 57
58 // For ValidityState 58 // For ValidityState
59 virtual bool hasBadInput() const override final; 59 virtual bool hasBadInput() const override final;
60 virtual bool patternMismatch() const override final; 60 virtual bool patternMismatch() const override final;
61 virtual bool rangeUnderflow() const override final; 61 virtual bool rangeUnderflow() const override final;
62 virtual bool rangeOverflow() const override final; 62 virtual bool rangeOverflow() const override final;
63 virtual bool stepMismatch() const override final; 63 virtual bool stepMismatch() const override final;
64 virtual bool tooLong() const override final; 64 virtual bool tooLong() const override final;
65 virtual bool tooShort() const override final;
65 virtual bool typeMismatch() const override final; 66 virtual bool typeMismatch() const override final;
66 virtual bool valueMissing() const override final; 67 virtual bool valueMissing() const override final;
67 virtual String validationMessage() const override final; 68 virtual String validationMessage() const override final;
68 69
69 // Returns the minimum value for type=date, number, or range. Don't call th is for other types. 70 // Returns the minimum value for type=date, number, or range. Don't call th is for other types.
70 double minimum() const; 71 double minimum() const;
71 // Returns the maximum value for type=date, number, or range. Don't call th is for other types. 72 // Returns the maximum value for type=date, number, or range. Don't call th is for other types.
72 // This always returns a value which is >= minimum(). 73 // This always returns a value which is >= minimum().
73 double maximum() const; 74 double maximum() const;
74 // Sets the "allowed value step" defined in the HTML spec to the specified d ouble pointer. 75 // Sets the "allowed value step" defined in the HTML spec to the specified d ouble pointer.
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 Vector<String> acceptMIMETypes(); 163 Vector<String> acceptMIMETypes();
163 Vector<String> acceptFileExtensions(); 164 Vector<String> acceptFileExtensions();
164 const AtomicString& alt() const; 165 const AtomicString& alt() const;
165 166
166 void setSize(unsigned); 167 void setSize(unsigned);
167 void setSize(unsigned, ExceptionState&); 168 void setSize(unsigned, ExceptionState&);
168 169
169 KURL src() const; 170 KURL src() const;
170 171
171 int maxLength() const; 172 int maxLength() const;
173 int minLength() const;
172 void setMaxLength(int, ExceptionState&); 174 void setMaxLength(int, ExceptionState&);
175 void setMinLength(int, ExceptionState&);
173 176
174 bool multiple() const; 177 bool multiple() const;
175 178
176 FileList* files(); 179 FileList* files();
177 void setFiles(FileList*); 180 void setFiles(FileList*);
178 181
179 // Returns true if the given DragData has more than one dropped files. 182 // Returns true if the given DragData has more than one dropped files.
180 bool receiveDroppedFiles(const DragData*); 183 bool receiveDroppedFiles(const DragData*);
181 184
182 String droppedFileSystemId(); 185 String droppedFileSystemId();
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 virtual void* preDispatchEventHandler(Event*) override final; 312 virtual void* preDispatchEventHandler(Event*) override final;
310 virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch) ove rride final; 313 virtual void postDispatchEventHandler(Event*, void* dataFromPreDispatch) ove rride final;
311 314
312 virtual bool isURLAttribute(const Attribute&) const override final; 315 virtual bool isURLAttribute(const Attribute&) const override final;
313 virtual bool hasLegalLinkAttribute(const QualifiedName&) const override fina l; 316 virtual bool hasLegalLinkAttribute(const QualifiedName&) const override fina l;
314 virtual const QualifiedName& subResourceAttributeName() const override final ; 317 virtual const QualifiedName& subResourceAttributeName() const override final ;
315 virtual bool isInRange() const override final; 318 virtual bool isInRange() const override final;
316 virtual bool isOutOfRange() const override final; 319 virtual bool isOutOfRange() const override final;
317 320
318 bool tooLong(const String&, NeedsToCheckDirtyFlag) const; 321 bool tooLong(const String&, NeedsToCheckDirtyFlag) const;
322 bool tooShort(const String&, NeedsToCheckDirtyFlag) const;
319 323
320 virtual bool supportsPlaceholder() const override final; 324 virtual bool supportsPlaceholder() const override final;
321 virtual void updatePlaceholderText() override final; 325 virtual void updatePlaceholderText() override final;
322 virtual bool isEmptyValue() const override final { return innerEditorValue() .isEmpty(); } 326 virtual bool isEmptyValue() const override final { return innerEditorValue() .isEmpty(); }
323 virtual bool isEmptySuggestedValue() const override final { return suggested Value().isEmpty(); } 327 virtual bool isEmptySuggestedValue() const override final { return suggested Value().isEmpty(); }
324 virtual void handleFocusEvent(Element* oldFocusedElement, FocusType) overrid e final; 328 virtual void handleFocusEvent(Element* oldFocusedElement, FocusType) overrid e final;
325 virtual void handleBlurEvent() override final; 329 virtual void handleBlurEvent() override final;
326 virtual void dispatchFocusInEvent(const AtomicString& eventType, Element* ol dFocusedElement, FocusType) override final; 330 virtual void dispatchFocusInEvent(const AtomicString& eventType, Element* ol dFocusedElement, FocusType) override final;
327 331
328 virtual bool isOptionalFormControl() const override final { return !isRequir edFormControl(); } 332 virtual bool isOptionalFormControl() const override final { return !isRequir edFormControl(); }
329 virtual bool isRequiredFormControl() const override final; 333 virtual bool isRequiredFormControl() const override final;
330 virtual bool recalcWillValidate() const override final; 334 virtual bool recalcWillValidate() const override final;
331 virtual void requiredAttributeChanged() override final; 335 virtual void requiredAttributeChanged() override final;
332 336
333 void updateType(); 337 void updateType();
334 338
335 virtual void subtreeHasChanged() override final; 339 virtual void subtreeHasChanged() override final;
336 340
337 void setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<ListAttributeTarg etObserver>); 341 void setListAttributeTargetObserver(PassOwnPtrWillBeRawPtr<ListAttributeTarg etObserver>);
338 void resetListAttributeTargetObserver(); 342 void resetListAttributeTargetObserver();
339 void parseMaxLengthAttribute(const AtomicString&); 343 void parseMaxLengthAttribute(const AtomicString&);
344 void parseMinLengthAttribute(const AtomicString&);
340 void updateValueIfNeeded(); 345 void updateValueIfNeeded();
341 346
342 // Returns null if this isn't associated with any radio button group. 347 // Returns null if this isn't associated with any radio button group.
343 RadioButtonGroupScope* radioButtonGroupScope() const; 348 RadioButtonGroupScope* radioButtonGroupScope() const;
344 void addToRadioButtonGroup(); 349 void addToRadioButtonGroup();
345 void removeFromRadioButtonGroup(); 350 void removeFromRadioButtonGroup();
346 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI) 351 #if ENABLE(INPUT_MULTIPLE_FIELDS_UI)
347 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override; 352 virtual PassRefPtr<RenderStyle> customStyleForRenderer() override;
348 #endif 353 #endif
349 354
350 virtual bool shouldDispatchFormControlChangeEvent(String&, String&) override ; 355 virtual bool shouldDispatchFormControlChangeEvent(String&, String&) override ;
351 356
352 AtomicString m_name; 357 AtomicString m_name;
353 String m_valueIfDirty; 358 String m_valueIfDirty;
354 String m_suggestedValue; 359 String m_suggestedValue;
355 int m_size; 360 int m_size;
356 int m_maxLength; 361 int m_maxLength;
362 int m_minLength;
tkent 2014/10/15 00:50:25 I don't think we need new data member. We should
Bartek Nowierski 2014/10/16 04:55:14 Someone decided that it's worth doing for maxlengt
357 short m_maxResults; 363 short m_maxResults;
358 bool m_isChecked : 1; 364 bool m_isChecked : 1;
359 bool m_reflectsCheckedAttribute : 1; 365 bool m_reflectsCheckedAttribute : 1;
360 bool m_isIndeterminate : 1; 366 bool m_isIndeterminate : 1;
361 bool m_isActivatedSubmit : 1; 367 bool m_isActivatedSubmit : 1;
362 unsigned m_autocomplete : 2; // AutoCompleteSetting 368 unsigned m_autocomplete : 2; // AutoCompleteSetting
363 bool m_hasNonEmptyList : 1; 369 bool m_hasNonEmptyList : 1;
364 bool m_stateRestored : 1; 370 bool m_stateRestored : 1;
365 bool m_parsingInProgress : 1; 371 bool m_parsingInProgress : 1;
366 bool m_valueAttributeWasUpdatedAfterParsing : 1; 372 bool m_valueAttributeWasUpdatedAfterParsing : 1;
367 bool m_canReceiveDroppedFiles : 1; 373 bool m_canReceiveDroppedFiles : 1;
368 bool m_hasTouchEventHandler : 1; 374 bool m_hasTouchEventHandler : 1;
369 bool m_shouldRevealPassword : 1; 375 bool m_shouldRevealPassword : 1;
370 bool m_needsToUpdateViewValue : 1; 376 bool m_needsToUpdateViewValue : 1;
371 RefPtrWillBeMember<InputType> m_inputType; 377 RefPtrWillBeMember<InputType> m_inputType;
372 RefPtrWillBeMember<InputTypeView> m_inputTypeView; 378 RefPtrWillBeMember<InputTypeView> m_inputTypeView;
373 // The ImageLoader must be owned by this element because the loader code ass umes 379 // The ImageLoader must be owned by this element because the loader code ass umes
374 // that it lives as long as its owning element lives. If we move the loader into 380 // that it lives as long as its owning element lives. If we move the loader into
375 // the ImageInput object we may delete the loader while this element lives o n. 381 // the ImageInput object we may delete the loader while this element lives o n.
376 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader; 382 OwnPtrWillBeMember<HTMLImageLoader> m_imageLoader;
377 OwnPtrWillBeMember<ListAttributeTargetObserver> m_listAttributeTargetObserve r; 383 OwnPtrWillBeMember<ListAttributeTargetObserver> m_listAttributeTargetObserve r;
378 }; 384 };
379 385
380 } // namespace blink 386 } // namespace blink
381 387
382 #endif // HTMLInputElement_h 388 #endif // HTMLInputElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698