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

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

Issue 120443003: Add autofill preview support for Textarea (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update code as per review comments 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
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 return false; 1012 return false;
1013 } 1013 }
1014 1014
1015 String Internals::suggestedValue(Element* element, ExceptionState& exceptionStat e) 1015 String Internals::suggestedValue(Element* element, ExceptionState& exceptionStat e)
1016 { 1016 {
1017 if (!element) { 1017 if (!element) {
1018 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or); 1018 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1019 return String(); 1019 return String();
1020 } 1020 }
1021 1021
1022 if (!element->hasTagName(inputTag)) { 1022 if (!element->isFormControlElement()) {
1023 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror); 1023 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1024 return String(); 1024 return String();
1025 } 1025 }
1026 1026
1027 return toHTMLInputElement(element)->suggestedValue(); 1027 String suggestedValue;
1028 if (element->hasTagName(inputTag))
1029 suggestedValue = toHTMLInputElement(element)->suggestedValue();
1030
1031 if (element->hasTagName(textareaTag))
1032 suggestedValue = toHTMLTextAreaElement(element)->suggestedValue();
1033 return suggestedValue;
1028 } 1034 }
1029 1035
1030 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState) 1036 void Internals::setSuggestedValue(Element* element, const String& value, Excepti onState& exceptionState)
1031 { 1037 {
1032 if (!element) { 1038 if (!element) {
1033 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or); 1039 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1034 return; 1040 return;
1035 } 1041 }
1036 1042
1037 if (!element->hasTagName(inputTag)) { 1043 if (!element->isFormControlElement()) {
1038 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror); 1044 exceptionState.throwUninformativeAndGenericDOMException(InvalidNodeTypeE rror);
1039 return; 1045 return;
1040 } 1046 }
1041 1047
1042 toHTMLInputElement(element)->setSuggestedValue(value); 1048 if (element->hasTagName(inputTag))
1049 toHTMLInputElement(element)->setSuggestedValue(value);
1050
1051 if (element->hasTagName(textareaTag))
1052 toHTMLTextAreaElement(element)->setSuggestedValue(value);
1043 } 1053 }
1044 1054
1045 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState) 1055 void Internals::setEditingValue(Element* element, const String& value, Exception State& exceptionState)
1046 { 1056 {
1047 if (!element) { 1057 if (!element) {
1048 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or); 1058 exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessErr or);
1049 return; 1059 return;
1050 } 1060 }
1051 1061
1052 if (!element->hasTagName(inputTag)) { 1062 if (!element->hasTagName(inputTag)) {
(...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
2328 if (view->compositor()) 2338 if (view->compositor())
2329 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork); 2339 view->compositor()->updateCompositingLayers(CompositingUpdateFinishAllDe ferredWork);
2330 } 2340 }
2331 2341
2332 void Internals::setZoomFactor(float factor) 2342 void Internals::setZoomFactor(float factor)
2333 { 2343 {
2334 frame()->setPageZoomFactor(factor); 2344 frame()->setPageZoomFactor(factor);
2335 } 2345 }
2336 2346
2337 } 2347 }
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/web/WebTextAreaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698