Bug 1339543 part 5 Remove unnecessary stuff from PuppetWidget r=smaug
MozReview-Commit-ID: 17dbDG1Fqwb
This commit is contained in:
@@ -92,12 +92,7 @@ PuppetWidget::PuppetWidget(TabChild* aTabChild)
|
|||||||
, mDefaultScale(-1)
|
, mDefaultScale(-1)
|
||||||
, mCursorHotspotX(0)
|
, mCursorHotspotX(0)
|
||||||
, mCursorHotspotY(0)
|
, mCursorHotspotY(0)
|
||||||
, mNativeKeyCommandsValid(false)
|
|
||||||
{
|
{
|
||||||
mSingleLineCommands.SetCapacity(4);
|
|
||||||
mMultiLineCommands.SetCapacity(4);
|
|
||||||
mRichTextCommands.SetCapacity(4);
|
|
||||||
|
|
||||||
// Setting 'Unknown' means "not yet cached".
|
// Setting 'Unknown' means "not yet cached".
|
||||||
mInputContext.mIMEState.mEnabled = IMEState::UNKNOWN;
|
mInputContext.mIMEState.mEnabled = IMEState::UNKNOWN;
|
||||||
|
|
||||||
|
|||||||
@@ -392,11 +392,6 @@ private:
|
|||||||
int32_t mRounding;
|
int32_t mRounding;
|
||||||
double mDefaultScale;
|
double mDefaultScale;
|
||||||
|
|
||||||
// Precomputed answers for ExecuteNativeKeyBinding
|
|
||||||
InfallibleTArray<mozilla::CommandInt> mSingleLineCommands;
|
|
||||||
InfallibleTArray<mozilla::CommandInt> mMultiLineCommands;
|
|
||||||
InfallibleTArray<mozilla::CommandInt> mRichTextCommands;
|
|
||||||
|
|
||||||
nsCOMPtr<imgIContainer> mCustomCursor;
|
nsCOMPtr<imgIContainer> mCustomCursor;
|
||||||
uint32_t mCursorHotspotX, mCursorHotspotY;
|
uint32_t mCursorHotspotX, mCursorHotspotY;
|
||||||
|
|
||||||
@@ -410,52 +405,6 @@ protected:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool mNeedIMEStateInit;
|
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
|
class PuppetScreen : public nsBaseScreen
|
||||||
|
|||||||
@@ -463,10 +463,8 @@ GeckoEditableSupport::OnKeyEvent(int32_t aAction, int32_t aKeyCode,
|
|||||||
mIMEKeyEvents.AppendElement(
|
mIMEKeyEvents.AppendElement(
|
||||||
UniquePtr<WidgetEvent>(pressEvent.Duplicate()));
|
UniquePtr<WidgetEvent>(pressEvent.Duplicate()));
|
||||||
} else if (nsIWidget::UsePuppetWidgets()) {
|
} else if (nsIWidget::UsePuppetWidgets()) {
|
||||||
AutoCacheNativeKeyCommands autoCache(
|
|
||||||
static_cast<PuppetWidget*>(widget.get()));
|
|
||||||
// Don't use native key bindings.
|
// Don't use native key bindings.
|
||||||
autoCache.CacheNoCommands();
|
pressEvent.PreventNativeKeyBindings();
|
||||||
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
|
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
|
||||||
} else {
|
} else {
|
||||||
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
|
dispatcher->MaybeDispatchKeypressEvents(pressEvent, status);
|
||||||
@@ -801,10 +799,8 @@ GeckoEditableSupport::OnImeReplaceText(int32_t aStart, int32_t aEnd,
|
|||||||
mDispatcher->DispatchKeyboardEvent(
|
mDispatcher->DispatchKeyboardEvent(
|
||||||
event->mMessage, *event, status);
|
event->mMessage, *event, status);
|
||||||
} else if (nsIWidget::UsePuppetWidgets()) {
|
} else if (nsIWidget::UsePuppetWidgets()) {
|
||||||
AutoCacheNativeKeyCommands autoCache(
|
|
||||||
static_cast<PuppetWidget*>(widget.get()));
|
|
||||||
// Don't use native key bindings.
|
// Don't use native key bindings.
|
||||||
autoCache.CacheNoCommands();
|
event->PreventNativeKeyBindings();
|
||||||
mDispatcher->MaybeDispatchKeypressEvents(*event, status);
|
mDispatcher->MaybeDispatchKeypressEvents(*event, status);
|
||||||
} else {
|
} else {
|
||||||
mDispatcher->MaybeDispatchKeypressEvents(*event, status);
|
mDispatcher->MaybeDispatchKeypressEvents(*event, status);
|
||||||
|
|||||||
Reference in New Issue
Block a user