Bug 920377 part.24 Get rid of nsSelectionEvent r=roc

This commit is contained in:
Masayuki Nakano 2013-10-01 16:23:01 +09:00
parent 597d5ac7d2
commit ebe48cadea
18 changed files with 27 additions and 31 deletions

View File

@ -114,7 +114,7 @@ nsContentEventHandler::Init(WidgetQueryContentEvent* aEvent)
}
nsresult
nsContentEventHandler::Init(nsSelectionEvent* aEvent)
nsContentEventHandler::Init(WidgetSelectionEvent* aEvent)
{
NS_ASSERTION(aEvent, "aEvent must not be null");
@ -1052,7 +1052,7 @@ static void AdjustRangeForSelection(nsIContent* aRoot,
}
nsresult
nsContentEventHandler::OnSelectionEvent(nsSelectionEvent* aEvent)
nsContentEventHandler::OnSelectionEvent(WidgetSelectionEvent* aEvent)
{
aEvent->mSucceeded = false;

View File

@ -50,7 +50,7 @@ public:
nsresult OnQueryDOMWidgetHittest(mozilla::WidgetQueryContentEvent* aEvent);
// NS_SELECTION_* event
nsresult OnSelectionEvent(nsSelectionEvent* aEvent);
nsresult OnSelectionEvent(mozilla::WidgetSelectionEvent* aEvent);
protected:
nsPresContext* mPresContext;
@ -60,7 +60,7 @@ protected:
nsCOMPtr<nsIContent> mRootContent;
nsresult Init(mozilla::WidgetQueryContentEvent* aEvent);
nsresult Init(nsSelectionEvent* aEvent);
nsresult Init(mozilla::WidgetSelectionEvent* aEvent);
// InitCommon() is called from each Init().
nsresult InitCommon();

View File

@ -1056,8 +1056,8 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
break;
case NS_SELECTION_SET:
{
nsSelectionEvent *selectionEvent =
static_cast<nsSelectionEvent*>(aEvent);
WidgetSelectionEvent *selectionEvent =
static_cast<WidgetSelectionEvent*>(aEvent);
if (IsTargetCrossProcess(selectionEvent)) {
// Will not be handled locally, remote the event
if (GetCrossProcessTarget()->SendSelectionEvent(*selectionEvent))
@ -1065,7 +1065,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
break;
}
nsContentEventHandler handler(mPresContext);
handler.OnSelectionEvent((nsSelectionEvent*)aEvent);
handler.OnSelectionEvent(static_cast<WidgetSelectionEvent*>(aEvent));
}
break;
case NS_CONTENT_COMMAND_CUT:

View File

@ -1970,7 +1970,7 @@ nsDOMWindowUtils::SendSelectionSetEvent(uint32_t aOffset,
return NS_ERROR_FAILURE;
}
nsSelectionEvent selectionEvent(true, NS_SELECTION_SET, widget);
WidgetSelectionEvent selectionEvent(true, NS_SELECTION_SET, widget);
InitEvent(selectionEvent);
selectionEvent.mOffset = aOffset;

View File

@ -46,7 +46,7 @@ using nsMouseEvent;
using nsMouseScrollEvent;
using mozilla::WheelEvent;
using nsRect;
using nsSelectionEvent;
using mozilla::WidgetSelectionEvent;
using mozilla::WidgetTextEvent;
using mozilla::WidgetTouchEvent;
using RemoteDOMEvent;
@ -384,7 +384,7 @@ child:
TextEvent(WidgetTextEvent event);
SelectionEvent(nsSelectionEvent event);
SelectionEvent(WidgetSelectionEvent event);
/**
* Activate event forwarding from client to parent.

View File

@ -1899,9 +1899,9 @@ TabChild::RecvTextEvent(const WidgetTextEvent& event)
}
bool
TabChild::RecvSelectionEvent(const nsSelectionEvent& event)
TabChild::RecvSelectionEvent(const WidgetSelectionEvent& event)
{
nsSelectionEvent localEvent(event);
WidgetSelectionEvent localEvent(event);
DispatchWidgetEvent(localEvent);
return true;
}

View File

@ -227,7 +227,7 @@ public:
const bool& aPreventDefault);
virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event);
virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event);
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event);
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
virtual bool RecvLoadRemoteScript(const nsString& aURL);
virtual bool RecvAsyncMessage(const nsString& aMessage,

View File

@ -1030,7 +1030,7 @@ TabParent::SendTextEvent(WidgetTextEvent& event)
}
bool
TabParent::SendSelectionEvent(nsSelectionEvent& event)
TabParent::SendSelectionEvent(WidgetSelectionEvent& event)
{
if (mIsDestroyed) {
return false;

View File

@ -227,7 +227,7 @@ public:
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& event);
bool SendTextEvent(mozilla::WidgetTextEvent& event);
bool SendSelectionEvent(nsSelectionEvent& event);
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& event);
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
static TabParent* GetFrom(nsIContent* aContent);

View File

@ -335,7 +335,7 @@ enum nsEventStructType
#define NS_PLUGIN_INPUT_EVENT (NS_PLUGIN_EVENT_START)
#define NS_PLUGIN_FOCUS_EVENT (NS_PLUGIN_EVENT_START+1)
// Events to manipulate selection (nsSelectionEvent)
// Events to manipulate selection (WidgetSelectionEvent)
#define NS_SELECTION_EVENT_START 3700
// Clear any previous selection and set the given range as the selection
#define NS_SELECTION_SET (NS_SELECTION_EVENT_START)

View File

@ -107,7 +107,6 @@ typedef mozilla::WidgetEvent nsEvent;
typedef mozilla::WidgetGUIEvent nsGUIEvent;
typedef mozilla::WidgetInputEvent nsInputEvent;
typedef mozilla::InternalUIEvent nsUIEvent;
typedef mozilla::WidgetSelectionEvent nsSelectionEvent;
typedef mozilla::WidgetMouseEventBase nsMouseEvent_base;
typedef mozilla::WidgetMouseEvent nsMouseEvent;
typedef mozilla::WidgetDragEvent nsDragEvent;

View File

@ -533,7 +533,4 @@ public:
} // namespace mozilla
// TODO: Remove following typedefs
typedef mozilla::WidgetSelectionEvent nsSelectionEvent;
#endif // mozilla_TextEvents_h__

View File

@ -1904,7 +1904,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
AutoIMEMask selMask(mIMEMaskSelectionUpdate);
RemoveIMEComposition();
{
nsSelectionEvent event(true, NS_SELECTION_SET, this);
WidgetSelectionEvent event(true, NS_SELECTION_SET, this);
InitEvent(event, nullptr);
event.mOffset = uint32_t(ae->Start());
event.mLength = uint32_t(ae->End() - ae->Start());
@ -1953,7 +1953,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
*/
AutoIMEMask selMask(mIMEMaskSelectionUpdate);
RemoveIMEComposition();
nsSelectionEvent selEvent(true, NS_SELECTION_SET, this);
WidgetSelectionEvent selEvent(true, NS_SELECTION_SET, this);
InitEvent(selEvent, nullptr);
int32_t start = ae->Start(), end = ae->End();
@ -2021,7 +2021,7 @@ nsWindow::OnIMEEvent(AndroidGeckoEvent *ae)
event.rangeCount = mIMERanges.Length();
{
nsSelectionEvent event(true, NS_SELECTION_SET, this);
WidgetSelectionEvent event(true, NS_SELECTION_SET, this);
InitEvent(event, nullptr);
event.mOffset = uint32_t(ae->Start());
event.mLength = uint32_t(ae->End() - ae->Start());

View File

@ -4378,7 +4378,7 @@ TextInputHandlerBase::SetSelection(NSRange& aRange)
MOZ_ASSERT(!Destroyed());
nsRefPtr<TextInputHandlerBase> kungFuDeathGrip(this);
nsSelectionEvent selectionEvent(true, NS_SELECTION_SET, mWidget);
WidgetSelectionEvent selectionEvent(true, NS_SELECTION_SET, mWidget);
selectionEvent.mOffset = aRange.location;
selectionEvent.mLength = aRange.length;
selectionEvent.mReversed = false;

View File

@ -1496,8 +1496,8 @@ nsGtkIMModule::DeleteText(const int32_t aOffset, const uint32_t aNChars)
g_utf8_offset_to_pointer(utf8Str.get(), endInUTF8Characters);
// Set selection to delete
nsSelectionEvent selectionEvent(true, NS_SELECTION_SET,
mLastFocusedWindow);
WidgetSelectionEvent selectionEvent(true, NS_SELECTION_SET,
mLastFocusedWindow);
nsDependentCSubstring utf8StrBeforeOffset(utf8Str, 0,
charAtOffset - utf8Str.get());

View File

@ -441,9 +441,9 @@ struct ParamTraits<mozilla::WidgetQueryContentEvent>
};
template<>
struct ParamTraits<nsSelectionEvent>
struct ParamTraits<mozilla::WidgetSelectionEvent>
{
typedef nsSelectionEvent paramType;
typedef mozilla::WidgetSelectionEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{

View File

@ -851,7 +851,7 @@ nsTextStore::FlushPendingActions()
MOZ_ASSERT(mComposition.mLastData.IsEmpty());
// Select composition range so the new composition replaces the range
nsSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
WidgetSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
mWidget->InitEvent(selectionSet);
selectionSet.mOffset = static_cast<uint32_t>(action.mSelectionStart);
selectionSet.mLength = static_cast<uint32_t>(action.mSelectionLength);
@ -1017,7 +1017,7 @@ nsTextStore::FlushPendingActions()
this, action.mSelectionStart, action.mSelectionLength,
GetBoolName(action.mSelectionReversed)));
nsSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
WidgetSelectionEvent selectionSet(true, NS_SELECTION_SET, mWidget);
selectionSet.mOffset =
static_cast<uint32_t>(action.mSelectionStart);
selectionSet.mLength =

View File

@ -285,7 +285,7 @@ PuppetWidget::DispatchEvent(nsGUIEvent* event, nsEventStatus& aStatus)
return NS_OK;
break;
case NS_SELECTION_EVENT:
mIMELastReceivedSeqno = static_cast<nsSelectionEvent*>(event)->seqno;
mIMELastReceivedSeqno = static_cast<WidgetSelectionEvent*>(event)->seqno;
if (mIMELastReceivedSeqno < mIMELastBlurSeqno)
return NS_OK;
break;