2001-09-25 22:53:13 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* 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/. */
|
1999-03-01 19:54:47 +00:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditor_h__
|
|
|
|
#define nsHTMLEditor_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
2002-11-12 19:40:11 +00:00
|
|
|
#include "nsCOMArray.h"
|
2001-01-28 20:13:07 +00:00
|
|
|
#include "nsPlaintextEditor.h"
|
|
|
|
#include "nsIEditor.h"
|
1999-08-09 01:37:50 +00:00
|
|
|
#include "nsIHTMLEditor.h"
|
|
|
|
#include "nsITableEditor.h"
|
|
|
|
#include "nsIEditorMailSupport.h"
|
|
|
|
#include "nsIEditorStyleSheets.h"
|
2005-02-01 21:12:53 +00:00
|
|
|
#include "nsITextServicesDocument.h"
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
#include "nsEditor.h"
|
|
|
|
#include "nsIDOMElement.h"
|
1999-03-01 19:54:47 +00:00
|
|
|
#include "nsIDOMEventListener.h"
|
1999-12-04 01:29:18 +00:00
|
|
|
#include "nsICSSLoaderObserver.h"
|
1999-08-01 22:37:58 +00:00
|
|
|
#include "nsITableLayout.h"
|
1999-03-01 19:54:47 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
#include "nsEditRules.h"
|
2001-04-05 23:48:01 +00:00
|
|
|
|
2003-04-17 05:42:33 +00:00
|
|
|
#include "nsEditProperty.h"
|
2002-01-09 13:51:37 +00:00
|
|
|
#include "nsHTMLCSSUtils.h"
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
#include "nsHTMLObjectResizer.h"
|
2003-06-25 08:50:48 +00:00
|
|
|
#include "nsIHTMLAbsPosEditor.h"
|
|
|
|
#include "nsIHTMLInlineTableEditor.h"
|
|
|
|
#include "nsIHTMLObjectResizeListener.h"
|
|
|
|
|
|
|
|
#include "nsIDocumentObserver.h"
|
2003-02-24 09:37:18 +00:00
|
|
|
|
|
|
|
#include "nsPoint.h"
|
2007-11-13 01:41:40 +00:00
|
|
|
#include "nsTArray.h"
|
2010-05-11 20:41:47 +00:00
|
|
|
#include "nsAutoPtr.h"
|
2012-02-10 10:04:46 +00:00
|
|
|
#include "nsAttrName.h"
|
|
|
|
|
2012-05-18 08:29:38 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-02-10 10:04:46 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2003-02-24 09:37:18 +00:00
|
|
|
|
1999-11-03 07:11:45 +00:00
|
|
|
class nsIDOMKeyEvent;
|
2000-04-25 14:14:48 +00:00
|
|
|
class nsITransferable;
|
2001-01-08 21:01:29 +00:00
|
|
|
class nsIDocumentEncoder;
|
2002-11-22 03:30:59 +00:00
|
|
|
class nsIClipboard;
|
2001-04-05 23:48:01 +00:00
|
|
|
class TypeInState;
|
2003-04-15 14:07:30 +00:00
|
|
|
class nsIContentFilter;
|
2004-03-04 18:47:49 +00:00
|
|
|
class nsIURL;
|
2005-06-09 22:50:41 +00:00
|
|
|
class nsILinkHandler;
|
2009-04-22 08:43:15 +00:00
|
|
|
struct PropItem;
|
1999-11-03 07:11:45 +00:00
|
|
|
|
2011-11-27 11:51:53 +00:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
struct IMEState;
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
1999-03-01 19:54:47 +00:00
|
|
|
/**
|
|
|
|
* The HTML editor implementation.<br>
|
|
|
|
* Use to edit HTML document represented as a DOM tree.
|
|
|
|
*/
|
2001-01-28 20:13:07 +00:00
|
|
|
class nsHTMLEditor : public nsPlaintextEditor,
|
1999-08-09 01:37:50 +00:00
|
|
|
public nsIHTMLEditor,
|
2003-02-24 09:37:18 +00:00
|
|
|
public nsIHTMLObjectResizer,
|
2003-06-25 08:50:48 +00:00
|
|
|
public nsIHTMLAbsPosEditor,
|
1999-08-09 01:37:50 +00:00
|
|
|
public nsITableEditor,
|
2003-06-25 08:50:48 +00:00
|
|
|
public nsIHTMLInlineTableEditor,
|
1999-12-04 01:29:18 +00:00
|
|
|
public nsIEditorStyleSheets,
|
2010-06-17 05:31:15 +00:00
|
|
|
public nsICSSLoaderObserver,
|
|
|
|
public nsStubMutationObserver
|
1999-03-01 19:54:47 +00:00
|
|
|
{
|
1999-08-09 01:37:50 +00:00
|
|
|
typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
|
1999-04-30 22:40:18 +00:00
|
|
|
|
1999-03-01 19:54:47 +00:00
|
|
|
public:
|
1999-12-07 08:30:19 +00:00
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
enum ResizingRequestID
|
|
|
|
{
|
|
|
|
kX = 0,
|
|
|
|
kY = 1,
|
|
|
|
kWidth = 2,
|
|
|
|
kHeight = 3
|
|
|
|
};
|
1999-12-07 08:30:19 +00:00
|
|
|
|
1999-03-01 19:54:47 +00:00
|
|
|
// see nsIHTMLEditor for documentation
|
|
|
|
|
|
|
|
//Interfaces for addref and release and queryinterface
|
1999-03-05 21:05:35 +00:00
|
|
|
//NOTE macro used is for classes that inherit from
|
|
|
|
// another class. Only the base class should use NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2011-02-16 12:07:47 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
|
1999-03-01 19:54:47 +00:00
|
|
|
|
2000-02-08 01:11:13 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
nsHTMLEditor();
|
|
|
|
virtual ~nsHTMLEditor();
|
1999-03-01 19:54:47 +00:00
|
|
|
|
2001-01-28 20:13:07 +00:00
|
|
|
/* ------------ nsPlaintextEditor overrides -------------- */
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
|
2010-11-11 21:40:55 +00:00
|
|
|
NS_IMETHOD BeginningOfDocument();
|
2010-06-10 01:16:58 +00:00
|
|
|
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
|
2010-10-29 16:30:52 +00:00
|
|
|
virtual already_AddRefed<nsIContent> GetFocusedContent();
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsActiveInDOMWindow();
|
2011-06-24 02:18:01 +00:00
|
|
|
virtual already_AddRefed<nsIDOMEventTarget> GetDOMEventTarget();
|
2012-05-06 07:53:11 +00:00
|
|
|
virtual mozilla::dom::Element* GetEditorRoot() MOZ_OVERRIDE;
|
2010-06-19 10:39:39 +00:00
|
|
|
virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
|
2012-03-27 01:36:44 +00:00
|
|
|
virtual already_AddRefed<nsIContent> GetInputEventTargetContent();
|
2010-11-16 20:45:49 +00:00
|
|
|
virtual bool IsEditable(nsIContent *aNode);
|
|
|
|
using nsEditor::IsEditable;
|
2010-05-04 17:40:39 +00:00
|
|
|
|
2010-06-17 05:31:15 +00:00
|
|
|
/* ------------ nsStubMutationObserver overrides --------- */
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2010-05-04 17:40:39 +00:00
|
|
|
/* ------------ nsIEditorIMESupport overrides ------------ */
|
2011-11-27 11:51:53 +00:00
|
|
|
NS_IMETHOD GetPreferredIMEState(mozilla::widget::IMEState *aState);
|
1999-03-01 19:54:47 +00:00
|
|
|
|
2000-11-17 00:25:31 +00:00
|
|
|
/* ------------ nsIHTMLEditor methods -------------- */
|
2002-03-11 13:11:48 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
NS_DECL_NSIHTMLEDITOR
|
2002-01-28 16:00:12 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
/* ------------ nsIHTMLObjectResizer methods -------------- */
|
|
|
|
/* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
|
|
|
|
NS_DECL_NSIHTMLOBJECTRESIZER
|
2003-06-02 22:21:06 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
/* ------------ nsIHTMLAbsPosEditor methods -------------- */
|
|
|
|
/* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
|
|
|
|
NS_DECL_NSIHTMLABSPOSEDITOR
|
2003-06-02 22:21:06 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
/* ------------ nsIHTMLInlineTableEditor methods -------------- */
|
|
|
|
/* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
|
|
|
|
NS_DECL_NSIHTMLINLINETABLEEDITOR
|
2003-06-02 22:21:06 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
/* ------------ nsIHTMLEditor methods -------------- */
|
|
|
|
NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
|
|
|
|
nsIDOMNode **aOutBrNode);
|
2002-10-06 01:23:18 +00:00
|
|
|
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD LoadHTML(const nsAString &aInputString);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor,
|
|
|
|
bool aBlockLevel);
|
|
|
|
NS_IMETHOD GetHTMLBackgroundColorState(bool *aMixed, nsAString &outColor);
|
2003-06-19 14:06:05 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
/* ------------ nsIEditorStyleSheets methods -------------- */
|
|
|
|
|
2002-09-13 19:47:38 +00:00
|
|
|
NS_IMETHOD AddStyleSheet(const nsAString & aURL);
|
|
|
|
NS_IMETHOD ReplaceStyleSheet(const nsAString& aURL);
|
|
|
|
NS_IMETHOD RemoveStyleSheet(const nsAString &aURL);
|
|
|
|
|
|
|
|
NS_IMETHOD AddOverrideStyleSheet(const nsAString & aURL);
|
|
|
|
NS_IMETHOD ReplaceOverrideStyleSheet(const nsAString& aURL);
|
|
|
|
NS_IMETHOD RemoveOverrideStyleSheet(const nsAString &aURL);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD EnableStyleSheet(const nsAString& aURL, bool aEnable);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
/* ------------ nsIEditorMailSupport methods -------------- */
|
|
|
|
|
2003-07-28 13:13:50 +00:00
|
|
|
NS_DECL_NSIEDITORMAILSUPPORT
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
/* ------------ nsITableEditor methods -------------- */
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD InsertTableCell(PRInt32 aNumber, bool aAfter);
|
|
|
|
NS_IMETHOD InsertTableColumn(PRInt32 aNumber, bool aAfter);
|
|
|
|
NS_IMETHOD InsertTableRow(PRInt32 aNumber, bool aAfter);
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD DeleteTable();
|
|
|
|
NS_IMETHOD DeleteTableCell(PRInt32 aNumber);
|
2000-01-13 23:33:00 +00:00
|
|
|
NS_IMETHOD DeleteTableCellContents();
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD DeleteTableColumn(PRInt32 aNumber);
|
|
|
|
NS_IMETHOD DeleteTableRow(PRInt32 aNumber);
|
2000-02-10 05:14:52 +00:00
|
|
|
NS_IMETHOD SelectTableCell();
|
2000-03-16 23:45:41 +00:00
|
|
|
NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
|
2000-02-10 05:14:52 +00:00
|
|
|
NS_IMETHOD SelectTableRow();
|
|
|
|
NS_IMETHOD SelectTableColumn();
|
|
|
|
NS_IMETHOD SelectTable();
|
|
|
|
NS_IMETHOD SelectAllTableCells();
|
2000-06-14 04:58:29 +00:00
|
|
|
NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD JoinTableCells(bool aMergeNonContiguousContents);
|
2000-05-04 22:32:24 +00:00
|
|
|
NS_IMETHOD SplitTableCell();
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
2002-03-14 22:11:14 +00:00
|
|
|
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
|
|
|
|
PRInt32* aRowIndex, PRInt32* aColIndex);
|
|
|
|
NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
|
|
|
|
PRInt32* aRowCount, PRInt32* aColCount);
|
2001-02-26 22:02:58 +00:00
|
|
|
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex, nsIDOMElement **aCell);
|
2002-03-14 22:11:14 +00:00
|
|
|
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
|
|
|
|
PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
nsIDOMElement **aCell,
|
|
|
|
PRInt32* aStartRowIndex, PRInt32* aStartColIndex,
|
|
|
|
PRInt32* aRowSpan, PRInt32* aColSpan,
|
|
|
|
PRInt32* aActualRowSpan, PRInt32* aActualColSpan,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool* aIsSelected);
|
2001-02-26 22:02:58 +00:00
|
|
|
NS_IMETHOD GetFirstRow(nsIDOMElement* aTableElement, nsIDOMNode** aRowNode);
|
|
|
|
NS_IMETHOD GetNextRow(nsIDOMNode* aCurrentRowNode, nsIDOMNode** aRowNode);
|
|
|
|
NS_IMETHOD GetLastCellInRow(nsIDOMNode* aRowNode, nsIDOMNode** aCellNode);
|
|
|
|
|
2000-05-15 03:06:29 +00:00
|
|
|
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, PRInt32 aRow, PRInt32 aCol,
|
2011-09-29 06:19:26 +00:00
|
|
|
PRInt32 aDirection, bool aSelected);
|
2002-09-13 04:19:30 +00:00
|
|
|
NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
|
|
|
|
PRInt32 *aSelectedCount,
|
|
|
|
nsIDOMElement** aTableElement);
|
2002-03-14 22:11:14 +00:00
|
|
|
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, PRUint32 *aSelectionType);
|
2000-07-01 00:37:12 +00:00
|
|
|
|
|
|
|
nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
|
|
|
|
|
2000-03-21 06:05:24 +00:00
|
|
|
// Finds the first selected cell in first range of selection
|
|
|
|
// This is in the *order of selection*, not order in the table
|
|
|
|
// (i.e., each cell added to selection is added in another range
|
|
|
|
// in the selection's rangelist, independent of location in table)
|
2000-03-31 04:18:29 +00:00
|
|
|
// aRange is optional: returns the range around the cell
|
2002-09-13 04:19:30 +00:00
|
|
|
NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
2000-03-21 06:05:24 +00:00
|
|
|
// Get next cell until no more are found. Always use GetFirstSelected cell first
|
2000-03-31 04:18:29 +00:00
|
|
|
// aRange is optional: returns the range around the cell
|
2002-09-13 04:19:30 +00:00
|
|
|
NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
1999-03-01 19:54:47 +00:00
|
|
|
|
2000-05-15 03:06:29 +00:00
|
|
|
// Upper-left-most selected cell in table
|
2002-09-13 04:19:30 +00:00
|
|
|
NS_IMETHOD GetFirstSelectedCellInTable(PRInt32 *aRowIndex, PRInt32 *aColIndex, nsIDOMElement **aCell);
|
2000-03-21 06:05:24 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
/* miscellaneous */
|
|
|
|
// This sets background on the appropriate container element (table, cell,)
|
|
|
|
// or calls into nsTextEditor to set the page background
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
2001-04-05 23:48:01 +00:00
|
|
|
/* ------------ Block methods moved from nsEditor -------------- */
|
2011-08-11 13:29:59 +00:00
|
|
|
static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
|
2001-04-05 23:48:01 +00:00
|
|
|
|
2011-08-11 13:29:59 +00:00
|
|
|
static already_AddRefed<nsIDOMNode> NextNodeInBlock(nsIDOMNode *aNode, IterDirection aDir);
|
2001-04-05 23:48:01 +00:00
|
|
|
nsresult IsNextCharWhitespace(nsIDOMNode *aParentNode,
|
|
|
|
PRInt32 aOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *outIsSpace,
|
|
|
|
bool *outIsNBSP,
|
2001-04-05 23:48:01 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outNode = 0,
|
|
|
|
PRInt32 *outOffset = 0);
|
|
|
|
nsresult IsPrevCharWhitespace(nsIDOMNode *aParentNode,
|
|
|
|
PRInt32 aOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *outIsSpace,
|
|
|
|
bool *outIsNBSP,
|
2001-04-05 23:48:01 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outNode = 0,
|
|
|
|
PRInt32 *outOffset = 0);
|
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
/* ------------ Overrides of nsEditor interface methods -------------- */
|
|
|
|
|
2003-03-25 15:24:08 +00:00
|
|
|
nsresult EndUpdateViewBatch();
|
|
|
|
|
1999-08-23 06:42:04 +00:00
|
|
|
/** prepare the editor for use */
|
2011-03-11 05:40:31 +00:00
|
|
|
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, PRUint32 aFlags);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD PreDestroy(bool aDestroyingFrames);
|
2010-06-17 05:31:15 +00:00
|
|
|
|
2001-04-05 23:48:01 +00:00
|
|
|
/** Internal, static version */
|
2011-09-29 06:19:26 +00:00
|
|
|
static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
|
2001-04-05 23:48:01 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD SetFlags(PRUint32 aFlags);
|
1999-05-07 05:02:35 +00:00
|
|
|
|
2000-04-14 23:38:21 +00:00
|
|
|
NS_IMETHOD Paste(PRInt32 aSelectionType);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD CanPaste(PRInt32 aSelectionType, bool *aCanPaste);
|
1999-07-14 18:54:29 +00:00
|
|
|
|
2010-01-11 01:45:45 +00:00
|
|
|
NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
|
2010-01-11 01:45:45 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD DebugUnitTests(PRInt32 *outNumTests, PRInt32 *outNumTestsFailed);
|
1999-07-01 19:32:35 +00:00
|
|
|
|
1999-12-07 08:30:19 +00:00
|
|
|
/** All editor operations which alter the doc should be prefaced
|
|
|
|
* with a call to StartOperation, naming the action and direction */
|
2012-05-05 18:52:29 +00:00
|
|
|
NS_IMETHOD StartOperation(OperationID opID,
|
|
|
|
nsIEditor::EDirection aDirection);
|
1999-12-07 08:30:19 +00:00
|
|
|
|
|
|
|
/** All editor operations which alter the doc should be followed
|
2000-08-14 02:39:37 +00:00
|
|
|
* with a call to EndOperation */
|
|
|
|
NS_IMETHOD EndOperation();
|
1999-12-07 08:30:19 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
/** returns true if aParentTag can contain a child of type aChildTag */
|
2012-05-01 06:34:52 +00:00
|
|
|
virtual bool TagCanContainTag(nsIAtom* aParentTag, nsIAtom* aChildTag);
|
2000-01-10 10:13:58 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
/** returns true if aNode is a container */
|
2012-01-25 07:50:05 +00:00
|
|
|
virtual bool IsContainer(nsINode* aNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsContainer(nsIDOMNode *aNode);
|
2005-09-05 14:18:56 +00:00
|
|
|
|
2000-01-13 10:17:35 +00:00
|
|
|
/** make the given selection span the entire document */
|
2000-09-14 11:45:01 +00:00
|
|
|
NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
|
2000-01-13 10:17:35 +00:00
|
|
|
|
2002-01-25 10:16:52 +00:00
|
|
|
NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString & aAttribute,
|
2002-09-17 12:04:59 +00:00
|
|
|
const nsAString & aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aSuppressTransaction);
|
2002-03-15 15:33:29 +00:00
|
|
|
NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
|
2002-09-17 12:04:59 +00:00
|
|
|
const nsAString & aAttribute,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aSuppressTransaction);
|
2002-01-09 13:51:37 +00:00
|
|
|
|
2012-05-18 08:29:38 +00:00
|
|
|
/** join together any adjacent editable text nodes in the range */
|
2000-03-29 12:53:23 +00:00
|
|
|
NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
|
|
|
|
|
2012-05-18 08:29:38 +00:00
|
|
|
virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
|
|
|
|
MOZ_OVERRIDE;
|
2002-01-09 13:51:37 +00:00
|
|
|
|
2012-05-10 14:54:33 +00:00
|
|
|
NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
|
|
|
|
EStripWrappers aStripWrappers);
|
|
|
|
nsresult DeleteNode(nsINode* aNode);
|
2002-12-22 01:51:14 +00:00
|
|
|
NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
|
|
|
|
NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
|
|
|
|
PRUint32 aOffset,
|
|
|
|
PRUint32 aLength);
|
2007-06-28 02:48:16 +00:00
|
|
|
NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aInOutNode,
|
|
|
|
PRInt32 *aInOutOffset,
|
|
|
|
nsIDOMDocument *aDoc);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD_(bool) IsModifiableNode(nsIDOMNode *aNode);
|
2011-11-28 12:53:29 +00:00
|
|
|
virtual bool IsModifiableNode(nsINode *aNode);
|
2007-06-28 02:48:16 +00:00
|
|
|
|
|
|
|
NS_IMETHOD SelectAll();
|
2002-12-22 01:51:14 +00:00
|
|
|
|
2010-06-17 05:29:40 +00:00
|
|
|
NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
|
|
|
|
|
2000-01-13 10:17:35 +00:00
|
|
|
/* ------------ nsICSSLoaderObserver -------------- */
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*aSheet, bool aWasAlternate,
|
2005-09-12 18:41:15 +00:00
|
|
|
nsresult aStatus);
|
2000-01-13 10:17:35 +00:00
|
|
|
|
1999-08-19 22:11:58 +00:00
|
|
|
/* ------------ Utility Routines, not part of public API -------------- */
|
2012-05-22 09:37:17 +00:00
|
|
|
NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
|
2001-06-15 22:29:07 +00:00
|
|
|
nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *ioParent,
|
|
|
|
PRInt32 *ioOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNoEmptyNodes);
|
2012-02-17 14:16:59 +00:00
|
|
|
virtual already_AddRefed<nsIDOMNode> FindUserSelectAllNode(nsIDOMNode* aNode);
|
1999-08-19 22:11:58 +00:00
|
|
|
|
2000-03-29 12:53:23 +00:00
|
|
|
/** returns the absolute position of the end points of aSelection
|
|
|
|
* in the document as a text stream.
|
|
|
|
*/
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult GetTextSelectionOffsets(nsISelection *aSelection,
|
2000-03-29 12:53:23 +00:00
|
|
|
PRInt32 &aStartOffset,
|
|
|
|
PRInt32 &aEndOffset);
|
|
|
|
|
2000-04-04 14:51:26 +00:00
|
|
|
// Use this to assure that selection is set after attribute nodes when
|
|
|
|
// trying to collapse selection at begining of a block node
|
|
|
|
// e.g., when setting at beginning of a table cell
|
|
|
|
// This will stop at a table, however, since we don't want to
|
|
|
|
// "drill down" into nested tables.
|
|
|
|
// aSelection is optional -- if null, we get current seletion
|
2000-09-14 11:45:01 +00:00
|
|
|
nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
|
2000-03-29 12:53:23 +00:00
|
|
|
|
2012-05-05 09:00:06 +00:00
|
|
|
/**
|
|
|
|
* aNode must be a non-null text node.
|
|
|
|
*/
|
2011-11-28 12:53:29 +00:00
|
|
|
virtual bool IsTextInDirtyFrameVisible(nsIContent *aNode);
|
2003-06-11 11:50:36 +00:00
|
|
|
|
2012-05-05 09:00:06 +00:00
|
|
|
/**
|
|
|
|
* aNode must be a non-null text node.
|
|
|
|
* outIsEmptyNode must be non-null.
|
|
|
|
*/
|
2012-01-25 07:50:05 +00:00
|
|
|
nsresult IsVisTextNode(nsIContent* aNode,
|
|
|
|
bool* outIsEmptyNode,
|
|
|
|
bool aSafeToAskFrames);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult IsEmptyNode(nsIDOMNode *aNode, bool *outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount = false,
|
|
|
|
bool aListOrCellNotEmpty = false,
|
|
|
|
bool aSafeToAskFrames = false);
|
2012-01-25 07:50:06 +00:00
|
|
|
nsresult IsEmptyNode(nsINode* aNode, bool* outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount = false,
|
|
|
|
bool aListOrCellNotEmpty = false,
|
|
|
|
bool aSafeToAskFrames = false);
|
2012-01-25 07:50:05 +00:00
|
|
|
nsresult IsEmptyNodeImpl(nsINode* aNode,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount,
|
|
|
|
bool aListOrCellNotEmpty,
|
|
|
|
bool aSafeToAskFrames,
|
|
|
|
bool *aSeenBR);
|
2002-09-13 19:47:38 +00:00
|
|
|
|
|
|
|
// Returns TRUE if sheet was loaded, false if it wasn't
|
2011-09-29 06:19:26 +00:00
|
|
|
bool EnableExistingStyleSheet(const nsAString& aURL);
|
2002-09-13 19:47:38 +00:00
|
|
|
|
|
|
|
// Dealing with the internal style sheet lists:
|
|
|
|
NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
|
2010-05-11 20:41:47 +00:00
|
|
|
nsCSSStyleSheet **_retval);
|
|
|
|
NS_IMETHOD GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet, nsAString &aURL);
|
2002-09-13 19:47:38 +00:00
|
|
|
|
|
|
|
// Add a url + known style sheet to the internal lists:
|
|
|
|
nsresult AddNewStyleSheetToList(const nsAString &aURL,
|
2010-05-11 20:41:47 +00:00
|
|
|
nsCSSStyleSheet *aStyleSheet);
|
2002-09-13 19:47:38 +00:00
|
|
|
|
|
|
|
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
|
2012-02-01 10:54:22 +00:00
|
|
|
|
|
|
|
bool IsCSSEnabled()
|
|
|
|
{
|
|
|
|
// TODO: removal of mCSSAware and use only the presence of mHTMLCSSUtils
|
|
|
|
return mCSSAware && mHTMLCSSUtils && mHTMLCSSUtils->IsCSSPrefChecked();
|
|
|
|
}
|
|
|
|
|
2012-02-10 10:04:46 +00:00
|
|
|
static bool HasAttributes(mozilla::dom::Element* aElement)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aElement);
|
|
|
|
PRUint32 attrCount = aElement->GetAttrCount();
|
|
|
|
return attrCount > 1 ||
|
|
|
|
(1 == attrCount && !aElement->GetAttrNameAt(0)->Equals(nsGkAtoms::mozdirty));
|
|
|
|
}
|
2012-02-01 10:54:22 +00:00
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
protected:
|
1999-06-14 20:02:46 +00:00
|
|
|
|
2000-03-24 00:26:47 +00:00
|
|
|
NS_IMETHOD InitRules();
|
1999-06-14 20:02:46 +00:00
|
|
|
|
2005-03-24 19:00:01 +00:00
|
|
|
// Create the event listeners for the editor to install
|
2011-07-15 10:18:35 +00:00
|
|
|
virtual void CreateEventListeners();
|
2005-03-24 19:00:01 +00:00
|
|
|
|
2010-04-19 12:20:42 +00:00
|
|
|
virtual nsresult InstallEventListeners();
|
2005-03-24 19:00:01 +00:00
|
|
|
virtual void RemoveEventListeners();
|
1999-08-23 06:42:04 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool ShouldReplaceRootElement();
|
2010-06-17 05:32:05 +00:00
|
|
|
void ResetRootElementAndEventTarget();
|
2010-06-17 05:29:40 +00:00
|
|
|
nsresult GetBodyElement(nsIDOMHTMLElement** aBody);
|
2010-07-22 16:22:44 +00:00
|
|
|
// Get the focused node of this editor.
|
|
|
|
// @return If the editor has focus, this returns the focused node.
|
|
|
|
// Otherwise, returns null.
|
2010-06-17 05:32:05 +00:00
|
|
|
already_AddRefed<nsINode> GetFocusedNode();
|
2010-06-17 05:29:40 +00:00
|
|
|
|
1999-07-23 00:52:17 +00:00
|
|
|
// Return TRUE if aElement is a table-related elemet and caret was set
|
2011-09-29 06:19:26 +00:00
|
|
|
bool SetCaretInTableCell(nsIDOMElement* aElement);
|
1999-12-04 01:46:23 +00:00
|
|
|
|
1999-09-13 09:37:51 +00:00
|
|
|
// key event helpers
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
|
2000-02-25 04:39:30 +00:00
|
|
|
NS_IMETHOD CreateBR(nsIDOMNode *aNode, PRInt32 aOffset,
|
2001-01-28 20:13:07 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
|
1999-09-13 09:37:51 +00:00
|
|
|
|
2000-02-10 05:14:52 +00:00
|
|
|
// Table Editing (implemented in nsTableEditor.cpp)
|
1999-08-01 22:37:58 +00:00
|
|
|
|
1999-12-04 01:46:23 +00:00
|
|
|
// Table utilities
|
|
|
|
|
2000-02-03 02:06:10 +00:00
|
|
|
// Insert a new cell after or before supplied aCell.
|
|
|
|
// Optional: If aNewCell supplied, returns the newly-created cell (addref'd, of course)
|
|
|
|
// This doesn't change or use the current selection
|
|
|
|
NS_IMETHOD InsertCell(nsIDOMElement *aCell, PRInt32 aRowSpan, PRInt32 aColSpan,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aAfter, bool aIsHeader, nsIDOMElement **aNewCell);
|
2000-05-02 03:24:11 +00:00
|
|
|
|
2000-07-01 00:37:12 +00:00
|
|
|
// Helpers that don't touch the selection or do batch transactions
|
|
|
|
NS_IMETHOD DeleteRow(nsIDOMElement *aTable, PRInt32 aRowIndex);
|
|
|
|
NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, PRInt32 aColIndex);
|
|
|
|
NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
|
|
|
|
|
2000-05-02 03:24:11 +00:00
|
|
|
// Move all contents from aCellToMerge into aTargetCell (append at end)
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge);
|
2000-05-02 03:24:11 +00:00
|
|
|
|
2000-09-14 11:45:01 +00:00
|
|
|
NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
|
2000-02-03 02:06:10 +00:00
|
|
|
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, PRInt32 aColSpan);
|
|
|
|
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, PRInt32 aRowSpan);
|
|
|
|
|
1999-08-01 22:37:58 +00:00
|
|
|
// Helper used to get nsITableLayout interface for methods implemented in nsTableFrame
|
|
|
|
NS_IMETHOD GetTableLayoutObject(nsIDOMElement* aTable, nsITableLayout **tableLayoutObject);
|
1999-12-07 01:12:10 +00:00
|
|
|
// Needed to do appropriate deleting when last cell or row is about to be deleted
|
|
|
|
// This doesn't count cells that don't start in the given row (are spanning from row above)
|
2000-01-26 14:57:43 +00:00
|
|
|
PRInt32 GetNumberOfCellsInRow(nsIDOMElement* aTable, PRInt32 rowIndex);
|
2000-03-21 06:05:24 +00:00
|
|
|
// Test if all cells in row or column at given index are selected
|
2011-09-29 06:19:26 +00:00
|
|
|
bool AllCellsInRowSelected(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aNumberOfColumns);
|
|
|
|
bool AllCellsInColumnSelected(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32 aNumberOfRows);
|
2000-03-21 06:05:24 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsEmptyCell(nsIDOMElement *aCell);
|
2000-06-22 05:39:54 +00:00
|
|
|
|
1999-12-04 01:46:23 +00:00
|
|
|
// Most insert methods need to get the same basic context data
|
2000-05-02 03:24:11 +00:00
|
|
|
// Any of the pointers may be null if you don't need that datum (for more efficiency)
|
|
|
|
// Input: *aCell is a known cell,
|
|
|
|
// if null, cell is obtained from the anchor node of the selection
|
|
|
|
// Returns NS_EDITOR_ELEMENT_NOT_FOUND if cell is not found even if aCell is null
|
2000-09-14 11:45:01 +00:00
|
|
|
NS_IMETHOD GetCellContext(nsISelection **aSelection,
|
2000-05-02 03:24:11 +00:00
|
|
|
nsIDOMElement **aTable,
|
|
|
|
nsIDOMElement **aCell,
|
|
|
|
nsIDOMNode **aCellParent, PRInt32 *aCellOffset,
|
|
|
|
PRInt32 *aRowIndex, PRInt32 *aColIndex);
|
1999-08-04 02:06:03 +00:00
|
|
|
|
2000-05-15 03:06:29 +00:00
|
|
|
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32& aActualRowSpan, PRInt32& aActualColSpan);
|
|
|
|
|
|
|
|
NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32 aColSpanLeft, PRInt32 aColSpanRight, nsIDOMElement **aNewCell);
|
|
|
|
|
|
|
|
NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32 aColIndex,
|
|
|
|
PRInt32 aRowSpanAbove, PRInt32 aRowSpanBelow, nsIDOMElement **aNewCell);
|
|
|
|
|
2000-08-30 02:44:08 +00:00
|
|
|
nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
|
|
|
|
|
2010-05-23 19:26:15 +00:00
|
|
|
// Reduce rowspan/colspan when cells span into nonexistent rows/columns
|
2000-05-15 03:06:29 +00:00
|
|
|
NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, PRInt32 aRowIndex, PRInt32& aNewRowCount);
|
2000-07-01 00:37:12 +00:00
|
|
|
NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, PRInt32 aColIndex, PRInt32& aNewColCount);
|
2000-05-15 03:06:29 +00:00
|
|
|
|
2000-02-10 05:14:52 +00:00
|
|
|
// Fallback method: Call this after using ClearSelection() and you
|
|
|
|
// failed to set selection to some other content in the document
|
2000-09-14 11:45:01 +00:00
|
|
|
NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
|
1999-08-05 20:04:58 +00:00
|
|
|
|
2000-03-21 06:05:24 +00:00
|
|
|
// End of Table Editing utilities
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsBlockNode(nsIDOMNode *aNode);
|
2011-11-28 12:53:29 +00:00
|
|
|
virtual bool IsBlockNode(nsINode *aNode);
|
2001-12-09 09:24:33 +00:00
|
|
|
|
1999-09-19 10:32:21 +00:00
|
|
|
static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
|
1999-05-05 04:05:19 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
|
1999-08-09 01:37:50 +00:00
|
|
|
* If <aProperty aAttribute=aValue> contains aNode,
|
|
|
|
* but <aProperty aAttribute=SomeOtherValue> also contains aNode and the second is
|
|
|
|
* more deeply nested than the first, then the first does not effect aNode.
|
|
|
|
*
|
|
|
|
* @param aNode The target of the query
|
|
|
|
* @param aProperty The property that we are querying for
|
|
|
|
* @param aAttribute The attribute of aProperty, example: color in <FONT color="blue">
|
|
|
|
* May be null.
|
|
|
|
* @param aValue The value of aAttribute, example: blue in <FONT color="blue">
|
|
|
|
* May be null. Ignored if aAttribute is null.
|
2011-10-17 14:59:28 +00:00
|
|
|
* @param aIsSet [OUT] true if <aProperty aAttribute=aValue> effects aNode.
|
2012-05-03 07:09:44 +00:00
|
|
|
* @param outValue [OUT] the value of the attribute, if aIsSet is true
|
1999-08-09 01:37:50 +00:00
|
|
|
*/
|
2012-05-03 07:09:44 +00:00
|
|
|
void IsTextPropertySetByContent(nsIDOMNode* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue,
|
|
|
|
bool& aIsSet,
|
|
|
|
nsAString* outValue = nsnull);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
// Methods for handling plaintext quotations
|
2000-04-14 23:38:21 +00:00
|
|
|
NS_IMETHOD PasteAsPlaintextQuotation(PRInt32 aSelectionType);
|
2002-10-08 20:24:23 +00:00
|
|
|
|
|
|
|
/** Insert a string as quoted text,
|
|
|
|
* replacing the selected text (if any).
|
|
|
|
* @param aQuotedText The string to insert.
|
|
|
|
* @param aAddCites Whether to prepend extra ">" to each line
|
|
|
|
* (usually true, unless those characters
|
|
|
|
* have already been added.)
|
|
|
|
* @return aNodeInserted The node spanning the insertion, if applicable.
|
|
|
|
* If aAddCites is false, this will be null.
|
|
|
|
*/
|
2002-03-23 22:08:20 +00:00
|
|
|
NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aAddCites,
|
1999-11-24 20:48:59 +00:00
|
|
|
nsIDOMNode **aNodeInserted);
|
2012-02-17 14:16:59 +00:00
|
|
|
// Return true if the data is safe to insert as the source and destination
|
|
|
|
// principals match, or we are in a editor context where this doesn't matter.
|
|
|
|
// Otherwise, the data must be sanitized first.
|
|
|
|
bool IsSafeToInsertData(nsIDOMDocument* aSourceDoc);
|
|
|
|
|
|
|
|
nsresult InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
|
|
|
PRInt32 aDestOffset,
|
|
|
|
bool aDoDeleteSelection);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
2000-04-25 14:14:48 +00:00
|
|
|
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
|
|
|
|
NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
|
2011-09-29 06:19:26 +00:00
|
|
|
NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 10:57:30 +00:00
|
|
|
NS_IMETHOD InsertFromTransferable(nsITransferable *transferable,
|
2003-06-10 18:52:31 +00:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString & aContextStr,
|
2003-04-15 14:07:30 +00:00
|
|
|
const nsAString & aInfoStr,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
|
|
|
PRInt32 aDestinationOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aDoDeleteSelection);
|
2012-02-17 14:16:59 +00:00
|
|
|
nsresult InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
|
|
|
|
PRInt32 aIndex,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
|
|
|
PRInt32 aDestOffset,
|
|
|
|
bool aDoDeleteSelection);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
|
2002-11-22 03:30:59 +00:00
|
|
|
nsresult ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext);
|
2003-04-15 14:07:30 +00:00
|
|
|
nsresult DoContentFilterCallback(const nsAString &aFlavor,
|
2003-06-10 18:52:31 +00:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aWillDeleteSelection,
|
2003-04-15 14:07:30 +00:00
|
|
|
nsIDOMNode **aFragmentAsNode,
|
|
|
|
nsIDOMNode **aFragStartNode,
|
|
|
|
PRInt32 *aFragStartOffset,
|
|
|
|
nsIDOMNode **aFragEndNode,
|
|
|
|
PRInt32 *aFragEndOffset,
|
|
|
|
nsIDOMNode **aTargetNode,
|
|
|
|
PRInt32 *aTargetOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *aDoContinue);
|
2004-03-04 18:47:49 +00:00
|
|
|
nsresult GetAttributeToModifyOnNode(nsIDOMNode *aNode, nsAString &aAttrib);
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nsnull);
|
|
|
|
nsresult StripFormattingNodes(nsIDOMNode *aNode, bool aOnlyList = false);
|
2003-04-15 14:07:30 +00:00
|
|
|
nsresult CreateDOMFragmentFromPaste(const nsAString & aInputString,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString & aContextStr,
|
|
|
|
const nsAString & aInfoStr,
|
2000-12-06 23:11:21 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outFragNode,
|
2006-04-25 20:13:46 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outStartNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outEndNode,
|
|
|
|
PRInt32 *outStartOffset,
|
2010-09-27 17:21:34 +00:00
|
|
|
PRInt32 *outEndOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aTrustedInput);
|
2011-07-29 11:48:04 +00:00
|
|
|
nsresult ParseFragment(const nsAString & aStr, nsIAtom* aContextLocalName,
|
2009-07-10 06:17:46 +00:00
|
|
|
nsIDocument* aTargetDoc,
|
2010-09-27 17:21:34 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outNode,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aTrustedInput);
|
2000-12-06 23:11:21 +00:00
|
|
|
nsresult CreateListOfNodesToPaste(nsIDOMNode *aFragmentAsNode,
|
2002-11-12 19:40:11 +00:00
|
|
|
nsCOMArray<nsIDOMNode>& outNodeList,
|
2003-04-15 14:07:30 +00:00
|
|
|
nsIDOMNode *aStartNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
nsIDOMNode *aEndNode,
|
|
|
|
PRInt32 aEndOffset);
|
2009-07-10 06:17:46 +00:00
|
|
|
nsresult CreateTagStack(nsTArray<nsString> &aTagStack,
|
|
|
|
nsIDOMNode *aNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetListAndTableParents( bool aEnd,
|
2002-11-12 19:40:11 +00:00
|
|
|
nsCOMArray<nsIDOMNode>& aListOfNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArray);
|
|
|
|
nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListsAndTables,
|
|
|
|
PRInt32 *outHighWaterMark);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult ScanForListAndTableStructure(bool aEnd,
|
2002-11-12 19:40:11 +00:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodes,
|
2001-06-15 22:29:07 +00:00
|
|
|
nsIDOMNode *aListOrTable,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outReplaceNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult ReplaceOrphanedStructure( bool aEnd,
|
2002-11-12 19:40:11 +00:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodeArray,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListAndTableArray,
|
2001-06-15 22:29:07 +00:00
|
|
|
PRInt32 aHighWaterMark);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsIDOMNode* GetArrayEndpoint(bool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
|
Checking in for bug 50742, this change removes the use of XIF in mozilla and replaces the XIF converter with a HTML (and XML) serializer.
Contextual information added to HTML copy and intelligence added to HTML paste in the editor (fixes bugs 47014, 50568 and 46554, and partly (at least) fixes bug 53188).
Code written by vidur, jfrancis, jst, akkana. Tested by jfrancis, akkana, vidur, jst, kin. Reviwed (and super reviewed) by waterson, vidur, kin, jfrancis, jst
2000-10-07 10:57:30 +00:00
|
|
|
|
2002-05-14 00:05:37 +00:00
|
|
|
/* small utility routine to test if a break node is visible to user */
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsVisBreak(nsIDOMNode *aNode);
|
2002-05-14 00:05:37 +00:00
|
|
|
|
2003-04-15 20:53:15 +00:00
|
|
|
/* utility routine to possibly adjust the insertion position when
|
|
|
|
inserting a block level element */
|
|
|
|
void NormalizeEOLInsertPosition(nsIDOMNode *firstNodeToInsert,
|
|
|
|
nsCOMPtr<nsIDOMNode> *insertParentNode,
|
|
|
|
PRInt32 *insertOffset);
|
|
|
|
|
2000-01-18 21:50:15 +00:00
|
|
|
/* small utility routine to test the eEditorReadonly bit */
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsModifiable();
|
2000-08-14 02:39:37 +00:00
|
|
|
|
fixes:
14753, 29843, 39864, 40141,
40139, 36679, 39542, 34729,
34855, 37216, 39292, 26447
r=sfraser,cmanske,fm; a=beppe
2000-05-24 23:00:24 +00:00
|
|
|
/* helpers for block transformations */
|
2002-03-23 22:08:20 +00:00
|
|
|
nsresult MakeDefinitionItem(const nsAString & aItemType);
|
|
|
|
nsresult InsertBasicBlock(const nsAString & aBlockType);
|
fixes:
14753, 29843, 39864, 40141,
40139, 36679, 39542, 34729,
34855, 37216, 39292, 26447
r=sfraser,cmanske,fm; a=beppe
2000-05-24 23:00:24 +00:00
|
|
|
|
2000-02-08 12:53:34 +00:00
|
|
|
/* increase/decrease the font size of selection */
|
|
|
|
nsresult RelativeFontChange( PRInt32 aSizeChange);
|
|
|
|
|
|
|
|
/* helper routines for font size changing */
|
|
|
|
nsresult RelativeFontChangeOnTextNode( PRInt32 aSizeChange,
|
|
|
|
nsIDOMCharacterData *aTextNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
PRInt32 aEndOffset);
|
2012-05-18 08:29:39 +00:00
|
|
|
nsresult RelativeFontChangeOnNode(PRInt32 aSizeChange, nsINode* aNode);
|
2012-05-18 08:29:39 +00:00
|
|
|
nsresult RelativeFontChangeHelper(PRInt32 aSizeChange, nsINode* aNode);
|
2000-02-08 12:53:34 +00:00
|
|
|
|
2000-03-24 00:26:47 +00:00
|
|
|
/* helper routines for inline style */
|
|
|
|
nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode,
|
|
|
|
PRInt32 aStartOffset,
|
|
|
|
PRInt32 aEndOffset,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsresult SetInlinePropertyOnNode(nsIContent* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2000-03-24 00:26:47 +00:00
|
|
|
|
|
|
|
nsresult PromoteInlineRange(nsIDOMRange *inRange);
|
2002-04-11 13:33:30 +00:00
|
|
|
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult SplitStyleAboveRange(nsIDOMRange *aRange,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
|
|
|
PRInt32 *aOffset,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
2000-08-30 04:33:20 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outLeftNode = nsnull,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outRightNode = nsnull);
|
2003-06-02 22:21:06 +00:00
|
|
|
nsresult ApplyDefaultProperties();
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult RemoveStyleInside(nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
2012-04-17 17:50:19 +00:00
|
|
|
const bool aChildrenOnly = false);
|
2002-03-23 22:08:20 +00:00
|
|
|
nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
|
2002-01-09 13:51:37 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool NodeIsProperty(nsIDOMNode *aNode);
|
|
|
|
bool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
|
2012-05-05 09:00:06 +00:00
|
|
|
bool HasAttrVal(const nsIContent* aNode, const nsAString* aAttribute,
|
|
|
|
const nsAString& aValue);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsAtFrontOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
|
|
|
|
bool IsAtEndOfNode(nsIDOMNode *aNode, PRInt32 aOffset);
|
|
|
|
bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
|
2012-05-05 09:00:06 +00:00
|
|
|
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);
|
2000-03-24 00:26:47 +00:00
|
|
|
|
2001-06-18 21:15:43 +00:00
|
|
|
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsIContent* GetPriorHTMLSibling(nsINode* aNode);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsIContent* GetPriorHTMLSibling(nsINode* aParent, PRInt32 aOffset);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsIContent* GetNextHTMLSibling(nsINode* aNode);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsIContent* GetNextHTMLSibling(nsINode* aParent, PRInt32 aOffset);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2000-03-24 00:26:47 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult IsFirstEditableChild( nsIDOMNode *aNode, bool *aOutIsFirst);
|
|
|
|
nsresult IsLastEditableChild( nsIDOMNode *aNode, bool *aOutIsLast);
|
2000-03-24 00:26:47 +00:00
|
|
|
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
|
|
|
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
2002-01-14 20:31:47 +00:00
|
|
|
|
2000-08-26 04:03:50 +00:00
|
|
|
nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
|
2002-05-14 00:05:37 +00:00
|
|
|
nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
|
2000-02-08 12:53:34 +00:00
|
|
|
|
2001-04-07 00:45:26 +00:00
|
|
|
nsresult GetInlinePropertyBase(nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *aFirst,
|
|
|
|
bool *aAny,
|
|
|
|
bool *aAll,
|
2003-06-02 22:21:06 +00:00
|
|
|
nsAString *outValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aCheckDefaults = true);
|
2012-02-01 10:54:22 +00:00
|
|
|
bool HasStyleOrIdOrClass(mozilla::dom::Element* aElement);
|
|
|
|
nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMNode* aElement);
|
2001-04-07 00:45:26 +00:00
|
|
|
|
2010-05-04 17:40:39 +00:00
|
|
|
// Whether the outer window of the DOM event target has focus or not.
|
2011-09-29 06:19:26 +00:00
|
|
|
bool OurWindowHasFocus();
|
2010-05-04 17:40:39 +00:00
|
|
|
|
2010-09-27 17:21:34 +00:00
|
|
|
// This function is used to insert a string of HTML input optionally with some
|
|
|
|
// context information into the editable field. The HTML input either comes
|
|
|
|
// from a transferable object created as part of a drop/paste operation, or from
|
|
|
|
// the InsertHTML method. We may want the HTML input to be sanitized (for example,
|
|
|
|
// if it's coming from a transferable object), in which case aTrustedInput should
|
|
|
|
// be set to false, otherwise, the caller should set it to true, which means that
|
|
|
|
// the HTML will be inserted in the DOM verbatim.
|
|
|
|
nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
|
|
|
|
const nsAString& aContextStr,
|
|
|
|
const nsAString& aInfoStr,
|
|
|
|
const nsAString& aFlavor,
|
|
|
|
nsIDOMDocument* aSourceDoc,
|
|
|
|
nsIDOMNode* aDestNode,
|
|
|
|
PRInt32 aDestOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aDeleteSelection,
|
|
|
|
bool aTrustedInput);
|
2010-09-27 17:21:34 +00:00
|
|
|
|
2012-05-10 12:00:14 +00:00
|
|
|
nsresult ClearStyle(nsCOMPtr<nsIDOMNode>* aNode, PRInt32* aOffset,
|
|
|
|
nsIAtom* aProperty, const nsAString* aAttribute);
|
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
// Data members
|
|
|
|
protected:
|
|
|
|
|
2003-04-15 14:07:30 +00:00
|
|
|
nsCOMArray<nsIContentFilter> mContentFilters;
|
|
|
|
|
2010-11-18 21:01:12 +00:00
|
|
|
nsRefPtr<TypeInState> mTypeInState;
|
2001-01-28 20:13:07 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCRInParagraphCreatesParagraph;
|
2005-01-12 19:11:48 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mCSSAware;
|
2010-11-18 21:01:12 +00:00
|
|
|
nsAutoPtr<nsHTMLCSSUtils> mHTMLCSSUtils;
|
2002-09-13 19:47:38 +00:00
|
|
|
|
2000-03-21 06:05:24 +00:00
|
|
|
// Used by GetFirstSelectedCell and GetNextSelectedCell
|
|
|
|
PRInt32 mSelectedCellIndex;
|
2000-03-16 23:45:41 +00:00
|
|
|
|
2002-09-13 19:47:38 +00:00
|
|
|
nsString mLastStyleSheetURL;
|
|
|
|
nsString mLastOverrideStyleSheetURL;
|
|
|
|
|
|
|
|
// Maintain a list of associated style sheets and their urls.
|
2009-01-18 20:14:14 +00:00
|
|
|
nsTArray<nsString> mStyleSheetURLs;
|
2010-05-11 20:41:47 +00:00
|
|
|
nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
|
2003-06-02 22:21:06 +00:00
|
|
|
|
|
|
|
// an array for holding default style settings
|
2009-04-22 08:43:15 +00:00
|
|
|
nsTArray<PropItem*> mDefaultStyles;
|
2002-09-13 19:47:38 +00:00
|
|
|
|
2005-02-01 21:12:53 +00:00
|
|
|
// for real-time spelling
|
|
|
|
nsCOMPtr<nsITextServicesDocument> mTextServices;
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
protected:
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
/* ANONYMOUS UTILS */
|
2006-06-15 07:31:01 +00:00
|
|
|
void RemoveListenerAndDeleteRef(const nsAString& aEvent,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aUseCapture,
|
2006-06-15 07:31:01 +00:00
|
|
|
nsIDOMElement* aElement,
|
|
|
|
nsIContent* aParentContent,
|
|
|
|
nsIPresShell* aShell);
|
2003-06-25 08:50:48 +00:00
|
|
|
void DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
|
|
|
nsIContent * aParentContent,
|
2006-06-15 07:31:01 +00:00
|
|
|
nsIPresShell* aShell);
|
2008-01-22 07:39:06 +00:00
|
|
|
|
2009-04-14 03:05:34 +00:00
|
|
|
nsresult ShowResizersInner(nsIDOMElement *aResizedElement);
|
|
|
|
|
2008-01-22 07:39:06 +00:00
|
|
|
// Returns the offset of an element's frame to its absolute containing block.
|
2003-06-25 08:50:48 +00:00
|
|
|
nsresult GetElementOrigin(nsIDOMElement * aElement, PRInt32 & aX, PRInt32 & aY);
|
|
|
|
nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
|
|
|
|
PRInt32 & aX, PRInt32 & aY,
|
|
|
|
PRInt32 & aW, PRInt32 & aH,
|
|
|
|
PRInt32 & aBorderLeft,
|
|
|
|
PRInt32 & aBorderTop,
|
|
|
|
PRInt32 & aMarginLeft,
|
|
|
|
PRInt32 & aMarginTop);
|
|
|
|
|
|
|
|
/* PACKED BOOLEANS FOR RESIZING, ABSOLUTE POSITIONING AND */
|
|
|
|
/* INLINE TABLE EDITING */
|
|
|
|
|
|
|
|
// resizing
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsObjectResizingEnabled;
|
|
|
|
bool mIsResizing;
|
|
|
|
bool mPreserveRatio;
|
|
|
|
bool mResizedObjectIsAnImage;
|
2003-02-24 09:37:18 +00:00
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
// absolute positioning
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsAbsolutelyPositioningEnabled;
|
|
|
|
bool mResizedObjectIsAbsolutelyPositioned;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mGrabberClicked;
|
|
|
|
bool mIsMoving;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mSnapToGridEnabled;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
// inline table editing
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mIsInlineTableEditingEnabled;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
/* RESIZING */
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
nsCOMPtr<nsIDOMElement> mTopLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomRightHandle;
|
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
nsCOMPtr<nsIDOMElement> mActivatedHandle;
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
nsCOMPtr<nsIDOMElement> mResizingShadow;
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizingInfo;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizedObject;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP;
|
|
|
|
nsCOMPtr<nsISelectionListener> mSelectionListenerP;
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP;
|
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
nsCOMArray<nsIHTMLObjectResizeListener> objectResizeEventListeners;
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
PRInt32 mOriginalX;
|
|
|
|
PRInt32 mOriginalY;
|
|
|
|
|
|
|
|
PRInt32 mResizedObjectX;
|
|
|
|
PRInt32 mResizedObjectY;
|
|
|
|
PRInt32 mResizedObjectWidth;
|
|
|
|
PRInt32 mResizedObjectHeight;
|
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
PRInt32 mResizedObjectMarginLeft;
|
|
|
|
PRInt32 mResizedObjectMarginTop;
|
|
|
|
PRInt32 mResizedObjectBorderLeft;
|
|
|
|
PRInt32 mResizedObjectBorderTop;
|
|
|
|
|
2003-02-24 09:37:18 +00:00
|
|
|
PRInt32 mXIncrementFactor;
|
|
|
|
PRInt32 mYIncrementFactor;
|
|
|
|
PRInt32 mWidthIncrementFactor;
|
|
|
|
PRInt32 mHeightIncrementFactor;
|
|
|
|
|
2003-06-25 08:50:48 +00:00
|
|
|
PRInt8 mInfoXIncrement;
|
|
|
|
PRInt8 mInfoYIncrement;
|
|
|
|
|
|
|
|
nsresult SetAllResizersPosition();
|
|
|
|
|
|
|
|
nsresult CreateResizer(nsIDOMElement ** aReturn, PRInt16 aLocation, nsIDOMNode * aParentNode);
|
|
|
|
void SetAnonymousElementPosition(PRInt32 aX, PRInt32 aY, nsIDOMElement *aResizer);
|
|
|
|
|
|
|
|
nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
|
|
|
|
nsIDOMElement * aOriginalObject);
|
|
|
|
nsresult SetShadowPosition(nsIDOMElement * aShadow,
|
|
|
|
nsIDOMElement * aOriginalObject,
|
|
|
|
PRInt32 aOriginalObjectX,
|
|
|
|
PRInt32 aOriginalObjectY);
|
|
|
|
|
|
|
|
nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
|
2003-02-24 09:37:18 +00:00
|
|
|
nsresult SetResizingInfoPosition(PRInt32 aX, PRInt32 aY,
|
|
|
|
PRInt32 aW, PRInt32 aH);
|
|
|
|
|
|
|
|
PRInt32 GetNewResizingIncrement(PRInt32 aX, PRInt32 aY, PRInt32 aID);
|
|
|
|
nsresult StartResizing(nsIDOMElement * aHandle);
|
|
|
|
PRInt32 GetNewResizingX(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingY(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingWidth(PRInt32 aX, PRInt32 aY);
|
|
|
|
PRInt32 GetNewResizingHeight(PRInt32 aX, PRInt32 aY);
|
|
|
|
void HideShadowAndInfo();
|
|
|
|
void SetFinalSize(PRInt32 aX, PRInt32 aY);
|
2003-06-25 08:50:48 +00:00
|
|
|
void DeleteRefToAnonymousNode(nsIDOMNode * aNode);
|
2011-09-29 06:19:26 +00:00
|
|
|
void SetResizeIncrements(PRInt32 aX, PRInt32 aY, PRInt32 aW, PRInt32 aH, bool aPreserveRatio);
|
2011-02-20 05:43:07 +00:00
|
|
|
void HideAnonymousEditingUIs();
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
/* ABSOLUTE POSITIONING */
|
|
|
|
|
|
|
|
PRInt32 mPositionedObjectX;
|
|
|
|
PRInt32 mPositionedObjectY;
|
|
|
|
PRInt32 mPositionedObjectWidth;
|
|
|
|
PRInt32 mPositionedObjectHeight;
|
|
|
|
|
|
|
|
PRInt32 mPositionedObjectMarginLeft;
|
|
|
|
PRInt32 mPositionedObjectMarginTop;
|
|
|
|
PRInt32 mPositionedObjectBorderLeft;
|
|
|
|
PRInt32 mPositionedObjectBorderTop;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
|
|
|
|
nsCOMPtr<nsIDOMElement> mGrabber;
|
|
|
|
nsCOMPtr<nsIDOMElement> mPositioningShadow;
|
|
|
|
|
|
|
|
PRInt32 mGridSize;
|
|
|
|
|
|
|
|
nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
|
|
|
|
nsresult StartMoving(nsIDOMElement * aHandle);
|
|
|
|
nsresult SetFinalPosition(PRInt32 aX, PRInt32 aY);
|
2010-05-24 12:20:59 +00:00
|
|
|
void AddPositioningOffset(PRInt32 & aX, PRInt32 & aY);
|
2003-06-25 08:50:48 +00:00
|
|
|
void SnapToGrid(PRInt32 & newX, PRInt32 & newY);
|
|
|
|
nsresult GrabberClicked();
|
|
|
|
nsresult EndMoving();
|
|
|
|
nsresult CheckPositionedElementBGandFG(nsIDOMElement * aElement,
|
|
|
|
nsAString & aReturn);
|
|
|
|
|
|
|
|
/* INLINE TABLE EDITING */
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mInlineEditedCell;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mAddColumnBeforeButton;
|
|
|
|
nsCOMPtr<nsIDOMElement> mRemoveColumnButton;
|
|
|
|
nsCOMPtr<nsIDOMElement> mAddColumnAfterButton;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mAddRowBeforeButton;
|
|
|
|
nsCOMPtr<nsIDOMElement> mRemoveRowButton;
|
|
|
|
nsCOMPtr<nsIDOMElement> mAddRowAfterButton;
|
|
|
|
|
|
|
|
void AddMouseClickListener(nsIDOMElement * aElement);
|
|
|
|
void RemoveMouseClickListener(nsIDOMElement * aElement);
|
|
|
|
|
2005-06-09 22:50:41 +00:00
|
|
|
nsCOMPtr<nsILinkHandler> mLinkHandler;
|
|
|
|
|
1999-09-29 20:08:15 +00:00
|
|
|
public:
|
|
|
|
|
1999-08-09 01:37:50 +00:00
|
|
|
// friends
|
|
|
|
friend class nsHTMLEditRules;
|
|
|
|
friend class nsTextEditRules;
|
2001-05-11 12:43:22 +00:00
|
|
|
friend class nsWSRunObject;
|
2012-04-13 12:52:12 +00:00
|
|
|
friend class nsHTMLEditorEventListener;
|
1999-05-03 18:48:39 +00:00
|
|
|
|
2012-04-20 06:33:21 +00:00
|
|
|
private:
|
|
|
|
// Helper
|
2012-05-05 09:00:06 +00:00
|
|
|
nsresult SetInlinePropertyOnNodeImpl(nsIContent* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2012-04-20 06:33:21 +00:00
|
|
|
|
1999-03-01 19:54:47 +00:00
|
|
|
};
|
|
|
|
#endif //nsHTMLEditor_h__
|
|
|
|
|