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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 138433002: Add Autofill preview support for <select> input fields (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update code and addressed all the review comments Created 6 years, 9 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Apple Inc. All rights reserved. 3 * Copyright (C) 2013 Apple Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a form control element."); 1003 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a form control element.");
1004 return String(); 1004 return String();
1005 } 1005 }
1006 1006
1007 String suggestedValue; 1007 String suggestedValue;
1008 if (element->hasTagName(inputTag)) 1008 if (element->hasTagName(inputTag))
1009 suggestedValue = toHTMLInputElement(element)->suggestedValue(); 1009 suggestedValue = toHTMLInputElement(element)->suggestedValue();
1010 1010
1011 if (element->hasTagName(textareaTag)) 1011 if (element->hasTagName(textareaTag))
1012 suggestedValue = toHTMLTextAreaElement(element)->suggestedValue(); 1012 suggestedValue = toHTMLTextAreaElement(element)->suggestedValue();
1013
1014 if (element->hasTagName(selectTag))
1015 suggestedValue = toHTMLSelectElement(element)->suggestedValue();
1013 return suggestedValue; 1016 return suggestedValue;
1014 } 1017 }
1015 1018
1016 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState) 1019 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState)
1017 { 1020 {
1018 if (!element) { 1021 if (!element) {
1019 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 1022 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1020 return; 1023 return;
1021 } 1024 }
1022 1025
1023 if (!element->isFormControlElement()) { 1026 if (!element->isFormControlElement()) {
1024 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a form control element."); 1027 exceptionState.throwDOMException(InvalidNodeTypeError, "The element prov ided is not a form control element.");
1025 return; 1028 return;
1026 } 1029 }
1027 1030
1028 if (element->hasTagName(inputTag)) 1031 if (element->hasTagName(inputTag))
1029 toHTMLInputElement(element)->setSuggestedValue(value); 1032 toHTMLInputElement(element)->setSuggestedValue(value);
1030 1033
1031 if (element->hasTagName(textareaTag)) 1034 if (element->hasTagName(textareaTag))
1032 toHTMLTextAreaElement(element)->setSuggestedValue(value); 1035 toHTMLTextAreaElement(element)->setSuggestedValue(value);
1036
1037 if (element->hasTagName(selectTag))
1038 toHTMLSelectElement(element)->setSuggestedValue(value);
1033 } 1039 }
1034 1040
1035 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState) 1041 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState)
1036 { 1042 {
1037 if (!element) { 1043 if (!element) {
1038 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element")); 1044 exceptionState.throwDOMException(InvalidAccessError, ExceptionMessages:: argumentNullOrIncorrectType(1, "Element"));
1039 return; 1045 return;
1040 } 1046 }
1041 1047
1042 if (!element->hasTagName(inputTag)) { 1048 if (!element->hasTagName(inputTag)) {
(...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 return promise.then(AddOneFunction::create(context)); 2387 return promise.then(AddOneFunction::create(context));
2382 } 2388 }
2383 2389
2384 void Internals::trace(Visitor* visitor) 2390 void Internals::trace(Visitor* visitor)
2385 { 2391 {
2386 visitor->trace(m_runtimeFlags); 2392 visitor->trace(m_runtimeFlags);
2387 visitor->trace(m_profilers); 2393 visitor->trace(m_profilers);
2388 } 2394 }
2389 2395
2390 } 2396 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698