Bug 1425652 - mosueDown, mouseUp and mouseMove should be removed from nsIHTMLObjectResizer. r?masayuki
comm-central and bluegriffon don't use mosueDown, mouseUp and mouseMove in
nsIHTMLObjectResizer, so we should remove these methods from this interface.
MozReview-Commit-ID: BnSkkH7f0xc
--- a/editor/libeditor/HTMLEditor.h
+++ b/editor/libeditor/HTMLEditor.h
@@ -125,18 +125,16 @@ public:
bool aSuppressTransaction) override;
virtual nsresult SetAttributeOrEquivalent(Element* aElement,
nsAtom* aAttribute,
const nsAString& aValue,
bool aSuppressTransaction) override;
using EditorBase::RemoveAttributeOrEquivalent;
using EditorBase::SetAttributeOrEquivalent;
- nsresult MouseMove(nsIDOMMouseEvent* aMouseEvent);
-
// nsStubMutationObserver overrides
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
// nsIHTMLEditor methods
NS_DECL_NSIHTMLEDITOR
@@ -439,16 +437,40 @@ public:
{
return mDefaultParagraphSeparator;
}
void SetDefaultParagraphSeparator(ParagraphSeparator aSep)
{
mDefaultParagraphSeparator = aSep;
}
+ /**
+ * event callback when a mouse button is pressed
+ * @param aX [IN] horizontal position of the pointer
+ * @param aY [IN] vertical position of the pointer
+ * @param aTarget [IN] the element triggering the event
+ * @param aMouseEvent [IN] the event
+ */
+ nsresult MouseDown(int32_t aX, int32_t aY, nsIDOMElement* aTarget,
+ nsIDOMEvent* aMouseEvent);
+
+ /**
+ * event callback when a mouse button is released
+ * @param aX [IN] horizontal position of the pointer
+ * @param aY [IN] vertical position of the pointer
+ * @param aTarget [IN] the element triggering the event
+ */
+ nsresult MouseUp(int32_t aX, int32_t aY, nsIDOMElement* aTarget);
+
+ /**
+ * event callback when the mouse pointer is moved
+ * @param aMouseEvent [IN] the event
+ */
+ nsresult MouseMove(nsIDOMMouseEvent* aMouseEvent);
+
protected:
class BlobReader final : public nsIEditorBlobListener
{
public:
BlobReader(dom::BlobImpl* aBlob, HTMLEditor* aHTMLEditor,
bool aIsSafe, nsIDOMDocument* aSourceDoc,
nsIDOMNode* aDestinationNode, int32_t aDestOffset,
bool aDoDeleteSelection);
--- a/editor/libeditor/HTMLEditorObjectResizer.cpp
+++ b/editor/libeditor/HTMLEditorObjectResizer.cpp
@@ -543,17 +543,17 @@ HTMLEditor::StartResizing(nsIDOMElement*
result = target->AddEventListener(NS_LITERAL_STRING("mousemove"),
mMouseMotionListenerP, true);
NS_ASSERTION(NS_SUCCEEDED(result),
"failed to register mouse motion listener");
}
return result;
}
-NS_IMETHODIMP
+nsresult
HTMLEditor::MouseDown(int32_t aClientX,
int32_t aClientY,
nsIDOMElement* aTarget,
nsIDOMEvent* aEvent)
{
bool anonElement = false;
if (aTarget && NS_SUCCEEDED(aTarget->HasAttribute(NS_LITERAL_STRING("_moz_anonclass"), &anonElement)))
// we caught a click on an anonymous element
@@ -575,17 +575,17 @@ HTMLEditor::MouseDown(int32_t aClientX,
mOriginalX = aClientX;
mOriginalY = aClientY;
return GrabberClicked();
}
}
return NS_OK;
}
-NS_IMETHODIMP
+nsresult
HTMLEditor::MouseUp(int32_t aClientX,
int32_t aClientY,
nsIDOMElement* aTarget)
{
if (mIsResizing) {
// we are resizing and release the mouse button, so let's
// end the resizing process
mIsResizing = false;
@@ -800,26 +800,16 @@ HTMLEditor::GetNewResizingHeight(int32_t
int32_t aY)
{
int32_t resized = mResizedObjectHeight +
GetNewResizingIncrement(aX, aY, kHeight) *
mHeightIncrementFactor;
return std::max(resized, 1);
}
-NS_IMETHODIMP
-HTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
-{
- nsCOMPtr<nsIDOMMouseEvent> mouseEvent = do_QueryInterface(aMouseEvent);
- if (NS_WARN_IF(!mouseEvent)) {
- return NS_OK;
- }
- return MouseMove(mouseEvent);
-}
-
nsresult
HTMLEditor::MouseMove(nsIDOMMouseEvent* aMouseEvent)
{
MOZ_ASSERT(aMouseEvent);
if (mIsResizing) {
// we are resizing and the mouse pointer's position has changed
// we have to resdisplay the shadow
--- a/editor/nsIHTMLObjectResizer.idl
+++ b/editor/nsIHTMLObjectResizer.idl
@@ -42,35 +42,10 @@ interface nsIHTMLObjectResizer : nsISupp
* Hide resizers if they are visible
*/
void hideResizers();
/**
* Refresh visible resizers
*/
void refreshResizers();
-
- /**
- * event callback when a mouse button is pressed
- * @param aX [IN] horizontal position of the pointer
- * @param aY [IN] vertical position of the pointer
- * @param aTarget [IN] the element triggering the event
- * @param aMouseEvent [IN] the event
- */
- void mouseDown(in long aX, in long aY,
- in nsIDOMElement aTarget, in nsIDOMEvent aMouseEvent);
-
- /**
- * event callback when a mouse button is released
- * @param aX [IN] horizontal position of the pointer
- * @param aY [IN] vertical position of the pointer
- * @param aTarget [IN] the element triggering the event
- */
- void mouseUp(in long aX, in long aY,
- in nsIDOMElement aTarget);
-
- /**
- * event callback when the mouse pointer is moved
- * @param aMouseEvent [IN] the event
- */
- void mouseMove(in nsIDOMEvent aMouseEvent);
};