Bug 1598539 : convert NS_STYLE_IME_MODE_* to an enum class in nsStyleConsts.h r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D54255

--HG--
extra : moz-landing-system : lando
This commit is contained in:
jeffin143 2019-11-25 15:41:18 +00:00
Родитель 962424ac4d
Коммит 2293551763
6 изменённых файлов: 19 добавлений и 13 удалений

Просмотреть файл

@ -2396,19 +2396,21 @@ nsresult EditorBase::GetPreferredIMEState(IMEState* aState) {
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE); NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
switch (frame->StyleUIReset()->mIMEMode) { switch (frame->StyleUIReset()->mIMEMode) {
case NS_STYLE_IME_MODE_AUTO: case StyleImeMode::Auto:
if (IsPasswordEditor()) aState->mEnabled = IMEState::PASSWORD; if (IsPasswordEditor()) aState->mEnabled = IMEState::PASSWORD;
break; break;
case NS_STYLE_IME_MODE_DISABLED: case StyleImeMode::Disabled:
// we should use password state for |ime-mode: disabled;|. // we should use password state for |ime-mode: disabled;|.
aState->mEnabled = IMEState::PASSWORD; aState->mEnabled = IMEState::PASSWORD;
break; break;
case NS_STYLE_IME_MODE_ACTIVE: case StyleImeMode::Active:
aState->mOpen = IMEState::OPEN; aState->mOpen = IMEState::OPEN;
break; break;
case NS_STYLE_IME_MODE_INACTIVE: case StyleImeMode::Inactive:
aState->mOpen = IMEState::CLOSED; aState->mOpen = IMEState::CLOSED;
break; break;
case StyleImeMode::Normal:
break;
} }
return NS_OK; return NS_OK;

Просмотреть файл

@ -119,6 +119,7 @@ rusty-enums = [
"mozilla::StyleRuleInclusion", "mozilla::StyleRuleInclusion",
"mozilla::StyleGridTrackBreadth", "mozilla::StyleGridTrackBreadth",
"mozilla::StyleOverscrollBehavior", "mozilla::StyleOverscrollBehavior",
"mozilla::StyleImeMode",
"mozilla::StyleOverflowAnchor", "mozilla::StyleOverflowAnchor",
"mozilla::StyleScrollbarWidth", "mozilla::StyleScrollbarWidth",
"mozilla::StyleWhiteSpace", "mozilla::StyleWhiteSpace",

Просмотреть файл

@ -722,11 +722,13 @@ enum class StyleWhiteSpace : uint8_t {
#define NS_STYLE_PAGE_BREAK_RIGHT 4 #define NS_STYLE_PAGE_BREAK_RIGHT 4
// See nsStyleUIReset // See nsStyleUIReset
#define NS_STYLE_IME_MODE_AUTO 0 enum class StyleImeMode : uint8_t {
#define NS_STYLE_IME_MODE_NORMAL 1 Auto,
#define NS_STYLE_IME_MODE_ACTIVE 2 Normal,
#define NS_STYLE_IME_MODE_DISABLED 3 Active,
#define NS_STYLE_IME_MODE_INACTIVE 4 Disabled,
Inactive,
};
// See nsStyleSVG // See nsStyleSVG

Просмотреть файл

@ -3703,7 +3703,7 @@ nsStyleUIReset::nsStyleUIReset(const Document& aDocument)
: mUserSelect(StyleUserSelect::Auto), : mUserSelect(StyleUserSelect::Auto),
mScrollbarWidth(StyleScrollbarWidth::Auto), mScrollbarWidth(StyleScrollbarWidth::Auto),
mForceBrokenImageIcon(0), mForceBrokenImageIcon(0),
mIMEMode(NS_STYLE_IME_MODE_AUTO), mIMEMode(StyleImeMode::Auto),
mWindowDragging(StyleWindowDragging::Default), mWindowDragging(StyleWindowDragging::Default),
mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT), mWindowShadow(NS_STYLE_WINDOW_SHADOW_DEFAULT),
mWindowOpacity(1.0), mWindowOpacity(1.0),

Просмотреть файл

@ -2074,7 +2074,7 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleUIReset {
mozilla::StyleUserSelect mUserSelect; // [reset](selection-style) mozilla::StyleUserSelect mUserSelect; // [reset](selection-style)
mozilla::StyleScrollbarWidth mScrollbarWidth; mozilla::StyleScrollbarWidth mScrollbarWidth;
uint8_t mForceBrokenImageIcon; // (0 if not forcing, otherwise forcing) uint8_t mForceBrokenImageIcon; // (0 if not forcing, otherwise forcing)
uint8_t mIMEMode; mozilla::StyleImeMode mIMEMode;
mozilla::StyleWindowDragging mWindowDragging; mozilla::StyleWindowDragging mWindowDragging;
uint8_t mWindowShadow; uint8_t mWindowShadow;
float mWindowOpacity; float mWindowOpacity;

Просмотреть файл

@ -15,6 +15,7 @@ ${helpers.single_keyword(
"ime-mode", "ime-mode",
"auto normal active disabled inactive", "auto normal active disabled inactive",
engines="gecko", engines="gecko",
gecko_enum_prefix="StyleImeMode",
gecko_ffi_name="mIMEMode", gecko_ffi_name="mIMEMode",
animation_value_type="discrete", animation_value_type="discrete",
spec="https://drafts.csswg.org/css-ui/#input-method-editor", spec="https://drafts.csswg.org/css-ui/#input-method-editor",