зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1086349 part 6 - Remove old nsEditor::GetNextNode/GetPriorNode overloads; r=ehsan
This commit is contained in:
Родитель
7a88b21c2d
Коммит
aa91d2c603
|
@ -2882,25 +2882,6 @@ nsEditor::GetLengthOfDOMNode(nsIDOMNode *aNode, uint32_t &aCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsEditor::GetPriorNode(nsIDOMNode *aParentNode,
|
|
||||||
int32_t aOffset,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
|
||||||
*aResultNode = nullptr;
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> parentNode = do_QueryInterface(aParentNode);
|
|
||||||
NS_ENSURE_TRUE(parentNode, NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
*aResultNode = do_QueryInterface(GetPriorNode(parentNode, aOffset,
|
|
||||||
aEditableNode,
|
|
||||||
bNoBlockCrossing));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
nsEditor::GetPriorNode(nsINode* aParentNode,
|
nsEditor::GetPriorNode(nsINode* aParentNode,
|
||||||
int32_t aOffset,
|
int32_t aOffset,
|
||||||
|
@ -2936,25 +2917,6 @@ nsEditor::GetPriorNode(nsINode* aParentNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsEditor::GetNextNode(nsIDOMNode *aParentNode,
|
|
||||||
int32_t aOffset,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
|
||||||
*aResultNode = nullptr;
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> parentNode = do_QueryInterface(aParentNode);
|
|
||||||
NS_ENSURE_TRUE(parentNode, NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
*aResultNode = do_QueryInterface(GetNextNode(parentNode, aOffset,
|
|
||||||
aEditableNode,
|
|
||||||
bNoBlockCrossing));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
nsEditor::GetNextNode(nsINode* aParentNode,
|
nsEditor::GetNextNode(nsINode* aParentNode,
|
||||||
int32_t aOffset,
|
int32_t aOffset,
|
||||||
|
@ -3006,22 +2968,6 @@ nsEditor::GetNextNode(nsINode* aParentNode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsEditor::GetPriorNode(nsIDOMNode *aCurrentNode,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing)
|
|
||||||
{
|
|
||||||
NS_ENSURE_TRUE(aResultNode, NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
nsCOMPtr<nsINode> currentNode = do_QueryInterface(aCurrentNode);
|
|
||||||
NS_ENSURE_TRUE(currentNode, NS_ERROR_NULL_POINTER);
|
|
||||||
|
|
||||||
*aResultNode = do_QueryInterface(GetPriorNode(currentNode, aEditableNode,
|
|
||||||
bNoBlockCrossing));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
nsEditor::GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
|
nsEditor::GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
|
||||||
bool aNoBlockCrossing /* = false */)
|
bool aNoBlockCrossing /* = false */)
|
||||||
|
@ -3087,22 +3033,6 @@ nsEditor::FindNextLeafNode(nsINode *aCurrentNode,
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
|
||||||
nsEditor::GetNextNode(nsIDOMNode* aCurrentNode,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsINode> currentNode = do_QueryInterface(aCurrentNode);
|
|
||||||
if (!currentNode || !aResultNode) {
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
}
|
|
||||||
|
|
||||||
*aResultNode = do_QueryInterface(GetNextNode(currentNode, aEditableNode,
|
|
||||||
bNoBlockCrossing));
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsIContent*
|
nsIContent*
|
||||||
nsEditor::GetNextNode(nsINode* aCurrentNode,
|
nsEditor::GetNextNode(nsINode* aCurrentNode,
|
||||||
bool aEditableNode,
|
bool aEditableNode,
|
||||||
|
|
|
@ -497,19 +497,10 @@ public:
|
||||||
* If there is no prior node, aResultNode will be nullptr.
|
* If there is no prior node, aResultNode will be nullptr.
|
||||||
* @param bNoBlockCrossing If true, don't move across "block" nodes, whatever that means.
|
* @param bNoBlockCrossing If true, don't move across "block" nodes, whatever that means.
|
||||||
*/
|
*/
|
||||||
nsresult GetPriorNode(nsIDOMNode *aCurrentNode,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing = false);
|
|
||||||
nsIContent* GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
|
nsIContent* GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
|
||||||
bool aNoBlockCrossing = false);
|
bool aNoBlockCrossing = false);
|
||||||
|
|
||||||
// and another version that takes a {parent,offset} pair rather than a node
|
// and another version that takes a {parent,offset} pair rather than a node
|
||||||
nsresult GetPriorNode(nsIDOMNode *aParentNode,
|
|
||||||
int32_t aOffset,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing = false);
|
|
||||||
nsIContent* GetPriorNode(nsINode* aParentNode,
|
nsIContent* GetPriorNode(nsINode* aParentNode,
|
||||||
int32_t aOffset,
|
int32_t aOffset,
|
||||||
bool aEditableNode,
|
bool aEditableNode,
|
||||||
|
@ -523,20 +514,11 @@ public:
|
||||||
* skipping non-editable nodes if aEditableNode is true.
|
* skipping non-editable nodes if aEditableNode is true.
|
||||||
* If there is no prior node, aResultNode will be nullptr.
|
* If there is no prior node, aResultNode will be nullptr.
|
||||||
*/
|
*/
|
||||||
nsresult GetNextNode(nsIDOMNode *aCurrentNode,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing = false);
|
|
||||||
nsIContent* GetNextNode(nsINode* aCurrentNode,
|
nsIContent* GetNextNode(nsINode* aCurrentNode,
|
||||||
bool aEditableNode,
|
bool aEditableNode,
|
||||||
bool bNoBlockCrossing = false);
|
bool bNoBlockCrossing = false);
|
||||||
|
|
||||||
// and another version that takes a {parent,offset} pair rather than a node
|
// and another version that takes a {parent,offset} pair rather than a node
|
||||||
nsresult GetNextNode(nsIDOMNode *aParentNode,
|
|
||||||
int32_t aOffset,
|
|
||||||
bool aEditableNode,
|
|
||||||
nsCOMPtr<nsIDOMNode> *aResultNode,
|
|
||||||
bool bNoBlockCrossing = false);
|
|
||||||
nsIContent* GetNextNode(nsINode* aParentNode,
|
nsIContent* GetNextNode(nsINode* aParentNode,
|
||||||
int32_t aOffset,
|
int32_t aOffset,
|
||||||
bool aEditableNode,
|
bool aEditableNode,
|
||||||
|
|
|
@ -796,20 +796,21 @@ nsHTMLEditRules::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
||||||
*aAlign = nsIHTMLEditor::eLeft;
|
*aAlign = nsIHTMLEditor::eLeft;
|
||||||
|
|
||||||
// get selection
|
// get selection
|
||||||
nsCOMPtr<nsISelection>selection;
|
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsresult res = mHTMLEditor->GetSelection(getter_AddRefs(selection));
|
nsRefPtr<Selection> selection = mHTMLEditor->GetSelection();
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_STATE(selection);
|
||||||
|
|
||||||
// get selection location
|
// get selection location
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
nsCOMPtr<nsIDOMElement> rootElem = do_QueryInterface(mHTMLEditor->GetRoot());
|
nsCOMPtr<Element> rootElem = mHTMLEditor->GetRoot();
|
||||||
NS_ENSURE_TRUE(rootElem, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(rootElem, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
int32_t offset, rootOffset;
|
int32_t offset, rootOffset;
|
||||||
nsCOMPtr<nsIDOMNode> parent = nsEditor::GetNodeLocation(rootElem, &rootOffset);
|
nsCOMPtr<nsINode> parent = nsEditor::GetNodeLocation(rootElem, &rootOffset);
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
res = mHTMLEditor->GetStartNodeAndOffset(selection, getter_AddRefs(parent), &offset);
|
nsresult res = mHTMLEditor->GetStartNodeAndOffset(selection,
|
||||||
|
getter_AddRefs(parent),
|
||||||
|
&offset);
|
||||||
NS_ENSURE_SUCCESS(res, res);
|
NS_ENSURE_SUCCESS(res, res);
|
||||||
|
|
||||||
// is the selection collapsed?
|
// is the selection collapsed?
|
||||||
|
@ -817,7 +818,7 @@ nsHTMLEditRules::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
||||||
if (selection->Collapsed()) {
|
if (selection->Collapsed()) {
|
||||||
// if it is, we want to look at 'parent' and its ancestors
|
// if it is, we want to look at 'parent' and its ancestors
|
||||||
// for divs with alignment on them
|
// for divs with alignment on them
|
||||||
nodeToExamine = parent;
|
nodeToExamine = GetAsDOMNode(parent);
|
||||||
}
|
}
|
||||||
else if (!mHTMLEditor) {
|
else if (!mHTMLEditor) {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -825,12 +826,12 @@ nsHTMLEditRules::GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign)
|
||||||
else if (mHTMLEditor->IsTextNode(parent))
|
else if (mHTMLEditor->IsTextNode(parent))
|
||||||
{
|
{
|
||||||
// if we are in a text node, then that is the node of interest
|
// if we are in a text node, then that is the node of interest
|
||||||
nodeToExamine = parent;
|
nodeToExamine = GetAsDOMNode(parent);
|
||||||
} else if (nsEditor::NodeIsType(parent, nsGkAtoms::html) &&
|
} else if (parent->Tag() == nsGkAtoms::html && offset == rootOffset) {
|
||||||
offset == rootOffset) {
|
|
||||||
// if we have selected the body, let's look at the first editable node
|
// if we have selected the body, let's look at the first editable node
|
||||||
NS_ENSURE_STATE(mHTMLEditor);
|
NS_ENSURE_STATE(mHTMLEditor);
|
||||||
mHTMLEditor->GetNextNode(parent, offset, true, address_of(nodeToExamine));
|
nodeToExamine =
|
||||||
|
GetAsDOMNode(mHTMLEditor->GetNextNode(parent, offset, true));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче