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 удалений

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

@ -53,8 +53,8 @@
#include "mozilla/dom/CharacterData.h" // for CharacterData
#include "mozilla/dom/DataTransfer.h" // for DataTransfer
#include "mozilla/InternalMutationEvent.h" // for NS_EVENT_BITS_MUTATION_CHARACTERDATAMODIFIED
#include "mozilla/dom/Element.h" // for Element, nsINode::AsElement
#include "mozilla/dom/EventTarget.h" // for EventTarget
#include "mozilla/dom/Element.h" // for Element, nsINode::AsElement
#include "mozilla/dom/EventTarget.h" // for EventTarget
#include "mozilla/dom/HTMLBodyElement.h"
#include "mozilla/dom/HTMLBRElement.h"
#include "mozilla/dom/Selection.h" // for Selection, etc.
@ -2396,19 +2396,21 @@ nsresult EditorBase::GetPreferredIMEState(IMEState* aState) {
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
switch (frame->StyleUIReset()->mIMEMode) {
case NS_STYLE_IME_MODE_AUTO:
case StyleImeMode::Auto:
if (IsPasswordEditor()) aState->mEnabled = IMEState::PASSWORD;
break;
case NS_STYLE_IME_MODE_DISABLED:
case StyleImeMode::Disabled:
// we should use password state for |ime-mode: disabled;|.
aState->mEnabled = IMEState::PASSWORD;
break;
case NS_STYLE_IME_MODE_ACTIVE:
case StyleImeMode::Active:
aState->mOpen = IMEState::OPEN;
break;
case NS_STYLE_IME_MODE_INACTIVE:
case StyleImeMode::Inactive:
aState->mOpen = IMEState::CLOSED;
break;
case StyleImeMode::Normal:
break;
}
return NS_OK;

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

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

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

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

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

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

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

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

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

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