Bug 1572060: declare a few methods around HTMLEditor static/const. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D40982

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mirko Brodesser 2019-08-07 15:58:41 +00:00
parent 1e0f988331
commit 1274c8140e
4 changed files with 21 additions and 18 deletions

View File

@ -3599,7 +3599,7 @@ nsIContent* EditorBase::FindNode(nsINode* aCurrentNode, bool aGoForward,
}
nsIContent* EditorBase::GetRightmostChild(nsINode* aCurrentNode,
bool bNoBlockCrossing) {
bool bNoBlockCrossing) const {
NS_ENSURE_TRUE(aCurrentNode, nullptr);
nsIContent* cur = aCurrentNode->GetLastChild();
if (!cur) {
@ -3621,7 +3621,7 @@ nsIContent* EditorBase::GetRightmostChild(nsINode* aCurrentNode,
}
nsIContent* EditorBase::GetLeftmostChild(nsINode* aCurrentNode,
bool bNoBlockCrossing) {
bool bNoBlockCrossing) const {
NS_ENSURE_TRUE(aCurrentNode, nullptr);
nsIContent* cur = aCurrentNode->GetFirstChild();
if (!cur) {
@ -3642,7 +3642,7 @@ nsIContent* EditorBase::GetLeftmostChild(nsINode* aCurrentNode,
return nullptr;
}
bool EditorBase::IsBlockNode(nsINode* aNode) {
bool EditorBase::IsBlockNode(nsINode* aNode) const {
// stub to be overridden in HTMLEditor.
// screwing around with the class hierarchy here in order
// to not duplicate the code in GetNextNode/GetPrevNode
@ -3722,7 +3722,9 @@ bool EditorBase::IsDescendantOfEditorRoot(nsINode* aNode) const {
return aNode->IsInclusiveDescendantOf(root);
}
bool EditorBase::IsContainer(nsINode* aNode) { return aNode ? true : false; }
bool EditorBase::IsContainer(nsINode* aNode) const {
return aNode ? true : false;
}
uint32_t EditorBase::CountEditableChildren(nsINode* aNode) {
MOZ_ASSERT(aNode);

View File

@ -1467,7 +1467,7 @@ class EditorBase : public nsIEditor,
MOZ_CAN_RUN_SCRIPT nsresult DoTransactionInternal(nsITransaction* aTxn);
virtual bool IsBlockNode(nsINode* aNode);
virtual bool IsBlockNode(nsINode* aNode) const;
/**
* Set outOffset to the offset of aChild in the parent.
@ -1591,14 +1591,14 @@ class EditorBase : public nsIEditor,
* return nullptr if aCurrentNode has no children.
*/
nsIContent* GetRightmostChild(nsINode* aCurrentNode,
bool bNoBlockCrossing = false);
bool bNoBlockCrossing = false) const;
/**
* Get the leftmost child of aCurrentNode;
* return nullptr if aCurrentNode has no children.
*/
nsIContent* GetLeftmostChild(nsINode* aCurrentNode,
bool bNoBlockCrossing = false);
bool bNoBlockCrossing = false) const;
/**
* Returns true if aParent can contain a child of type aTag.
@ -1623,12 +1623,12 @@ class EditorBase : public nsIEditor,
/**
* Returns true if aNode is a container.
*/
virtual bool IsContainer(nsINode* aNode);
virtual bool IsContainer(nsINode* aNode) const;
/**
* returns true if aNode is an editable node.
*/
bool IsEditable(nsINode* aNode) {
bool IsEditable(nsINode* aNode) const {
if (NS_WARN_IF(!aNode)) {
return false;
}

View File

@ -763,7 +763,7 @@ HTMLEditor::NodeIsBlock(nsINode* aNode, bool* aIsBlock) {
return NS_OK;
}
bool HTMLEditor::IsBlockNode(nsINode* aNode) {
bool HTMLEditor::IsBlockNode(nsINode* aNode) const {
return aNode && NodeIsBlockStatic(aNode);
}
@ -3744,7 +3744,7 @@ bool HTMLEditor::TagCanContainTag(nsAtom& aParentTag, nsAtom& aChildTag) const {
return HTMLEditUtils::CanContain(parentTagEnum, childTagEnum);
}
bool HTMLEditor::IsContainer(nsINode* aNode) {
bool HTMLEditor::IsContainer(nsINode* aNode) const {
MOZ_ASSERT(aNode);
int32_t tagEnum;
@ -4234,7 +4234,7 @@ nsIContent* HTMLEditor::GetLastEditableLeaf(nsINode& aNode) {
return child;
}
bool HTMLEditor::IsInVisibleTextFrames(Text& aText) {
bool HTMLEditor::IsInVisibleTextFrames(Text& aText) const {
nsISelectionController* selectionController = GetSelectionController();
if (NS_WARN_IF(!selectionController)) {
return false;

View File

@ -823,7 +823,7 @@ class HTMLEditor final : public TextEditor,
int32_t aChange,
int32_t* aReturn);
virtual bool IsBlockNode(nsINode* aNode) override;
virtual bool IsBlockNode(nsINode* aNode) const override;
using EditorBase::IsBlockNode;
/**
@ -835,7 +835,7 @@ class HTMLEditor final : public TextEditor,
/**
* Returns true if aNode is a container.
*/
virtual bool IsContainer(nsINode* aNode) override;
virtual bool IsContainer(nsINode* aNode) const override;
/**
* Join together any adjacent editable text nodes in the range.
@ -846,7 +846,7 @@ class HTMLEditor final : public TextEditor,
* IsInVisibleTextFrames() returns true if all text in aText is in visible
* text frames. Callers have to guarantee that there is no pending reflow.
*/
bool IsInVisibleTextFrames(dom::Text& aText);
bool IsInVisibleTextFrames(dom::Text& aText) const;
/**
* IsVisibleTextNode() returns true if aText has visible text. If it has
@ -893,9 +893,10 @@ class HTMLEditor final : public TextEditor,
*
* The nsIContent variant returns aIsSet instead of using an out parameter.
*/
bool IsTextPropertySetByContent(nsINode* aNode, nsAtom* aProperty,
nsAtom* aAttribute, const nsAString* aValue,
nsAString* outValue = nullptr);
static bool IsTextPropertySetByContent(nsINode* aNode, nsAtom* aProperty,
nsAtom* aAttribute,
const nsAString* aValue,
nsAString* outValue = nullptr);
static dom::Element* GetLinkElement(nsINode* aNode);