Bug 1339543 part 5 Remove unnecessary stuff from PuppetWidget r=smaug

MozReview-Commit-ID: 17dbDG1Fqwb

--HG--
extra : rebase_source : 9e1c849791d4b0e7bf132dd2d6a1628103664887
This commit is contained in:
Masayuki Nakano 2017-05-17 20:46:47 +09:00
Родитель 872f694c63
Коммит 5c5c82abc8
3 изменённых файлов: 2 добавлений и 62 удалений

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

@ -92,12 +92,7 @@ PuppetWidget::PuppetWidget(TabChild* aTabChild)
, mDefaultScale(-1)
, mCursorHotspotX(0)
, mCursorHotspotY(0)
, mNativeKeyCommandsValid(false)
{
mSingleLineCommands.SetCapacity(4);
mMultiLineCommands.SetCapacity(4);
mRichTextCommands.SetCapacity(4);
// Setting 'Unknown' means "not yet cached".
mInputContext.mIMEState.mEnabled = IMEState::UNKNOWN;

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

@ -392,11 +392,6 @@ private:
int32_t mRounding;
double mDefaultScale;
// Precomputed answers for ExecuteNativeKeyBinding
InfallibleTArray<mozilla::CommandInt> mSingleLineCommands;
InfallibleTArray<mozilla::CommandInt> mMultiLineCommands;
InfallibleTArray<mozilla::CommandInt> mRichTextCommands;
nsCOMPtr<imgIContainer> mCustomCursor;
uint32_t mCursorHotspotX, mCursorHotspotY;
@ -410,52 +405,6 @@ protected:
private:
bool mNeedIMEStateInit;
bool mNativeKeyCommandsValid;
};
struct AutoCacheNativeKeyCommands
{
explicit AutoCacheNativeKeyCommands(PuppetWidget* aWidget)
: mWidget(aWidget)
{
mSavedValid = mWidget->mNativeKeyCommandsValid;
mSavedSingleLine = mWidget->mSingleLineCommands;
mSavedMultiLine = mWidget->mMultiLineCommands;
mSavedRichText = mWidget->mRichTextCommands;
}
void Cache(const InfallibleTArray<mozilla::CommandInt>& aSingleLineCommands,
const InfallibleTArray<mozilla::CommandInt>& aMultiLineCommands,
const InfallibleTArray<mozilla::CommandInt>& aRichTextCommands)
{
mWidget->mNativeKeyCommandsValid = true;
mWidget->mSingleLineCommands = aSingleLineCommands;
mWidget->mMultiLineCommands = aMultiLineCommands;
mWidget->mRichTextCommands = aRichTextCommands;
}
void CacheNoCommands()
{
mWidget->mNativeKeyCommandsValid = true;
mWidget->mSingleLineCommands.Clear();
mWidget->mMultiLineCommands.Clear();
mWidget->mRichTextCommands.Clear();
}
~AutoCacheNativeKeyCommands()
{
mWidget->mNativeKeyCommandsValid = mSavedValid;
mWidget->mSingleLineCommands = mSavedSingleLine;
mWidget->mMultiLineCommands = mSavedMultiLine;
mWidget->mRichTextCommands = mSavedRichText;
}
private:
PuppetWidget* mWidget;
bool mSavedValid;
InfallibleTArray<mozilla::CommandInt> mSavedSingleLine;
InfallibleTArray<mozilla::CommandInt> mSavedMultiLine;
InfallibleTArray<mozilla::CommandInt> mSavedRichText;
};
class PuppetScreen : public nsBaseScreen

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

@ -463,10 +463,8 @@ GeckoEditableSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
mIMEKeyEvents.AppendElement(
UniquePtr<WidgetEvent>(pressEvent.Duplicate()));
} else if (nsIWidget::UsePuppetWidgets()) {
AutoCacheNativeKeyCommands autoCache(
static_cast<PuppetWidget*>(widget.get()));
// Don't use native key bindings.
autoCache.CacheNoCommands();
pressEvent.PreventNativeKeyBindings();
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
} else {
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
@ -801,10 +799,8 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd,
mDispatcher->DispatchKeyboardEvent(
event->mMessage, *event, status);
} else if (nsIWidget::UsePuppetWidgets()) {
AutoCacheNativeKeyCommands autoCache(
static_cast<PuppetWidget*>(widget.get()));
// Don't use native key bindings.
autoCache.CacheNoCommands();
event->PreventNativeKeyBindings();
mDispatcher->MaybeDispatchKeypressEvents(*event, status);
} else {
mDispatcher->MaybeDispatchKeypressEvents(*event, status);