зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1386485 - Part 4: Devirtualize and inline EditorBase::IsEditable(); r=masayuki
This commit is contained in:
Родитель
c6b7fe866d
Коммит
4018b56c7c
|
@ -3578,25 +3578,6 @@ EditorBase::IsEditable(nsIDOMNode* aNode)
|
|||
return IsEditable(content);
|
||||
}
|
||||
|
||||
bool
|
||||
EditorBase::IsEditable(nsINode* aNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, false);
|
||||
|
||||
if (!aNode->IsNodeOfType(nsINode::eCONTENT) || IsMozEditorBogusNode(aNode) ||
|
||||
!IsModifiableNode(aNode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (aNode->NodeType()) {
|
||||
case nsIDOMNode::ELEMENT_NODE:
|
||||
case nsIDOMNode::TEXT_NODE:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t
|
||||
EditorBase::CountEditableChildren(nsINode* aNode)
|
||||
{
|
||||
|
|
|
@ -765,7 +765,27 @@ public:
|
|||
* returns true if aNode is an editable node.
|
||||
*/
|
||||
bool IsEditable(nsIDOMNode* aNode);
|
||||
virtual bool IsEditable(nsINode* aNode);
|
||||
bool IsEditable(nsINode* aNode)
|
||||
{
|
||||
NS_ENSURE_TRUE(aNode, false);
|
||||
|
||||
if (!aNode->IsNodeOfType(nsINode::eCONTENT) || IsMozEditorBogusNode(aNode) ||
|
||||
!IsModifiableNode(aNode)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (aNode->NodeType()) {
|
||||
case nsIDOMNode::ELEMENT_NODE:
|
||||
// In HTML editors, if we're dealing with an element, then ask it
|
||||
// whether it's editable.
|
||||
return mIsHTMLEditorClass ? aNode->IsEditable() : true;
|
||||
case nsIDOMNode::TEXT_NODE:
|
||||
// Text nodes are considered to be editable by both typed of editors.
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if aNode is a MozEditorBogus node.
|
||||
|
|
|
@ -5290,21 +5290,6 @@ HTMLEditor::GetInputEventTargetContent()
|
|||
return target.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
HTMLEditor::IsEditable(nsINode* aNode)
|
||||
{
|
||||
if (!TextEditor::IsEditable(aNode)) {
|
||||
return false;
|
||||
}
|
||||
if (aNode->IsElement()) {
|
||||
// If we're dealing with an element, then ask it whether it's editable.
|
||||
return aNode->IsEditable();
|
||||
}
|
||||
// We might be dealing with a text node for example, which we always consider
|
||||
// to be editable.
|
||||
return true;
|
||||
}
|
||||
|
||||
Element*
|
||||
HTMLEditor::GetEditorRoot()
|
||||
{
|
||||
|
|
|
@ -119,7 +119,6 @@ public:
|
|||
nsINode *aNode) override;
|
||||
virtual bool IsAcceptableInputEvent(WidgetGUIEvent* aGUIEvent) override;
|
||||
virtual already_AddRefed<nsIContent> GetInputEventTargetContent() override;
|
||||
virtual bool IsEditable(nsINode* aNode) override;
|
||||
using EditorBase::IsEditable;
|
||||
virtual nsresult RemoveAttributeOrEquivalent(
|
||||
Element* aElement,
|
||||
|
|
Загрузка…
Ссылка в новой задаче