Bug 1683534 - Make `editor` buildable outside of `unified-build` environment. r=sg

Differential Revision: https://phabricator.services.mozilla.com/D100206
This commit is contained in:
Andi-Bogdan Postelnicu 2021-01-04 14:18:50 +00:00
Родитель 8dcc17a525
Коммит b6b336c821
11 изменённых файлов: 73 добавлений и 52 удалений

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

@ -77,4 +77,9 @@ dom/worklet/
dom/xhr/ dom/xhr/
dom/xml/ dom/xml/
dom/xslt/ dom/xslt/
dom/xul/ dom/xul/
editor/composer/
editor/libeditor/
editor/reftests/
editor/spellchecker/
editor/txmgr/

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

@ -19,30 +19,31 @@
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsDebug.h" // for NS_ENSURE_SUCCESS, etc #include "nsDebug.h" // for NS_ENSURE_SUCCESS, etc
#include "nsEditingSession.h" #include "nsEditingSession.h"
#include "nsError.h" // for NS_ERROR_FAILURE, NS_OK, etc #include "nsError.h" // for NS_ERROR_FAILURE, NS_OK, etc
#include "nsIChannel.h" // for nsIChannel #include "nsIChannel.h" // for nsIChannel
#include "nsIContentViewer.h" // for nsIContentViewer #include "nsIContentViewer.h" // for nsIContentViewer
#include "nsIControllers.h" // for nsIControllers #include "nsIControllers.h" // for nsIControllers
#include "nsID.h" // for NS_GET_IID, etc #include "nsID.h" // for NS_GET_IID, etc
#include "nsHTMLDocument.h" // for nsHTMLDocument #include "nsHTMLDocument.h" // for nsHTMLDocument
#include "nsIDocShell.h" // for nsIDocShell #include "nsIDocShell.h" // for nsIDocShell
#include "mozilla/dom/Document.h" // for Document #include "mozilla/dom/Document.h" // for Document
#include "nsIEditor.h" // for nsIEditor #include "nsIEditor.h" // for nsIEditor
#include "nsIInterfaceRequestorUtils.h" // for do_GetInterface #include "nsIInterfaceRequestorUtils.h" // for do_GetInterface
#include "nsIRefreshURI.h" // for nsIRefreshURI #include "nsIRefreshURI.h" // for nsIRefreshURI
#include "nsIRequest.h" // for nsIRequest #include "nsIRequest.h" // for nsIRequest
#include "nsITimer.h" // for nsITimer, etc #include "nsITimer.h" // for nsITimer, etc
#include "nsIWeakReference.h" // for nsISupportsWeakReference, etc #include "nsIWeakReference.h" // for nsISupportsWeakReference, etc
#include "nsIWebNavigation.h" // for nsIWebNavigation #include "nsIWebNavigation.h" // for nsIWebNavigation
#include "nsIWebProgress.h" // for nsIWebProgress, etc #include "nsIWebProgress.h" // for nsIWebProgress, etc
#include "nsLiteralString.h" // for NS_LITERAL_STRING #include "nsLiteralString.h" // for NS_LITERAL_STRING
#include "nsPIDOMWindow.h" // for nsPIDOMWindow #include "nsPIDOMWindow.h" // for nsPIDOMWindow
#include "nsPresContext.h" // for nsPresContext #include "nsPresContext.h" // for nsPresContext
#include "nsReadableUtils.h" // for AppendUTF16toUTF8 #include "nsReadableUtils.h" // for AppendUTF16toUTF8
#include "nsStringFwd.h" // for nsString #include "nsStringFwd.h" // for nsString
#include "mozilla/dom/Selection.h" // for AutoHideSelectionChanges, etc #include "mozilla/dom/BrowsingContext.h" // for BrowsingContext
#include "nsFrameSelection.h" // for nsFrameSelection #include "mozilla/dom/Selection.h" // for AutoHideSelectionChanges, etc
#include "nsBaseCommandController.h" // for nsBaseCommandController #include "nsFrameSelection.h" // for nsFrameSelection
#include "nsBaseCommandController.h" // for nsBaseCommandController
#include "mozilla/dom/LoadURIOptionsBinding.h" #include "mozilla/dom/LoadURIOptionsBinding.h"
class nsISupports; class nsISupports;

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

@ -4,6 +4,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "EditAggregateTransaction.h" #include "EditAggregateTransaction.h"
#include "mozilla/ReverseIterator.h" // for Reversed
#include "nsAString.h" #include "nsAString.h"
#include "nsCOMPtr.h" // for nsCOMPtr #include "nsCOMPtr.h" // for nsCOMPtr
#include "nsError.h" // for NS_OK, etc. #include "nsError.h" // for NS_OK, etc.

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

@ -5,6 +5,7 @@
#include "EditorUtils.h" #include "EditorUtils.h"
#include "gfxFontUtils.h"
#include "WSRunObject.h" #include "WSRunObject.h"
#include "mozilla/ComputedStyle.h" #include "mozilla/ComputedStyle.h"
#include "mozilla/ContentIterator.h" #include "mozilla/ContentIterator.h"

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

@ -9,6 +9,7 @@
#include "HTMLEditorEventListener.h" #include "HTMLEditorEventListener.h"
#include "HTMLEditUtils.h" #include "HTMLEditUtils.h"
#include "mozilla/EditAction.h" #include "mozilla/EditAction.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/Preferences.h" #include "mozilla/Preferences.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"
#include "mozilla/dom/AncestorIterator.h" #include "mozilla/dom/AncestorIterator.h"

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

@ -22,6 +22,7 @@
#include "mozilla/EventStates.h" #include "mozilla/EventStates.h"
#include "mozilla/InternalMutationEvent.h" #include "mozilla/InternalMutationEvent.h"
#include "mozilla/mozInlineSpellChecker.h" #include "mozilla/mozInlineSpellChecker.h"
#include "mozilla/Preferences.h"
#include "mozilla/PresShell.h" #include "mozilla/PresShell.h"
#include "mozilla/StaticPrefs_editor.h" #include "mozilla/StaticPrefs_editor.h"
#include "mozilla/StyleSheet.h" #include "mozilla/StyleSheet.h"

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

@ -7,10 +7,15 @@
#define HTMLEditorEventListener_h #define HTMLEditorEventListener_h
#include "EditorEventListener.h" #include "EditorEventListener.h"
#include "mozilla/HTMLEditor.h"
#include "nscore.h" #include "nscore.h"
namespace mozilla { namespace mozilla {
namespace dom {
class Element;
}
class EditorBase; class EditorBase;
class HTMLEditorEventListener final : public EditorEventListener { class HTMLEditorEventListener final : public EditorEventListener {
@ -80,12 +85,12 @@ class HTMLEditorEventListener final : public EditorEventListener {
bool aForGrabber); bool aForGrabber);
MOZ_CAN_RUN_SCRIPT void MaybeDisplayResizers(HTMLEditor& aHTMLEditor, MOZ_CAN_RUN_SCRIPT void MaybeDisplayResizers(HTMLEditor& aHTMLEditor,
Element& aElement, dom::Element& aElement,
MouseEvent& aMouseEvent); dom::MouseEvent& aMouseEvent);
MOZ_CAN_RUN_SCRIPT nsresult HandlePrimaryMouseButtonDown( MOZ_CAN_RUN_SCRIPT nsresult HandlePrimaryMouseButtonDown(
HTMLEditor& aHTMLEditor, MouseEvent& aMouseEvent); HTMLEditor& aHTMLEditor, dom::MouseEvent& aMouseEvent);
MOZ_CAN_RUN_SCRIPT nsresult HandleSecondaryMouseButtonDown( MOZ_CAN_RUN_SCRIPT nsresult HandleSecondaryMouseButtonDown(
HTMLEditor& aHTMLEditor, MouseEvent& aMouseEvent); HTMLEditor& aHTMLEditor, dom::MouseEvent& aMouseEvent);
bool mListeningToMouseMoveEventForResizers; bool mListeningToMouseMoveEventForResizers;
bool mListeningToMouseMoveEventForGrabber; bool mListeningToMouseMoveEventForGrabber;

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

@ -82,7 +82,7 @@ ListElementSelectionState::ListElementSelectionState(HTMLEditor& aHTMLEditor,
} else if (content->IsHTMLElement(nsGkAtoms::ol)) { } else if (content->IsHTMLElement(nsGkAtoms::ol)) {
mIsOLElementSelected = true; mIsOLElementSelected = true;
} else if (content->IsHTMLElement(nsGkAtoms::li)) { } else if (content->IsHTMLElement(nsGkAtoms::li)) {
if (Element* parent = content->GetParentElement()) { if (dom::Element* parent = content->GetParentElement()) {
if (parent->IsHTMLElement(nsGkAtoms::ul)) { if (parent->IsHTMLElement(nsGkAtoms::ul)) {
mIsULElementSelected = true; mIsULElementSelected = true;
} else if (parent->IsHTMLElement(nsGkAtoms::ol)) { } else if (parent->IsHTMLElement(nsGkAtoms::ol)) {
@ -210,7 +210,7 @@ AlignStateAtSelection::AlignStateAtSelection(HTMLEditor& aHTMLEditor,
return; return;
} }
OwningNonNull<Element> bodyOrDocumentElement = *aHTMLEditor.GetRoot(); OwningNonNull<dom::Element> bodyOrDocumentElement = *aHTMLEditor.GetRoot();
EditorRawDOMPoint atBodyOrDocumentElement(bodyOrDocumentElement); EditorRawDOMPoint atBodyOrDocumentElement(bodyOrDocumentElement);
const nsRange* firstRange = aHTMLEditor.SelectionRefPtr()->GetRangeAt(0); const nsRange* firstRange = aHTMLEditor.SelectionRefPtr()->GetRangeAt(0);
@ -281,7 +281,7 @@ AlignStateAtSelection::AlignStateAtSelection(HTMLEditor& aHTMLEditor,
editTargetContent = arrayOfContents[0]; editTargetContent = arrayOfContents[0];
} }
RefPtr<Element> blockElementAtEditTarget = RefPtr<dom::Element> blockElementAtEditTarget =
HTMLEditUtils::GetInclusiveAncestorBlockElement(*editTargetContent); HTMLEditUtils::GetInclusiveAncestorBlockElement(*editTargetContent);
if (NS_WARN_IF(!blockElementAtEditTarget)) { if (NS_WARN_IF(!blockElementAtEditTarget)) {
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
@ -468,7 +468,7 @@ ParagraphStateAtSelection::ParagraphStateAtSelection(HTMLEditor& aHTMLEditor,
arrayOfContents.AppendElement(*content); arrayOfContents.AppendElement(*content);
} }
Element* bodyOrDocumentElement = aHTMLEditor.GetRoot(); dom::Element* bodyOrDocumentElement = aHTMLEditor.GetRoot();
if (NS_WARN_IF(!bodyOrDocumentElement)) { if (NS_WARN_IF(!bodyOrDocumentElement)) {
aRv.Throw(NS_ERROR_FAILURE); aRv.Throw(NS_ERROR_FAILURE);
return; return;
@ -518,7 +518,7 @@ ParagraphStateAtSelection::ParagraphStateAtSelection(HTMLEditor& aHTMLEditor,
// static // static
void ParagraphStateAtSelection::AppendDescendantFormatNodesAndFirstInlineNode( void ParagraphStateAtSelection::AppendDescendantFormatNodesAndFirstInlineNode(
nsTArray<OwningNonNull<nsIContent>>& aArrayOfContents, nsTArray<OwningNonNull<nsIContent>>& aArrayOfContents,
Element& aNonFormatBlockElement) { dom::Element& aNonFormatBlockElement) {
MOZ_ASSERT(HTMLEditUtils::IsBlockElement(aNonFormatBlockElement)); MOZ_ASSERT(HTMLEditUtils::IsBlockElement(aNonFormatBlockElement));
MOZ_ASSERT(!HTMLEditUtils::IsFormatNode(&aNonFormatBlockElement)); MOZ_ASSERT(!HTMLEditUtils::IsFormatNode(&aNonFormatBlockElement));

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

@ -22,6 +22,10 @@
namespace mozilla { namespace mozilla {
namespace dom {
class Element;
}
class WSRunScanner; class WSRunScanner;
/** /**
@ -348,10 +352,10 @@ class MOZ_STACK_CLASS WSRunScanner final {
*/ */
template <typename EditorDOMPointType> template <typename EditorDOMPointType>
static EditorDOMPointType GetAfterLastVisiblePoint( static EditorDOMPointType GetAfterLastVisiblePoint(
Text& aTextNode, const Element* aAncestorLimiter); dom::Text& aTextNode, const dom::Element* aAncestorLimiter);
template <typename EditorDOMPointType> template <typename EditorDOMPointType>
static EditorDOMPointType GetFirstVisiblePoint( static EditorDOMPointType GetFirstVisiblePoint(
Text& aTextNode, const Element* aAncestorLimiter); dom::Text& aTextNode, const dom::Element* aAncestorLimiter);
/** /**
* GetRangeInTextNodesToForwardDeleteFrom() returns the range to remove * GetRangeInTextNodesToForwardDeleteFrom() returns the range to remove
@ -398,8 +402,8 @@ class MOZ_STACK_CLASS WSRunScanner final {
* Otherwise, must not be set. * Otherwise, must not be set.
*/ */
static EditorDOMRange GetRangeForDeletingBlockElementBoundaries( static EditorDOMRange GetRangeForDeletingBlockElementBoundaries(
const HTMLEditor& aHTMLEditor, const Element& aLeftBlockElement, const HTMLEditor& aHTMLEditor, const dom::Element& aLeftBlockElement,
const Element& aRightBlockElement, const dom::Element& aRightBlockElement,
const EditorDOMPoint& aPointContainingTheOtherBlock); const EditorDOMPoint& aPointContainingTheOtherBlock);
/** /**
@ -409,7 +413,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
*/ */
static Result<bool, nsresult> ShrinkRangeIfStartsFromOrEndsAfterAtomicContent( static Result<bool, nsresult> ShrinkRangeIfStartsFromOrEndsAfterAtomicContent(
const HTMLEditor& aHTMLEditor, nsRange& aRange, const HTMLEditor& aHTMLEditor, nsRange& aRange,
const Element* aEditingHost); const dom::Element* aEditingHost);
/** /**
* GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries() returns * GetRangeContainingInvisibleWhiteSpacesAtRangeBoundaries() returns
@ -425,7 +429,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
* white-spaces between `<br>` element and aPoint. * white-spaces between `<br>` element and aPoint.
*/ */
template <typename EditorDOMPointType> template <typename EditorDOMPointType>
MOZ_NEVER_INLINE_DEBUG static HTMLBRElement* MOZ_NEVER_INLINE_DEBUG static dom::HTMLBRElement*
GetPrecedingBRElementUnlessVisibleContentFound( GetPrecedingBRElementUnlessVisibleContentFound(
const HTMLEditor& aHTMLEditor, const EditorDOMPointType& aPoint) { const HTMLEditor& aHTMLEditor, const EditorDOMPointType& aPoint) {
MOZ_ASSERT(aPoint.IsSetAndValid()); MOZ_ASSERT(aPoint.IsSetAndValid());
@ -728,7 +732,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
static BoundaryData ScanCollapsibleWhiteSpaceStartFrom( static BoundaryData ScanCollapsibleWhiteSpaceStartFrom(
const EditorDOMPointType& aPoint, const EditorDOMPointType& aPoint,
const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent, const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent,
const Element* aEditingHost, NoBreakingSpaceData* aNBSPData); const dom::Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
/** /**
* ScanCollapsibleWhiteSpaceEndFrom() returns end boundary data of * ScanCollapsibleWhiteSpaceEndFrom() returns end boundary data of
@ -748,7 +752,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
static BoundaryData ScanCollapsibleWhiteSpaceEndFrom( static BoundaryData ScanCollapsibleWhiteSpaceEndFrom(
const EditorDOMPointType& aPoint, const EditorDOMPointType& aPoint,
const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent, const nsIContent& aEditableBlockParentOrTopmostEditableInlineContent,
const Element* aEditingHost, NoBreakingSpaceData* aNBSPData); const dom::Element* aEditingHost, NoBreakingSpaceData* aNBSPData);
enum class Preformatted : bool { Yes, No }; enum class Preformatted : bool { Yes, No };
BoundaryData() BoundaryData()
@ -856,7 +860,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
TextFragmentData() = delete; TextFragmentData() = delete;
template <typename EditorDOMPointType> template <typename EditorDOMPointType>
TextFragmentData(const EditorDOMPointType& aPoint, TextFragmentData(const EditorDOMPointType& aPoint,
const Element* aEditingHost); const dom::Element* aEditingHost);
bool IsInitialized() const { bool IsInitialized() const {
return mStart.Initialized() && mEnd.Initialized(); return mStart.Initialized() && mEnd.Initialized();
@ -1185,7 +1189,7 @@ class MOZ_STACK_CLASS WSRunScanner final {
BoundaryData mStart; BoundaryData mStart;
BoundaryData mEnd; BoundaryData mEnd;
NoBreakingSpaceData mNBSPData; NoBreakingSpaceData mNBSPData;
RefPtr<const Element> mEditingHost; RefPtr<const dom::Element> mEditingHost;
mutable Maybe<EditorDOMRange> mLeadingWhiteSpaceRange; mutable Maybe<EditorDOMRange> mLeadingWhiteSpaceRange;
mutable Maybe<EditorDOMRange> mTrailingWhiteSpaceRange; mutable Maybe<EditorDOMRange> mTrailingWhiteSpaceRange;
mutable Maybe<VisibleWhiteSpacesData> mVisibleWhiteSpacesData; mutable Maybe<VisibleWhiteSpacesData> mVisibleWhiteSpacesData;
@ -1325,8 +1329,9 @@ class WhiteSpaceVisibilityKeeper final {
*/ */
[[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
MergeFirstLineOfRightBlockElementIntoDescendantLeftBlockElement( MergeFirstLineOfRightBlockElementIntoDescendantLeftBlockElement(
HTMLEditor& aHTMLEditor, Element& aLeftBlockElement, HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
Element& aRightBlockElement, const EditorDOMPoint& aAtRightBlockChild, dom::Element& aRightBlockElement,
const EditorDOMPoint& aAtRightBlockChild,
const Maybe<nsAtom*>& aListElementTagName, const Maybe<nsAtom*>& aListElementTagName,
const dom::HTMLBRElement* aPrecedingInvisibleBRElement); const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
@ -1352,8 +1357,8 @@ class WhiteSpaceVisibilityKeeper final {
*/ */
[[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
MergeFirstLineOfRightBlockElementIntoAncestorLeftBlockElement( MergeFirstLineOfRightBlockElementIntoAncestorLeftBlockElement(
HTMLEditor& aHTMLEditor, Element& aLeftBlockElement, HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
Element& aRightBlockElement, const EditorDOMPoint& aAtLeftBlockChild, dom::Element& aRightBlockElement, const EditorDOMPoint& aAtLeftBlockChild,
nsIContent& aLeftContentInBlock, nsIContent& aLeftContentInBlock,
const Maybe<nsAtom*>& aListElementTagName, const Maybe<nsAtom*>& aListElementTagName,
const dom::HTMLBRElement* aPrecedingInvisibleBRElement); const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
@ -1374,8 +1379,9 @@ class WhiteSpaceVisibilityKeeper final {
*/ */
[[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult [[nodiscard]] MOZ_CAN_RUN_SCRIPT static EditActionResult
MergeFirstLineOfRightBlockElementIntoLeftBlockElement( MergeFirstLineOfRightBlockElementIntoLeftBlockElement(
HTMLEditor& aHTMLEditor, Element& aLeftBlockElement, HTMLEditor& aHTMLEditor, dom::Element& aLeftBlockElement,
Element& aRightBlockElement, const Maybe<nsAtom*>& aListElementTagName, dom::Element& aRightBlockElement,
const Maybe<nsAtom*>& aListElementTagName,
const dom::HTMLBRElement* aPrecedingInvisibleBRElement); const dom::HTMLBRElement* aPrecedingInvisibleBRElement);
/** /**
@ -1391,7 +1397,7 @@ class WhiteSpaceVisibilityKeeper final {
* @return The new <br> node. If failed to create new <br> * @return The new <br> node. If failed to create new <br>
* node, returns nullptr. * node, returns nullptr.
*/ */
[[nodiscard]] MOZ_CAN_RUN_SCRIPT static Result<RefPtr<Element>, nsresult> [[nodiscard]] MOZ_CAN_RUN_SCRIPT static Result<RefPtr<dom::Element>, nsresult>
InsertBRElement(HTMLEditor& aHTMLEditor, InsertBRElement(HTMLEditor& aHTMLEditor,
const EditorDOMPoint& aPointToInsert); const EditorDOMPoint& aPointToInsert);

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

@ -5,7 +5,6 @@
#include "TransactionStack.h" #include "TransactionStack.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h" #include "nsCycleCollectionParticipant.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsISupportsUtils.h" #include "nsISupportsUtils.h"

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

@ -31,6 +31,7 @@
#include "mozilla/fallible.h" #include "mozilla/fallible.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/RefPtr.h" #include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsDebug.h" #include "nsDebug.h"
#include "nsISupports.h" #include "nsISupports.h"