Bug 1446527 part 1. Remove rangeParent/rangeOffset members from nsIDOMUIEvent. r=qdot

MozReview-Commit-ID: 86cMORXSV9u
This commit is contained in:
Boris Zbarsky 2018-03-26 14:53:02 -04:00
Родитель 3cae600c35
Коммит f0bc98f232
4 изменённых файлов: 7 добавлений и 37 удалений

Просмотреть файл

@ -263,26 +263,6 @@ UIEvent::GetRangeParent()
return nullptr;
}
NS_IMETHODIMP
UIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
{
NS_ENSURE_ARG_POINTER(aRangeParent);
*aRangeParent = nullptr;
nsCOMPtr<nsINode> n = GetRangeParent();
if (n) {
CallQueryInterface(n, aRangeParent);
}
return NS_OK;
}
NS_IMETHODIMP
UIEvent::GetRangeOffset(int32_t* aRangeOffset)
{
NS_ENSURE_ARG_POINTER(aRangeOffset);
*aRangeOffset = RangeOffset();
return NS_OK;
}
int32_t
UIEvent::RangeOffset() const
{

Просмотреть файл

@ -46,8 +46,6 @@ interface nsIDOMUIEvent : nsISupports
readonly attribute long pageX;
readonly attribute long pageY;
readonly attribute unsigned long which;
readonly attribute nsIDOMNode rangeParent;
readonly attribute long rangeOffset;
[notxpcom, nostdcall] EventPtr AsEvent();
};

Просмотреть файл

@ -694,14 +694,8 @@ EditorEventListener::HandleMiddleClickPaste(MouseEvent* aMouseEvent)
}
// Set the selection to the point under the mouse cursor:
nsCOMPtr<nsIDOMNode> parent;
if (NS_FAILED(aMouseEvent->GetRangeParent(getter_AddRefs(parent)))) {
return NS_ERROR_NULL_POINTER;
}
int32_t offset = 0;
if (NS_FAILED(aMouseEvent->GetRangeOffset(&offset))) {
return NS_ERROR_NULL_POINTER;
}
nsCOMPtr<nsINode> parent = aMouseEvent->GetRangeParent();
int32_t offset = aMouseEvent->RangeOffset();
RefPtr<TextEditor> textEditor = mEditorBase->AsTextEditor();
MOZ_ASSERT(textEditor);

Просмотреть файл

@ -112,14 +112,10 @@ HTMLEditorEventListener::MouseDown(MouseEvent* aMouseEvent)
NS_ENSURE_TRUE(selection, NS_OK);
// Get location of mouse within target node
nsCOMPtr<nsIDOMNode> parent;
rv = aMouseEvent->GetRangeParent(getter_AddRefs(parent));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsINode> parent = aMouseEvent->GetRangeParent();
NS_ENSURE_TRUE(parent, NS_ERROR_FAILURE);
int32_t offset = 0;
rv = aMouseEvent->GetRangeOffset(&offset);
NS_ENSURE_SUCCESS(rv, rv);
int32_t offset = aMouseEvent->RangeOffset();
// Detect if mouse point is within current selection for context click
bool nodeIsInSelection = false;
@ -133,7 +129,9 @@ HTMLEditorEventListener::MouseDown(MouseEvent* aMouseEvent)
continue;
}
range->IsPointInRange(parent, offset, &nodeIsInSelection);
IgnoredErrorResult err;
nodeIsInSelection =
range->IsPointInRange(*parent, offset, err) && !err.Failed();
// Done when we find a range that we are in
if (nodeIsInSelection) {