Bug 1467790 - Inline nsINode::IsEditable, r=masayuki

This commit is contained in:
Olli Pettay
2018-06-08 15:57:13 -04:00
parent b08698d505
commit d107f4ae65
8 changed files with 20 additions and 16 deletions

View File

@@ -166,6 +166,20 @@ nsINode::NodeOrAncestorHasDirAuto() const
return AncestorHasDirAuto() || (IsElement() && AsElement()->HasDirAuto());
}
inline bool
nsINode::IsEditable() const
{
if (HasFlag(NODE_IS_EDITABLE)) {
// The node is in an editable contentEditable subtree.
return true;
}
nsIDocument* doc = GetUncomposedDoc();
// Check if the node is in a document and the document is in designMode.
return doc && doc->HasFlag(NODE_IS_EDITABLE);
}
inline bool
nsIContent::IsActiveChildrenElement() const
{

View File

@@ -201,20 +201,6 @@ nsINode::CreateSlots()
return new nsSlots();
}
bool
nsINode::IsEditable() const
{
if (HasFlag(NODE_IS_EDITABLE)) {
// The node is in an editable contentEditable subtree.
return true;
}
nsIDocument *doc = GetUncomposedDoc();
// Check if the node is in a document and the document is in designMode.
return doc && doc->HasFlag(NODE_IS_EDITABLE);
}
nsIContent*
nsINode::GetTextEditorRootContent(TextEditor** aTextEditor)
{

View File

@@ -1249,7 +1249,7 @@ public:
}
}
bool IsEditable() const;
inline bool IsEditable() const;
/**
* Returns true if |this| or any of its ancestors is native anonymous.

View File

@@ -14,6 +14,7 @@
#include "nsContentUtils.h"
#include "nsGkAtoms.h"
#include "nsSVGString.h"
#include "nsIContentInlines.h"
#include "nsIURI.h"
NS_IMPL_NS_NEW_NAMESPACED_SVG_ELEMENT(A)

View File

@@ -71,7 +71,7 @@
#include "nsGenericHTMLElement.h" // for nsGenericHTMLElement
#include "nsGkAtoms.h" // for nsGkAtoms, nsGkAtoms::dir
#include "nsIAbsorbingTransaction.h" // for nsIAbsorbingTransaction
#include "nsAtom.h" // for nsAtom
#include "nsAtom.h" // for nsAtom
#include "nsIContent.h" // for nsIContent
#include "nsIDocument.h" // for nsIDocument
#include "nsIDOMEventListener.h" // for nsIDOMEventListener

View File

@@ -22,6 +22,7 @@
#include "nsCycleCollectionParticipant.h"
#include "nsGkAtoms.h"
#include "nsIDocument.h" // for nsIDocument
#include "nsIContentInlines.h" // for nsINode::IsEditable()
#include "nsIEditor.h" // for nsIEditor, etc.
#include "nsIObserver.h" // for NS_DECL_NSIOBSERVER, etc.
#include "nsIPlaintextEditor.h" // for nsIPlaintextEditor, etc.

View File

@@ -22,6 +22,7 @@
#include "nsDebug.h"
#include "nsError.h"
#include "nsIContent.h"
#include "nsIContentInlines.h"
#include "nsISupportsImpl.h"
#include "nsRange.h"
#include "nsString.h"

View File

@@ -10,6 +10,7 @@
#include "mozilla/dom/TabParent.h" // for TabParent
#include "mozilla/EventDispatcher.h" // for EventDispatcher
#include "mozilla/layout/RenderFrameParent.h" // For RenderFrameParent
#include "nsIContentInlines.h" // for nsINode::IsEditable()
#include "nsIPresShell.h" // for nsIPresShell
#include "nsLayoutUtils.h" // for nsLayoutUtils