| Index: content/renderer/render_widget.cc
|
| diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
|
| index 9bccbfc603193a9c0e6dac8cfa7eaa3aedec2754..daf23c910f2ab1c61afa6baea88a511011a9a9ec 100644
|
| --- a/content/renderer/render_widget.cc
|
| +++ b/content/renderer/render_widget.cc
|
| @@ -123,10 +123,6 @@ using blink::WebTouchPoint;
|
| using blink::WebVector;
|
| using blink::WebWidget;
|
|
|
| -#define STATIC_ASSERT_ENUM(a, b) \
|
| - static_assert(static_cast<int>(a) == static_cast<int>(b), \
|
| - "mismatching enums: " #a)
|
| -
|
| namespace {
|
|
|
| typedef std::map<std::string, ui::TextInputMode> TextInputModeMap;
|
| @@ -154,43 +150,6 @@ class WebWidgetLockTarget : public content::MouseLockDispatcher::LockTarget {
|
| blink::WebWidget* webwidget_;
|
| };
|
|
|
| -class TextInputModeMapSingleton {
|
| - public:
|
| - static TextInputModeMapSingleton* GetInstance() {
|
| - return base::Singleton<TextInputModeMapSingleton>::get();
|
| - }
|
| - TextInputModeMapSingleton() {
|
| - map_["verbatim"] = ui::TEXT_INPUT_MODE_VERBATIM;
|
| - map_["latin"] = ui::TEXT_INPUT_MODE_LATIN;
|
| - map_["latin-name"] = ui::TEXT_INPUT_MODE_LATIN_NAME;
|
| - map_["latin-prose"] = ui::TEXT_INPUT_MODE_LATIN_PROSE;
|
| - map_["full-width-latin"] = ui::TEXT_INPUT_MODE_FULL_WIDTH_LATIN;
|
| - map_["kana"] = ui::TEXT_INPUT_MODE_KANA;
|
| - map_["katakana"] = ui::TEXT_INPUT_MODE_KATAKANA;
|
| - map_["numeric"] = ui::TEXT_INPUT_MODE_NUMERIC;
|
| - map_["tel"] = ui::TEXT_INPUT_MODE_TEL;
|
| - map_["email"] = ui::TEXT_INPUT_MODE_EMAIL;
|
| - map_["url"] = ui::TEXT_INPUT_MODE_URL;
|
| - }
|
| - const TextInputModeMap& map() const { return map_; }
|
| - private:
|
| - TextInputModeMap map_;
|
| -
|
| - friend struct base::DefaultSingletonTraits<TextInputModeMapSingleton>;
|
| -
|
| - DISALLOW_COPY_AND_ASSIGN(TextInputModeMapSingleton);
|
| -};
|
| -
|
| -ui::TextInputMode ConvertInputMode(const blink::WebString& input_mode) {
|
| - static TextInputModeMapSingleton* singleton =
|
| - TextInputModeMapSingleton::GetInstance();
|
| - TextInputModeMap::const_iterator it =
|
| - singleton->map().find(input_mode.utf8());
|
| - if (it == singleton->map().end())
|
| - return ui::TEXT_INPUT_MODE_DEFAULT;
|
| - return it->second;
|
| -}
|
| -
|
| content::RenderWidgetInputHandlerDelegate* GetRenderWidgetInputHandlerDelegate(
|
| content::RenderWidget* widget) {
|
| #if defined(USE_AURA)
|
| @@ -213,6 +172,20 @@ content::RenderWidget::CreateRenderWidgetFunction g_create_render_widget =
|
| content::RenderWidget::RenderWidgetInitializedCallback
|
| g_render_widget_initialized = nullptr;
|
|
|
| +ui::TextInputType ConvertWebTextInputType(blink::WebTextInputType type) {
|
| + // Check the type is in the range representable by ui::TextInputType.
|
| + DCHECK_LE(type, static_cast<int>(ui::TEXT_INPUT_TYPE_MAX))
|
| + << "blink::WebTextInputType and ui::TextInputType not synchronized";
|
| + return static_cast<ui::TextInputType>(type);
|
| +}
|
| +
|
| +ui::TextInputMode ConvertWebTextInputMode(blink::WebTextInputMode mode) {
|
| + // Check the mode is in the range representable by ui::TextInputMode.
|
| + DCHECK_LE(mode, static_cast<int>(ui::TEXT_INPUT_MODE_MAX))
|
| + << "blink::WebTextInputMode and ui::TextInputMode not synchronized";
|
| + return static_cast<ui::TextInputMode>(mode);
|
| +}
|
| +
|
| } // namespace
|
|
|
| namespace content {
|
| @@ -931,7 +904,8 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
|
|
|
| blink::WebTextInputInfo new_info = GetWebWidget()->textInputInfo();
|
|
|
| - const ui::TextInputMode new_mode = ConvertInputMode(new_info.inputMode);
|
| + const ui::TextInputMode new_mode =
|
| + ConvertWebTextInputMode(new_info.inputMode);
|
|
|
| bool new_can_compose_inline = CanComposeInline();
|
|
|
| @@ -946,7 +920,7 @@ void RenderWidget::UpdateTextInputState(ShowIme show_ime,
|
| #endif
|
| ) {
|
| TextInputState params;
|
| - params.type = WebKitToUiTextInputType(new_info.type);
|
| + params.type = ConvertWebTextInputType(new_info.type);
|
| params.mode = new_mode;
|
| params.flags = new_info.flags;
|
| params.value = new_info.value.utf8();
|
| @@ -1542,7 +1516,7 @@ ui::TextInputType RenderWidget::GetTextInputType() {
|
| return focused_pepper_plugin_->text_input_type();
|
| #endif
|
| if (GetWebWidget())
|
| - return WebKitToUiTextInputType(GetWebWidget()->textInputType());
|
| + return ConvertWebTextInputType(GetWebWidget()->textInputType());
|
| return ui::TEXT_INPUT_TYPE_NONE;
|
| }
|
|
|
| @@ -1867,40 +1841,6 @@ void RenderWidget::DidAutoResize(const gfx::Size& new_size) {
|
| }
|
| }
|
|
|
| -// Check blink::WebTextInputType and ui::TextInputType is kept in sync.
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeNone, ui::TEXT_INPUT_TYPE_NONE);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeText, ui::TEXT_INPUT_TYPE_TEXT);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypePassword,
|
| - ui::TEXT_INPUT_TYPE_PASSWORD);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeSearch, ui::TEXT_INPUT_TYPE_SEARCH);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeEmail, ui::TEXT_INPUT_TYPE_EMAIL);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeNumber, ui::TEXT_INPUT_TYPE_NUMBER);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeTelephone,
|
| - ui::TEXT_INPUT_TYPE_TELEPHONE);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeURL, ui::TEXT_INPUT_TYPE_URL);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeDate, ui::TEXT_INPUT_TYPE_DATE);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeDateTime,
|
| - ui::TEXT_INPUT_TYPE_DATE_TIME);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeDateTimeLocal,
|
| - ui::TEXT_INPUT_TYPE_DATE_TIME_LOCAL);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeMonth, ui::TEXT_INPUT_TYPE_MONTH);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeTime, ui::TEXT_INPUT_TYPE_TIME);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeWeek, ui::TEXT_INPUT_TYPE_WEEK);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeTextArea,
|
| - ui::TEXT_INPUT_TYPE_TEXT_AREA);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeContentEditable,
|
| - ui::TEXT_INPUT_TYPE_CONTENT_EDITABLE);
|
| -STATIC_ASSERT_ENUM(blink::WebTextInputTypeDateTimeField,
|
| - ui::TEXT_INPUT_TYPE_DATE_TIME_FIELD);
|
| -
|
| -ui::TextInputType RenderWidget::WebKitToUiTextInputType(
|
| - blink::WebTextInputType type) {
|
| - // Check the type is in the range representable by ui::TextInputType.
|
| - DCHECK_LE(type, static_cast<int>(ui::TEXT_INPUT_TYPE_MAX)) <<
|
| - "blink::WebTextInputType and ui::TextInputType not synchronized";
|
| - return static_cast<ui::TextInputType>(type);
|
| -}
|
| -
|
| void RenderWidget::GetCompositionCharacterBounds(
|
| std::vector<gfx::Rect>* bounds) {
|
| DCHECK(bounds);
|
| @@ -2086,22 +2026,6 @@ void RenderWidget::hasTouchEventHandlers(bool has_handlers) {
|
| Send(new ViewHostMsg_HasTouchEventHandlers(routing_id_, has_handlers));
|
| }
|
|
|
| -// Check blink::WebTouchAction and content::TouchAction is kept in sync.
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionNone, TOUCH_ACTION_NONE);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanLeft, TOUCH_ACTION_PAN_LEFT);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanRight, TOUCH_ACTION_PAN_RIGHT);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanX, TOUCH_ACTION_PAN_X);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanUp, TOUCH_ACTION_PAN_UP);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanDown, TOUCH_ACTION_PAN_DOWN);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPanY, TOUCH_ACTION_PAN_Y);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPan, TOUCH_ACTION_PAN);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionPinchZoom, TOUCH_ACTION_PINCH_ZOOM);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionManipulation,
|
| - TOUCH_ACTION_MANIPULATION);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionDoubleTapZoom,
|
| - TOUCH_ACTION_DOUBLE_TAP_ZOOM);
|
| -STATIC_ASSERT_ENUM(blink::WebTouchActionAuto, TOUCH_ACTION_AUTO);
|
| -
|
| void RenderWidget::setTouchAction(
|
| blink::WebTouchAction web_touch_action) {
|
|
|
|
|