Bug 1759885 - Default callback for initializing new element should be static r=m_kato

This decreases the binary size of xul.dll of debug build on Windows 3KB.

Depends on D141447

Differential Revision: https://phabricator.services.mozilla.com/D141448
This commit is contained in:
Masayuki Nakano 2022-03-18 07:20:52 +00:00
parent 5990ed6b84
commit fd40906504
2 changed files with 7 additions and 6 deletions

View File

@ -136,6 +136,9 @@ void HTMLEditor::AutoSelectionRestorer::Abort() {
* HTMLEditor
*****************************************************************************/
HTMLEditor::InitializeInsertingElement HTMLEditor::DoNothingForNewElement =
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; };
HTMLEditor::HTMLEditor()
: mCRInParagraphCreatesParagraph(false),
mIsObjectResizingEnabled(

View File

@ -1494,6 +1494,7 @@ class HTMLEditor final : public EditorBase,
using InitializeInsertingElement =
std::function<nsresult(HTMLEditor& aHTMLEditor, Element& aNewElement,
const EditorDOMPoint& aPointToInsert)>;
static InitializeInsertingElement DoNothingForNewElement;
/**
* Create an element node whose name is aTag at before aPointToInsert. When
@ -1524,8 +1525,7 @@ class HTMLEditor final : public EditorBase,
CreateAndInsertElement(
WithTransaction aWithTransaction, nsAtom& aTagName,
const EditorDOMPoint& aPointToInsert,
const InitializeInsertingElement& aInitializer =
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; });
const InitializeInsertingElement& aInitializer = DoNothingForNewElement);
/**
* MaybeSplitAncestorsForInsertWithTransaction() does nothing if container of
@ -1573,8 +1573,7 @@ class HTMLEditor final : public EditorBase,
InsertElementWithSplittingAncestorsWithTransaction(
nsAtom& aTagName, const EditorDOMPoint& aPointToInsert,
BRElementNextToSplitPoint aBRElementNextToSplitPoint,
const InitializeInsertingElement& aInitializer =
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; });
const InitializeInsertingElement& aInitializer = DoNothingForNewElement);
/**
* SplitRangeOffFromBlock() splits aBlockElement at two points, before
@ -3455,8 +3454,7 @@ class HTMLEditor final : public EditorBase,
MOZ_CAN_RUN_SCRIPT Result<RefPtr<Element>, nsresult>
DeleteSelectionAndCreateElement(
nsAtom& aTag,
const InitializeInsertingElement& aInitializer =
[](HTMLEditor&, Element&, const EditorDOMPoint&) { return NS_OK; });
const InitializeInsertingElement& aInitializer = DoNothingForNewElement);
/**
* This method first deletes the selection, if it's not collapsed. Then if