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"
|
|
|
|
|
|
|
|
#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-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"
|
2012-07-13 06:33:42 +00:00
|
|
|
#include "nsIHTMLObjectResizer.h"
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
#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-07-13 06:33:42 +00:00
|
|
|
#include "nsStubMutationObserver.h"
|
2012-02-10 10:04:46 +00:00
|
|
|
|
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;
|
2012-08-08 13:05:17 +00:00
|
|
|
class nsTableOuterFrame;
|
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
|
|
|
|
2012-06-01 11:03:17 +00:00
|
|
|
bool GetReturnInParagraphCreatesNewParagraph();
|
|
|
|
|
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();
|
2012-11-09 08:40:39 +00:00
|
|
|
virtual already_AddRefed<nsIContent> GetFocusedContentForIME();
|
2011-09-29 06:19:26 +00:00
|
|
|
virtual bool IsActiveInDOMWindow();
|
2013-10-22 23:32:04 +00:00
|
|
|
virtual already_AddRefed<mozilla::dom::EventTarget> 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();
|
2014-04-28 16:03:12 +00:00
|
|
|
virtual bool IsEditable(nsINode* aNode) MOZ_OVERRIDE;
|
2010-11-16 20:45:49 +00:00
|
|
|
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 -------------- */
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD InsertTableCell(int32_t aNumber, bool aAfter);
|
|
|
|
NS_IMETHOD InsertTableColumn(int32_t aNumber, bool aAfter);
|
|
|
|
NS_IMETHOD InsertTableRow(int32_t aNumber, bool aAfter);
|
1999-08-09 01:37:50 +00:00
|
|
|
NS_IMETHOD DeleteTable();
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD DeleteTableCell(int32_t aNumber);
|
2000-01-13 23:33:00 +00:00
|
|
|
NS_IMETHOD DeleteTableCellContents();
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD DeleteTableColumn(int32_t aNumber);
|
|
|
|
NS_IMETHOD DeleteTableRow(int32_t 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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t* aRowIndex, int32_t* aColIndex);
|
2002-03-14 22:11:14 +00:00
|
|
|
NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t* aRowCount, int32_t* aColCount);
|
|
|
|
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell);
|
2002-03-14 22:11:14 +00:00
|
|
|
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aRowIndex, int32_t aColIndex,
|
2002-03-14 22:11:14 +00:00
|
|
|
nsIDOMElement **aCell,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t* aStartRowIndex, int32_t* aStartColIndex,
|
|
|
|
int32_t* aRowSpan, int32_t* aColSpan,
|
|
|
|
int32_t* aActualRowSpan, int32_t* 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);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol,
|
|
|
|
int32_t aDirection, bool aSelected);
|
2002-09-13 04:19:30 +00:00
|
|
|
NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aSelectedCount,
|
2002-09-13 04:19:30 +00:00
|
|
|
nsIDOMElement** aTableElement);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *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
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *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 -------------- */
|
2014-04-25 10:34:42 +00:00
|
|
|
static already_AddRefed<mozilla::dom::Element> GetBlockNodeParent(nsINode* aNode);
|
2011-08-11 13:29:59 +00:00
|
|
|
static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
|
2001-04-05 23:48:01 +00:00
|
|
|
|
2012-07-01 11:07:16 +00:00
|
|
|
void IsNextCharInNodeWhitespace(nsIContent* aContent,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aOffset,
|
2012-07-01 11:07:16 +00:00
|
|
|
bool* outIsSpace,
|
|
|
|
bool* outIsNBSP,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsIContent** outNode = nullptr,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t* outOffset = 0);
|
2012-07-01 11:07:16 +00:00
|
|
|
void IsPrevCharInNodeWhitespace(nsIContent* aContent,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aOffset,
|
2012-07-01 11:07:16 +00:00
|
|
|
bool* outIsSpace,
|
|
|
|
bool* outIsNBSP,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsIContent** outNode = nullptr,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t* outOffset = 0);
|
2001-04-05 23:48:01 +00:00
|
|
|
|
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 */
|
2014-04-14 12:33:47 +00:00
|
|
|
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot,
|
|
|
|
nsISelectionController *aSelCon, uint32_t aFlags,
|
|
|
|
const nsAString& aValue);
|
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 */
|
2012-07-01 19:53:16 +00:00
|
|
|
// aElement must not be null.
|
|
|
|
static bool NodeIsBlockStatic(const mozilla::dom::Element* aElement);
|
2011-09-29 06:19:26 +00:00
|
|
|
static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
|
2012-07-01 19:53:16 +00:00
|
|
|
protected:
|
|
|
|
using nsEditor::IsBlockNode;
|
|
|
|
virtual bool IsBlockNode(nsINode *aNode);
|
2001-04-05 23:48:01 +00:00
|
|
|
|
2012-07-01 19:53:16 +00:00
|
|
|
public:
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetFlags(uint32_t aFlags);
|
1999-05-07 05:02:35 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD Paste(int32_t aSelectionType);
|
|
|
|
NS_IMETHOD CanPaste(int32_t 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
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD DebugUnitTests(int32_t *outNumTests, int32_t *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-08-12 18:28:26 +00:00
|
|
|
NS_IMETHOD StartOperation(EditAction opID,
|
2012-05-05 18:52:29 +00:00
|
|
|
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 */
|
2014-04-28 11:54:46 +00:00
|
|
|
virtual bool IsContainer(nsINode* aNode) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsContainer(nsIDOMNode* aNode) MOZ_OVERRIDE;
|
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);
|
2014-05-02 12:15:27 +00:00
|
|
|
using nsEditor::DeleteText;
|
2002-12-22 01:51:14 +00:00
|
|
|
NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength);
|
2007-06-28 02:48:16 +00:00
|
|
|
NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aInOutNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aInOutOffset,
|
2007-06-28 02:48:16 +00:00
|
|
|
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
|
|
|
|
2012-06-24 14:39:11 +00:00
|
|
|
NS_IMETHOD GetIsSelectionEditable(bool* aIsSelectionEditable);
|
|
|
|
|
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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *ioOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aNoEmptyNodes);
|
1999-08-19 22:11:58 +00:00
|
|
|
|
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
|
2014-04-28 11:54:46 +00:00
|
|
|
void CollapseSelectionToDeepestNonTableFirstChild(
|
|
|
|
mozilla::dom::Selection* aSelection, nsINode* 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.
|
|
|
|
* 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);
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t attrCount = aElement->GetAttrCount();
|
2012-02-10 10:04:46 +00:00
|
|
|
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);
|
2014-05-02 11:11:26 +00:00
|
|
|
already_AddRefed<mozilla::dom::Element> CreateBR(nsINode* aNode,
|
|
|
|
int32_t aOffset, EDirection aSelect = eNone);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t 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
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t 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
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex);
|
|
|
|
NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, int32_t aColIndex);
|
2000-07-01 00:37:12 +00:00
|
|
|
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);
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
|
|
|
|
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
|
2000-02-03 02:06:10 +00:00
|
|
|
|
2012-08-08 13:05:17 +00:00
|
|
|
// Helper used to get nsTableOuterFrame for a table.
|
|
|
|
nsTableOuterFrame* GetTableFrame(nsIDOMElement* aTable);
|
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)
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex);
|
2000-03-21 06:05:24 +00:00
|
|
|
// Test if all cells in row or column at given index are selected
|
2012-08-22 15:56:38 +00:00
|
|
|
bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns);
|
|
|
|
bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows);
|
2000-03-21 06:05:24 +00:00
|
|
|
|
2012-06-06 07:36:28 +00:00
|
|
|
bool IsEmptyCell(mozilla::dom::Element* 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,
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIDOMNode **aCellParent, int32_t *aCellOffset,
|
|
|
|
int32_t *aRowIndex, int32_t *aColIndex);
|
1999-08-04 02:06:03 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t& aActualRowSpan, int32_t& aActualColSpan);
|
2000-05-15 03:06:29 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t aColSpanLeft, int32_t aColSpanRight, nsIDOMElement **aNewCell);
|
2000-05-15 03:06:29 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t aRowSpanAbove, int32_t aRowSpanBelow, nsIDOMElement **aNewCell);
|
2000-05-15 03:06:29 +00:00
|
|
|
|
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
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, int32_t aRowIndex, int32_t& aNewRowCount);
|
|
|
|
NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, int32_t aColIndex, int32_t& 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
|
|
|
|
|
2014-04-28 11:54:46 +00:00
|
|
|
static already_AddRefed<mozilla::dom::Element>
|
|
|
|
GetEnclosingTable(nsINode* aNode);
|
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
|
2012-05-23 07:49:29 +00:00
|
|
|
*
|
|
|
|
* The nsIContent variant returns aIsSet instead of using an out parameter.
|
1999-08-09 01:37:50 +00:00
|
|
|
*/
|
2012-05-23 07:49:29 +00:00
|
|
|
bool IsTextPropertySetByContent(nsIContent* aContent,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsAString* outValue = nullptr);
|
2012-05-23 07:49:29 +00:00
|
|
|
|
2012-05-03 07:09:44 +00:00
|
|
|
void IsTextPropertySetByContent(nsIDOMNode* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue,
|
|
|
|
bool& aIsSet,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsAString* outValue = nullptr);
|
1999-08-09 01:37:50 +00:00
|
|
|
|
|
|
|
// Methods for handling plaintext quotations
|
2012-08-22 15:56:38 +00:00
|
|
|
NS_IMETHOD PasteAsPlaintextQuotation(int32_t 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
|
|
|
|
|
|
|
nsresult InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aDestOffset,
|
2012-02-17 14:16:59 +00:00
|
|
|
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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aDestinationOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aDoDeleteSelection);
|
2013-07-09 17:54:21 +00:00
|
|
|
nsresult InsertFromDataTransfer(mozilla::dom::DataTransfer *aDataTransfer,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aIndex,
|
2012-02-17 14:16:59 +00:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aDestOffset,
|
2012-02-17 14:16:59 +00:00
|
|
|
bool aDoDeleteSelection);
|
2011-09-29 06:19:26 +00:00
|
|
|
bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
|
2014-01-04 15:02:17 +00:00
|
|
|
nsresult ParseCFHTML(nsCString & aCfhtml, char16_t **aStuffToPaste, char16_t **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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aFragStartOffset,
|
2003-04-15 14:07:30 +00:00
|
|
|
nsIDOMNode **aFragEndNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aFragEndOffset,
|
2003-04-15 14:07:30 +00:00
|
|
|
nsIDOMNode **aTargetNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aTargetOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool *aDoContinue);
|
2004-03-04 18:47:49 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
bool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nullptr);
|
2011-09-29 06:19:26 +00:00
|
|
|
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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *outStartOffset,
|
|
|
|
int32_t *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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aStartOffset,
|
2003-04-15 14:07:30 +00:00
|
|
|
nsIDOMNode *aEndNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t 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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t 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 */
|
2014-04-25 10:34:42 +00:00
|
|
|
bool IsVisBreak(nsINode* aNode);
|
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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *insertOffset);
|
2003-04-15 20:53:15 +00:00
|
|
|
|
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 */
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult RelativeFontChange( int32_t aSizeChange);
|
2000-02-08 12:53:34 +00:00
|
|
|
|
|
|
|
/* helper routines for font size changing */
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
2000-02-08 12:53:34 +00:00
|
|
|
nsIDOMCharacterData *aTextNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
|
|
|
nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsINode* aNode);
|
|
|
|
nsresult RelativeFontChangeHelper(int32_t 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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset,
|
2000-03-24 00:26:47 +00:00
|
|
|
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,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t *aOffset,
|
2000-03-24 00:26:47 +00:00
|
|
|
nsIAtom *aProperty,
|
2002-03-23 22:08:20 +00:00
|
|
|
const nsAString *aAttribute,
|
2012-07-30 14:20:58 +00:00
|
|
|
nsCOMPtr<nsIDOMNode> *outLeftNode = nullptr,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outRightNode = nullptr);
|
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-08-22 15:56:38 +00:00
|
|
|
bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
|
|
|
|
bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
|
2011-09-29 06:19:26 +00:00
|
|
|
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-12-22 08:17:05 +00:00
|
|
|
|
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-08-22 15:56:38 +00:00
|
|
|
nsIContent* GetPriorHTMLSibling(nsINode* aParent, int32_t aOffset);
|
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-12-22 08:17:05 +00:00
|
|
|
|
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-08-22 15:56:38 +00:00
|
|
|
nsIContent* GetNextHTMLSibling(nsINode* aParent, int32_t aOffset);
|
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-12-22 08:17:05 +00:00
|
|
|
|
|
|
|
nsIContent* GetPriorHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIContent* GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
|
2012-07-01 11:53:45 +00:00
|
|
|
bool aNoBlockCrossing = false);
|
2012-12-22 08:17:05 +00:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
|
|
|
|
2012-12-22 08:17:05 +00:00
|
|
|
nsIContent* GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
2011-09-29 06:19:26 +00:00
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsIContent* GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
2012-07-01 11:53:45 +00:00
|
|
|
bool aNoBlockCrossing = false);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inParent, int32_t 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.
|
2013-04-04 14:27:41 +00:00
|
|
|
//
|
|
|
|
// aClearStyle should be set to false if you want the paste to be affected by
|
|
|
|
// local style (e.g., for the insertHTML command).
|
2010-09-27 17:21:34 +00:00
|
|
|
nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
|
|
|
|
const nsAString& aContextStr,
|
|
|
|
const nsAString& aInfoStr,
|
|
|
|
const nsAString& aFlavor,
|
|
|
|
nsIDOMDocument* aSourceDoc,
|
|
|
|
nsIDOMNode* aDestNode,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aDestOffset,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aDeleteSelection,
|
2013-04-04 14:27:41 +00:00
|
|
|
bool aTrustedInput,
|
|
|
|
bool aClearStyle = true);
|
2010-09-27 17:21:34 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult ClearStyle(nsCOMPtr<nsIDOMNode>* aNode, int32_t* aOffset,
|
2012-05-10 12:00:14 +00:00
|
|
|
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
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t 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
|
|
|
|
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.
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult GetElementOrigin(nsIDOMElement * aElement, int32_t & aX, int32_t & aY);
|
2003-06-25 08:50:48 +00:00
|
|
|
nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t & aX, int32_t & aY,
|
|
|
|
int32_t & aW, int32_t & aH,
|
|
|
|
int32_t & aBorderLeft,
|
|
|
|
int32_t & aBorderTop,
|
|
|
|
int32_t & aMarginLeft,
|
|
|
|
int32_t & aMarginTop);
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
/* 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;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mOriginalX;
|
|
|
|
int32_t mOriginalY;
|
2003-02-24 09:37:18 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mResizedObjectX;
|
|
|
|
int32_t mResizedObjectY;
|
|
|
|
int32_t mResizedObjectWidth;
|
|
|
|
int32_t mResizedObjectHeight;
|
2003-02-24 09:37:18 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mResizedObjectMarginLeft;
|
|
|
|
int32_t mResizedObjectMarginTop;
|
|
|
|
int32_t mResizedObjectBorderLeft;
|
|
|
|
int32_t mResizedObjectBorderTop;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mXIncrementFactor;
|
|
|
|
int32_t mYIncrementFactor;
|
|
|
|
int32_t mWidthIncrementFactor;
|
|
|
|
int32_t mHeightIncrementFactor;
|
2003-02-24 09:37:18 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int8_t mInfoXIncrement;
|
|
|
|
int8_t mInfoYIncrement;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
nsresult SetAllResizersPosition();
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult CreateResizer(nsIDOMElement ** aReturn, int16_t aLocation, nsIDOMNode * aParentNode);
|
|
|
|
void SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aResizer);
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
|
|
|
|
nsIDOMElement * aOriginalObject);
|
|
|
|
nsresult SetShadowPosition(nsIDOMElement * aShadow,
|
|
|
|
nsIDOMElement * aOriginalObject,
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t aOriginalObjectX,
|
|
|
|
int32_t aOriginalObjectY);
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SetResizingInfoPosition(int32_t aX, int32_t aY,
|
|
|
|
int32_t aW, int32_t aH);
|
2003-02-24 09:37:18 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID);
|
2003-02-24 09:37:18 +00:00
|
|
|
nsresult StartResizing(nsIDOMElement * aHandle);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t GetNewResizingX(int32_t aX, int32_t aY);
|
|
|
|
int32_t GetNewResizingY(int32_t aX, int32_t aY);
|
|
|
|
int32_t GetNewResizingWidth(int32_t aX, int32_t aY);
|
|
|
|
int32_t GetNewResizingHeight(int32_t aX, int32_t aY);
|
2003-02-24 09:37:18 +00:00
|
|
|
void HideShadowAndInfo();
|
2012-08-22 15:56:38 +00:00
|
|
|
void SetFinalSize(int32_t aX, int32_t aY);
|
2003-06-25 08:50:48 +00:00
|
|
|
void DeleteRefToAnonymousNode(nsIDOMNode * aNode);
|
2012-08-22 15:56:38 +00:00
|
|
|
void SetResizeIncrements(int32_t aX, int32_t aY, int32_t aW, int32_t aH, bool aPreserveRatio);
|
2011-02-20 05:43:07 +00:00
|
|
|
void HideAnonymousEditingUIs();
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
/* ABSOLUTE POSITIONING */
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mPositionedObjectX;
|
|
|
|
int32_t mPositionedObjectY;
|
|
|
|
int32_t mPositionedObjectWidth;
|
|
|
|
int32_t mPositionedObjectHeight;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mPositionedObjectMarginLeft;
|
|
|
|
int32_t mPositionedObjectMarginTop;
|
|
|
|
int32_t mPositionedObjectBorderLeft;
|
|
|
|
int32_t mPositionedObjectBorderTop;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
|
|
|
|
nsCOMPtr<nsIDOMElement> mGrabber;
|
|
|
|
nsCOMPtr<nsIDOMElement> mPositioningShadow;
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t mGridSize;
|
2003-06-25 08:50:48 +00:00
|
|
|
|
|
|
|
nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
|
|
|
|
nsresult StartMoving(nsIDOMElement * aHandle);
|
2012-08-22 15:56:38 +00:00
|
|
|
nsresult SetFinalPosition(int32_t aX, int32_t aY);
|
|
|
|
void AddPositioningOffset(int32_t & aX, int32_t & aY);
|
|
|
|
void SnapToGrid(int32_t & newX, int32_t & newY);
|
2003-06-25 08:50:48 +00:00
|
|
|
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:
|
2012-05-29 07:12:51 +00:00
|
|
|
// Helpers
|
|
|
|
bool IsSimpleModifiableNode(nsIContent* aContent,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2012-05-05 09:00:06 +00:00
|
|
|
nsresult SetInlinePropertyOnNodeImpl(nsIContent* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2014-04-06 14:56:08 +00:00
|
|
|
typedef enum { eInserted, eAppended } InsertedOrAppended;
|
|
|
|
void DoContentInserted(nsIDocument* aDocument, nsIContent* aContainer,
|
|
|
|
nsIContent* aChild, int32_t aIndexInContainer,
|
|
|
|
InsertedOrAppended aInsertedOrAppended);
|
2014-04-28 11:54:46 +00:00
|
|
|
already_AddRefed<mozilla::dom::Element> GetElementOrParentByTagName(
|
2014-04-28 11:54:47 +00:00
|
|
|
const nsAString& aTagName, nsINode* aNode);
|
|
|
|
already_AddRefed<mozilla::dom::Element> CreateElementWithDefaults(
|
|
|
|
const nsAString& aTagName);
|
1999-03-01 19:54:47 +00:00
|
|
|
};
|
|
|
|
#endif //nsHTMLEditor_h__
|
|
|
|
|