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

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: Created 6 years, 11 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 1028 matching lines...) Expand 10 before | Expand all | Expand 10 after
1039 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror); 1039 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1040 return String(); 1040 return String();
1041 } 1041 }
1042 1042
1043 String suggestedValue; 1043 String suggestedValue;
1044 if (element->hasTagName(inputTag)) 1044 if (element->hasTagName(inputTag))
1045 suggestedValue = toHTMLInputElement(element)->suggestedValue(); 1045 suggestedValue = toHTMLInputElement(element)->suggestedValue();
1046 1046
1047 if (element->hasTagName(textareaTag)) 1047 if (element->hasTagName(textareaTag))
1048 suggestedValue = toHTMLTextAreaElement(element)->suggestedValue(); 1048 suggestedValue = toHTMLTextAreaElement(element)->suggestedValue();
1049
1050 if (element->hasTagName(selectTag))
1051 suggestedValue = toHTMLSelectElement(element)->suggestedValue();
1049 return suggestedValue; 1052 return suggestedValue;
1050 } 1053 }
1051 1054
1052 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState) 1055 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState)
1053 { 1056 {
1054 if (!element) { 1057 if (!element) {
1055 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or); 1058 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1056 return; 1059 return;
1057 } 1060 }
1058 1061
1059 if (!element->isFormControlElement()) { 1062 if (!element->isFormControlElement()) {
1060 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror); 1063 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1061 return; 1064 return;
1062 } 1065 }
1063 1066
1064 if (element->hasTagName(inputTag)) 1067 if (element->hasTagName(inputTag))
1065 toHTMLInputElement(element)->setSuggestedValue(value); 1068 toHTMLInputElement(element)->setSuggestedValue(value);
1066 1069
1067 if (element->hasTagName(textareaTag)) 1070 if (element->hasTagName(textareaTag))
1068 toHTMLTextAreaElement(element)->setSuggestedValue(value); 1071 toHTMLTextAreaElement(element)->setSuggestedValue(value);
1072
1073 if (element->hasTagName(selectTag))
1074 toHTMLSelectElement(element)->setSuggestedValue(value);
1075 }
1076
1077 String Internals::originalValue(Element* element, ExceptionState& exceptionState )
1078 {
1079 if (!element) {
1080 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1081 return String();
1082 }
1083
1084 if (!element->isFormControlElement()) {
1085 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1086 return String();
1087 }
1088
1089 String originalValue;
1090 if (element->hasTagName(selectTag))
1091 originalValue = toHTMLSelectElement(element)->originalValue();
1092 return originalValue;
1093 }
1094
1095 void Internals::setOriginalValue(Element* element, const String& value, Exceptio nState& exceptionState)
1096 {
1097 if (!element) {
1098 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1099 return;
1100 }
1101
1102 if (!element->isFormControlElement()) {
1103 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1104 return;
1105 }
1106
1107 if (element->hasTagName(selectTag))
1108 toHTMLSelectElement(element)->setOriginalValue(value);
1069 } 1109 }
1070 1110
1071 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState) 1111 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState)
1072 { 1112 {
1073 if (!element) { 1113 if (!element) {
1074 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or); 1114 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1075 return; 1115 return;
1076 } 1116 }
1077 1117
1078 if (!element->hasTagName(inputTag)) { 1118 if (!element->hasTagName(inputTag)) {
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2354 if (view->compositor()) 2394 if (view->compositor())
2355 view->compositor()->updateCompositingLayers(); 2395 view->compositor()->updateCompositingLayers();
2356 } 2396 }
2357 2397
2358 void Internals::setZoomFactor(float factor) 2398 void Internals::setZoomFactor(float factor)
2359 { 2399 {
2360 frame()->setPageZoomFactor(factor); 2400 frame()->setPageZoomFactor(factor);
2361 } 2401 }
2362 2402
2363 } 2403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698