| OLD | NEW |
| 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) 2001 Dirk Mueller (mueller@kde.org) | 4 * (C) 2001 Dirk Mueller (mueller@kde.org) |
| 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All | 5 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All |
| 6 * rights reserved. | 6 * rights reserved. |
| 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 7 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) | 8 * Copyright (C) 2007 Samuel Weinig (sam@webkit.org) |
| 9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. | 9 * Copyright (C) 2009, 2010, 2011, 2012 Google Inc. All rights reserved. |
| 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 10 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 #include "platform/text/PlatformLocale.h" | 75 #include "platform/text/PlatformLocale.h" |
| 76 #include "platform/text/TextBreakIterator.h" | 76 #include "platform/text/TextBreakIterator.h" |
| 77 #include "platform/wtf/PtrUtil.h" | 77 #include "platform/wtf/PtrUtil.h" |
| 78 | 78 |
| 79 namespace blink { | 79 namespace blink { |
| 80 | 80 |
| 81 using blink::WebLocalizedString; | 81 using blink::WebLocalizedString; |
| 82 using namespace HTMLNames; | 82 using namespace HTMLNames; |
| 83 | 83 |
| 84 using InputTypeFactoryFunction = InputType* (*)(HTMLInputElement&); | 84 using InputTypeFactoryFunction = InputType* (*)(HTMLInputElement&); |
| 85 using InputTypeFactoryMap = | 85 using InputTypeFactoryMap = HashMap<AtomicString, InputTypeFactoryFunction>; |
| 86 HashMap<AtomicString, InputTypeFactoryFunction, CaseFoldingHash>; | |
| 87 | 86 |
| 88 static std::unique_ptr<InputTypeFactoryMap> CreateInputTypeFactoryMap() { | 87 static std::unique_ptr<InputTypeFactoryMap> CreateInputTypeFactoryMap() { |
| 89 std::unique_ptr<InputTypeFactoryMap> map = | 88 std::unique_ptr<InputTypeFactoryMap> map = |
| 90 WTF::WrapUnique(new InputTypeFactoryMap); | 89 WTF::WrapUnique(new InputTypeFactoryMap); |
| 91 map->insert(InputTypeNames::button, ButtonInputType::Create); | 90 map->insert(InputTypeNames::button, ButtonInputType::Create); |
| 92 map->insert(InputTypeNames::checkbox, CheckboxInputType::Create); | 91 map->insert(InputTypeNames::checkbox, CheckboxInputType::Create); |
| 93 map->insert(InputTypeNames::color, ColorInputType::Create); | 92 map->insert(InputTypeNames::color, ColorInputType::Create); |
| 94 map->insert(InputTypeNames::date, DateInputType::Create); | 93 map->insert(InputTypeNames::date, DateInputType::Create); |
| 95 map->insert(InputTypeNames::datetime_local, DateTimeLocalInputType::Create); | 94 map->insert(InputTypeNames::datetime_local, DateTimeLocalInputType::Create); |
| 96 map->insert(InputTypeNames::email, EmailInputType::Create); | 95 map->insert(InputTypeNames::email, EmailInputType::Create); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 128 } |
| 130 | 129 |
| 131 InputType* InputType::CreateText(HTMLInputElement& element) { | 130 InputType* InputType::CreateText(HTMLInputElement& element) { |
| 132 return TextInputType::Create(element); | 131 return TextInputType::Create(element); |
| 133 } | 132 } |
| 134 | 133 |
| 135 const AtomicString& InputType::NormalizeTypeName( | 134 const AtomicString& InputType::NormalizeTypeName( |
| 136 const AtomicString& type_name) { | 135 const AtomicString& type_name) { |
| 137 if (type_name.IsEmpty()) | 136 if (type_name.IsEmpty()) |
| 138 return InputTypeNames::text; | 137 return InputTypeNames::text; |
| 139 InputTypeFactoryMap::const_iterator it = FactoryMap()->find(type_name); | 138 InputTypeFactoryMap::const_iterator it = |
| 139 FactoryMap()->find(type_name.LowerASCII()); |
| 140 return it == FactoryMap()->end() ? InputTypeNames::text : it->key; | 140 return it == FactoryMap()->end() ? InputTypeNames::text : it->key; |
| 141 } | 141 } |
| 142 | 142 |
| 143 InputType::~InputType() {} | 143 InputType::~InputType() {} |
| 144 | 144 |
| 145 DEFINE_TRACE(InputType) { | 145 DEFINE_TRACE(InputType) { |
| 146 visitor->Trace(element_); | 146 visitor->Trace(element_); |
| 147 } | 147 } |
| 148 | 148 |
| 149 bool InputType::IsTextField() const { | 149 bool InputType::IsTextField() const { |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 | 915 |
| 916 void InputType::AddWarningToConsole(const char* message_format, | 916 void InputType::AddWarningToConsole(const char* message_format, |
| 917 const String& value) const { | 917 const String& value) const { |
| 918 GetElement().GetDocument().AddConsoleMessage(ConsoleMessage::Create( | 918 GetElement().GetDocument().AddConsoleMessage(ConsoleMessage::Create( |
| 919 kRenderingMessageSource, kWarningMessageLevel, | 919 kRenderingMessageSource, kWarningMessageLevel, |
| 920 String::Format(message_format, | 920 String::Format(message_format, |
| 921 JSONValue::QuoteString(value).Utf8().data()))); | 921 JSONValue::QuoteString(value).Utf8().data()))); |
| 922 } | 922 } |
| 923 | 923 |
| 924 } // namespace blink | 924 } // namespace blink |
| OLD | NEW |