gecko/editor/libeditor/base/nsEditor.h
Wes Kocher 75fd9bfafa Backed out 6 changesets (bug 1028559, bug 1028565) for android mochitest bustage on a CLOSED TREE
Backed out changeset fdd74c065e5d (bug 1028565)
Backed out changeset 5e9777d38052 (bug 1028565)
Backed out changeset 3510bcdba3fc (bug 1028565)
Backed out changeset 62ad3254903e (bug 1028565)
Backed out changeset e7557f70acfe (bug 1028565)
Backed out changeset 5b1b527abe47 (bug 1028559)

--HG--
rename : editor/composer/nsIEditingSession.idl => editor/composer/public/nsIEditingSession.idl
rename : editor/composer/crashtests/351236-1.html => editor/composer/src/crashtests/351236-1.html
rename : editor/composer/crashtests/407062-1.html => editor/composer/src/crashtests/407062-1.html
rename : editor/composer/crashtests/419563-1.xhtml => editor/composer/src/crashtests/419563-1.xhtml
rename : editor/composer/crashtests/428844-1-inner.xhtml => editor/composer/src/crashtests/428844-1-inner.xhtml
rename : editor/composer/crashtests/428844-1.html => editor/composer/src/crashtests/428844-1.html
rename : editor/composer/crashtests/461049-1.html => editor/composer/src/crashtests/461049-1.html
rename : editor/composer/crashtests/crashtests.list => editor/composer/src/crashtests/crashtests.list
rename : editor/composer/crashtests/removing-editable-xslt-inner.xhtml => editor/composer/src/crashtests/removing-editable-xslt-inner.xhtml
rename : editor/composer/crashtests/removing-editable-xslt.html => editor/composer/src/crashtests/removing-editable-xslt.html
rename : editor/composer/nsComposeTxtSrvFilter.cpp => editor/composer/src/nsComposeTxtSrvFilter.cpp
rename : editor/composer/nsComposeTxtSrvFilter.h => editor/composer/src/nsComposeTxtSrvFilter.h
rename : editor/composer/nsComposerCommands.cpp => editor/composer/src/nsComposerCommands.cpp
rename : editor/composer/nsComposerCommands.h => editor/composer/src/nsComposerCommands.h
rename : editor/composer/nsComposerCommandsUpdater.cpp => editor/composer/src/nsComposerCommandsUpdater.cpp
rename : editor/composer/nsComposerCommandsUpdater.h => editor/composer/src/nsComposerCommandsUpdater.h
rename : editor/composer/nsComposerController.cpp => editor/composer/src/nsComposerController.cpp
rename : editor/composer/nsComposerController.h => editor/composer/src/nsComposerController.h
rename : editor/composer/nsComposerDocumentCommands.cpp => editor/composer/src/nsComposerDocumentCommands.cpp
rename : editor/composer/nsComposerRegistration.cpp => editor/composer/src/nsComposerRegistration.cpp
rename : editor/composer/nsEditingSession.cpp => editor/composer/src/nsEditingSession.cpp
rename : editor/composer/nsEditingSession.h => editor/composer/src/nsEditingSession.h
rename : editor/composer/nsEditorSpellCheck.cpp => editor/composer/src/nsEditorSpellCheck.cpp
rename : editor/composer/nsEditorSpellCheck.h => editor/composer/src/nsEditorSpellCheck.h
rename : editor/composer/res/EditorOverride.css => editor/composer/src/res/EditorOverride.css
rename : editor/composer/res/grabber.gif => editor/composer/src/res/grabber.gif
rename : editor/composer/res/table-add-column-after-active.gif => editor/composer/src/res/table-add-column-after-active.gif
rename : editor/composer/res/table-add-column-after-hover.gif => editor/composer/src/res/table-add-column-after-hover.gif
rename : editor/composer/res/table-add-column-after.gif => editor/composer/src/res/table-add-column-after.gif
rename : editor/composer/res/table-add-column-before-active.gif => editor/composer/src/res/table-add-column-before-active.gif
rename : editor/composer/res/table-add-column-before-hover.gif => editor/composer/src/res/table-add-column-before-hover.gif
rename : editor/composer/res/table-add-column-before.gif => editor/composer/src/res/table-add-column-before.gif
rename : editor/composer/res/table-add-row-after-active.gif => editor/composer/src/res/table-add-row-after-active.gif
rename : editor/composer/res/table-add-row-after-hover.gif => editor/composer/src/res/table-add-row-after-hover.gif
rename : editor/composer/res/table-add-row-after.gif => editor/composer/src/res/table-add-row-after.gif
rename : editor/composer/res/table-add-row-before-active.gif => editor/composer/src/res/table-add-row-before-active.gif
rename : editor/composer/res/table-add-row-before-hover.gif => editor/composer/src/res/table-add-row-before-hover.gif
rename : editor/composer/res/table-add-row-before.gif => editor/composer/src/res/table-add-row-before.gif
rename : editor/composer/res/table-remove-column-active.gif => editor/composer/src/res/table-remove-column-active.gif
rename : editor/composer/res/table-remove-column-hover.gif => editor/composer/src/res/table-remove-column-hover.gif
rename : editor/composer/res/table-remove-column.gif => editor/composer/src/res/table-remove-column.gif
rename : editor/composer/res/table-remove-row-active.gif => editor/composer/src/res/table-remove-row-active.gif
rename : editor/composer/res/table-remove-row-hover.gif => editor/composer/src/res/table-remove-row-hover.gif
rename : editor/composer/res/table-remove-row.gif => editor/composer/src/res/table-remove-row.gif
rename : editor/composer/res/text_caret.png => editor/composer/src/res/text_caret.png
rename : editor/composer/res/text_caret@1.5x.png => editor/composer/src/res/text_caret@1.5x.png
rename : editor/composer/res/text_caret@2.25x.png => editor/composer/src/res/text_caret@2.25x.png
rename : editor/composer/res/text_caret@2x.png => editor/composer/src/res/text_caret@2x.png
rename : editor/composer/res/text_caret_tilt_left.png => editor/composer/src/res/text_caret_tilt_left.png
rename : editor/composer/res/text_caret_tilt_left@1.5x.png => editor/composer/src/res/text_caret_tilt_left@1.5x.png
rename : editor/composer/res/text_caret_tilt_left@2.25x.png => editor/composer/src/res/text_caret_tilt_left@2.25x.png
rename : editor/composer/res/text_caret_tilt_left@2x.png => editor/composer/src/res/text_caret_tilt_left@2x.png
rename : editor/composer/res/text_caret_tilt_right.png => editor/composer/src/res/text_caret_tilt_right.png
rename : editor/composer/res/text_caret_tilt_right@1.5x.png => editor/composer/src/res/text_caret_tilt_right@1.5x.png
rename : editor/composer/res/text_caret_tilt_right@2.25x.png => editor/composer/src/res/text_caret_tilt_right@2.25x.png
rename : editor/composer/res/text_caret_tilt_right@2x.png => editor/composer/src/res/text_caret_tilt_right@2x.png
rename : editor/composer/res/text_selection_handle.png => editor/composer/src/res/text_selection_handle.png
rename : editor/composer/res/text_selection_handle@1.5.png => editor/composer/src/res/text_selection_handle@1.5.png
rename : editor/composer/res/text_selection_handle@2.png => editor/composer/src/res/text_selection_handle@2.png
rename : editor/nsIContentFilter.idl => editor/idl/nsIContentFilter.idl
rename : editor/nsIDocumentStateListener.idl => editor/idl/nsIDocumentStateListener.idl
rename : editor/nsIEditActionListener.idl => editor/idl/nsIEditActionListener.idl
rename : editor/nsIEditor.idl => editor/idl/nsIEditor.idl
rename : editor/nsIEditorIMESupport.idl => editor/idl/nsIEditorIMESupport.idl
rename : editor/nsIEditorMailSupport.idl => editor/idl/nsIEditorMailSupport.idl
rename : editor/nsIEditorObserver.idl => editor/idl/nsIEditorObserver.idl
rename : editor/nsIEditorSpellCheck.idl => editor/idl/nsIEditorSpellCheck.idl
rename : editor/nsIEditorStyleSheets.idl => editor/idl/nsIEditorStyleSheets.idl
rename : editor/nsIHTMLAbsPosEditor.idl => editor/idl/nsIHTMLAbsPosEditor.idl
rename : editor/nsIHTMLEditor.idl => editor/idl/nsIHTMLEditor.idl
rename : editor/nsIHTMLInlineTableEditor.idl => editor/idl/nsIHTMLInlineTableEditor.idl
rename : editor/nsIHTMLObjectResizeListener.idl => editor/idl/nsIHTMLObjectResizeListener.idl
rename : editor/nsIHTMLObjectResizer.idl => editor/idl/nsIHTMLObjectResizer.idl
rename : editor/nsIPlaintextEditor.idl => editor/idl/nsIPlaintextEditor.idl
rename : editor/nsITableEditor.idl => editor/idl/nsITableEditor.idl
rename : editor/nsIURIRefObject.idl => editor/idl/nsIURIRefObject.idl
rename : editor/nsPIEditorTransaction.idl => editor/idl/nsPIEditorTransaction.idl
rename : editor/libeditor/ChangeAttributeTxn.cpp => editor/libeditor/base/ChangeAttributeTxn.cpp
rename : editor/libeditor/ChangeAttributeTxn.h => editor/libeditor/base/ChangeAttributeTxn.h
rename : editor/libeditor/ChangeCSSInlineStyleTxn.cpp => editor/libeditor/base/ChangeCSSInlineStyleTxn.cpp
rename : editor/libeditor/ChangeCSSInlineStyleTxn.h => editor/libeditor/base/ChangeCSSInlineStyleTxn.h
rename : editor/libeditor/CreateElementTxn.cpp => editor/libeditor/base/CreateElementTxn.cpp
rename : editor/libeditor/CreateElementTxn.h => editor/libeditor/base/CreateElementTxn.h
rename : editor/libeditor/DeleteNodeTxn.cpp => editor/libeditor/base/DeleteNodeTxn.cpp
rename : editor/libeditor/DeleteNodeTxn.h => editor/libeditor/base/DeleteNodeTxn.h
rename : editor/libeditor/DeleteRangeTxn.cpp => editor/libeditor/base/DeleteRangeTxn.cpp
rename : editor/libeditor/DeleteRangeTxn.h => editor/libeditor/base/DeleteRangeTxn.h
rename : editor/libeditor/DeleteTextTxn.cpp => editor/libeditor/base/DeleteTextTxn.cpp
rename : editor/libeditor/DeleteTextTxn.h => editor/libeditor/base/DeleteTextTxn.h
rename : editor/libeditor/EditActionListener.h => editor/libeditor/base/EditActionListener.h
rename : editor/libeditor/EditAggregateTxn.cpp => editor/libeditor/base/EditAggregateTxn.cpp
rename : editor/libeditor/EditAggregateTxn.h => editor/libeditor/base/EditAggregateTxn.h
rename : editor/libeditor/EditTxn.cpp => editor/libeditor/base/EditTxn.cpp
rename : editor/libeditor/EditTxn.h => editor/libeditor/base/EditTxn.h
rename : editor/libeditor/IMETextTxn.cpp => editor/libeditor/base/IMETextTxn.cpp
rename : editor/libeditor/IMETextTxn.h => editor/libeditor/base/IMETextTxn.h
rename : editor/libeditor/InsertElementTxn.cpp => editor/libeditor/base/InsertElementTxn.cpp
rename : editor/libeditor/InsertElementTxn.h => editor/libeditor/base/InsertElementTxn.h
rename : editor/libeditor/InsertTextTxn.cpp => editor/libeditor/base/InsertTextTxn.cpp
rename : editor/libeditor/InsertTextTxn.h => editor/libeditor/base/InsertTextTxn.h
rename : editor/libeditor/JoinElementTxn.cpp => editor/libeditor/base/JoinElementTxn.cpp
rename : editor/libeditor/JoinElementTxn.h => editor/libeditor/base/JoinElementTxn.h
rename : editor/libeditor/PlaceholderTxn.cpp => editor/libeditor/base/PlaceholderTxn.cpp
rename : editor/libeditor/PlaceholderTxn.h => editor/libeditor/base/PlaceholderTxn.h
rename : editor/libeditor/SetDocTitleTxn.cpp => editor/libeditor/base/SetDocTitleTxn.cpp
rename : editor/libeditor/SetDocTitleTxn.h => editor/libeditor/base/SetDocTitleTxn.h
rename : editor/libeditor/SplitElementTxn.cpp => editor/libeditor/base/SplitElementTxn.cpp
rename : editor/libeditor/SplitElementTxn.h => editor/libeditor/base/SplitElementTxn.h
rename : editor/libeditor/crashtests/336104.html => editor/libeditor/base/crashtests/336104.html
rename : editor/libeditor/crashtests/382527-1.html => editor/libeditor/base/crashtests/382527-1.html
rename : editor/libeditor/crashtests/402172-1.html => editor/libeditor/base/crashtests/402172-1.html
rename : editor/libeditor/crashtests/407079-1.html => editor/libeditor/base/crashtests/407079-1.html
rename : editor/libeditor/crashtests/407256-1.html => editor/libeditor/base/crashtests/407256-1.html
rename : editor/libeditor/crashtests/430624-1.html => editor/libeditor/base/crashtests/430624-1.html
rename : editor/libeditor/crashtests/459613-iframe.html => editor/libeditor/base/crashtests/459613-iframe.html
rename : editor/libeditor/crashtests/459613.html => editor/libeditor/base/crashtests/459613.html
rename : editor/libeditor/crashtests/475132-1.xhtml => editor/libeditor/base/crashtests/475132-1.xhtml
rename : editor/libeditor/crashtests/633709.xhtml => editor/libeditor/base/crashtests/633709.xhtml
rename : editor/libeditor/crashtests/636074-1.html => editor/libeditor/base/crashtests/636074-1.html
rename : editor/libeditor/crashtests/713427-1.html => editor/libeditor/base/crashtests/713427-1.html
rename : editor/libeditor/crashtests/713427-2.xhtml => editor/libeditor/base/crashtests/713427-2.xhtml
rename : editor/libeditor/crashtests/762183.html => editor/libeditor/base/crashtests/762183.html
rename : editor/libeditor/crashtests/766360.html => editor/libeditor/base/crashtests/766360.html
rename : editor/libeditor/crashtests/766413.html => editor/libeditor/base/crashtests/766413.html
rename : editor/libeditor/crashtests/766845.xhtml => editor/libeditor/base/crashtests/766845.xhtml
rename : editor/libeditor/crashtests/768765.html => editor/libeditor/base/crashtests/768765.html
rename : editor/libeditor/crashtests/771749.html => editor/libeditor/base/crashtests/771749.html
rename : editor/libeditor/crashtests/772282.html => editor/libeditor/base/crashtests/772282.html
rename : editor/libeditor/crashtests/776323.html => editor/libeditor/base/crashtests/776323.html
rename : editor/libeditor/crashtests/crashtests.list => editor/libeditor/base/crashtests/crashtests.list
rename : editor/libeditor/nsEditProperty.h => editor/libeditor/base/nsEditProperty.h
rename : editor/libeditor/nsEditPropertyAtomList.h => editor/libeditor/base/nsEditPropertyAtomList.h
rename : editor/libeditor/nsEditRules.h => editor/libeditor/base/nsEditRules.h
rename : editor/libeditor/nsEditor.cpp => editor/libeditor/base/nsEditor.cpp
rename : editor/libeditor/nsEditor.h => editor/libeditor/base/nsEditor.h
rename : editor/libeditor/nsEditorCommands.cpp => editor/libeditor/base/nsEditorCommands.cpp
rename : editor/libeditor/nsEditorCommands.h => editor/libeditor/base/nsEditorCommands.h
rename : editor/libeditor/nsEditorController.cpp => editor/libeditor/base/nsEditorController.cpp
rename : editor/libeditor/nsEditorController.h => editor/libeditor/base/nsEditorController.h
rename : editor/libeditor/nsEditorEventListener.cpp => editor/libeditor/base/nsEditorEventListener.cpp
rename : editor/libeditor/nsEditorEventListener.h => editor/libeditor/base/nsEditorEventListener.h
rename : editor/libeditor/nsEditorUtils.cpp => editor/libeditor/base/nsEditorUtils.cpp
rename : editor/libeditor/nsEditorUtils.h => editor/libeditor/base/nsEditorUtils.h
rename : editor/libeditor/nsIAbsorbingTransaction.h => editor/libeditor/base/nsIAbsorbingTransaction.h
rename : editor/libeditor/nsSelectionState.cpp => editor/libeditor/base/nsSelectionState.cpp
rename : editor/libeditor/nsSelectionState.h => editor/libeditor/base/nsSelectionState.h
rename : editor/libeditor/nsStyleSheetTxns.cpp => editor/libeditor/base/nsStyleSheetTxns.cpp
rename : editor/libeditor/nsStyleSheetTxns.h => editor/libeditor/base/nsStyleSheetTxns.h
rename : editor/libeditor/tests/chrome.ini => editor/libeditor/base/tests/chrome.ini
rename : editor/libeditor/tests/file_bug586662.html => editor/libeditor/base/tests/file_bug586662.html
rename : editor/libeditor/tests/mochitest.ini => editor/libeditor/base/tests/mochitest.ini
rename : editor/libeditor/tests/moz.build => editor/libeditor/base/tests/moz.build
rename : editor/libeditor/tests/test_bug408231.html => editor/libeditor/base/tests/test_bug408231.html
rename : editor/libeditor/tests/test_bug46555.html => editor/libeditor/base/tests/test_bug46555.html
rename : editor/libeditor/tests/test_bug502673.html => editor/libeditor/base/tests/test_bug502673.html
rename : editor/libeditor/tests/test_bug514156.html => editor/libeditor/base/tests/test_bug514156.html
rename : editor/libeditor/tests/test_bug567213.html => editor/libeditor/base/tests/test_bug567213.html
rename : editor/libeditor/tests/test_bug586662.html => editor/libeditor/base/tests/test_bug586662.html
rename : editor/libeditor/tests/test_bug599983.html => editor/libeditor/base/tests/test_bug599983.html
rename : editor/libeditor/tests/test_bug599983.xul => editor/libeditor/base/tests/test_bug599983.xul
rename : editor/libeditor/tests/test_bug646194.xul => editor/libeditor/base/tests/test_bug646194.xul
rename : editor/libeditor/tests/test_bug742261.html => editor/libeditor/base/tests/test_bug742261.html
rename : editor/libeditor/tests/test_bug773262.html => editor/libeditor/base/tests/test_bug773262.html
rename : editor/libeditor/tests/test_bug795785.html => editor/libeditor/base/tests/test_bug795785.html
rename : editor/libeditor/tests/test_dragdrop.html => editor/libeditor/base/tests/test_dragdrop.html
rename : editor/libeditor/tests/test_selection_move_commands.xul => editor/libeditor/base/tests/test_selection_move_commands.xul
rename : editor/nsEditorCID.h => editor/public/nsEditorCID.h
rename : editor/txmgr/nsITransaction.idl => editor/txmgr/idl/nsITransaction.idl
rename : editor/txmgr/nsITransactionList.idl => editor/txmgr/idl/nsITransactionList.idl
rename : editor/txmgr/nsITransactionListener.idl => editor/txmgr/idl/nsITransactionListener.idl
rename : editor/txmgr/nsITransactionManager.idl => editor/txmgr/idl/nsITransactionManager.idl
rename : editor/txmgr/nsTransactionManagerCID.h => editor/txmgr/public/nsTransactionManagerCID.h
rename : editor/txmgr/nsTransactionItem.cpp => editor/txmgr/src/nsTransactionItem.cpp
rename : editor/txmgr/nsTransactionItem.h => editor/txmgr/src/nsTransactionItem.h
rename : editor/txmgr/nsTransactionList.cpp => editor/txmgr/src/nsTransactionList.cpp
rename : editor/txmgr/nsTransactionList.h => editor/txmgr/src/nsTransactionList.h
rename : editor/txmgr/nsTransactionManager.cpp => editor/txmgr/src/nsTransactionManager.cpp
rename : editor/txmgr/nsTransactionManager.h => editor/txmgr/src/nsTransactionManager.h
rename : editor/txmgr/nsTransactionManagerFactory.cpp => editor/txmgr/src/nsTransactionManagerFactory.cpp
rename : editor/txmgr/nsTransactionStack.cpp => editor/txmgr/src/nsTransactionStack.cpp
rename : editor/txmgr/nsTransactionStack.h => editor/txmgr/src/nsTransactionStack.h
rename : editor/txtsvc/nsIInlineSpellChecker.idl => editor/txtsvc/public/nsIInlineSpellChecker.idl
rename : editor/txtsvc/nsISpellChecker.h => editor/txtsvc/public/nsISpellChecker.h
rename : editor/txtsvc/nsITextService.h => editor/txtsvc/public/nsITextService.h
rename : editor/txtsvc/nsITextServicesDocument.h => editor/txtsvc/public/nsITextServicesDocument.h
rename : editor/txtsvc/nsITextServicesFilter.idl => editor/txtsvc/public/nsITextServicesFilter.idl
rename : editor/txtsvc/nsTextServicesCID.h => editor/txtsvc/public/nsTextServicesCID.h
rename : editor/txtsvc/nsFilteredContentIterator.cpp => editor/txtsvc/src/nsFilteredContentIterator.cpp
rename : editor/txtsvc/nsFilteredContentIterator.h => editor/txtsvc/src/nsFilteredContentIterator.h
rename : editor/txtsvc/nsTSAtomList.h => editor/txtsvc/src/nsTSAtomList.h
rename : editor/txtsvc/nsTextServicesDocument.cpp => editor/txtsvc/src/nsTextServicesDocument.cpp
rename : editor/txtsvc/nsTextServicesDocument.h => editor/txtsvc/src/nsTextServicesDocument.h
rename : editor/txtsvc/nsTextServicesFactory.cpp => editor/txtsvc/src/nsTextServicesFactory.cpp
rename : xpcom/string/nsAString.h => xpcom/string/public/nsAString.h
rename : xpcom/string/nsAlgorithm.h => xpcom/string/public/nsAlgorithm.h
rename : xpcom/string/nsCharTraits.h => xpcom/string/public/nsCharTraits.h
rename : xpcom/string/nsDependentString.h => xpcom/string/public/nsDependentString.h
rename : xpcom/string/nsDependentSubstring.h => xpcom/string/public/nsDependentSubstring.h
rename : xpcom/string/nsEmbedString.h => xpcom/string/public/nsEmbedString.h
rename : xpcom/string/nsLiteralString.h => xpcom/string/public/nsLiteralString.h
rename : xpcom/string/nsPrintfCString.h => xpcom/string/public/nsPrintfCString.h
rename : xpcom/string/nsPromiseFlatString.h => xpcom/string/public/nsPromiseFlatString.h
rename : xpcom/string/nsReadableUtils.h => xpcom/string/public/nsReadableUtils.h
rename : xpcom/string/nsString.h => xpcom/string/public/nsString.h
rename : xpcom/string/nsStringBuffer.h => xpcom/string/public/nsStringBuffer.h
rename : xpcom/string/nsStringFwd.h => xpcom/string/public/nsStringFwd.h
rename : xpcom/string/nsStringIterator.h => xpcom/string/public/nsStringIterator.h
rename : xpcom/string/nsSubstring.h => xpcom/string/public/nsSubstring.h
rename : xpcom/string/nsSubstringTuple.h => xpcom/string/public/nsSubstringTuple.h
rename : xpcom/string/nsTDependentString.h => xpcom/string/public/nsTDependentString.h
rename : xpcom/string/nsTDependentSubstring.h => xpcom/string/public/nsTDependentSubstring.h
rename : xpcom/string/nsTLiteralString.h => xpcom/string/public/nsTLiteralString.h
rename : xpcom/string/nsTPromiseFlatString.h => xpcom/string/public/nsTPromiseFlatString.h
rename : xpcom/string/nsTString.h => xpcom/string/public/nsTString.h
rename : xpcom/string/nsTSubstring.h => xpcom/string/public/nsTSubstring.h
rename : xpcom/string/nsTSubstringTuple.h => xpcom/string/public/nsTSubstringTuple.h
rename : xpcom/string/nsUTF8Utils.h => xpcom/string/public/nsUTF8Utils.h
rename : xpcom/string/nsXPCOMStrings.h => xpcom/string/public/nsXPCOMStrings.h
rename : xpcom/string/nsXPIDLString.h => xpcom/string/public/nsXPIDLString.h
rename : xpcom/string/string-template-def-char.h => xpcom/string/public/string-template-def-char.h
rename : xpcom/string/string-template-def-unichar.h => xpcom/string/public/string-template-def-unichar.h
rename : xpcom/string/string-template-undef.h => xpcom/string/public/string-template-undef.h
rename : xpcom/string/nsDependentString.cpp => xpcom/string/src/nsDependentString.cpp
rename : xpcom/string/nsDependentSubstring.cpp => xpcom/string/src/nsDependentSubstring.cpp
rename : xpcom/string/nsPromiseFlatString.cpp => xpcom/string/src/nsPromiseFlatString.cpp
rename : xpcom/string/nsReadableUtils.cpp => xpcom/string/src/nsReadableUtils.cpp
rename : xpcom/string/nsString.cpp => xpcom/string/src/nsString.cpp
rename : xpcom/string/nsStringComparator.cpp => xpcom/string/src/nsStringComparator.cpp
rename : xpcom/string/nsStringObsolete.cpp => xpcom/string/src/nsStringObsolete.cpp
rename : xpcom/string/nsSubstring.cpp => xpcom/string/src/nsSubstring.cpp
rename : xpcom/string/nsSubstringTuple.cpp => xpcom/string/src/nsSubstringTuple.cpp
rename : xpcom/string/nsTDependentString.cpp => xpcom/string/src/nsTDependentString.cpp
rename : xpcom/string/nsTDependentSubstring.cpp => xpcom/string/src/nsTDependentSubstring.cpp
rename : xpcom/string/nsTPromiseFlatString.cpp => xpcom/string/src/nsTPromiseFlatString.cpp
rename : xpcom/string/nsTString.cpp => xpcom/string/src/nsTString.cpp
rename : xpcom/string/nsTStringComparator.cpp => xpcom/string/src/nsTStringComparator.cpp
rename : xpcom/string/nsTStringObsolete.cpp => xpcom/string/src/nsTStringObsolete.cpp
rename : xpcom/string/nsTSubstring.cpp => xpcom/string/src/nsTSubstring.cpp
rename : xpcom/string/nsTSubstringTuple.cpp => xpcom/string/src/nsTSubstringTuple.cpp
rename : xpcom/string/nsUTF8UtilsSSE2.cpp => xpcom/string/src/nsUTF8UtilsSSE2.cpp
2014-06-24 18:32:55 -07:00

906 lines
35 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef __editor_h__
#define __editor_h__
#include "mozilla/Assertions.h" // for MOZ_ASSERT, etc.
#include "mozilla/TypedEnum.h" // for MOZ_BEGIN_ENUM_CLASS, etc.
#include "mozilla/dom/Text.h"
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMArray.h" // for nsCOMArray
#include "nsCOMPtr.h" // for already_AddRefed, nsCOMPtr
#include "nsCycleCollectionParticipant.h"
#include "nsEditProperty.h" // for nsEditProperty, etc
#include "nsIEditor.h" // for nsIEditor::EDirection, etc
#include "nsIEditorIMESupport.h" // for NS_DECL_NSIEDITORIMESUPPORT, etc
#include "nsIObserver.h" // for NS_DECL_NSIOBSERVER, etc
#include "nsIPhonetic.h" // for NS_DECL_NSIPHONETIC, etc
#include "nsIPlaintextEditor.h" // for nsIPlaintextEditor, etc
#include "nsISupportsImpl.h" // for nsEditor::Release, etc
#include "nsIWeakReferenceUtils.h" // for nsWeakPtr
#include "nsLiteralString.h" // for NS_LITERAL_STRING
#include "nsSelectionState.h" // for nsRangeUpdater, etc
#include "nsString.h" // for nsCString
#include "nsWeakReference.h" // for nsSupportsWeakReference
#include "nscore.h" // for nsresult, nsAString, etc
class AddStyleSheetTxn;
class ChangeAttributeTxn;
class CreateElementTxn;
class DeleteNodeTxn;
class DeleteTextTxn;
class EditAggregateTxn;
class IMETextTxn;
class InsertElementTxn;
class InsertTextTxn;
class JoinElementTxn;
class RemoveStyleSheetTxn;
class SplitElementTxn;
class nsIAtom;
class nsIContent;
class nsIDOMCharacterData;
class nsIDOMDataTransfer;
class nsIDOMDocument;
class nsIDOMElement;
class nsIDOMEvent;
class nsIDOMEventListener;
class nsIDOMEventTarget;
class nsIDOMKeyEvent;
class nsIDOMNode;
class nsIDOMRange;
class nsIDocument;
class nsIDocumentStateListener;
class nsIEditActionListener;
class nsIEditorObserver;
class nsIInlineSpellChecker;
class nsINode;
class nsIPresShell;
class nsISelection;
class nsISupports;
class nsITransaction;
class nsIWidget;
class nsRange;
class nsString;
class nsTransactionManager;
namespace mozilla {
class CSSStyleSheet;
class ErrorResult;
class TextComposition;
namespace dom {
class DataTransfer;
class Element;
class EventTarget;
class Selection;
class Text;
} // namespace dom
} // namespace mozilla
namespace mozilla {
namespace widget {
struct IMEState;
} // namespace widget
} // namespace mozilla
#define kMOZEditorBogusNodeAttrAtom nsEditProperty::mozEditorBogusNode
#define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
// This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
// spellCheckAfterEditorChange is defined to take it as a long.
MOZ_BEGIN_ENUM_CLASS(EditAction, int32_t)
ignore = -1,
none = 0,
undo,
redo,
insertNode,
createNode,
deleteNode,
splitNode,
joinNode,
deleteText = 1003,
// text commands
insertText = 2000,
insertIMEText = 2001,
deleteSelection = 2002,
setTextProperty = 2003,
removeTextProperty = 2004,
outputText = 2005,
// html only action
insertBreak = 3000,
makeList = 3001,
indent = 3002,
outdent = 3003,
align = 3004,
makeBasicBlock = 3005,
removeList = 3006,
makeDefListItem = 3007,
insertElement = 3008,
insertQuotation = 3009,
htmlPaste = 3012,
loadHTML = 3013,
resetTextProperties = 3014,
setAbsolutePosition = 3015,
removeAbsolutePosition = 3016,
decreaseZIndex = 3017,
increaseZIndex = 3018
MOZ_END_ENUM_CLASS(EditAction)
inline bool operator!(const EditAction& aOp)
{
return aOp == EditAction::none;
}
/** implementation of an editor object. it will be the controller/focal point
* for the main editor services. i.e. the GUIManager, publishing, transaction
* manager, event interfaces. the idea for the event interfaces is to have them
* delegate the actual commands to the editor independent of the XPFE implementation.
*/
class nsEditor : public nsIEditor,
public nsIEditorIMESupport,
public nsSupportsWeakReference,
public nsIObserver,
public nsIPhonetic
{
public:
enum IterDirection
{
kIterForward,
kIterBackward
};
/** The default constructor. This should suffice. the setting of the interfaces is done
* after the construction of the editor class.
*/
nsEditor();
protected:
/** The default destructor. This should suffice. Should this be pure virtual
* for someone to derive from the nsEditor later? I don't believe so.
*/
virtual ~nsEditor();
public:
//Interfaces for addref and release and queryinterface
//NOTE: Use NS_DECL_ISUPPORTS_INHERITED in any class inherited from nsEditor
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsEditor,
nsIEditor)
/* ------------ utility methods -------------- */
already_AddRefed<nsIDOMDocument> GetDOMDocument();
already_AddRefed<nsIDocument> GetDocument();
already_AddRefed<nsIPresShell> GetPresShell();
already_AddRefed<nsIWidget> GetWidget();
void NotifyEditorObservers();
/* ------------ nsIEditor methods -------------- */
NS_DECL_NSIEDITOR
/* ------------ nsIEditorIMESupport methods -------------- */
NS_DECL_NSIEDITORIMESUPPORT
/* ------------ nsIObserver methods -------------- */
NS_DECL_NSIOBSERVER
// nsIPhonetic
NS_DECL_NSIPHONETIC
public:
nsresult MarkNodeDirty(nsINode* aNode);
virtual bool IsModifiableNode(nsINode *aNode);
NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert,
nsCOMPtr<nsIDOMNode> *aInOutNode,
int32_t *aInOutOffset,
nsIDOMDocument *aDoc);
nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert,
nsINode* aTextNode,
int32_t aOffset,
bool aSuppressIME = false);
nsresult InsertTextIntoTextNodeImpl(const nsAString& aStringToInsert,
nsIDOMCharacterData *aTextNode,
int32_t aOffset,
bool aSuppressIME = false);
NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
EStripWrappers aStripWrappers);
NS_IMETHOD DeleteSelectionAndCreateNode(const nsAString& aTag,
nsIDOMNode ** aNewNode);
/* helper routines for node/parent manipulations */
nsresult DeleteNode(nsINode* aNode);
nsresult InsertNode(nsIContent* aContent, nsINode* aParent,
int32_t aPosition);
nsresult ReplaceContainer(nsINode* inNode,
mozilla::dom::Element** outNode,
const nsAString& aNodeType,
const nsAString* aAttribute = nullptr,
const nsAString* aValue = nullptr,
bool aCloneAttributes = false);
nsresult ReplaceContainer(nsIDOMNode *inNode,
nsCOMPtr<nsIDOMNode> *outNode,
const nsAString &aNodeType,
const nsAString *aAttribute = nullptr,
const nsAString *aValue = nullptr,
bool aCloneAttributes = false);
nsresult RemoveContainer(nsINode* aNode);
nsresult RemoveContainer(nsIDOMNode *inNode);
nsresult InsertContainerAbove(nsIContent* aNode,
mozilla::dom::Element** aOutNode,
const nsAString& aNodeType,
const nsAString* aAttribute = nullptr,
const nsAString* aValue = nullptr);
nsresult InsertContainerAbove(nsIDOMNode *inNode,
nsCOMPtr<nsIDOMNode> *outNode,
const nsAString &aNodeType,
const nsAString *aAttribute = nullptr,
const nsAString *aValue = nullptr);
nsresult JoinNodes(nsINode* aNodeToKeep, nsIContent* aNodeToMove);
nsresult MoveNode(nsINode* aNode, nsINode* aParent, int32_t aOffset);
nsresult MoveNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aOffset);
/* Method to replace certain CreateElementNS() calls.
Arguments:
nsString& aTag - tag you want
*/
already_AddRefed<mozilla::dom::Element>
CreateHTMLContent(const nsAString& aTag, mozilla::ErrorResult& rv);
// IME event handlers
virtual nsresult BeginIMEComposition(mozilla::WidgetCompositionEvent* aEvent);
virtual nsresult UpdateIMEComposition(nsIDOMEvent* aDOMTextEvent) = 0;
void EndIMEComposition();
void SwitchTextDirectionTo(uint32_t aDirection);
protected:
nsresult DetermineCurrentDirection();
void FireInputEvent();
/** create a transaction for setting aAttribute to aValue on aElement
*/
NS_IMETHOD CreateTxnForSetAttribute(nsIDOMElement *aElement,
const nsAString & aAttribute,
const nsAString & aValue,
ChangeAttributeTxn ** aTxn);
/** create a transaction for removing aAttribute on aElement
*/
NS_IMETHOD CreateTxnForRemoveAttribute(nsIDOMElement *aElement,
const nsAString & aAttribute,
ChangeAttributeTxn ** aTxn);
/** create a transaction for creating a new child node of aParent of type aTag.
*/
NS_IMETHOD CreateTxnForCreateElement(const nsAString & aTag,
nsIDOMNode *aParent,
int32_t aPosition,
CreateElementTxn ** aTxn);
/** create a transaction for inserting aNode as a child of aParent.
*/
NS_IMETHOD CreateTxnForInsertElement(nsIDOMNode * aNode,
nsIDOMNode * aParent,
int32_t aOffset,
InsertElementTxn ** aTxn);
/** create a transaction for removing aNode from its parent.
*/
nsresult CreateTxnForDeleteNode(nsINode* aNode, DeleteNodeTxn** aTxn);
nsresult CreateTxnForDeleteSelection(EDirection aAction,
EditAggregateTxn** aTxn,
nsINode** aNode,
int32_t* aOffset,
int32_t* aLength);
nsresult CreateTxnForDeleteInsertionPoint(nsRange* aRange,
EDirection aAction,
EditAggregateTxn* aTxn,
nsINode** aNode,
int32_t* aOffset,
int32_t* aLength);
/** create a transaction for inserting aStringToInsert into aTextNode
* if aTextNode is null, the string is inserted at the current selection.
*/
NS_IMETHOD CreateTxnForInsertText(const nsAString & aStringToInsert,
nsIDOMCharacterData *aTextNode,
int32_t aOffset,
InsertTextTxn ** aTxn);
NS_IMETHOD CreateTxnForIMEText(const nsAString & aStringToInsert,
IMETextTxn ** aTxn);
/** create a transaction for adding a style sheet
*/
NS_IMETHOD CreateTxnForAddStyleSheet(mozilla::CSSStyleSheet* aSheet,
AddStyleSheetTxn* *aTxn);
/** create a transaction for removing a style sheet
*/
NS_IMETHOD CreateTxnForRemoveStyleSheet(mozilla::CSSStyleSheet* aSheet,
RemoveStyleSheetTxn* *aTxn);
NS_IMETHOD DeleteText(nsIDOMCharacterData *aElement,
uint32_t aOffset,
uint32_t aLength);
inline nsresult DeleteText(mozilla::dom::Text* aText, uint32_t aOffset,
uint32_t aLength)
{
return DeleteText(static_cast<nsIDOMCharacterData*>(GetAsDOMNode(aText)),
aOffset, aLength);
}
// NS_IMETHOD DeleteRange(nsIDOMRange *aRange);
nsresult CreateTxnForDeleteText(nsIDOMCharacterData* aElement,
uint32_t aOffset,
uint32_t aLength,
DeleteTextTxn** aTxn);
nsresult CreateTxnForDeleteCharacter(nsIDOMCharacterData* aData,
uint32_t aOffset,
EDirection aDirection,
DeleteTextTxn** aTxn);
NS_IMETHOD CreateTxnForSplitNode(nsIDOMNode *aNode,
uint32_t aOffset,
SplitElementTxn **aTxn);
NS_IMETHOD CreateTxnForJoinNode(nsIDOMNode *aLeftNode,
nsIDOMNode *aRightNode,
JoinElementTxn **aTxn);
/**
* This method first deletes the selection, if it's not collapsed. Then if
* the selection lies in a CharacterData node, it splits it. If the
* selection is at this point collapsed in a CharacterData node, it's
* adjusted to be collapsed right before or after the node instead (which is
* always possible, since the node was split).
*/
nsresult DeleteSelectionAndPrepareToCreateNode();
// called after a transaction is done successfully
void DoAfterDoTransaction(nsITransaction *aTxn);
// called after a transaction is undone successfully
void DoAfterUndoTransaction();
// called after a transaction is redone successfully
void DoAfterRedoTransaction();
typedef enum {
eDocumentCreated,
eDocumentToBeDestroyed,
eDocumentStateChanged
} TDocumentListenerNotification;
// tell the doc state listeners that the doc state has changed
NS_IMETHOD NotifyDocumentListeners(TDocumentListenerNotification aNotificationType);
/** make the given selection span the entire document */
NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
/** helper method for scrolling the selection into view after
* an edit operation. aScrollToAnchor should be true if you
* want to scroll to the point where the selection was started.
* If false, it attempts to scroll the end of the selection into view.
*
* Editor methods *should* call this method instead of the versions
* in the various selection interfaces, since this version makes sure
* that the editor's sync/async settings for reflowing, painting, and
* scrolling match.
*/
NS_IMETHOD ScrollSelectionIntoView(bool aScrollToAnchor);
// Convenience method; forwards to IsBlockNode(nsINode*).
bool IsBlockNode(nsIDOMNode* aNode);
// stub. see comment in source.
virtual bool IsBlockNode(nsINode* aNode);
// helper for GetPriorNode and GetNextNode
nsIContent* FindNextLeafNode(nsINode *aCurrentNode,
bool aGoForward,
bool bNoBlockCrossing);
// install the event listeners for the editor
virtual nsresult InstallEventListeners();
virtual void CreateEventListeners();
// unregister and release our event listeners
virtual void RemoveEventListeners();
/**
* Return true if spellchecking should be enabled for this editor.
*/
bool GetDesiredSpellCheckState();
bool CanEnableSpellCheck()
{
// Check for password/readonly/disabled, which are not spellchecked
// regardless of DOM. Also, check to see if spell check should be skipped or not.
return !IsPasswordEditor() && !IsReadonly() && !IsDisabled() && !ShouldSkipSpellCheck();
}
/**
* EnsureComposition() should be composition event handlers or text event
* handler. This tries to get the composition for the event and set it to
* mComposition.
*/
void EnsureComposition(mozilla::WidgetGUIEvent* aEvent);
public:
/** All editor operations which alter the doc should be prefaced
* with a call to StartOperation, naming the action and direction */
NS_IMETHOD StartOperation(EditAction opID,
nsIEditor::EDirection aDirection);
/** All editor operations which alter the doc should be followed
* with a call to EndOperation */
NS_IMETHOD EndOperation();
/** routines for managing the preservation of selection across
* various editor actions */
bool ArePreservingSelection();
void PreserveSelectionAcrossActions(mozilla::dom::Selection* aSel);
nsresult RestorePreservedSelection(nsISelection *aSel);
void StopPreservingSelection();
/**
* SplitNode() creates a new node identical to an existing node, and split the contents between the two nodes
* @param aExistingRightNode the node to split. It will become the new node's next sibling.
* @param aOffset the offset of aExistingRightNode's content|children to do the split at
* @param aNewLeftNode [OUT] the new node resulting from the split, becomes aExistingRightNode's previous sibling.
* @param aParent the parent of aExistingRightNode
*/
nsresult SplitNodeImpl(nsIDOMNode *aExistingRightNode,
int32_t aOffset,
nsIDOMNode *aNewLeftNode,
nsIDOMNode *aParent);
/**
* JoinNodes() takes 2 nodes and merge their content|children.
* @param aNodeToKeep The node that will remain after the join.
* @param aNodeToJoin The node that will be joined with aNodeToKeep.
* There is no requirement that the two nodes be of the same type.
* @param aParent The parent of aNodeToKeep
*/
nsresult JoinNodesImpl(nsINode* aNodeToKeep,
nsINode* aNodeToJoin,
nsINode* aParent);
/**
* Return the offset of aChild in aParent. Asserts fatally if parent or
* child is null, or parent is not child's parent.
*/
static int32_t GetChildOffset(nsIDOMNode *aChild,
nsIDOMNode *aParent);
/**
* Set outOffset to the offset of aChild in the parent.
* Returns the parent of aChild.
*/
static already_AddRefed<nsIDOMNode> GetNodeLocation(nsIDOMNode* aChild,
int32_t* outOffset);
static nsINode* GetNodeLocation(nsINode* aChild, int32_t* aOffset);
/** returns the number of things inside aNode in the out-param aCount.
* @param aNode is the node to get the length of.
* If aNode is text, returns number of characters.
* If not, returns number of children nodes.
* @param aCount [OUT] the result of the above calculation.
*/
static nsresult GetLengthOfDOMNode(nsIDOMNode *aNode, uint32_t &aCount);
/** get the node immediately prior to aCurrentNode
* @param aCurrentNode the node from which we start the search
* @param aEditableNode if true, only return an editable node
* @param aResultNode [OUT] the node that occurs before aCurrentNode in the tree,
* skipping non-editable nodes if aEditableNode is true.
* If there is no prior node, aResultNode will be nullptr.
* @param bNoBlockCrossing If true, don't move across "block" nodes, whatever that means.
*/
nsresult GetPriorNode(nsIDOMNode *aCurrentNode,
bool aEditableNode,
nsCOMPtr<nsIDOMNode> *aResultNode,
bool bNoBlockCrossing = false);
nsIContent* GetPriorNode(nsINode* aCurrentNode, bool aEditableNode,
bool aNoBlockCrossing = false);
// and another version that takes a {parent,offset} pair rather than a node
nsresult GetPriorNode(nsIDOMNode *aParentNode,
int32_t aOffset,
bool aEditableNode,
nsCOMPtr<nsIDOMNode> *aResultNode,
bool bNoBlockCrossing = false);
nsIContent* GetPriorNode(nsINode* aParentNode,
int32_t aOffset,
bool aEditableNode,
bool aNoBlockCrossing = false);
/** get the node immediately after to aCurrentNode
* @param aCurrentNode the node from which we start the search
* @param aEditableNode if true, only return an editable node
* @param aResultNode [OUT] the node that occurs after aCurrentNode in the tree,
* skipping non-editable nodes if aEditableNode is true.
* If there is no prior node, aResultNode will be nullptr.
*/
nsresult GetNextNode(nsIDOMNode *aCurrentNode,
bool aEditableNode,
nsCOMPtr<nsIDOMNode> *aResultNode,
bool bNoBlockCrossing = false);
nsIContent* GetNextNode(nsINode* aCurrentNode,
bool aEditableNode,
bool bNoBlockCrossing = false);
// and another version that takes a {parent,offset} pair rather than a node
nsresult GetNextNode(nsIDOMNode *aParentNode,
int32_t aOffset,
bool aEditableNode,
nsCOMPtr<nsIDOMNode> *aResultNode,
bool bNoBlockCrossing = false);
nsIContent* GetNextNode(nsINode* aParentNode,
int32_t aOffset,
bool aEditableNode,
bool aNoBlockCrossing = false);
// Helper for GetNextNode and GetPriorNode
nsIContent* FindNode(nsINode *aCurrentNode,
bool aGoForward,
bool aEditableNode,
bool bNoBlockCrossing);
/**
* Get the rightmost child of aCurrentNode;
* return nullptr if aCurrentNode has no children.
*/
nsIDOMNode* GetRightmostChild(nsIDOMNode* aCurrentNode,
bool bNoBlockCrossing = false);
nsIContent* GetRightmostChild(nsINode *aCurrentNode,
bool bNoBlockCrossing = false);
/**
* Get the leftmost child of aCurrentNode;
* return nullptr if aCurrentNode has no children.
*/
nsIDOMNode* GetLeftmostChild(nsIDOMNode* aCurrentNode,
bool bNoBlockCrossing = false);
nsIContent* GetLeftmostChild(nsINode *aCurrentNode,
bool bNoBlockCrossing = false);
/** returns true if aNode is of the type implied by aTag */
static inline bool NodeIsType(nsIDOMNode *aNode, nsIAtom *aTag)
{
return GetTag(aNode) == aTag;
}
/** returns true if aParent can contain a child of type aTag */
bool CanContain(nsIDOMNode* aParent, nsIDOMNode* aChild);
bool CanContainTag(nsIDOMNode* aParent, nsIAtom* aTag);
bool TagCanContain(nsIAtom* aParentTag, nsIDOMNode* aChild);
virtual bool TagCanContainTag(nsIAtom* aParentTag, nsIAtom* aChildTag);
/** returns true if aNode is our root node */
bool IsRoot(nsIDOMNode* inNode);
bool IsRoot(nsINode* inNode);
bool IsEditorRoot(nsINode* aNode);
/** returns true if aNode is a descendant of our root node */
bool IsDescendantOfRoot(nsIDOMNode* inNode);
bool IsDescendantOfRoot(nsINode* inNode);
bool IsDescendantOfEditorRoot(nsIDOMNode* aNode);
bool IsDescendantOfEditorRoot(nsINode* aNode);
/** returns true if aNode is a container */
virtual bool IsContainer(nsINode* aNode);
virtual bool IsContainer(nsIDOMNode* aNode);
/** returns true if aNode is an editable node */
bool IsEditable(nsIDOMNode *aNode);
virtual bool IsEditable(nsINode* aNode);
/** returns true if aNode is a MozEditorBogus node */
bool IsMozEditorBogusNode(nsINode* aNode);
/** counts number of editable child nodes */
uint32_t CountEditableChildren(nsINode* aNode);
/** Find the deep first and last children. */
nsINode* GetFirstEditableNode(nsINode* aRoot);
/**
* Returns current composition.
*/
mozilla::TextComposition* GetComposition() const;
/**
* Returns true if there is composition string and not fixed.
*/
bool IsIMEComposing() const;
/** from html rules code - migration in progress */
static nsresult GetTagString(nsIDOMNode *aNode, nsAString& outString);
static nsIAtom *GetTag(nsIDOMNode *aNode);
bool NodesSameType(nsIDOMNode *aNode1, nsIDOMNode *aNode2);
virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2);
static bool IsTextNode(nsIDOMNode *aNode);
static bool IsTextNode(nsINode *aNode);
static nsCOMPtr<nsIDOMNode> GetChildAt(nsIDOMNode *aParent, int32_t aOffset);
static nsCOMPtr<nsIDOMNode> GetNodeAtRangeOffsetPoint(nsIDOMNode* aParentOrNode, int32_t aOffset);
static nsresult GetStartNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outStartNode, int32_t *outStartOffset);
static nsresult GetStartNodeAndOffset(mozilla::dom::Selection* aSelection,
nsINode** aStartNode,
int32_t* aStartOffset);
static nsresult GetEndNodeAndOffset(nsISelection *aSelection, nsIDOMNode **outEndNode, int32_t *outEndOffset);
static nsresult GetEndNodeAndOffset(mozilla::dom::Selection* aSelection,
nsINode** aEndNode,
int32_t* aEndOffset);
#if DEBUG_JOE
static void DumpNode(nsIDOMNode *aNode, int32_t indent=0);
#endif
mozilla::dom::Selection* GetSelection();
// Helpers to add a node to the selection.
// Used by table cell selection methods
nsresult CreateRange(nsIDOMNode *aStartParent, int32_t aStartOffset,
nsIDOMNode *aEndParent, int32_t aEndOffset,
nsIDOMRange **aRange);
// Creates a range with just the supplied node and appends that to the selection
nsresult AppendNodeToSelectionAsRange(nsIDOMNode *aNode);
// When you are using AppendNodeToSelectionAsRange, call this first to start a new selection
nsresult ClearSelection();
nsresult IsPreformatted(nsIDOMNode *aNode, bool *aResult);
nsresult SplitNodeDeep(nsIDOMNode *aNode,
nsIDOMNode *aSplitPointParent,
int32_t aSplitPointOffset,
int32_t *outOffset,
bool aNoEmptyContainers = false,
nsCOMPtr<nsIDOMNode> *outLeftNode = 0,
nsCOMPtr<nsIDOMNode> *outRightNode = 0);
nsresult JoinNodeDeep(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsCOMPtr<nsIDOMNode> *aOutJoinNode, int32_t *outOffset);
nsresult GetString(const nsAString& name, nsAString& value);
void BeginUpdateViewBatch(void);
virtual nsresult EndUpdateViewBatch(void);
bool GetShouldTxnSetSelection();
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
nsresult HandleInlineSpellCheck(EditAction action,
nsISelection *aSelection,
nsIDOMNode *previousSelectedNode,
int32_t previousSelectedOffset,
nsIDOMNode *aStartNode,
int32_t aStartOffset,
nsIDOMNode *aEndNode,
int32_t aEndOffset);
virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget() = 0;
// Fast non-refcounting editor root element accessor
mozilla::dom::Element *GetRoot();
// Likewise, but gets the editor's root instead, which is different for HTML
// editors
virtual mozilla::dom::Element* GetEditorRoot();
// Likewise, but gets the text control element instead of the root for
// plaintext editors
mozilla::dom::Element* GetExposedRoot();
// Accessor methods to flags
bool IsPlaintextEditor() const
{
return (mFlags & nsIPlaintextEditor::eEditorPlaintextMask) != 0;
}
bool IsSingleLineEditor() const
{
return (mFlags & nsIPlaintextEditor::eEditorSingleLineMask) != 0;
}
bool IsPasswordEditor() const
{
return (mFlags & nsIPlaintextEditor::eEditorPasswordMask) != 0;
}
bool IsReadonly() const
{
return (mFlags & nsIPlaintextEditor::eEditorReadonlyMask) != 0;
}
bool IsDisabled() const
{
return (mFlags & nsIPlaintextEditor::eEditorDisabledMask) != 0;
}
bool IsInputFiltered() const
{
return (mFlags & nsIPlaintextEditor::eEditorFilterInputMask) != 0;
}
bool IsMailEditor() const
{
return (mFlags & nsIPlaintextEditor::eEditorMailMask) != 0;
}
bool IsWrapHackEnabled() const
{
return (mFlags & nsIPlaintextEditor::eEditorEnableWrapHackMask) != 0;
}
bool IsFormWidget() const
{
return (mFlags & nsIPlaintextEditor::eEditorWidgetMask) != 0;
}
bool NoCSS() const
{
return (mFlags & nsIPlaintextEditor::eEditorNoCSSMask) != 0;
}
bool IsInteractionAllowed() const
{
return (mFlags & nsIPlaintextEditor::eEditorAllowInteraction) != 0;
}
bool DontEchoPassword() const
{
return (mFlags & nsIPlaintextEditor::eEditorDontEchoPassword) != 0;
}
bool ShouldSkipSpellCheck() const
{
return (mFlags & nsIPlaintextEditor::eEditorSkipSpellCheck) != 0;
}
bool IsTabbable() const
{
return IsSingleLineEditor() || IsPasswordEditor() || IsFormWidget() ||
IsInteractionAllowed();
}
bool HasIndependentSelection() const
{
return !!mSelConWeak;
}
// Get the input event target. This might return null.
virtual already_AddRefed<nsIContent> GetInputEventTargetContent() = 0;
// Get the focused content, if we're focused. Returns null otherwise.
virtual already_AddRefed<nsIContent> GetFocusedContent();
// Get the focused content for the argument of some IMEStateManager's
// methods.
virtual already_AddRefed<nsIContent> GetFocusedContentForIME();
// Whether the editor is active on the DOM window. Note that when this
// returns true but GetFocusedContent() returns null, it means that this editor was
// focused when the DOM window was active.
virtual bool IsActiveInDOMWindow();
// Whether the aEvent should be handled by this editor or not. When this
// returns FALSE, The aEvent shouldn't be handled on this editor,
// i.e., The aEvent should be handled by another inner editor or ancestor
// elements.
virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
// FindSelectionRoot() returns a selection root of this editor when aNode
// gets focus. aNode must be a content node or a document node. When the
// target isn't a part of this editor, returns nullptr. If this is for
// designMode, you should set the document node to aNode except that an
// element in the document has focus.
virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode* aNode);
// Initializes selection and caret for the editor. If aEventTarget isn't
// a host of the editor, i.e., the editor doesn't get focus, this does
// nothing.
nsresult InitializeSelection(nsIDOMEventTarget* aFocusEventTarget);
// Finalizes selection and caret for the editor.
void FinalizeSelection();
// This method has to be called by nsEditorEventListener::Focus.
// All actions that have to be done when the editor is focused needs to be
// added here.
void OnFocus(nsIDOMEventTarget* aFocusEventTarget);
// Used to insert content from a data transfer into the editable area.
// This is called for each item in the data transfer, with the index of
// each item passed as aIndex.
virtual nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
int32_t aIndex,
nsIDOMDocument *aSourceDoc,
nsIDOMNode *aDestinationNode,
int32_t aDestOffset,
bool aDoDeleteSelection) = 0;
virtual nsresult InsertFromDrop(nsIDOMEvent* aDropEvent) = 0;
virtual already_AddRefed<nsIDOMNode> FindUserSelectAllNode(nsIDOMNode* aNode) { return nullptr; }
protected:
enum Tristate {
eTriUnset,
eTriFalse,
eTriTrue
};
// Spellchecking
nsCString mContentMIMEType; // MIME type of the doc we are editing.
nsCOMPtr<nsIInlineSpellChecker> mInlineSpellChecker;
nsRefPtr<nsTransactionManager> mTxnMgr;
nsCOMPtr<mozilla::dom::Element> mRootElement; // cached root node
nsCOMPtr<nsIDOMCharacterData> mIMETextNode; // current IME text node
nsCOMPtr<mozilla::dom::EventTarget> mEventTarget; // The form field as an event receiver
nsCOMPtr<nsIDOMEventListener> mEventListener;
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
nsWeakPtr mPlaceHolderTxn; // weak reference to placeholder for begin/end batch purposes
nsWeakPtr mDocWeak; // weak reference to the nsIDOMDocument
nsIAtom *mPlaceHolderName; // name of placeholder transaction
nsSelectionState *mSelState; // saved selection state for placeholder txn batching
nsString *mPhonetic;
// IME composition this is not null between compositionstart and
// compositionend.
nsRefPtr<mozilla::TextComposition> mComposition;
// various listeners
nsCOMArray<nsIEditActionListener> mActionListeners; // listens to all low level actions on the doc
nsCOMArray<nsIEditorObserver> mEditorObservers; // just notify once per high level change
nsCOMArray<nsIDocumentStateListener> mDocStateListeners;// listen to overall doc state (dirty or not, just created, etc)
nsSelectionState mSavedSel; // cached selection for nsAutoSelectionReset
nsRangeUpdater mRangeUpdater; // utility class object for maintaining preserved ranges
uint32_t mModCount; // number of modifications (for undo/redo stack)
uint32_t mFlags; // behavior flags. See nsIPlaintextEditor.idl for the flags we use.
int32_t mUpdateCount;
int32_t mPlaceHolderBatch; // nesting count for batching
EditAction mAction; // the current editor action
uint32_t mIMETextOffset; // offset in text node where IME comp string begins
EDirection mDirection; // the current direction of editor action
int8_t mDocDirtyState; // -1 = not initialized
uint8_t mSpellcheckCheckboxState; // a Tristate value
bool mShouldTxnSetSelection; // turn off for conservative selection adjustment by txns
bool mDidPreDestroy; // whether PreDestroy has been called
bool mDidPostCreate; // whether PostCreate has been called
bool mDispatchInputEvent;
friend bool NSCanUnload(nsISupports* serviceMgr);
friend class nsAutoTxnsConserveSelection;
friend class nsAutoSelectionReset;
friend class nsAutoRules;
friend class nsRangeUpdater;
};
#endif