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

Unified Diff: Source/core/html/forms/InputType.cpp

Issue 72683003: Auto-generate InputTypeNames source from InputTypeNames.in. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/forms/ImageInputType.cpp ('k') | Source/core/html/forms/InputTypeNames.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/InputType.cpp
diff --git a/Source/core/html/forms/InputType.cpp b/Source/core/html/forms/InputType.cpp
index cefc1f582fb04153386c247a223f2734f65bf3b9..e0979e29f698a9475252433a14abf0a3f98dd56b 100644
--- a/Source/core/html/forms/InputType.cpp
+++ b/Source/core/html/forms/InputType.cpp
@@ -28,6 +28,7 @@
#include "config.h"
#include "core/html/forms/InputType.h"
+#include "InputTypeNames.h"
#include "RuntimeEnabledFeatures.h"
#include "core/accessibility/AXObjectCache.h"
#include "core/dom/NodeRenderStyle.h"
@@ -46,7 +47,6 @@
#include "core/html/forms/FormController.h"
#include "core/html/forms/HiddenInputType.h"
#include "core/html/forms/ImageInputType.h"
-#include "core/html/forms/InputTypeNames.h"
#include "core/html/forms/MonthInputType.h"
#include "core/html/forms/NumberInputType.h"
#include "core/html/forms/PasswordInputType.h"
@@ -79,29 +79,29 @@ typedef HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash> InputTy
static PassOwnPtr<InputTypeFactoryMap> createInputTypeFactoryMap()
{
OwnPtr<InputTypeFactoryMap> map = adoptPtr(new InputTypeFactoryMap);
- map->add(InputTypeNames::button(), ButtonInputType::create);
- map->add(InputTypeNames::checkbox(), CheckboxInputType::create);
+ map->add(InputTypeNames::button, ButtonInputType::create);
+ map->add(InputTypeNames::checkbox, CheckboxInputType::create);
if (RuntimeEnabledFeatures::inputTypeColorEnabled())
- map->add(InputTypeNames::color(), ColorInputType::create);
- map->add(InputTypeNames::date(), DateInputType::create);
- map->add(InputTypeNames::datetimelocal(), DateTimeLocalInputType::create);
- map->add(InputTypeNames::email(), EmailInputType::create);
- map->add(InputTypeNames::file(), FileInputType::create);
- map->add(InputTypeNames::hidden(), HiddenInputType::create);
- map->add(InputTypeNames::image(), ImageInputType::create);
- map->add(InputTypeNames::month(), MonthInputType::create);
- map->add(InputTypeNames::number(), NumberInputType::create);
- map->add(InputTypeNames::password(), PasswordInputType::create);
- map->add(InputTypeNames::radio(), RadioInputType::create);
- map->add(InputTypeNames::range(), RangeInputType::create);
- map->add(InputTypeNames::reset(), ResetInputType::create);
- map->add(InputTypeNames::search(), SearchInputType::create);
- map->add(InputTypeNames::submit(), SubmitInputType::create);
- map->add(InputTypeNames::telephone(), TelephoneInputType::create);
- map->add(InputTypeNames::time(), TimeInputType::create);
- map->add(InputTypeNames::url(), URLInputType::create);
+ map->add(InputTypeNames::color, ColorInputType::create);
+ map->add(InputTypeNames::date, DateInputType::create);
eseidel 2013/11/14 15:17:18 This looks very much like the ElementFactory logic
+ map->add(InputTypeNames::datetime_local, DateTimeLocalInputType::create);
+ map->add(InputTypeNames::email, EmailInputType::create);
+ map->add(InputTypeNames::file, FileInputType::create);
+ map->add(InputTypeNames::hidden, HiddenInputType::create);
+ map->add(InputTypeNames::image, ImageInputType::create);
+ map->add(InputTypeNames::month, MonthInputType::create);
+ map->add(InputTypeNames::number, NumberInputType::create);
+ map->add(InputTypeNames::password, PasswordInputType::create);
+ map->add(InputTypeNames::radio, RadioInputType::create);
+ map->add(InputTypeNames::range, RangeInputType::create);
+ map->add(InputTypeNames::reset, ResetInputType::create);
+ map->add(InputTypeNames::search, SearchInputType::create);
+ map->add(InputTypeNames::submit, SubmitInputType::create);
+ map->add(InputTypeNames::tel, TelephoneInputType::create);
+ map->add(InputTypeNames::time, TimeInputType::create);
+ map->add(InputTypeNames::url, URLInputType::create);
if (RuntimeEnabledFeatures::inputTypeWeekEnabled())
- map->add(InputTypeNames::week(), WeekInputType::create);
+ map->add(InputTypeNames::week, WeekInputType::create);
// No need to register "text" because it is the default type.
return map.release();
}
@@ -128,9 +128,9 @@ PassRefPtr<InputType> InputType::createText(HTMLInputElement& element)
const AtomicString& InputType::normalizeTypeName(const AtomicString& typeName)
{
if (typeName.isEmpty())
- return InputTypeNames::text();
+ return InputTypeNames::text;
InputTypeFactoryMap::const_iterator it = factoryMap()->find(typeName);
- return it == factoryMap()->end() ? InputTypeNames::text() : it->key;
+ return it == factoryMap()->end() ? InputTypeNames::text : it->key;
}
bool InputType::canChangeFromAnotherType(const AtomicString& normalizedTypeName)
@@ -140,7 +140,7 @@ bool InputType::canChangeFromAnotherType(const AtomicString& normalizedTypeName)
// field's value to something like /etc/passwd and then change it to a file
// input. I don't think this would actually occur in Blink, but this rule
// still may be important for compatibility.
- return normalizedTypeName != InputTypeNames::file();
+ return normalizedTypeName != InputTypeNames::file;
}
InputType::~InputType()
« no previous file with comments | « Source/core/html/forms/ImageInputType.cpp ('k') | Source/core/html/forms/InputTypeNames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698