editor/libeditor/html/nsHTMLEditor.h

Wed, 31 Dec 2014 06:55:50 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:55:50 +0100
changeset 2
7e26c7da4463
permissions
-rw-r--r--

Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2

     1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #ifndef nsHTMLEditor_h__
     7 #define nsHTMLEditor_h__
     9 #include "nsCOMPtr.h"
    10 #include "nsCOMArray.h"
    11 #include "nsPlaintextEditor.h"
    12 #include "nsIEditor.h"
    13 #include "nsIHTMLEditor.h"
    14 #include "nsITableEditor.h"
    15 #include "nsIEditorMailSupport.h"
    16 #include "nsIEditorStyleSheets.h"
    18 #include "nsEditor.h"
    19 #include "nsIDOMElement.h"
    20 #include "nsIDOMEventListener.h"
    21 #include "nsICSSLoaderObserver.h"
    23 #include "nsEditRules.h"
    25 #include "nsEditProperty.h"
    26 #include "nsHTMLCSSUtils.h"
    28 #include "nsHTMLObjectResizer.h"
    29 #include "nsIHTMLAbsPosEditor.h"
    30 #include "nsIHTMLInlineTableEditor.h"
    31 #include "nsIHTMLObjectResizeListener.h"
    32 #include "nsIHTMLObjectResizer.h"
    34 #include "nsIDocumentObserver.h"
    36 #include "nsPoint.h"
    37 #include "nsTArray.h"
    38 #include "nsAutoPtr.h"
    39 #include "nsAttrName.h"
    40 #include "nsStubMutationObserver.h"
    42 #include "mozilla/Attributes.h"
    43 #include "mozilla/dom/Element.h"
    45 class nsIDOMKeyEvent;
    46 class nsITransferable;
    47 class nsIDocumentEncoder;
    48 class nsIClipboard;
    49 class TypeInState;
    50 class nsIContentFilter;
    51 class nsIURL;
    52 class nsILinkHandler;
    53 class nsTableOuterFrame;
    54 struct PropItem;
    56 namespace mozilla {
    57 namespace widget {
    58 struct IMEState;
    59 } // namespace widget
    60 } // namespace mozilla
    62 /**
    63  * The HTML editor implementation.<br>
    64  * Use to edit HTML document represented as a DOM tree. 
    65  */
    66 class nsHTMLEditor : public nsPlaintextEditor,
    67                      public nsIHTMLEditor,
    68                      public nsIHTMLObjectResizer,
    69                      public nsIHTMLAbsPosEditor,
    70                      public nsITableEditor,
    71                      public nsIHTMLInlineTableEditor,
    72                      public nsIEditorStyleSheets,
    73                      public nsICSSLoaderObserver,
    74                      public nsStubMutationObserver
    75 {
    76   typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
    78 public:
    80   enum ResizingRequestID
    81   {
    82     kX      = 0,
    83     kY      = 1,
    84     kWidth  = 2,
    85     kHeight = 3
    86   };
    88   // see nsIHTMLEditor for documentation
    90 //Interfaces for addref and release and queryinterface
    91 //NOTE macro used is for classes that inherit from 
    92 // another class. Only the base class should use NS_DECL_ISUPPORTS
    93   NS_DECL_ISUPPORTS_INHERITED
    94   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
    97            nsHTMLEditor();
    98   virtual  ~nsHTMLEditor();
   100   bool GetReturnInParagraphCreatesNewParagraph();
   102   /* ------------ nsPlaintextEditor overrides -------------- */
   103   NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
   104   NS_IMETHOD BeginningOfDocument();
   105   virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
   106   virtual already_AddRefed<nsIContent> GetFocusedContent();
   107   virtual already_AddRefed<nsIContent> GetFocusedContentForIME();
   108   virtual bool IsActiveInDOMWindow();
   109   virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget();
   110   virtual mozilla::dom::Element* GetEditorRoot() MOZ_OVERRIDE;
   111   virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
   112   virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
   113   virtual already_AddRefed<nsIContent> GetInputEventTargetContent();
   114   virtual bool IsEditable(nsIContent *aNode);
   115   using nsEditor::IsEditable;
   117   /* ------------ nsStubMutationObserver overrides --------- */
   118   NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
   119   NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
   120   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
   122   /* ------------ nsIEditorIMESupport overrides ------------ */
   123   NS_IMETHOD GetPreferredIMEState(mozilla::widget::IMEState *aState);
   125   /* ------------ nsIHTMLEditor methods -------------- */
   127   NS_DECL_NSIHTMLEDITOR
   129   /* ------------ nsIHTMLObjectResizer methods -------------- */
   130   /* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
   131   NS_DECL_NSIHTMLOBJECTRESIZER
   133   /* ------------ nsIHTMLAbsPosEditor methods -------------- */
   134   /* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
   135   NS_DECL_NSIHTMLABSPOSEDITOR
   137   /* ------------ nsIHTMLInlineTableEditor methods -------------- */
   138   /* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
   139   NS_DECL_NSIHTMLINLINETABLEEDITOR
   141   /* ------------ nsIHTMLEditor methods -------------- */
   142   NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
   143                                          nsIDOMNode **aOutBrNode);
   145   NS_IMETHOD LoadHTML(const nsAString &aInputString);
   147   nsresult GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor,
   148                                       bool aBlockLevel);
   149   NS_IMETHOD GetHTMLBackgroundColorState(bool *aMixed, nsAString &outColor);
   151   /* ------------ nsIEditorStyleSheets methods -------------- */
   153   NS_IMETHOD AddStyleSheet(const nsAString & aURL);
   154   NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
   155   NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
   157   NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
   158   NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
   159   NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
   161   NS_IMETHOD EnableStyleSheet(const nsAString& aURL, bool aEnable);
   163   /* ------------ nsIEditorMailSupport methods -------------- */
   165   NS_DECL_NSIEDITORMAILSUPPORT
   167   /* ------------ nsITableEditor methods -------------- */
   169   NS_IMETHOD InsertTableCell(int32_t aNumber, bool aAfter);
   170   NS_IMETHOD InsertTableColumn(int32_t aNumber, bool aAfter);
   171   NS_IMETHOD InsertTableRow(int32_t aNumber, bool aAfter);
   172   NS_IMETHOD DeleteTable();
   173   NS_IMETHOD DeleteTableCell(int32_t aNumber);
   174   NS_IMETHOD DeleteTableCellContents();
   175   NS_IMETHOD DeleteTableColumn(int32_t aNumber);
   176   NS_IMETHOD DeleteTableRow(int32_t aNumber);
   177   NS_IMETHOD SelectTableCell();
   178   NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
   179   NS_IMETHOD SelectTableRow();
   180   NS_IMETHOD SelectTableColumn();
   181   NS_IMETHOD SelectTable();
   182   NS_IMETHOD SelectAllTableCells();
   183   NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
   184   NS_IMETHOD JoinTableCells(bool aMergeNonContiguousContents);
   185   NS_IMETHOD SplitTableCell();
   186   NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
   187   NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
   188                             int32_t* aRowIndex, int32_t* aColIndex);
   189   NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
   190                           int32_t* aRowCount, int32_t* aColCount);
   191   NS_IMETHOD GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell);
   192   NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
   193                            int32_t aRowIndex, int32_t aColIndex,
   194                            nsIDOMElement **aCell,
   195                            int32_t* aStartRowIndex, int32_t* aStartColIndex,
   196                            int32_t* aRowSpan, int32_t* aColSpan, 
   197                            int32_t* aActualRowSpan, int32_t* aActualColSpan, 
   198                            bool* aIsSelected);
   199   NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
   200   NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
   201   NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
   203   NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol, 
   204                                         int32_t aDirection, bool aSelected);
   205   NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
   206                                              int32_t *aSelectedCount,
   207                                              nsIDOMElement** aTableElement);
   208   NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelectionType);
   210   nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
   212   // Finds the first selected cell in first range of selection
   213   // This is in the *order of selection*, not order in the table
   214   // (i.e., each cell added to selection is added in another range 
   215   //  in the selection's rangelist, independent of location in table)
   216   // aRange is optional: returns the range around the cell
   217   NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
   218   // Get next cell until no more are found. Always use GetFirstSelected cell first
   219   // aRange is optional: returns the range around the cell
   220   NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
   222   // Upper-left-most selected cell in table
   223   NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell);
   225   /* miscellaneous */
   226   // This sets background on the appropriate container element (table, cell,)
   227   //   or calls into nsTextEditor to set the page background
   228   NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
   229   NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
   231   /* ------------ Block methods moved from nsEditor -------------- */
   232   static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
   234   void IsNextCharInNodeWhitespace(nsIContent* aContent,
   235                                   int32_t aOffset,
   236                                   bool* outIsSpace,
   237                                   bool* outIsNBSP,
   238                                   nsIContent** outNode = nullptr,
   239                                   int32_t* outOffset = 0);
   240   void IsPrevCharInNodeWhitespace(nsIContent* aContent,
   241                                   int32_t aOffset,
   242                                   bool* outIsSpace,
   243                                   bool* outIsNBSP,
   244                                   nsIContent** outNode = nullptr,
   245                                   int32_t* outOffset = 0);
   247   /* ------------ Overrides of nsEditor interface methods -------------- */
   249   nsresult EndUpdateViewBatch();
   251   /** prepare the editor for use */
   252   NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
   253                   nsISelectionController *aSelCon, uint32_t aFlags,
   254                   const nsAString& aValue);
   255   NS_IMETHOD PreDestroy(bool aDestroyingFrames);
   257   /** Internal, static version */
   258   // aElement must not be null.
   259   static bool NodeIsBlockStatic(const mozilla::dom::Element* aElement);
   260   static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
   261 protected:
   262   using nsEditor::IsBlockNode;
   263   virtual bool IsBlockNode(nsINode *aNode);
   265 public:
   266   NS_IMETHOD SetFlags(uint32_t aFlags);
   268   NS_IMETHOD Paste(int32_t aSelectionType);
   269   NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste);
   271   NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
   272   NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
   274   NS_IMETHOD DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed);
   276   /** All editor operations which alter the doc should be prefaced
   277    *  with a call to StartOperation, naming the action and direction */
   278   NS_IMETHOD StartOperation(EditAction opID,
   279                             nsIEditor::EDirection aDirection);
   281   /** All editor operations which alter the doc should be followed
   282    *  with a call to EndOperation */
   283   NS_IMETHOD EndOperation();
   285   /** returns true if aParentTag can contain a child of type aChildTag */
   286   virtual bool TagCanContainTag(nsIAtom* aParentTag, nsIAtom* aChildTag);
   288   /** returns true if aNode is a container */
   289   virtual bool IsContainer(nsIDOMNode *aNode);
   291   /** make the given selection span the entire document */
   292   NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
   294   NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
   295                                       const nsAString & aAttribute,
   296                                       const nsAString & aValue,
   297                                       bool aSuppressTransaction);
   298   NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
   299                                          const nsAString & aAttribute,
   300                                          bool aSuppressTransaction);
   302   /** join together any adjacent editable text nodes in the range */
   303   NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
   305   virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
   306     MOZ_OVERRIDE;
   308   NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
   309                                  EStripWrappers aStripWrappers);
   310   nsresult DeleteNode(nsINode* aNode);
   311   NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
   312   NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
   313                            uint32_t             aOffset,
   314                            uint32_t             aLength);
   315   NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert, 
   316                             nsCOMPtr<nsIDOMNode> *aInOutNode, 
   317                             int32_t *aInOutOffset,
   318                             nsIDOMDocument *aDoc);
   319   NS_IMETHOD_(bool) IsModifiableNode(nsIDOMNode *aNode);
   320   virtual bool IsModifiableNode(nsINode *aNode);
   322   NS_IMETHOD GetIsSelectionEditable(bool* aIsSelectionEditable);
   324   NS_IMETHOD SelectAll();
   326   NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
   328   /* ------------ nsICSSLoaderObserver -------------- */
   329   NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*aSheet, bool aWasAlternate,
   330                               nsresult aStatus);
   332   /* ------------ Utility Routines, not part of public API -------------- */
   333   NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
   334   nsresult InsertNodeAtPoint( nsIDOMNode *aNode, 
   335                               nsCOMPtr<nsIDOMNode> *ioParent, 
   336                               int32_t *ioOffset, 
   337                               bool aNoEmptyNodes);
   339   // Use this to assure that selection is set after attribute nodes when 
   340   //  trying to collapse selection at begining of a block node
   341   //  e.g., when setting at beginning of a table cell
   342   // This will stop at a table, however, since we don't want to
   343   //  "drill down" into nested tables.
   344   // aSelection is optional -- if null, we get current seletion
   345   nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
   347   /**
   348    * aNode must be a non-null text node.
   349    * outIsEmptyNode must be non-null.
   350    */
   351   nsresult IsVisTextNode(nsIContent* aNode,
   352                          bool* outIsEmptyNode,
   353                          bool aSafeToAskFrames);
   354   nsresult IsEmptyNode(nsIDOMNode *aNode, bool *outIsEmptyBlock, 
   355                        bool aMozBRDoesntCount = false,
   356                        bool aListOrCellNotEmpty = false,
   357                        bool aSafeToAskFrames = false);
   358   nsresult IsEmptyNode(nsINode* aNode, bool* outIsEmptyBlock,
   359                        bool aMozBRDoesntCount = false,
   360                        bool aListOrCellNotEmpty = false,
   361                        bool aSafeToAskFrames = false);
   362   nsresult IsEmptyNodeImpl(nsINode* aNode,
   363                            bool *outIsEmptyBlock, 
   364                            bool aMozBRDoesntCount,
   365                            bool aListOrCellNotEmpty,
   366                            bool aSafeToAskFrames,
   367                            bool *aSeenBR);
   369   // Returns TRUE if sheet was loaded, false if it wasn't
   370   bool     EnableExistingStyleSheet(const nsAString& aURL);
   372   // Dealing with the internal style sheet lists:
   373   NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
   374                                  nsCSSStyleSheet **_retval);
   375   NS_IMETHOD GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet, nsAString &aURL);
   377   // Add a url + known style sheet to the internal lists:
   378   nsresult AddNewStyleSheetToList(const nsAString &aURL,
   379                                   nsCSSStyleSheet *aStyleSheet);
   381   nsresult RemoveStyleSheetFromList(const nsAString &aURL);
   383   bool IsCSSEnabled()
   384   {
   385     // TODO: removal of mCSSAware and use only the presence of mHTMLCSSUtils
   386     return mCSSAware && mHTMLCSSUtils && mHTMLCSSUtils->IsCSSPrefChecked();
   387   }
   389   static bool HasAttributes(mozilla::dom::Element* aElement)
   390   {
   391     MOZ_ASSERT(aElement);
   392     uint32_t attrCount = aElement->GetAttrCount();
   393     return attrCount > 1 ||
   394            (1 == attrCount && !aElement->GetAttrNameAt(0)->Equals(nsGkAtoms::mozdirty));
   395   }
   397 protected:
   399   NS_IMETHOD  InitRules();
   401   // Create the event listeners for the editor to install
   402   virtual void CreateEventListeners();
   404   virtual nsresult InstallEventListeners();
   405   virtual void RemoveEventListeners();
   407   bool ShouldReplaceRootElement();
   408   void ResetRootElementAndEventTarget();
   409   nsresult GetBodyElement(nsIDOMHTMLElement** aBody);
   410   // Get the focused node of this editor.
   411   // @return    If the editor has focus, this returns the focused node.
   412   //            Otherwise, returns null.
   413   already_AddRefed<nsINode> GetFocusedNode();
   415   // Return TRUE if aElement is a table-related elemet and caret was set
   416   bool SetCaretInTableCell(nsIDOMElement* aElement);
   418   // key event helpers
   419   NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
   420   NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset, 
   421                       nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
   423 // Table Editing (implemented in nsTableEditor.cpp)
   425   // Table utilities
   427   // Insert a new cell after or before supplied aCell. 
   428   //  Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
   429   // This doesn't change or use the current selection
   430   NS_IMETHOD InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t aColSpan,
   431                         bool aAfter, bool aIsHeader, nsIDOMElement **aNewCell);
   433   // Helpers that don't touch the selection or do batch transactions
   434   NS_IMETHOD DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex);
   435   NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, int32_t aColIndex);
   436   NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
   438   // Move all contents from aCellToMerge into aTargetCell (append at end)
   439   NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge);
   441   NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
   442   NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
   443   NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
   445   // Helper used to get nsTableOuterFrame for a table.
   446   nsTableOuterFrame* GetTableFrame(nsIDOMElement* aTable);
   447   // Needed to do appropriate deleting when last cell or row is about to be deleted
   448   // This doesn't count cells that don't start in the given row (are spanning from row above)
   449   int32_t  GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex);
   450   // Test if all cells in row or column at given index are selected
   451   bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns);
   452   bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows);
   454   bool IsEmptyCell(mozilla::dom::Element* aCell);
   456   // Most insert methods need to get the same basic context data
   457   // Any of the pointers may be null if you don't need that datum (for more efficiency)
   458   // Input: *aCell is a known cell,
   459   //        if null, cell is obtained from the anchor node of the selection
   460   // Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
   461   NS_IMETHOD GetCellContext(nsISelection **aSelection,
   462                             nsIDOMElement   **aTable,
   463                             nsIDOMElement   **aCell,
   464                             nsIDOMNode      **aCellParent, int32_t *aCellOffset,
   465                             int32_t *aRowIndex, int32_t *aColIndex);
   467   NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, 
   468                             int32_t& aActualRowSpan, int32_t& aActualColSpan);
   470   NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
   471                                   int32_t aColSpanLeft, int32_t aColSpanRight, nsIDOMElement **aNewCell);
   473   NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
   474                                int32_t aRowSpanAbove, int32_t aRowSpanBelow, nsIDOMElement **aNewCell);
   476   nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
   478   // Reduce rowspan/colspan when cells span into nonexistent rows/columns
   479   NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, int32_t aRowIndex, int32_t& aNewRowCount);
   480   NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, int32_t aColIndex, int32_t& aNewColCount);
   482   // Fallback method: Call this after using ClearSelection() and you
   483   //  failed to set selection to some other content in the document
   484   NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
   486 // End of Table Editing utilities
   488   static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
   490   /** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
   491     * If <aProperty aAttribute=aValue> contains aNode, 
   492     * but <aProperty aAttribute=SomeOtherValue> also contains aNode and the second is
   493     * more deeply nested than the first, then the first does not effect aNode.
   494     *
   495     * @param aNode      The target of the query
   496     * @param aProperty  The property that we are querying for
   497     * @param aAttribute The attribute of aProperty, example: color in <FONT color="blue">
   498     *                   May be null.
   499     * @param aValue     The value of aAttribute, example: blue in <FONT color="blue">
   500     *                   May be null.  Ignored if aAttribute is null.
   501     * @param aIsSet     [OUT] true if <aProperty aAttribute=aValue> effects aNode.
   502     * @param outValue   [OUT] the value of the attribute, if aIsSet is true
   503     *
   504     * The nsIContent variant returns aIsSet instead of using an out parameter.
   505     */
   506   bool IsTextPropertySetByContent(nsIContent*      aContent,
   507                                   nsIAtom*         aProperty,
   508                                   const nsAString* aAttribute,
   509                                   const nsAString* aValue,
   510                                   nsAString*       outValue = nullptr);
   512   void IsTextPropertySetByContent(nsIDOMNode*      aNode,
   513                                   nsIAtom*         aProperty,
   514                                   const nsAString* aAttribute,
   515                                   const nsAString* aValue,
   516                                   bool&            aIsSet,
   517                                   nsAString*       outValue = nullptr);
   519   // Methods for handling plaintext quotations
   520   NS_IMETHOD PasteAsPlaintextQuotation(int32_t aSelectionType);
   522   /** Insert a string as quoted text,
   523     * replacing the selected text (if any).
   524     * @param aQuotedText     The string to insert.
   525     * @param aAddCites       Whether to prepend extra ">" to each line
   526     *                        (usually true, unless those characters
   527     *                        have already been added.)
   528     * @return aNodeInserted  The node spanning the insertion, if applicable.
   529     *                        If aAddCites is false, this will be null.
   530     */
   531   NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
   532                                         bool aAddCites,
   533                                         nsIDOMNode **aNodeInserted);
   535   nsresult InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
   536                         nsIDOMDocument *aSourceDoc,
   537                         nsIDOMNode *aDestinationNode,
   538                         int32_t aDestOffset,
   539                         bool aDoDeleteSelection);
   541   // factored methods for handling insertion of data from transferables (drag&drop or clipboard)
   542   NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
   543   NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
   544   NS_IMETHOD InsertFromTransferable(nsITransferable *transferable, 
   545                                     nsIDOMDocument *aSourceDoc,
   546                                     const nsAString & aContextStr,
   547                                     const nsAString & aInfoStr,
   548                                     nsIDOMNode *aDestinationNode,
   549                                     int32_t aDestinationOffset,
   550                                     bool aDoDeleteSelection);
   551   nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
   552                                   int32_t aIndex,
   553                                   nsIDOMDocument *aSourceDoc,
   554                                   nsIDOMNode *aDestinationNode,
   555                                   int32_t aDestOffset,
   556                                   bool aDoDeleteSelection);
   557   bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
   558   nsresult   ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **aCfcontext);
   559   nsresult   DoContentFilterCallback(const nsAString &aFlavor,
   560                                      nsIDOMDocument *aSourceDoc,
   561                                      bool aWillDeleteSelection,
   562                                      nsIDOMNode **aFragmentAsNode,      
   563                                      nsIDOMNode **aFragStartNode,
   564                                      int32_t *aFragStartOffset,
   565                                      nsIDOMNode **aFragEndNode,
   566                                      int32_t *aFragEndOffset,
   567                                      nsIDOMNode **aTargetNode,       
   568                                      int32_t *aTargetOffset,   
   569                                      bool *aDoContinue);
   571   bool       IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nullptr);
   572   nsresult   StripFormattingNodes(nsIDOMNode *aNode, bool aOnlyList = false);
   573   nsresult   CreateDOMFragmentFromPaste(const nsAString & aInputString,
   574                                         const nsAString & aContextStr,
   575                                         const nsAString & aInfoStr,
   576                                         nsCOMPtr<nsIDOMNode> *outFragNode,
   577                                         nsCOMPtr<nsIDOMNode> *outStartNode,
   578                                         nsCOMPtr<nsIDOMNode> *outEndNode,
   579                                         int32_t *outStartOffset,
   580                                         int32_t *outEndOffset,
   581                                         bool aTrustedInput);
   582   nsresult   ParseFragment(const nsAString & aStr, nsIAtom* aContextLocalName,
   583                            nsIDocument* aTargetDoc,
   584                            nsCOMPtr<nsIDOMNode> *outNode,
   585                            bool aTrustedInput);
   586   nsresult   CreateListOfNodesToPaste(nsIDOMNode  *aFragmentAsNode,
   587                                       nsCOMArray<nsIDOMNode>& outNodeList,
   588                                       nsIDOMNode *aStartNode,
   589                                       int32_t aStartOffset,
   590                                       nsIDOMNode *aEndNode,
   591                                       int32_t aEndOffset);
   592   nsresult CreateTagStack(nsTArray<nsString> &aTagStack,
   593                           nsIDOMNode *aNode);
   594   nsresult GetListAndTableParents( bool aEnd, 
   595                                    nsCOMArray<nsIDOMNode>& aListOfNodes,
   596                                    nsCOMArray<nsIDOMNode>& outArray);
   597   nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
   598                                          nsCOMArray<nsIDOMNode>& aListsAndTables,
   599                                          int32_t *outHighWaterMark);
   600   nsresult ScanForListAndTableStructure(bool aEnd,
   601                                         nsCOMArray<nsIDOMNode>& aNodes,
   602                                         nsIDOMNode *aListOrTable,
   603                                         nsCOMPtr<nsIDOMNode> *outReplaceNode);
   604   nsresult ReplaceOrphanedStructure( bool aEnd,
   605                                      nsCOMArray<nsIDOMNode>& aNodeArray,
   606                                      nsCOMArray<nsIDOMNode>& aListAndTableArray,
   607                                      int32_t aHighWaterMark);
   608   nsIDOMNode* GetArrayEndpoint(bool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
   610   /* small utility routine to test if a break node is visible to user */
   611   bool     IsVisBreak(nsIDOMNode *aNode);
   613   /* utility routine to possibly adjust the insertion position when 
   614      inserting a block level element */
   615   void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
   616                                   nsCOMPtr<nsIDOMNode> *insertParentNode,
   617                                   int32_t *insertOffset);
   619   /* small utility routine to test the eEditorReadonly bit */
   620   bool IsModifiable();
   622   /* helpers for block transformations */
   623   nsresult MakeDefinitionItem(const nsAString & aItemType);
   624   nsresult InsertBasicBlock(const nsAString & aBlockType);
   626   /* increase/decrease the font size of selection */
   627   nsresult RelativeFontChange( int32_t aSizeChange);
   629   /* helper routines for font size changing */
   630   nsresult RelativeFontChangeOnTextNode( int32_t aSizeChange, 
   631                                          nsIDOMCharacterData *aTextNode, 
   632                                          int32_t aStartOffset,
   633                                          int32_t aEndOffset);
   634   nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsINode* aNode);
   635   nsresult RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode);
   637   /* helper routines for inline style */
   638   nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode, 
   639                                         int32_t aStartOffset,
   640                                         int32_t aEndOffset,
   641                                         nsIAtom *aProperty, 
   642                                         const nsAString *aAttribute,
   643                                         const nsAString *aValue);
   644   nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
   645                                     nsIAtom *aProperty, 
   646                                     const nsAString *aAttribute,
   647                                     const nsAString *aValue);
   648   nsresult SetInlinePropertyOnNode(nsIContent* aNode,
   649                                    nsIAtom* aProperty,
   650                                    const nsAString* aAttribute,
   651                                    const nsAString* aValue);
   653   nsresult PromoteInlineRange(nsIDOMRange *inRange);
   654   nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
   655   nsresult SplitStyleAboveRange(nsIDOMRange *aRange, 
   656                                 nsIAtom *aProperty, 
   657                                 const nsAString *aAttribute);
   658   nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
   659                                 int32_t *aOffset,
   660                                 nsIAtom *aProperty, 
   661                                 const nsAString *aAttribute,
   662                                 nsCOMPtr<nsIDOMNode> *outLeftNode = nullptr,
   663                                 nsCOMPtr<nsIDOMNode> *outRightNode = nullptr);
   664   nsresult ApplyDefaultProperties();
   665   nsresult RemoveStyleInside(nsIDOMNode *aNode, 
   666                              nsIAtom *aProperty, 
   667                              const nsAString *aAttribute, 
   668                              const bool aChildrenOnly = false);
   669   nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
   671   bool NodeIsProperty(nsIDOMNode *aNode);
   672   bool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
   673   bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
   674   bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
   675   bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
   676   bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);
   678   nsresult RemoveBlockContainer(nsIDOMNode *inNode);
   680   nsIContent* GetPriorHTMLSibling(nsINode* aNode);
   681   nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
   682   nsIContent* GetPriorHTMLSibling(nsINode* aParent, int32_t aOffset);
   683   nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
   685   nsIContent* GetNextHTMLSibling(nsINode* aNode);
   686   nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
   687   nsIContent* GetNextHTMLSibling(nsINode* aParent, int32_t aOffset);
   688   nsresult GetNextHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
   690   nsIContent* GetPriorHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
   691   nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
   692   nsIContent* GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
   693                                bool aNoBlockCrossing = false);
   694   nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
   696   nsIContent* GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
   697   nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
   698   nsIContent* GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
   699                               bool aNoBlockCrossing = false);
   700   nsresult GetNextHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
   702   nsresult IsFirstEditableChild( nsIDOMNode *aNode, bool *aOutIsFirst);
   703   nsresult IsLastEditableChild( nsIDOMNode *aNode, bool *aOutIsLast);
   704   nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
   705   nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
   707   nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
   708   nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
   710   nsresult GetInlinePropertyBase(nsIAtom *aProperty, 
   711                              const nsAString *aAttribute,
   712                              const nsAString *aValue,
   713                              bool *aFirst, 
   714                              bool *aAny, 
   715                              bool *aAll,
   716                              nsAString *outValue,
   717                              bool aCheckDefaults = true);
   718   bool HasStyleOrIdOrClass(mozilla::dom::Element* aElement);
   719   nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMNode* aElement);
   721   // Whether the outer window of the DOM event target has focus or not.
   722   bool     OurWindowHasFocus();
   724   // This function is used to insert a string of HTML input optionally with some
   725   // context information into the editable field.  The HTML input either comes
   726   // from a transferable object created as part of a drop/paste operation, or from
   727   // the InsertHTML method.  We may want the HTML input to be sanitized (for example,
   728   // if it's coming from a transferable object), in which case aTrustedInput should
   729   // be set to false, otherwise, the caller should set it to true, which means that
   730   // the HTML will be inserted in the DOM verbatim.
   731   //
   732   // aClearStyle should be set to false if you want the paste to be affected by
   733   // local style (e.g., for the insertHTML command).
   734   nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
   735                                    const nsAString& aContextStr,
   736                                    const nsAString& aInfoStr,
   737                                    const nsAString& aFlavor,
   738                                    nsIDOMDocument* aSourceDoc,
   739                                    nsIDOMNode* aDestNode,
   740                                    int32_t aDestOffset,
   741                                    bool aDeleteSelection,
   742                                    bool aTrustedInput,
   743                                    bool aClearStyle = true);
   745   nsresult ClearStyle(nsCOMPtr<nsIDOMNode>* aNode, int32_t* aOffset,
   746                       nsIAtom* aProperty, const nsAString* aAttribute);
   748 // Data members
   749 protected:
   751   nsCOMArray<nsIContentFilter> mContentFilters;
   753   nsRefPtr<TypeInState>        mTypeInState;
   755   bool mCRInParagraphCreatesParagraph;
   757   bool mCSSAware;
   758   nsAutoPtr<nsHTMLCSSUtils> mHTMLCSSUtils;
   760   // Used by GetFirstSelectedCell and GetNextSelectedCell
   761   int32_t  mSelectedCellIndex;
   763   nsString mLastStyleSheetURL;
   764   nsString mLastOverrideStyleSheetURL;
   766   // Maintain a list of associated style sheets and their urls.
   767   nsTArray<nsString> mStyleSheetURLs;
   768   nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
   770   // an array for holding default style settings
   771   nsTArray<PropItem*> mDefaultStyles;
   773 protected:
   775   /* ANONYMOUS UTILS */
   776   void     RemoveListenerAndDeleteRef(const nsAString& aEvent,
   777                                       nsIDOMEventListener* aListener,
   778                                       bool aUseCapture,
   779                                       nsIDOMElement* aElement,
   780                                       nsIContent* aParentContent,
   781                                       nsIPresShell* aShell);
   782   void     DeleteRefToAnonymousNode(nsIDOMElement* aElement,
   783                                     nsIContent * aParentContent,
   784                                     nsIPresShell* aShell);
   786   nsresult ShowResizersInner(nsIDOMElement *aResizedElement);
   788   // Returns the offset of an element's frame to its absolute containing block.
   789   nsresult GetElementOrigin(nsIDOMElement * aElement, int32_t & aX, int32_t & aY);
   790   nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
   791                                     int32_t & aX, int32_t & aY,
   792                                     int32_t & aW, int32_t & aH,
   793                                     int32_t & aBorderLeft,
   794                                     int32_t & aBorderTop,
   795                                     int32_t & aMarginLeft,
   796                                     int32_t & aMarginTop);
   798   /* PACKED BOOLEANS FOR RESIZING, ABSOLUTE POSITIONING AND */
   799   /* INLINE TABLE EDITING */
   801   // resizing
   802   bool mIsObjectResizingEnabled;
   803   bool mIsResizing;
   804   bool mPreserveRatio;
   805   bool mResizedObjectIsAnImage;
   807   // absolute positioning
   808   bool mIsAbsolutelyPositioningEnabled;
   809   bool mResizedObjectIsAbsolutelyPositioned;
   811   bool mGrabberClicked;
   812   bool mIsMoving;
   814   bool mSnapToGridEnabled;
   816   // inline table editing
   817   bool mIsInlineTableEditingEnabled;
   819   /* RESIZING */
   821   nsCOMPtr<nsIDOMElement> mTopLeftHandle;
   822   nsCOMPtr<nsIDOMElement> mTopHandle;
   823   nsCOMPtr<nsIDOMElement> mTopRightHandle;
   824   nsCOMPtr<nsIDOMElement> mLeftHandle;
   825   nsCOMPtr<nsIDOMElement> mRightHandle;
   826   nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
   827   nsCOMPtr<nsIDOMElement> mBottomHandle;
   828   nsCOMPtr<nsIDOMElement> mBottomRightHandle;
   830   nsCOMPtr<nsIDOMElement> mActivatedHandle;
   832   nsCOMPtr<nsIDOMElement> mResizingShadow;
   833   nsCOMPtr<nsIDOMElement> mResizingInfo;
   835   nsCOMPtr<nsIDOMElement> mResizedObject;
   837   nsCOMPtr<nsIDOMEventListener>  mMouseMotionListenerP;
   838   nsCOMPtr<nsISelectionListener> mSelectionListenerP;
   839   nsCOMPtr<nsIDOMEventListener>  mResizeEventListenerP;
   841   nsCOMArray<nsIHTMLObjectResizeListener> objectResizeEventListeners;
   843   int32_t mOriginalX;
   844   int32_t mOriginalY;
   846   int32_t mResizedObjectX;
   847   int32_t mResizedObjectY;
   848   int32_t mResizedObjectWidth;
   849   int32_t mResizedObjectHeight;
   851   int32_t mResizedObjectMarginLeft;
   852   int32_t mResizedObjectMarginTop;
   853   int32_t mResizedObjectBorderLeft;
   854   int32_t mResizedObjectBorderTop;
   856   int32_t mXIncrementFactor;
   857   int32_t mYIncrementFactor;
   858   int32_t mWidthIncrementFactor;
   859   int32_t mHeightIncrementFactor;
   861   int8_t  mInfoXIncrement;
   862   int8_t  mInfoYIncrement;
   864   nsresult SetAllResizersPosition();
   866   nsresult CreateResizer(nsIDOMElement ** aReturn, int16_t aLocation, nsIDOMNode * aParentNode);
   867   void     SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aResizer);
   869   nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
   870                         nsIDOMElement * aOriginalObject);
   871   nsresult SetShadowPosition(nsIDOMElement * aShadow,
   872                              nsIDOMElement * aOriginalObject,
   873                              int32_t aOriginalObjectX,
   874                              int32_t aOriginalObjectY);
   876   nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
   877   nsresult SetResizingInfoPosition(int32_t aX, int32_t aY,
   878                                    int32_t aW, int32_t aH);
   880   int32_t  GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID);
   881   nsresult StartResizing(nsIDOMElement * aHandle);
   882   int32_t  GetNewResizingX(int32_t aX, int32_t aY);
   883   int32_t  GetNewResizingY(int32_t aX, int32_t aY);
   884   int32_t  GetNewResizingWidth(int32_t aX, int32_t aY);
   885   int32_t  GetNewResizingHeight(int32_t aX, int32_t aY);
   886   void     HideShadowAndInfo();
   887   void     SetFinalSize(int32_t aX, int32_t aY);
   888   void     DeleteRefToAnonymousNode(nsIDOMNode * aNode);
   889   void     SetResizeIncrements(int32_t aX, int32_t aY, int32_t aW, int32_t aH, bool aPreserveRatio);
   890   void     HideAnonymousEditingUIs();
   892   /* ABSOLUTE POSITIONING */
   894   int32_t mPositionedObjectX;
   895   int32_t mPositionedObjectY;
   896   int32_t mPositionedObjectWidth;
   897   int32_t mPositionedObjectHeight;
   899   int32_t mPositionedObjectMarginLeft;
   900   int32_t mPositionedObjectMarginTop;
   901   int32_t mPositionedObjectBorderLeft;
   902   int32_t mPositionedObjectBorderTop;
   904   nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
   905   nsCOMPtr<nsIDOMElement> mGrabber;
   906   nsCOMPtr<nsIDOMElement> mPositioningShadow;
   908   int32_t      mGridSize;
   910   nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
   911   nsresult StartMoving(nsIDOMElement * aHandle);
   912   nsresult SetFinalPosition(int32_t aX, int32_t aY);
   913   void     AddPositioningOffset(int32_t & aX, int32_t & aY);
   914   void     SnapToGrid(int32_t & newX, int32_t & newY);
   915   nsresult GrabberClicked();
   916   nsresult EndMoving();
   917   nsresult CheckPositionedElementBGandFG(nsIDOMElement * aElement,
   918                                          nsAString & aReturn);
   920   /* INLINE TABLE EDITING */
   922   nsCOMPtr<nsIDOMElement> mInlineEditedCell;
   924   nsCOMPtr<nsIDOMElement> mAddColumnBeforeButton;
   925   nsCOMPtr<nsIDOMElement> mRemoveColumnButton;
   926   nsCOMPtr<nsIDOMElement> mAddColumnAfterButton;
   928   nsCOMPtr<nsIDOMElement> mAddRowBeforeButton;
   929   nsCOMPtr<nsIDOMElement> mRemoveRowButton;
   930   nsCOMPtr<nsIDOMElement> mAddRowAfterButton;
   932   void     AddMouseClickListener(nsIDOMElement * aElement);
   933   void     RemoveMouseClickListener(nsIDOMElement * aElement);
   935   nsCOMPtr<nsILinkHandler> mLinkHandler;
   937 public:
   939 // friends
   940 friend class nsHTMLEditRules;
   941 friend class nsTextEditRules;
   942 friend class nsWSRunObject;
   943 friend class nsHTMLEditorEventListener;
   945 private:
   946   // Helpers
   947   bool IsSimpleModifiableNode(nsIContent* aContent,
   948                               nsIAtom* aProperty,
   949                               const nsAString* aAttribute,
   950                               const nsAString* aValue);
   951   nsresult SetInlinePropertyOnNodeImpl(nsIContent* aNode,
   952                                        nsIAtom* aProperty,
   953                                        const nsAString* aAttribute,
   954                                        const nsAString* aValue);
   955   typedef enum { eInserted, eAppended } InsertedOrAppended;
   956   void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
   957                          nsIContent* aChild, int32_t aIndexInContainer,
   958                          InsertedOrAppended aInsertedOrAppended);
   959 };
   960 #endif //nsHTMLEditor_h__

mercurial