зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1107617 - Add support for writing-mode to the NotifyIMESelection message. r=smaug
This commit is contained in:
Родитель
b2dc1329b1
Коммит
491103743a
|
@ -52,6 +52,7 @@ using mozilla::CSSPoint from "Units.h";
|
|||
using mozilla::CSSToScreenScale from "Units.h";
|
||||
using mozilla::CommandInt from "mozilla/EventForwards.h";
|
||||
using mozilla::layers::GeckoContentController::APZStateChange from "mozilla/layers/GeckoContentController.h";
|
||||
using mozilla::WritingMode from "WritingModes.h";
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -201,10 +202,13 @@ parent:
|
|||
* seqno Current seqno value on the content side
|
||||
* anchor Offset where the selection started
|
||||
* focus Offset where the caret is
|
||||
* writingMode CSS writing-mode in effect at the focus
|
||||
* causedByComposition true if the change is caused by composition
|
||||
*/
|
||||
prio(urgent) async NotifyIMESelection(uint32_t seqno, uint32_t anchor,
|
||||
uint32_t focus, bool causedByComposition);
|
||||
uint32_t focus,
|
||||
WritingMode writingMode,
|
||||
bool causedByComposition);
|
||||
|
||||
/**
|
||||
* Notifies chrome to refresh its text cache
|
||||
|
|
|
@ -229,6 +229,7 @@ TabParent::TabParent(nsIContentParent* aManager,
|
|||
, mFrameElement(nullptr)
|
||||
, mIMESelectionAnchor(0)
|
||||
, mIMESelectionFocus(0)
|
||||
, mWritingMode()
|
||||
, mIMEComposing(false)
|
||||
, mIMECompositionEnding(false)
|
||||
, mIMECompositionStart(0)
|
||||
|
@ -1395,6 +1396,7 @@ bool
|
|||
TabParent::RecvNotifyIMESelection(const uint32_t& aSeqno,
|
||||
const uint32_t& aAnchor,
|
||||
const uint32_t& aFocus,
|
||||
const mozilla::WritingMode& aWritingMode,
|
||||
const bool& aCausedByComposition)
|
||||
{
|
||||
nsCOMPtr<nsIWidget> widget = GetWidget();
|
||||
|
@ -1404,6 +1406,7 @@ TabParent::RecvNotifyIMESelection(const uint32_t& aSeqno,
|
|||
if (aSeqno == mIMESeqno) {
|
||||
mIMESelectionAnchor = aAnchor;
|
||||
mIMESelectionFocus = aFocus;
|
||||
mWritingMode = aWritingMode;
|
||||
const nsIMEUpdatePreference updatePreference =
|
||||
widget->GetIMEUpdatePreference();
|
||||
if (updatePreference.WantSelectionChange() &&
|
||||
|
@ -1585,6 +1588,7 @@ TabParent::HandleQueryContentEvent(WidgetQueryContentEvent& aEvent)
|
|||
}
|
||||
aEvent.mReply.mReversed = mIMESelectionFocus < mIMESelectionAnchor;
|
||||
aEvent.mReply.mHasSelection = true;
|
||||
aEvent.mReply.mWritingMode = mWritingMode;
|
||||
aEvent.mSucceeded = true;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsIXULBrowserWindow.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "Units.h"
|
||||
#include "WritingModes.h"
|
||||
#include "js/TypeDecls.h"
|
||||
|
||||
class nsFrameLoader;
|
||||
|
@ -172,6 +173,7 @@ public:
|
|||
virtual bool RecvNotifyIMESelection(const uint32_t& aSeqno,
|
||||
const uint32_t& aAnchor,
|
||||
const uint32_t& aFocus,
|
||||
const mozilla::WritingMode& aWritingMode,
|
||||
const bool& aCausedByComposition) MOZ_OVERRIDE;
|
||||
virtual bool RecvNotifyIMETextHint(const nsString& aText) MOZ_OVERRIDE;
|
||||
virtual bool RecvNotifyIMEMouseButtonEvent(const widget::IMENotification& aEventMessage,
|
||||
|
@ -379,6 +381,7 @@ protected:
|
|||
nsString mIMECacheText;
|
||||
uint32_t mIMESelectionAnchor;
|
||||
uint32_t mIMESelectionFocus;
|
||||
mozilla::WritingMode mWritingMode;
|
||||
bool mIMEComposing;
|
||||
bool mIMECompositionEnding;
|
||||
// Buffer to store composition text during ResetInputState
|
||||
|
|
|
@ -346,6 +346,8 @@ private:
|
|||
friend class LogicalMargin;
|
||||
friend class LogicalRect;
|
||||
|
||||
friend struct IPC::ParamTraits<WritingMode>;
|
||||
|
||||
/**
|
||||
* Return a WritingMode representing an unknown value.
|
||||
*/
|
||||
|
|
|
@ -652,6 +652,7 @@ PuppetWidget::NotifyIMEOfSelectionChange(
|
|||
mIMELastReceivedSeqno,
|
||||
queryEvent.GetSelectionStart(),
|
||||
queryEvent.GetSelectionEnd(),
|
||||
queryEvent.GetWritingMode(),
|
||||
aIMENotification.mSelectionChangeData.mCausedByComposition);
|
||||
}
|
||||
return NS_OK;
|
||||
|
|
|
@ -447,6 +447,13 @@ public:
|
|||
return mReply.mOffset + (mReply.mReversed ? 0 : mReply.mString.Length());
|
||||
}
|
||||
|
||||
mozilla::WritingMode GetWritingMode(void) const
|
||||
{
|
||||
NS_ASSERTION(message == NS_QUERY_SELECTED_TEXT,
|
||||
"not querying selection");
|
||||
return mReply.mWritingMode;
|
||||
}
|
||||
|
||||
bool mSucceeded;
|
||||
bool mWasAsync;
|
||||
bool mUseNativeLineBreak;
|
||||
|
|
|
@ -702,6 +702,22 @@ struct ParamTraits<mozilla::WidgetPluginEvent>
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct ParamTraits<mozilla::WritingMode>
|
||||
{
|
||||
typedef mozilla::WritingMode paramType;
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
WriteParam(aMsg, aParam.mWritingMode);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
return ReadParam(aMsg, aIter, &aResult->mWritingMode);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace IPC
|
||||
|
||||
#endif // nsGUIEventIPC_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче