Bug 1056545 part.1 Make event handlers of ns*EditorEventListener protected and virtual as far as possible r=ehsan

This commit is contained in:
Masayuki Nakano 2014-08-26 09:57:45 +09:00
parent 4d1c439d55
commit 63489b425b
4 changed files with 31 additions and 32 deletions

View File

@ -422,7 +422,7 @@ bool IsCtrlShiftPressed(bool& isRTL)
// This logic is mostly borrowed from Chromium's
// RenderWidgetHostViewWin::OnKeyEvent.
NS_IMETHODIMP
nsresult
nsEditorEventListener::KeyUp(nsIDOMEvent* aKeyEvent)
{
if (mHaveBidiKeyboards) {
@ -448,7 +448,7 @@ nsEditorEventListener::KeyUp(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::KeyDown(nsIDOMEvent* aKeyEvent)
{
if (mHaveBidiKeyboards) {
@ -476,7 +476,7 @@ nsEditorEventListener::KeyDown(nsIDOMEvent* aKeyEvent)
}
#endif
NS_IMETHODIMP
nsresult
nsEditorEventListener::KeyPress(nsIDOMEvent* aKeyEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -538,7 +538,7 @@ nsEditorEventListener::KeyPress(nsIDOMEvent* aKeyEvent)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -634,7 +634,7 @@ nsEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -642,7 +642,7 @@ nsEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::HandleText(nsIDOMEvent* aTextEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -868,7 +868,7 @@ nsEditorEventListener::CanDrop(nsIDOMDragEvent* aEvent)
return true;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::HandleStartComposition(nsIDOMEvent* aCompositionEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -891,7 +891,7 @@ nsEditorEventListener::HandleEndComposition(nsIDOMEvent* aCompositionEvent)
mEditor->EndIMEComposition();
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -949,7 +949,7 @@ nsEditorEventListener::Focus(nsIDOMEvent* aEvent)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsEditorEventListener::Blur(nsIDOMEvent* aEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);

View File

@ -42,20 +42,6 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMEVENTLISTENER
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
NS_IMETHOD KeyDown(nsIDOMEvent* aKeyEvent);
NS_IMETHOD KeyUp(nsIDOMEvent* aKeyEvent);
#endif
NS_IMETHOD KeyPress(nsIDOMEvent* aKeyEvent);
NS_IMETHOD HandleText(nsIDOMEvent* aTextEvent);
NS_IMETHOD HandleStartComposition(nsIDOMEvent* aCompositionEvent);
void HandleEndComposition(nsIDOMEvent* aCompositionEvent);
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; }
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
NS_IMETHOD Focus(nsIDOMEvent* aEvent);
NS_IMETHOD Blur(nsIDOMEvent* aEvent);
void SpellCheckIfNeeded();
protected:
@ -64,18 +50,31 @@ protected:
nsresult InstallToEditor();
void UninstallFromEditor();
bool CanDrop(nsIDOMDragEvent* aEvent);
#ifdef HANDLE_NATIVE_TEXT_DIRECTION_SWITCH
nsresult KeyDown(nsIDOMEvent* aKeyEvent);
nsresult KeyUp(nsIDOMEvent* aKeyEvent);
#endif
nsresult KeyPress(nsIDOMEvent* aKeyEvent);
nsresult HandleText(nsIDOMEvent* aTextEvent);
nsresult HandleStartComposition(nsIDOMEvent* aCompositionEvent);
void HandleEndComposition(nsIDOMEvent* aCompositionEvent);
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent);
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent) { return NS_OK; }
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent);
nsresult Focus(nsIDOMEvent* aEvent);
nsresult Blur(nsIDOMEvent* aEvent);
nsresult DragEnter(nsIDOMDragEvent* aDragEvent);
nsresult DragOver(nsIDOMDragEvent* aDragEvent);
nsresult DragExit(nsIDOMDragEvent* aDragEvent);
nsresult Drop(nsIDOMDragEvent* aDragEvent);
nsresult DragGesture(nsIDOMDragEvent* aDragEvent);
bool CanDrop(nsIDOMDragEvent* aEvent);
void CleanupDragDropCaret();
already_AddRefed<nsIPresShell> GetPresShell();
bool IsFileControlTextBox();
bool ShouldHandleNativeKeyBindings(nsIDOMEvent* aKeyEvent);
protected:
nsEditor* mEditor; // weak
nsRefPtr<nsCaret> mCaret;
bool mCommitText;

View File

@ -48,7 +48,7 @@ nsHTMLEditorEventListener::GetHTMLEditor()
return static_cast<nsHTMLEditor*>(mEditor);
}
NS_IMETHODIMP
nsresult
nsHTMLEditorEventListener::MouseUp(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -75,7 +75,7 @@ nsHTMLEditorEventListener::MouseUp(nsIDOMEvent* aMouseEvent)
return nsEditorEventListener::MouseUp(aMouseEvent);
}
NS_IMETHODIMP
nsresult
nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);
@ -220,7 +220,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
return nsEditorEventListener::MouseDown(aMouseEvent);
}
NS_IMETHODIMP
nsresult
nsHTMLEditorEventListener::MouseClick(nsIDOMEvent* aMouseEvent)
{
NS_ENSURE_TRUE(mEditor, NS_ERROR_NOT_AVAILABLE);

View File

@ -30,11 +30,11 @@ public:
virtual nsresult Connect(nsEditor* aEditor);
#endif
NS_IMETHOD MouseDown(nsIDOMEvent* aMouseEvent);
NS_IMETHOD MouseUp(nsIDOMEvent* aMouseEvent);
NS_IMETHOD MouseClick(nsIDOMEvent* aMouseEvent);
protected:
virtual nsresult MouseDown(nsIDOMEvent* aMouseEvent) MOZ_OVERRIDE;
virtual nsresult MouseUp(nsIDOMEvent* aMouseEvent) MOZ_OVERRIDE;
virtual nsresult MouseClick(nsIDOMEvent* aMouseEvent) MOZ_OVERRIDE;
inline nsHTMLEditor* GetHTMLEditor();
};