2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07: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/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsHTMLEditor_h__
|
|
|
|
#define nsHTMLEditor_h__
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsPlaintextEditor.h"
|
|
|
|
#include "nsIEditor.h"
|
|
|
|
#include "nsIHTMLEditor.h"
|
|
|
|
#include "nsITableEditor.h"
|
|
|
|
#include "nsIEditorMailSupport.h"
|
|
|
|
#include "nsIEditorStyleSheets.h"
|
|
|
|
|
|
|
|
#include "nsEditor.h"
|
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsICSSLoaderObserver.h"
|
|
|
|
|
|
|
|
#include "nsEditRules.h"
|
|
|
|
|
|
|
|
#include "nsEditProperty.h"
|
|
|
|
#include "nsHTMLCSSUtils.h"
|
|
|
|
|
|
|
|
#include "nsHTMLObjectResizer.h"
|
|
|
|
#include "nsIHTMLAbsPosEditor.h"
|
|
|
|
#include "nsIHTMLInlineTableEditor.h"
|
|
|
|
#include "nsIHTMLObjectResizeListener.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsIHTMLObjectResizer.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#include "nsIDocumentObserver.h"
|
|
|
|
|
|
|
|
#include "nsPoint.h"
|
2007-11-12 17:41:40 -08:00
|
|
|
#include "nsTArray.h"
|
2010-05-11 13:41:47 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2012-02-10 02:04:46 -08:00
|
|
|
#include "nsAttrName.h"
|
2012-07-12 23:33:42 -07:00
|
|
|
#include "nsStubMutationObserver.h"
|
2012-02-10 02:04:46 -08:00
|
|
|
|
2012-05-18 01:29:38 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-02-10 02:04:46 -08:00
|
|
|
#include "mozilla/dom/Element.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIDOMKeyEvent;
|
|
|
|
class nsITransferable;
|
|
|
|
class nsIDocumentEncoder;
|
|
|
|
class nsIClipboard;
|
|
|
|
class TypeInState;
|
|
|
|
class nsIContentFilter;
|
|
|
|
class nsIURL;
|
|
|
|
class nsILinkHandler;
|
2012-08-08 06:05:17 -07:00
|
|
|
class nsTableOuterFrame;
|
2009-04-22 01:43:15 -07:00
|
|
|
struct PropItem;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-11-27 03:51:53 -08:00
|
|
|
namespace mozilla {
|
|
|
|
namespace widget {
|
|
|
|
struct IMEState;
|
|
|
|
} // namespace widget
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/**
|
|
|
|
* The HTML editor implementation.<br>
|
|
|
|
* Use to edit HTML document represented as a DOM tree.
|
|
|
|
*/
|
|
|
|
class nsHTMLEditor : public nsPlaintextEditor,
|
|
|
|
public nsIHTMLEditor,
|
|
|
|
public nsIHTMLObjectResizer,
|
|
|
|
public nsIHTMLAbsPosEditor,
|
|
|
|
public nsITableEditor,
|
|
|
|
public nsIHTMLInlineTableEditor,
|
|
|
|
public nsIEditorStyleSheets,
|
2010-06-16 22:31:15 -07:00
|
|
|
public nsICSSLoaderObserver,
|
|
|
|
public nsStubMutationObserver
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
typedef enum {eNoOp, eReplaceParent=1, eInsertParent=2} BlockTransformationType;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
enum ResizingRequestID
|
|
|
|
{
|
|
|
|
kX = 0,
|
|
|
|
kY = 1,
|
|
|
|
kWidth = 2,
|
|
|
|
kHeight = 3
|
|
|
|
};
|
|
|
|
|
|
|
|
// see nsIHTMLEditor for documentation
|
|
|
|
|
|
|
|
//Interfaces for addref and release and queryinterface
|
|
|
|
//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 04:07:47 -08:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
|
|
|
|
nsHTMLEditor();
|
|
|
|
virtual ~nsHTMLEditor();
|
|
|
|
|
2012-06-01 04:03:17 -07:00
|
|
|
bool GetReturnInParagraphCreatesNewParagraph();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* ------------ nsPlaintextEditor overrides -------------- */
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD GetIsDocumentEditable(bool *aIsDocumentEditable);
|
2010-11-11 13:40:55 -08:00
|
|
|
NS_IMETHOD BeginningOfDocument();
|
2010-06-09 18:16:58 -07:00
|
|
|
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
|
2010-10-29 09:30:52 -07:00
|
|
|
virtual already_AddRefed<nsIContent> GetFocusedContent();
|
2012-11-09 00:40:39 -08:00
|
|
|
virtual already_AddRefed<nsIContent> GetFocusedContentForIME();
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsActiveInDOMWindow();
|
2013-10-22 16:32:04 -07:00
|
|
|
virtual already_AddRefed<mozilla::dom::EventTarget> GetDOMEventTarget();
|
2012-05-06 00:53:11 -07:00
|
|
|
virtual mozilla::dom::Element* GetEditorRoot() MOZ_OVERRIDE;
|
2010-06-19 03:39:39 -07:00
|
|
|
virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsAcceptableInputEvent(nsIDOMEvent* aEvent);
|
2012-03-26 18:36:44 -07:00
|
|
|
virtual already_AddRefed<nsIContent> GetInputEventTargetContent();
|
2010-11-16 12:45:49 -08:00
|
|
|
virtual bool IsEditable(nsIContent *aNode);
|
|
|
|
using nsEditor::IsEditable;
|
2010-05-04 10:40:39 -07:00
|
|
|
|
2010-06-16 22:31:15 -07:00
|
|
|
/* ------------ nsStubMutationObserver overrides --------- */
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
|
|
|
|
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
|
|
|
|
|
2010-05-04 10:40:39 -07:00
|
|
|
/* ------------ nsIEditorIMESupport overrides ------------ */
|
2011-11-27 03:51:53 -08:00
|
|
|
NS_IMETHOD GetPreferredIMEState(mozilla::widget::IMEState *aState);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* ------------ nsIHTMLEditor methods -------------- */
|
|
|
|
|
|
|
|
NS_DECL_NSIHTMLEDITOR
|
|
|
|
|
|
|
|
/* ------------ nsIHTMLObjectResizer methods -------------- */
|
|
|
|
/* -------- Implemented in nsHTMLObjectResizer.cpp -------- */
|
|
|
|
NS_DECL_NSIHTMLOBJECTRESIZER
|
|
|
|
|
|
|
|
/* ------------ nsIHTMLAbsPosEditor methods -------------- */
|
|
|
|
/* -------- Implemented in nsHTMLAbsPosition.cpp --------- */
|
|
|
|
NS_DECL_NSIHTMLABSPOSEDITOR
|
|
|
|
|
|
|
|
/* ------------ nsIHTMLInlineTableEditor methods -------------- */
|
|
|
|
/* ------- Implemented in nsHTMLInlineTableEditor.cpp --------- */
|
|
|
|
NS_DECL_NSIHTMLINLINETABLEEDITOR
|
|
|
|
|
|
|
|
/* ------------ nsIHTMLEditor methods -------------- */
|
|
|
|
NS_IMETHOD CopyLastEditableChildStyles(nsIDOMNode *aPreviousBlock, nsIDOMNode *aNewBlock,
|
|
|
|
nsIDOMNode **aOutBrNode);
|
|
|
|
|
|
|
|
NS_IMETHOD LoadHTML(const nsAString &aInputString);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetCSSBackgroundColorState(bool *aMixed, nsAString &aOutColor,
|
|
|
|
bool aBlockLevel);
|
|
|
|
NS_IMETHOD GetHTMLBackgroundColorState(bool *aMixed, nsAString &outColor);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* ------------ nsIEditorStyleSheets methods -------------- */
|
|
|
|
|
|
|
|
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-28 23:19:26 -07:00
|
|
|
NS_IMETHOD EnableStyleSheet(const nsAString& aURL, bool aEnable);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* ------------ nsIEditorMailSupport methods -------------- */
|
|
|
|
|
|
|
|
NS_DECL_NSIEDITORMAILSUPPORT
|
|
|
|
|
|
|
|
/* ------------ nsITableEditor methods -------------- */
|
|
|
|
|
2012-08-22 08:56:38 -07: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);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD DeleteTable();
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD DeleteTableCell(int32_t aNumber);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD DeleteTableCellContents();
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD DeleteTableColumn(int32_t aNumber);
|
|
|
|
NS_IMETHOD DeleteTableRow(int32_t aNumber);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SelectTableCell();
|
|
|
|
NS_IMETHOD SelectBlockOfCells(nsIDOMElement *aStartCell, nsIDOMElement *aEndCell);
|
|
|
|
NS_IMETHOD SelectTableRow();
|
|
|
|
NS_IMETHOD SelectTableColumn();
|
|
|
|
NS_IMETHOD SelectTable();
|
|
|
|
NS_IMETHOD SelectAllTableCells();
|
|
|
|
NS_IMETHOD SwitchTableCellHeaderType(nsIDOMElement *aSourceCell, nsIDOMElement **aNewCell);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD JoinTableCells(bool aMergeNonContiguousContents);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD SplitTableCell();
|
|
|
|
NS_IMETHOD NormalizeTable(nsIDOMElement *aTable);
|
|
|
|
NS_IMETHOD GetCellIndexes(nsIDOMElement *aCell,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* aRowIndex, int32_t* aColIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetTableSize(nsIDOMElement *aTable,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* aRowCount, int32_t* aColCount);
|
|
|
|
NS_IMETHOD GetCellAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex, nsIDOMElement **aCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetCellDataAt(nsIDOMElement* aTable,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aRowIndex, int32_t aColIndex,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMElement **aCell,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* aStartRowIndex, int32_t* aStartColIndex,
|
|
|
|
int32_t* aRowSpan, int32_t* aColSpan,
|
|
|
|
int32_t* aActualRowSpan, int32_t* aActualColSpan,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool* aIsSelected);
|
2007-03-22 10:30:00 -07: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 08:56:38 -07:00
|
|
|
NS_IMETHOD SetSelectionAfterTableEdit(nsIDOMElement* aTable, int32_t aRow, int32_t aCol,
|
|
|
|
int32_t aDirection, bool aSelected);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD GetSelectedOrParentTableElement(nsAString& aTagName,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aSelectedCount,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMElement** aTableElement);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetSelectedCellsType(nsIDOMElement *aElement, uint32_t *aSelectionType);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult GetCellFromRange(nsIDOMRange *aRange, nsIDOMElement **aCell);
|
|
|
|
|
|
|
|
// 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)
|
|
|
|
// aRange is optional: returns the range around the cell
|
|
|
|
NS_IMETHOD GetFirstSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
|
|
|
// Get next cell until no more are found. Always use GetFirstSelected cell first
|
|
|
|
// aRange is optional: returns the range around the cell
|
|
|
|
NS_IMETHOD GetNextSelectedCell(nsIDOMRange **aRange, nsIDOMElement **aCell);
|
|
|
|
|
|
|
|
// Upper-left-most selected cell in table
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetFirstSelectedCellInTable(int32_t *aRowIndex, int32_t *aColIndex, nsIDOMElement **aCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* miscellaneous */
|
|
|
|
// This sets background on the appropriate container element (table, cell,)
|
|
|
|
// or calls into nsTextEditor to set the page background
|
|
|
|
NS_IMETHOD SetCSSBackgroundColor(const nsAString& aColor);
|
|
|
|
NS_IMETHOD SetHTMLBackgroundColor(const nsAString& aColor);
|
|
|
|
|
|
|
|
/* ------------ Block methods moved from nsEditor -------------- */
|
2011-08-11 06:29:59 -07:00
|
|
|
static already_AddRefed<nsIDOMNode> GetBlockNodeParent(nsIDOMNode *aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-01 04:07:16 -07:00
|
|
|
void IsNextCharInNodeWhitespace(nsIContent* aContent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset,
|
2012-07-01 04:07:16 -07:00
|
|
|
bool* outIsSpace,
|
|
|
|
bool* outIsNBSP,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIContent** outNode = nullptr,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* outOffset = 0);
|
2012-07-01 04:07:16 -07:00
|
|
|
void IsPrevCharInNodeWhitespace(nsIContent* aContent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOffset,
|
2012-07-01 04:07:16 -07:00
|
|
|
bool* outIsSpace,
|
|
|
|
bool* outIsNBSP,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsIContent** outNode = nullptr,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t* outOffset = 0);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* ------------ Overrides of nsEditor interface methods -------------- */
|
|
|
|
|
|
|
|
nsresult EndUpdateViewBatch();
|
|
|
|
|
|
|
|
/** prepare the editor for use */
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Init(nsIDOMDocument *aDoc, nsIContent *aRoot, nsISelectionController *aSelCon, uint32_t aFlags);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD PreDestroy(bool aDestroyingFrames);
|
2010-06-16 22:31:15 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/** Internal, static version */
|
2012-07-01 12:53:16 -07:00
|
|
|
// aElement must not be null.
|
|
|
|
static bool NodeIsBlockStatic(const mozilla::dom::Element* aElement);
|
2011-09-28 23:19:26 -07:00
|
|
|
static nsresult NodeIsBlockStatic(nsIDOMNode *aNode, bool *aIsBlock);
|
2012-07-01 12:53:16 -07:00
|
|
|
protected:
|
|
|
|
using nsEditor::IsBlockNode;
|
|
|
|
virtual bool IsBlockNode(nsINode *aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-01 12:53:16 -07:00
|
|
|
public:
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SetFlags(uint32_t aFlags);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD Paste(int32_t aSelectionType);
|
|
|
|
NS_IMETHOD CanPaste(int32_t aSelectionType, bool *aCanPaste);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-01-10 17:45:45 -08:00
|
|
|
NS_IMETHOD PasteTransferable(nsITransferable *aTransferable);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD CanPasteTransferable(nsITransferable *aTransferable, bool *aCanPaste);
|
2010-01-10 17:45:45 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD DebugUnitTests(int32_t *outNumTests, int32_t *outNumTestsFailed);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** All editor operations which alter the doc should be prefaced
|
|
|
|
* with a call to StartOperation, naming the action and direction */
|
2012-08-12 11:28:26 -07:00
|
|
|
NS_IMETHOD StartOperation(EditAction opID,
|
2012-05-05 11:52:29 -07:00
|
|
|
nsIEditor::EDirection aDirection);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** All editor operations which alter the doc should be followed
|
|
|
|
* with a call to EndOperation */
|
|
|
|
NS_IMETHOD EndOperation();
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
/** returns true if aParentTag can contain a child of type aChildTag */
|
2012-04-30 23:34:52 -07:00
|
|
|
virtual bool TagCanContainTag(nsIAtom* aParentTag, nsIAtom* aChildTag);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
/** returns true if aNode is a container */
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual bool IsContainer(nsIDOMNode *aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/** make the given selection span the entire document */
|
|
|
|
NS_IMETHOD SelectEntireDocument(nsISelection *aSelection);
|
|
|
|
|
|
|
|
NS_IMETHOD SetAttributeOrEquivalent(nsIDOMElement * aElement,
|
|
|
|
const nsAString & aAttribute,
|
|
|
|
const nsAString & aValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aSuppressTransaction);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD RemoveAttributeOrEquivalent(nsIDOMElement * aElement,
|
|
|
|
const nsAString & aAttribute,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aSuppressTransaction);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-18 01:29:38 -07:00
|
|
|
/** join together any adjacent editable text nodes in the range */
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD CollapseAdjacentTextNodes(nsIDOMRange *aInRange);
|
|
|
|
|
2012-05-18 01:29:38 -07:00
|
|
|
virtual bool AreNodesSameType(nsIContent* aNode1, nsIContent* aNode2)
|
|
|
|
MOZ_OVERRIDE;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-05-10 07:54:33 -07:00
|
|
|
NS_IMETHOD DeleteSelectionImpl(EDirection aAction,
|
|
|
|
EStripWrappers aStripWrappers);
|
|
|
|
nsresult DeleteNode(nsINode* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHODIMP DeleteNode(nsIDOMNode * aNode);
|
|
|
|
NS_IMETHODIMP DeleteText(nsIDOMCharacterData *aTextNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t aOffset,
|
|
|
|
uint32_t aLength);
|
2007-06-27 19:48:16 -07:00
|
|
|
NS_IMETHOD InsertTextImpl(const nsAString& aStringToInsert,
|
|
|
|
nsCOMPtr<nsIDOMNode> *aInOutNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aInOutOffset,
|
2007-06-27 19:48:16 -07:00
|
|
|
nsIDOMDocument *aDoc);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD_(bool) IsModifiableNode(nsIDOMNode *aNode);
|
2011-11-28 04:53:29 -08:00
|
|
|
virtual bool IsModifiableNode(nsINode *aNode);
|
2007-06-27 19:48:16 -07:00
|
|
|
|
2012-06-24 07:39:11 -07:00
|
|
|
NS_IMETHOD GetIsSelectionEditable(bool* aIsSelectionEditable);
|
|
|
|
|
2007-06-27 19:48:16 -07:00
|
|
|
NS_IMETHOD SelectAll();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-06-16 22:29:40 -07:00
|
|
|
NS_IMETHOD GetRootElement(nsIDOMElement **aRootElement);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
/* ------------ nsICSSLoaderObserver -------------- */
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD StyleSheetLoaded(nsCSSStyleSheet*aSheet, bool aWasAlternate,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult aStatus);
|
|
|
|
|
|
|
|
/* ------------ Utility Routines, not part of public API -------------- */
|
2012-05-22 02:37:17 -07:00
|
|
|
NS_IMETHOD TypedText(const nsAString& aString, ETypingAction aAction);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult InsertNodeAtPoint( nsIDOMNode *aNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *ioParent,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *ioOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aNoEmptyNodes);
|
2007-03-22 10:30:00 -07: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
|
|
|
|
nsresult CollapseSelectionToDeepestNonTableFirstChild(nsISelection *aSelection, nsIDOMNode *aNode);
|
|
|
|
|
2012-05-05 02:00:06 -07:00
|
|
|
/**
|
|
|
|
* aNode must be a non-null text node.
|
|
|
|
* outIsEmptyNode must be non-null.
|
|
|
|
*/
|
2012-01-24 23:50:05 -08:00
|
|
|
nsresult IsVisTextNode(nsIContent* aNode,
|
|
|
|
bool* outIsEmptyNode,
|
|
|
|
bool aSafeToAskFrames);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult IsEmptyNode(nsIDOMNode *aNode, bool *outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount = false,
|
|
|
|
bool aListOrCellNotEmpty = false,
|
|
|
|
bool aSafeToAskFrames = false);
|
2012-01-24 23:50:06 -08:00
|
|
|
nsresult IsEmptyNode(nsINode* aNode, bool* outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount = false,
|
|
|
|
bool aListOrCellNotEmpty = false,
|
|
|
|
bool aSafeToAskFrames = false);
|
2012-01-24 23:50:05 -08:00
|
|
|
nsresult IsEmptyNodeImpl(nsINode* aNode,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *outIsEmptyBlock,
|
|
|
|
bool aMozBRDoesntCount,
|
|
|
|
bool aListOrCellNotEmpty,
|
|
|
|
bool aSafeToAskFrames,
|
|
|
|
bool *aSeenBR);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Returns TRUE if sheet was loaded, false if it wasn't
|
2011-09-28 23:19:26 -07:00
|
|
|
bool EnableExistingStyleSheet(const nsAString& aURL);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Dealing with the internal style sheet lists:
|
|
|
|
NS_IMETHOD GetStyleSheetForURL(const nsAString &aURL,
|
2010-05-11 13:41:47 -07:00
|
|
|
nsCSSStyleSheet **_retval);
|
|
|
|
NS_IMETHOD GetURLForStyleSheet(nsCSSStyleSheet *aStyleSheet, nsAString &aURL);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Add a url + known style sheet to the internal lists:
|
|
|
|
nsresult AddNewStyleSheetToList(const nsAString &aURL,
|
2010-05-11 13:41:47 -07:00
|
|
|
nsCSSStyleSheet *aStyleSheet);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult RemoveStyleSheetFromList(const nsAString &aURL);
|
2012-02-01 02:54:22 -08:00
|
|
|
|
|
|
|
bool IsCSSEnabled()
|
|
|
|
{
|
|
|
|
// TODO: removal of mCSSAware and use only the presence of mHTMLCSSUtils
|
|
|
|
return mCSSAware && mHTMLCSSUtils && mHTMLCSSUtils->IsCSSPrefChecked();
|
|
|
|
}
|
|
|
|
|
2012-02-10 02:04:46 -08:00
|
|
|
static bool HasAttributes(mozilla::dom::Element* aElement)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aElement);
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t attrCount = aElement->GetAttrCount();
|
2012-02-10 02:04:46 -08:00
|
|
|
return attrCount > 1 ||
|
|
|
|
(1 == attrCount && !aElement->GetAttrNameAt(0)->Equals(nsGkAtoms::mozdirty));
|
|
|
|
}
|
2012-02-01 02:54:22 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
NS_IMETHOD InitRules();
|
|
|
|
|
|
|
|
// Create the event listeners for the editor to install
|
2011-07-15 03:18:35 -07:00
|
|
|
virtual void CreateEventListeners();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-04-19 05:20:42 -07:00
|
|
|
virtual nsresult InstallEventListeners();
|
2007-03-22 10:30:00 -07:00
|
|
|
virtual void RemoveEventListeners();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool ShouldReplaceRootElement();
|
2010-06-16 22:32:05 -07:00
|
|
|
void ResetRootElementAndEventTarget();
|
2010-06-16 22:29:40 -07:00
|
|
|
nsresult GetBodyElement(nsIDOMHTMLElement** aBody);
|
2010-07-22 09:22:44 -07:00
|
|
|
// Get the focused node of this editor.
|
|
|
|
// @return If the editor has focus, this returns the focused node.
|
|
|
|
// Otherwise, returns null.
|
2010-06-16 22:32:05 -07:00
|
|
|
already_AddRefed<nsINode> GetFocusedNode();
|
2010-06-16 22:29:40 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Return TRUE if aElement is a table-related elemet and caret was set
|
2011-09-28 23:19:26 -07:00
|
|
|
bool SetCaretInTableCell(nsIDOMElement* aElement);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// key event helpers
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD TabInTable(bool inIsShift, bool *outHandled);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD CreateBR(nsIDOMNode *aNode, int32_t aOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *outBRNode, nsIEditor::EDirection aSelect = nsIEditor::eNone);
|
|
|
|
|
|
|
|
// Table Editing (implemented in nsTableEditor.cpp)
|
|
|
|
|
|
|
|
// Table utilities
|
|
|
|
|
|
|
|
// 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 08:56:38 -07:00
|
|
|
NS_IMETHOD InsertCell(nsIDOMElement *aCell, int32_t aRowSpan, int32_t aColSpan,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAfter, bool aIsHeader, nsIDOMElement **aNewCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Helpers that don't touch the selection or do batch transactions
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD DeleteRow(nsIDOMElement *aTable, int32_t aRowIndex);
|
|
|
|
NS_IMETHOD DeleteColumn(nsIDOMElement *aTable, int32_t aColIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD DeleteCellContents(nsIDOMElement *aCell);
|
|
|
|
|
|
|
|
// Move all contents from aCellToMerge into aTargetCell (append at end)
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD MergeCells(nsCOMPtr<nsIDOMElement> aTargetCell, nsCOMPtr<nsIDOMElement> aCellToMerge, bool aDeleteCellToMerge);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
NS_IMETHOD DeleteTable2(nsIDOMElement *aTable, nsISelection *aSelection);
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SetColSpan(nsIDOMElement *aCell, int32_t aColSpan);
|
|
|
|
NS_IMETHOD SetRowSpan(nsIDOMElement *aCell, int32_t aRowSpan);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-08 06:05:17 -07:00
|
|
|
// Helper used to get nsTableOuterFrame for a table.
|
|
|
|
nsTableOuterFrame* GetTableFrame(nsIDOMElement* aTable);
|
2007-03-22 10:30:00 -07: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 08:56:38 -07:00
|
|
|
int32_t GetNumberOfCellsInRow(nsIDOMElement* aTable, int32_t rowIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
// Test if all cells in row or column at given index are selected
|
2012-08-22 08:56:38 -07:00
|
|
|
bool AllCellsInRowSelected(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aNumberOfColumns);
|
|
|
|
bool AllCellsInColumnSelected(nsIDOMElement *aTable, int32_t aColIndex, int32_t aNumberOfRows);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-06-06 00:36:28 -07:00
|
|
|
bool IsEmptyCell(mozilla::dom::Element* aCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Most insert methods need to get the same basic context data
|
|
|
|
// 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
|
|
|
|
NS_IMETHOD GetCellContext(nsISelection **aSelection,
|
|
|
|
nsIDOMElement **aTable,
|
|
|
|
nsIDOMElement **aCell,
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIDOMNode **aCellParent, int32_t *aCellOffset,
|
|
|
|
int32_t *aRowIndex, int32_t *aColIndex);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD GetCellSpansAt(nsIDOMElement* aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t& aActualRowSpan, int32_t& aActualColSpan);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SplitCellIntoColumns(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t aColSpanLeft, int32_t aColSpanRight, nsIDOMElement **aNewCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD SplitCellIntoRows(nsIDOMElement *aTable, int32_t aRowIndex, int32_t aColIndex,
|
|
|
|
int32_t aRowSpanAbove, int32_t aRowSpanBelow, nsIDOMElement **aNewCell);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult CopyCellBackgroundColor(nsIDOMElement *destCell, nsIDOMElement *sourceCell);
|
|
|
|
|
2010-05-23 12:26:15 -07:00
|
|
|
// Reduce rowspan/colspan when cells span into nonexistent rows/columns
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD FixBadRowSpan(nsIDOMElement *aTable, int32_t aRowIndex, int32_t& aNewRowCount);
|
|
|
|
NS_IMETHOD FixBadColSpan(nsIDOMElement *aTable, int32_t aColIndex, int32_t& aNewColCount);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Fallback method: Call this after using ClearSelection() and you
|
|
|
|
// failed to set selection to some other content in the document
|
|
|
|
NS_IMETHOD SetSelectionAtDocumentStart(nsISelection *aSelection);
|
|
|
|
|
|
|
|
// End of Table Editing utilities
|
|
|
|
|
|
|
|
static nsCOMPtr<nsIDOMNode> GetEnclosingTable(nsIDOMNode *aNode);
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
/** content-based query returns true if <aProperty aAttribute=aValue> effects aNode
|
2007-03-22 10:30:00 -07: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 07:59:28 -07:00
|
|
|
* @param aIsSet [OUT] true if <aProperty aAttribute=aValue> effects aNode.
|
2012-05-03 00:09:44 -07:00
|
|
|
* @param outValue [OUT] the value of the attribute, if aIsSet is true
|
2012-05-23 00:49:29 -07:00
|
|
|
*
|
|
|
|
* The nsIContent variant returns aIsSet instead of using an out parameter.
|
2007-03-22 10:30:00 -07:00
|
|
|
*/
|
2012-05-23 00:49:29 -07:00
|
|
|
bool IsTextPropertySetByContent(nsIContent* aContent,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsAString* outValue = nullptr);
|
2012-05-23 00:49:29 -07:00
|
|
|
|
2012-05-03 00:09:44 -07:00
|
|
|
void IsTextPropertySetByContent(nsIDOMNode* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue,
|
|
|
|
bool& aIsSet,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsAString* outValue = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Methods for handling plaintext quotations
|
2012-08-22 08:56:38 -07:00
|
|
|
NS_IMETHOD PasteAsPlaintextQuotation(int32_t aSelectionType);
|
2007-03-22 10:30:00 -07: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.
|
|
|
|
*/
|
|
|
|
NS_IMETHOD InsertAsPlaintextQuotation(const nsAString & aQuotedText,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aAddCites,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMNode **aNodeInserted);
|
2012-02-17 06:16:59 -08:00
|
|
|
|
|
|
|
nsresult InsertObject(const char* aType, nsISupports* aObject, bool aIsSafe,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aDestOffset,
|
2012-02-17 06:16:59 -08:00
|
|
|
bool aDoDeleteSelection);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// factored methods for handling insertion of data from transferables (drag&drop or clipboard)
|
|
|
|
NS_IMETHOD PrepareTransferable(nsITransferable **transferable);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD PrepareHTMLTransferable(nsITransferable **transferable, bool havePrivFlavor);
|
2007-03-22 10:30:00 -07:00
|
|
|
NS_IMETHOD InsertFromTransferable(nsITransferable *transferable,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
const nsAString & aContextStr,
|
|
|
|
const nsAString & aInfoStr,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aDestinationOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDoDeleteSelection);
|
2012-02-17 06:16:59 -08:00
|
|
|
nsresult InsertFromDataTransfer(nsIDOMDataTransfer *aDataTransfer,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aIndex,
|
2012-02-17 06:16:59 -08:00
|
|
|
nsIDOMDocument *aSourceDoc,
|
|
|
|
nsIDOMNode *aDestinationNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aDestOffset,
|
2012-02-17 06:16:59 -08:00
|
|
|
bool aDoDeleteSelection);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool HavePrivateHTMLFlavor( nsIClipboard *clipboard );
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ParseCFHTML(nsCString & aCfhtml, PRUnichar **aStuffToPaste, PRUnichar **aCfcontext);
|
|
|
|
nsresult DoContentFilterCallback(const nsAString &aFlavor,
|
|
|
|
nsIDOMDocument *aSourceDoc,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aWillDeleteSelection,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMNode **aFragmentAsNode,
|
|
|
|
nsIDOMNode **aFragStartNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aFragStartOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMNode **aFragEndNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aFragEndOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMNode **aTargetNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aTargetOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aDoContinue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-07-30 07:20:58 -07:00
|
|
|
bool IsInLink(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *outLink = nullptr);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult StripFormattingNodes(nsIDOMNode *aNode, bool aOnlyList = false);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult CreateDOMFragmentFromPaste(const nsAString & aInputString,
|
|
|
|
const nsAString & aContextStr,
|
|
|
|
const nsAString & aInfoStr,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outFragNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outStartNode,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outEndNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *outStartOffset,
|
|
|
|
int32_t *outEndOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aTrustedInput);
|
2011-07-29 04:48:04 -07:00
|
|
|
nsresult ParseFragment(const nsAString & aStr, nsIAtom* aContextLocalName,
|
2009-07-09 23:17:46 -07:00
|
|
|
nsIDocument* aTargetDoc,
|
2010-09-27 10:21:34 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *outNode,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aTrustedInput);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult CreateListOfNodesToPaste(nsIDOMNode *aFragmentAsNode,
|
|
|
|
nsCOMArray<nsIDOMNode>& outNodeList,
|
|
|
|
nsIDOMNode *aStartNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMNode *aEndNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aEndOffset);
|
2009-07-09 23:17:46 -07:00
|
|
|
nsresult CreateTagStack(nsTArray<nsString> &aTagStack,
|
|
|
|
nsIDOMNode *aNode);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetListAndTableParents( bool aEnd,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& aListOfNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& outArray);
|
|
|
|
nsresult DiscoverPartialListsAndTables(nsCOMArray<nsIDOMNode>& aPasteNodes,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListsAndTables,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *outHighWaterMark);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult ScanForListAndTableStructure(bool aEnd,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodes,
|
|
|
|
nsIDOMNode *aListOrTable,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outReplaceNode);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult ReplaceOrphanedStructure( bool aEnd,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMArray<nsIDOMNode>& aNodeArray,
|
|
|
|
nsCOMArray<nsIDOMNode>& aListAndTableArray,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aHighWaterMark);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsIDOMNode* GetArrayEndpoint(bool aEnd, nsCOMArray<nsIDOMNode>& aNodeArray);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* small utility routine to test if a break node is visible to user */
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsVisBreak(nsIDOMNode *aNode);
|
2007-03-22 10:30:00 -07: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 08:56:38 -07:00
|
|
|
int32_t *insertOffset);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* small utility routine to test the eEditorReadonly bit */
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsModifiable();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* helpers for block transformations */
|
|
|
|
nsresult MakeDefinitionItem(const nsAString & aItemType);
|
|
|
|
nsresult InsertBasicBlock(const nsAString & aBlockType);
|
|
|
|
|
|
|
|
/* increase/decrease the font size of selection */
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult RelativeFontChange( int32_t aSizeChange);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* helper routines for font size changing */
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult RelativeFontChangeOnTextNode( int32_t aSizeChange,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMCharacterData *aTextNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset);
|
|
|
|
nsresult RelativeFontChangeOnNode(int32_t aSizeChange, nsINode* aNode);
|
|
|
|
nsresult RelativeFontChangeHelper(int32_t aSizeChange, nsINode* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* helper routines for inline style */
|
|
|
|
nsresult SetInlinePropertyOnTextNode( nsIDOMCharacterData *aTextNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aStartOffset,
|
|
|
|
int32_t aEndOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
|
|
|
nsresult SetInlinePropertyOnNode( nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue);
|
2012-05-05 02:00:06 -07:00
|
|
|
nsresult SetInlinePropertyOnNode(nsIContent* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult PromoteInlineRange(nsIDOMRange *inRange);
|
|
|
|
nsresult PromoteRangeIfStartsOrEndsInNamedAnchor(nsIDOMRange *inRange);
|
|
|
|
nsresult SplitStyleAboveRange(nsIDOMRange *aRange,
|
|
|
|
nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute);
|
|
|
|
nsresult SplitStyleAbovePoint(nsCOMPtr<nsIDOMNode> *aNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t *aOffset,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute,
|
2012-07-30 07:20:58 -07:00
|
|
|
nsCOMPtr<nsIDOMNode> *outLeftNode = nullptr,
|
|
|
|
nsCOMPtr<nsIDOMNode> *outRightNode = nullptr);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult ApplyDefaultProperties();
|
|
|
|
nsresult RemoveStyleInside(nsIDOMNode *aNode,
|
|
|
|
nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute,
|
2012-04-17 10:50:19 -07:00
|
|
|
const bool aChildrenOnly = false);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult RemoveInlinePropertyImpl(nsIAtom *aProperty, const nsAString *aAttribute);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool NodeIsProperty(nsIDOMNode *aNode);
|
|
|
|
bool HasAttr(nsIDOMNode *aNode, const nsAString *aAttribute);
|
2012-08-22 08:56:38 -07:00
|
|
|
bool IsAtFrontOfNode(nsIDOMNode *aNode, int32_t aOffset);
|
|
|
|
bool IsAtEndOfNode(nsIDOMNode *aNode, int32_t aOffset);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsOnlyAttribute(nsIDOMNode *aElement, const nsAString *aAttribute);
|
2012-05-05 02:00:06 -07:00
|
|
|
bool IsOnlyAttribute(const nsIContent* aElement, const nsAString& aAttribute);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult RemoveBlockContainer(nsIDOMNode *inNode);
|
2012-12-22 00:17:05 -08:00
|
|
|
|
2012-05-05 02:00:06 -07:00
|
|
|
nsIContent* GetPriorHTMLSibling(nsINode* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIContent* GetPriorHTMLSibling(nsINode* aParent, int32_t aOffset);
|
|
|
|
nsresult GetPriorHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-12-22 00:17:05 -08:00
|
|
|
|
2012-05-05 02:00:06 -07:00
|
|
|
nsIContent* GetNextHTMLSibling(nsINode* aNode);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIContent* GetNextHTMLSibling(nsINode* aParent, int32_t aOffset);
|
|
|
|
nsresult GetNextHTMLSibling(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode);
|
2012-12-22 00:17:05 -08:00
|
|
|
|
|
|
|
nsIContent* GetPriorHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIContent* GetPriorHTMLNode(nsINode* aParent, int32_t aOffset,
|
2012-07-01 04:53:45 -07:00
|
|
|
bool aNoBlockCrossing = false);
|
2012-12-22 00:17:05 -08:00
|
|
|
nsresult GetPriorHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
|
|
|
|
2012-12-22 00:17:05 -08:00
|
|
|
nsIContent* GetNextHTMLNode(nsINode* aNode, bool aNoBlockCrossing = false);
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inNode, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsIContent* GetNextHTMLNode(nsINode* aParent, int32_t aOffset,
|
2012-07-01 04:53:45 -07:00
|
|
|
bool aNoBlockCrossing = false);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetNextHTMLNode(nsIDOMNode *inParent, int32_t inOffset, nsCOMPtr<nsIDOMNode> *outNode, bool bNoBlockCrossing = false);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
nsresult IsFirstEditableChild( nsIDOMNode *aNode, bool *aOutIsFirst);
|
|
|
|
nsresult IsLastEditableChild( nsIDOMNode *aNode, bool *aOutIsLast);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetFirstEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstChild);
|
|
|
|
nsresult GetLastEditableChild( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastChild);
|
|
|
|
|
|
|
|
nsresult GetFirstEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutFirstLeaf);
|
|
|
|
nsresult GetLastEditableLeaf( nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutLastLeaf);
|
|
|
|
|
|
|
|
nsresult GetInlinePropertyBase(nsIAtom *aProperty,
|
|
|
|
const nsAString *aAttribute,
|
|
|
|
const nsAString *aValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool *aFirst,
|
|
|
|
bool *aAny,
|
|
|
|
bool *aAll,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsAString *outValue,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aCheckDefaults = true);
|
2012-02-01 02:54:22 -08:00
|
|
|
bool HasStyleOrIdOrClass(mozilla::dom::Element* aElement);
|
|
|
|
nsresult RemoveElementIfNoStyleOrIdOrClass(nsIDOMNode* aElement);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-05-04 10:40:39 -07:00
|
|
|
// Whether the outer window of the DOM event target has focus or not.
|
2011-09-28 23:19:26 -07:00
|
|
|
bool OurWindowHasFocus();
|
2010-05-04 10:40:39 -07:00
|
|
|
|
2010-09-27 10:21:34 -07: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 07:27:41 -07: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 10:21:34 -07:00
|
|
|
nsresult DoInsertHTMLWithContext(const nsAString& aInputString,
|
|
|
|
const nsAString& aContextStr,
|
|
|
|
const nsAString& aInfoStr,
|
|
|
|
const nsAString& aFlavor,
|
|
|
|
nsIDOMDocument* aSourceDoc,
|
|
|
|
nsIDOMNode* aDestNode,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aDestOffset,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aDeleteSelection,
|
2013-04-04 07:27:41 -07:00
|
|
|
bool aTrustedInput,
|
|
|
|
bool aClearStyle = true);
|
2010-09-27 10:21:34 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult ClearStyle(nsCOMPtr<nsIDOMNode>* aNode, int32_t* aOffset,
|
2012-05-10 05:00:14 -07:00
|
|
|
nsIAtom* aProperty, const nsAString* aAttribute);
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// Data members
|
|
|
|
protected:
|
|
|
|
|
|
|
|
nsCOMArray<nsIContentFilter> mContentFilters;
|
|
|
|
|
2010-11-18 13:01:12 -08:00
|
|
|
nsRefPtr<TypeInState> mTypeInState;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCRInParagraphCreatesParagraph;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mCSSAware;
|
2010-11-18 13:01:12 -08:00
|
|
|
nsAutoPtr<nsHTMLCSSUtils> mHTMLCSSUtils;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// Used by GetFirstSelectedCell and GetNextSelectedCell
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mSelectedCellIndex;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsString mLastStyleSheetURL;
|
|
|
|
nsString mLastOverrideStyleSheetURL;
|
|
|
|
|
|
|
|
// Maintain a list of associated style sheets and their urls.
|
2009-01-18 12:14:14 -08:00
|
|
|
nsTArray<nsString> mStyleSheetURLs;
|
2010-05-11 13:41:47 -07:00
|
|
|
nsTArray<nsRefPtr<nsCSSStyleSheet> > mStyleSheets;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// an array for holding default style settings
|
2009-04-22 01:43:15 -07:00
|
|
|
nsTArray<PropItem*> mDefaultStyles;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
/* ANONYMOUS UTILS */
|
|
|
|
void RemoveListenerAndDeleteRef(const nsAString& aEvent,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-28 23:19:26 -07:00
|
|
|
bool aUseCapture,
|
2007-03-22 10:30:00 -07:00
|
|
|
nsIDOMElement* aElement,
|
|
|
|
nsIContent* aParentContent,
|
|
|
|
nsIPresShell* aShell);
|
|
|
|
void DeleteRefToAnonymousNode(nsIDOMElement* aElement,
|
|
|
|
nsIContent * aParentContent,
|
|
|
|
nsIPresShell* aShell);
|
2008-01-21 23:39:06 -08:00
|
|
|
|
2009-04-13 20:05:34 -07:00
|
|
|
nsresult ShowResizersInner(nsIDOMElement *aResizedElement);
|
|
|
|
|
2008-01-21 23:39:06 -08:00
|
|
|
// Returns the offset of an element's frame to its absolute containing block.
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult GetElementOrigin(nsIDOMElement * aElement, int32_t & aX, int32_t & aY);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult GetPositionAndDimensions(nsIDOMElement * aElement,
|
2012-08-22 08:56:38 -07: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);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* PACKED BOOLEANS FOR RESIZING, ABSOLUTE POSITIONING AND */
|
|
|
|
/* INLINE TABLE EDITING */
|
|
|
|
|
|
|
|
// resizing
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsObjectResizingEnabled;
|
|
|
|
bool mIsResizing;
|
|
|
|
bool mPreserveRatio;
|
|
|
|
bool mResizedObjectIsAnImage;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// absolute positioning
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsAbsolutelyPositioningEnabled;
|
|
|
|
bool mResizedObjectIsAbsolutelyPositioned;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mGrabberClicked;
|
|
|
|
bool mIsMoving;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mSnapToGridEnabled;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// inline table editing
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mIsInlineTableEditingEnabled;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* RESIZING */
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mTopRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mRightHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomLeftHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomHandle;
|
|
|
|
nsCOMPtr<nsIDOMElement> mBottomRightHandle;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mActivatedHandle;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizingShadow;
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizingInfo;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mResizedObject;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mMouseMotionListenerP;
|
|
|
|
nsCOMPtr<nsISelectionListener> mSelectionListenerP;
|
|
|
|
nsCOMPtr<nsIDOMEventListener> mResizeEventListenerP;
|
|
|
|
|
|
|
|
nsCOMArray<nsIHTMLObjectResizeListener> objectResizeEventListeners;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mOriginalX;
|
|
|
|
int32_t mOriginalY;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mResizedObjectX;
|
|
|
|
int32_t mResizedObjectY;
|
|
|
|
int32_t mResizedObjectWidth;
|
|
|
|
int32_t mResizedObjectHeight;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mResizedObjectMarginLeft;
|
|
|
|
int32_t mResizedObjectMarginTop;
|
|
|
|
int32_t mResizedObjectBorderLeft;
|
|
|
|
int32_t mResizedObjectBorderTop;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mXIncrementFactor;
|
|
|
|
int32_t mYIncrementFactor;
|
|
|
|
int32_t mWidthIncrementFactor;
|
|
|
|
int32_t mHeightIncrementFactor;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int8_t mInfoXIncrement;
|
|
|
|
int8_t mInfoYIncrement;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult SetAllResizersPosition();
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult CreateResizer(nsIDOMElement ** aReturn, int16_t aLocation, nsIDOMNode * aParentNode);
|
|
|
|
void SetAnonymousElementPosition(int32_t aX, int32_t aY, nsIDOMElement *aResizer);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult CreateShadow(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode,
|
|
|
|
nsIDOMElement * aOriginalObject);
|
|
|
|
nsresult SetShadowPosition(nsIDOMElement * aShadow,
|
|
|
|
nsIDOMElement * aOriginalObject,
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t aOriginalObjectX,
|
|
|
|
int32_t aOriginalObjectY);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult CreateResizingInfo(nsIDOMElement ** aReturn, nsIDOMNode * aParentNode);
|
2012-08-22 08:56:38 -07:00
|
|
|
nsresult SetResizingInfoPosition(int32_t aX, int32_t aY,
|
|
|
|
int32_t aW, int32_t aH);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t GetNewResizingIncrement(int32_t aX, int32_t aY, int32_t aID);
|
2007-03-22 10:30:00 -07:00
|
|
|
nsresult StartResizing(nsIDOMElement * aHandle);
|
2012-08-22 08:56:38 -07: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);
|
2007-03-22 10:30:00 -07:00
|
|
|
void HideShadowAndInfo();
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetFinalSize(int32_t aX, int32_t aY);
|
2007-03-22 10:30:00 -07:00
|
|
|
void DeleteRefToAnonymousNode(nsIDOMNode * aNode);
|
2012-08-22 08:56:38 -07:00
|
|
|
void SetResizeIncrements(int32_t aX, int32_t aY, int32_t aW, int32_t aH, bool aPreserveRatio);
|
2011-02-19 21:43:07 -08:00
|
|
|
void HideAnonymousEditingUIs();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
/* ABSOLUTE POSITIONING */
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPositionedObjectX;
|
|
|
|
int32_t mPositionedObjectY;
|
|
|
|
int32_t mPositionedObjectWidth;
|
|
|
|
int32_t mPositionedObjectHeight;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mPositionedObjectMarginLeft;
|
|
|
|
int32_t mPositionedObjectMarginTop;
|
|
|
|
int32_t mPositionedObjectBorderLeft;
|
|
|
|
int32_t mPositionedObjectBorderTop;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMElement> mAbsolutelyPositionedObject;
|
|
|
|
nsCOMPtr<nsIDOMElement> mGrabber;
|
|
|
|
nsCOMPtr<nsIDOMElement> mPositioningShadow;
|
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
int32_t mGridSize;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsresult CreateGrabber(nsIDOMNode * aParentNode, nsIDOMElement ** aReturn);
|
|
|
|
nsresult StartMoving(nsIDOMElement * aHandle);
|
2012-08-22 08:56:38 -07: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);
|
2007-03-22 10:30:00 -07: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);
|
|
|
|
|
|
|
|
nsCOMPtr<nsILinkHandler> mLinkHandler;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// friends
|
|
|
|
friend class nsHTMLEditRules;
|
|
|
|
friend class nsTextEditRules;
|
|
|
|
friend class nsWSRunObject;
|
2012-04-13 05:52:12 -07:00
|
|
|
friend class nsHTMLEditorEventListener;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-04-19 23:33:21 -07:00
|
|
|
private:
|
2012-05-29 00:12:51 -07:00
|
|
|
// Helpers
|
|
|
|
bool IsSimpleModifiableNode(nsIContent* aContent,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2012-05-05 02:00:06 -07:00
|
|
|
nsresult SetInlinePropertyOnNodeImpl(nsIContent* aNode,
|
|
|
|
nsIAtom* aProperty,
|
|
|
|
const nsAString* aAttribute,
|
|
|
|
const nsAString* aValue);
|
2012-04-19 23:33:21 -07:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
#endif //nsHTMLEditor_h__
|
|
|
|
|