Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsHTMLEditRules_h__ |
michael@0 | 7 | #define nsHTMLEditRules_h__ |
michael@0 | 8 | |
michael@0 | 9 | #include "TypeInState.h" |
michael@0 | 10 | #include "nsAutoPtr.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsEditor.h" |
michael@0 | 13 | #include "nsIEditActionListener.h" |
michael@0 | 14 | #include "nsIEditor.h" |
michael@0 | 15 | #include "nsIHTMLEditor.h" |
michael@0 | 16 | #include "nsISupportsImpl.h" |
michael@0 | 17 | #include "nsSelectionState.h" |
michael@0 | 18 | #include "nsTArray.h" |
michael@0 | 19 | #include "nsTextEditRules.h" |
michael@0 | 20 | #include "nscore.h" |
michael@0 | 21 | |
michael@0 | 22 | class nsHTMLEditor; |
michael@0 | 23 | class nsIAtom; |
michael@0 | 24 | class nsIDOMCharacterData; |
michael@0 | 25 | class nsIDOMDocument; |
michael@0 | 26 | class nsIDOMElement; |
michael@0 | 27 | class nsIDOMNode; |
michael@0 | 28 | class nsIDOMRange; |
michael@0 | 29 | class nsIEditor; |
michael@0 | 30 | class nsINode; |
michael@0 | 31 | class nsISelection; |
michael@0 | 32 | class nsPlaintextEditor; |
michael@0 | 33 | class nsRange; |
michael@0 | 34 | class nsRulesInfo; |
michael@0 | 35 | namespace mozilla { |
michael@0 | 36 | namespace dom { |
michael@0 | 37 | class Element; |
michael@0 | 38 | class Selection; |
michael@0 | 39 | } // namespace dom |
michael@0 | 40 | } // namespace mozilla |
michael@0 | 41 | struct DOMPoint; |
michael@0 | 42 | template <class E> class nsCOMArray; |
michael@0 | 43 | |
michael@0 | 44 | struct StyleCache : public PropItem |
michael@0 | 45 | { |
michael@0 | 46 | bool mPresent; |
michael@0 | 47 | |
michael@0 | 48 | StyleCache() : PropItem(), mPresent(false) { |
michael@0 | 49 | MOZ_COUNT_CTOR(StyleCache); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | StyleCache(nsIAtom *aTag, const nsAString &aAttr, const nsAString &aValue) : |
michael@0 | 53 | PropItem(aTag, aAttr, aValue), mPresent(false) { |
michael@0 | 54 | MOZ_COUNT_CTOR(StyleCache); |
michael@0 | 55 | } |
michael@0 | 56 | |
michael@0 | 57 | ~StyleCache() { |
michael@0 | 58 | MOZ_COUNT_DTOR(StyleCache); |
michael@0 | 59 | } |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | #define SIZE_STYLE_TABLE 19 |
michael@0 | 64 | |
michael@0 | 65 | class nsHTMLEditRules : public nsTextEditRules, public nsIEditActionListener |
michael@0 | 66 | { |
michael@0 | 67 | public: |
michael@0 | 68 | |
michael@0 | 69 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 70 | |
michael@0 | 71 | nsHTMLEditRules(); |
michael@0 | 72 | virtual ~nsHTMLEditRules(); |
michael@0 | 73 | |
michael@0 | 74 | |
michael@0 | 75 | // nsIEditRules methods |
michael@0 | 76 | NS_IMETHOD Init(nsPlaintextEditor *aEditor); |
michael@0 | 77 | NS_IMETHOD DetachEditor(); |
michael@0 | 78 | NS_IMETHOD BeforeEdit(EditAction action, |
michael@0 | 79 | nsIEditor::EDirection aDirection); |
michael@0 | 80 | NS_IMETHOD AfterEdit(EditAction action, |
michael@0 | 81 | nsIEditor::EDirection aDirection); |
michael@0 | 82 | NS_IMETHOD WillDoAction(mozilla::dom::Selection* aSelection, nsRulesInfo* aInfo, |
michael@0 | 83 | bool* aCancel, bool* aHandled); |
michael@0 | 84 | NS_IMETHOD DidDoAction(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult); |
michael@0 | 85 | NS_IMETHOD DocumentModified(); |
michael@0 | 86 | |
michael@0 | 87 | nsresult GetListState(bool *aMixed, bool *aOL, bool *aUL, bool *aDL); |
michael@0 | 88 | nsresult GetListItemState(bool *aMixed, bool *aLI, bool *aDT, bool *aDD); |
michael@0 | 89 | nsresult GetIndentState(bool *aCanIndent, bool *aCanOutdent); |
michael@0 | 90 | nsresult GetAlignment(bool *aMixed, nsIHTMLEditor::EAlignment *aAlign); |
michael@0 | 91 | nsresult GetParagraphState(bool *aMixed, nsAString &outFormat); |
michael@0 | 92 | nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode); |
michael@0 | 93 | |
michael@0 | 94 | // nsIEditActionListener methods |
michael@0 | 95 | |
michael@0 | 96 | NS_IMETHOD WillCreateNode(const nsAString& aTag, nsIDOMNode *aParent, int32_t aPosition); |
michael@0 | 97 | NS_IMETHOD DidCreateNode(const nsAString& aTag, nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult); |
michael@0 | 98 | NS_IMETHOD WillInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition); |
michael@0 | 99 | NS_IMETHOD DidInsertNode(nsIDOMNode *aNode, nsIDOMNode *aParent, int32_t aPosition, nsresult aResult); |
michael@0 | 100 | NS_IMETHOD WillDeleteNode(nsIDOMNode *aChild); |
michael@0 | 101 | NS_IMETHOD DidDeleteNode(nsIDOMNode *aChild, nsresult aResult); |
michael@0 | 102 | NS_IMETHOD WillSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset); |
michael@0 | 103 | NS_IMETHOD DidSplitNode(nsIDOMNode *aExistingRightNode, int32_t aOffset, nsIDOMNode *aNewLeftNode, nsresult aResult); |
michael@0 | 104 | NS_IMETHOD WillJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent); |
michael@0 | 105 | NS_IMETHOD DidJoinNodes(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, nsIDOMNode *aParent, nsresult aResult); |
michael@0 | 106 | NS_IMETHOD WillInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString); |
michael@0 | 107 | NS_IMETHOD DidInsertText(nsIDOMCharacterData *aTextNode, int32_t aOffset, const nsAString &aString, nsresult aResult); |
michael@0 | 108 | NS_IMETHOD WillDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength); |
michael@0 | 109 | NS_IMETHOD DidDeleteText(nsIDOMCharacterData *aTextNode, int32_t aOffset, int32_t aLength, nsresult aResult); |
michael@0 | 110 | NS_IMETHOD WillDeleteSelection(nsISelection *aSelection); |
michael@0 | 111 | NS_IMETHOD DidDeleteSelection(nsISelection *aSelection); |
michael@0 | 112 | |
michael@0 | 113 | protected: |
michael@0 | 114 | |
michael@0 | 115 | enum RulesEndpoint |
michael@0 | 116 | { |
michael@0 | 117 | kStart, |
michael@0 | 118 | kEnd |
michael@0 | 119 | }; |
michael@0 | 120 | |
michael@0 | 121 | enum BRLocation |
michael@0 | 122 | { |
michael@0 | 123 | kBeforeBlock, |
michael@0 | 124 | kBlockEnd |
michael@0 | 125 | }; |
michael@0 | 126 | |
michael@0 | 127 | void InitFields(); |
michael@0 | 128 | |
michael@0 | 129 | // nsHTMLEditRules implementation methods |
michael@0 | 130 | nsresult WillInsert(nsISelection *aSelection, bool *aCancel); |
michael@0 | 131 | nsresult WillInsertText( EditAction aAction, |
michael@0 | 132 | mozilla::dom::Selection* aSelection, |
michael@0 | 133 | bool *aCancel, |
michael@0 | 134 | bool *aHandled, |
michael@0 | 135 | const nsAString *inString, |
michael@0 | 136 | nsAString *outString, |
michael@0 | 137 | int32_t aMaxLength); |
michael@0 | 138 | nsresult WillLoadHTML(nsISelection *aSelection, bool *aCancel); |
michael@0 | 139 | nsresult WillInsertBreak(mozilla::dom::Selection* aSelection, |
michael@0 | 140 | bool* aCancel, bool* aHandled); |
michael@0 | 141 | nsresult StandardBreakImpl(nsIDOMNode *aNode, int32_t aOffset, nsISelection *aSelection); |
michael@0 | 142 | nsresult DidInsertBreak(nsISelection *aSelection, nsresult aResult); |
michael@0 | 143 | nsresult SplitMailCites(nsISelection *aSelection, bool aPlaintext, bool *aHandled); |
michael@0 | 144 | nsresult WillDeleteSelection(mozilla::dom::Selection* aSelection, |
michael@0 | 145 | nsIEditor::EDirection aAction, |
michael@0 | 146 | nsIEditor::EStripWrappers aStripWrappers, |
michael@0 | 147 | bool* aCancel, bool* aHandled); |
michael@0 | 148 | nsresult DidDeleteSelection(nsISelection *aSelection, |
michael@0 | 149 | nsIEditor::EDirection aDir, |
michael@0 | 150 | nsresult aResult); |
michael@0 | 151 | nsresult InsertBRIfNeeded(nsISelection *aSelection); |
michael@0 | 152 | nsresult GetGoodSelPointForNode(nsIDOMNode *aNode, nsIEditor::EDirection aAction, |
michael@0 | 153 | nsCOMPtr<nsIDOMNode> *outSelNode, int32_t *outSelOffset); |
michael@0 | 154 | nsresult JoinBlocks(nsIDOMNode *aLeftNode, nsIDOMNode *aRightNode, bool *aCanceled); |
michael@0 | 155 | nsresult MoveBlock(nsIDOMNode *aLeft, nsIDOMNode *aRight, int32_t aLeftOffset, int32_t aRightOffset); |
michael@0 | 156 | nsresult MoveNodeSmart(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset); |
michael@0 | 157 | nsresult MoveContents(nsIDOMNode *aSource, nsIDOMNode *aDest, int32_t *aOffset); |
michael@0 | 158 | nsresult DeleteNonTableElements(nsINode* aNode); |
michael@0 | 159 | nsresult WillMakeList(mozilla::dom::Selection* aSelection, |
michael@0 | 160 | const nsAString* aListType, |
michael@0 | 161 | bool aEntireList, |
michael@0 | 162 | const nsAString* aBulletType, |
michael@0 | 163 | bool* aCancel, bool* aHandled, |
michael@0 | 164 | const nsAString* aItemType = nullptr); |
michael@0 | 165 | nsresult WillRemoveList(mozilla::dom::Selection* aSelection, |
michael@0 | 166 | bool aOrdered, bool* aCancel, bool* aHandled); |
michael@0 | 167 | nsresult WillIndent(mozilla::dom::Selection* aSelection, |
michael@0 | 168 | bool* aCancel, bool* aHandled); |
michael@0 | 169 | nsresult WillCSSIndent(mozilla::dom::Selection* aSelection, |
michael@0 | 170 | bool* aCancel, bool* aHandled); |
michael@0 | 171 | nsresult WillHTMLIndent(mozilla::dom::Selection* aSelection, |
michael@0 | 172 | bool* aCancel, bool* aHandled); |
michael@0 | 173 | nsresult WillOutdent(mozilla::dom::Selection* aSelection, |
michael@0 | 174 | bool* aCancel, bool* aHandled); |
michael@0 | 175 | nsresult WillAlign(mozilla::dom::Selection* aSelection, |
michael@0 | 176 | const nsAString* alignType, |
michael@0 | 177 | bool* aCancel, bool* aHandled); |
michael@0 | 178 | nsresult WillAbsolutePosition(mozilla::dom::Selection* aSelection, |
michael@0 | 179 | bool* aCancel, bool* aHandled); |
michael@0 | 180 | nsresult WillRemoveAbsolutePosition(mozilla::dom::Selection* aSelection, |
michael@0 | 181 | bool* aCancel, bool* aHandled); |
michael@0 | 182 | nsresult WillRelativeChangeZIndex(mozilla::dom::Selection* aSelection, |
michael@0 | 183 | int32_t aChange, |
michael@0 | 184 | bool* aCancel, bool* aHandled); |
michael@0 | 185 | nsresult WillMakeDefListItem(mozilla::dom::Selection* aSelection, |
michael@0 | 186 | const nsAString* aBlockType, bool aEntireList, |
michael@0 | 187 | bool* aCancel, bool* aHandled); |
michael@0 | 188 | nsresult WillMakeBasicBlock(mozilla::dom::Selection* aSelection, |
michael@0 | 189 | const nsAString* aBlockType, |
michael@0 | 190 | bool* aCancel, bool* aHandled); |
michael@0 | 191 | nsresult DidMakeBasicBlock(nsISelection *aSelection, nsRulesInfo *aInfo, nsresult aResult); |
michael@0 | 192 | nsresult DidAbsolutePosition(); |
michael@0 | 193 | nsresult AlignInnerBlocks(nsIDOMNode *aNode, const nsAString *alignType); |
michael@0 | 194 | nsresult AlignBlockContents(nsIDOMNode *aNode, const nsAString *alignType); |
michael@0 | 195 | nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray, |
michael@0 | 196 | nsINode* aNode); |
michael@0 | 197 | nsresult AppendInnerFormatNodes(nsCOMArray<nsIDOMNode>& aArray, |
michael@0 | 198 | nsIDOMNode *aNode); |
michael@0 | 199 | nsresult GetFormatString(nsIDOMNode *aNode, nsAString &outFormat); |
michael@0 | 200 | nsresult GetInnerContent(nsIDOMNode *aNode, nsCOMArray<nsIDOMNode>& outArrayOfNodes, int32_t *aIndex, bool aList = true, bool aTble = true); |
michael@0 | 201 | already_AddRefed<nsIDOMNode> IsInListItem(nsIDOMNode* aNode); |
michael@0 | 202 | nsINode* IsInListItem(nsINode* aNode); |
michael@0 | 203 | nsresult ReturnInHeader(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, int32_t aOffset); |
michael@0 | 204 | nsresult ReturnInParagraph(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, int32_t aOffset, bool *aCancel, bool *aHandled); |
michael@0 | 205 | nsresult SplitParagraph(nsIDOMNode *aPara, |
michael@0 | 206 | nsIDOMNode *aBRNode, |
michael@0 | 207 | nsISelection *aSelection, |
michael@0 | 208 | nsCOMPtr<nsIDOMNode> *aSelNode, |
michael@0 | 209 | int32_t *aOffset); |
michael@0 | 210 | nsresult ReturnInListItem(nsISelection *aSelection, nsIDOMNode *aHeader, nsIDOMNode *aTextNode, int32_t aOffset); |
michael@0 | 211 | nsresult AfterEditInner(EditAction action, |
michael@0 | 212 | nsIEditor::EDirection aDirection); |
michael@0 | 213 | nsresult RemovePartOfBlock(nsIDOMNode *aBlock, |
michael@0 | 214 | nsIDOMNode *aStartChild, |
michael@0 | 215 | nsIDOMNode *aEndChild, |
michael@0 | 216 | nsCOMPtr<nsIDOMNode> *aLeftNode = 0, |
michael@0 | 217 | nsCOMPtr<nsIDOMNode> *aRightNode = 0); |
michael@0 | 218 | nsresult SplitBlock(nsIDOMNode *aBlock, |
michael@0 | 219 | nsIDOMNode *aStartChild, |
michael@0 | 220 | nsIDOMNode *aEndChild, |
michael@0 | 221 | nsCOMPtr<nsIDOMNode> *aLeftNode = 0, |
michael@0 | 222 | nsCOMPtr<nsIDOMNode> *aRightNode = 0, |
michael@0 | 223 | nsCOMPtr<nsIDOMNode> *aMiddleNode = 0); |
michael@0 | 224 | nsresult OutdentPartOfBlock(nsIDOMNode *aBlock, |
michael@0 | 225 | nsIDOMNode *aStartChild, |
michael@0 | 226 | nsIDOMNode *aEndChild, |
michael@0 | 227 | bool aIsBlockIndentedWithCSS, |
michael@0 | 228 | nsCOMPtr<nsIDOMNode> *aLeftNode = 0, |
michael@0 | 229 | nsCOMPtr<nsIDOMNode> *aRightNode = 0); |
michael@0 | 230 | |
michael@0 | 231 | nsresult ConvertListType(nsIDOMNode* aList, |
michael@0 | 232 | nsCOMPtr<nsIDOMNode>* outList, |
michael@0 | 233 | nsIAtom* aListType, |
michael@0 | 234 | nsIAtom* aItemType); |
michael@0 | 235 | nsresult ConvertListType(nsINode* aList, |
michael@0 | 236 | mozilla::dom::Element** aOutList, |
michael@0 | 237 | nsIAtom* aListType, |
michael@0 | 238 | nsIAtom* aItemType); |
michael@0 | 239 | |
michael@0 | 240 | nsresult CreateStyleForInsertText(nsISelection *aSelection, nsIDOMDocument *aDoc); |
michael@0 | 241 | nsresult IsEmptyBlock(nsIDOMNode *aNode, |
michael@0 | 242 | bool *outIsEmptyBlock, |
michael@0 | 243 | bool aMozBRDoesntCount = false, |
michael@0 | 244 | bool aListItemsNotEmpty = false); |
michael@0 | 245 | nsresult CheckForEmptyBlock(nsIDOMNode *aStartNode, |
michael@0 | 246 | nsIDOMNode *aBodyNode, |
michael@0 | 247 | nsISelection *aSelection, |
michael@0 | 248 | bool *aHandled); |
michael@0 | 249 | nsresult CheckForInvisibleBR(nsIDOMNode *aBlock, nsHTMLEditRules::BRLocation aWhere, |
michael@0 | 250 | nsCOMPtr<nsIDOMNode> *outBRNode, int32_t aOffset=0); |
michael@0 | 251 | nsresult ExpandSelectionForDeletion(nsISelection *aSelection); |
michael@0 | 252 | bool IsFirstNode(nsIDOMNode *aNode); |
michael@0 | 253 | bool IsLastNode(nsIDOMNode *aNode); |
michael@0 | 254 | nsresult NormalizeSelection(nsISelection *inSelection); |
michael@0 | 255 | void GetPromotedPoint(RulesEndpoint aWhere, nsIDOMNode* aNode, |
michael@0 | 256 | int32_t aOffset, EditAction actionID, |
michael@0 | 257 | nsCOMPtr<nsIDOMNode>* outNode, int32_t* outOffset); |
michael@0 | 258 | nsresult GetPromotedRanges(nsISelection *inSelection, |
michael@0 | 259 | nsCOMArray<nsIDOMRange> &outArrayOfRanges, |
michael@0 | 260 | EditAction inOperationType); |
michael@0 | 261 | nsresult PromoteRange(nsIDOMRange *inRange, |
michael@0 | 262 | EditAction inOperationType); |
michael@0 | 263 | nsresult GetNodesForOperation(nsCOMArray<nsIDOMRange>& inArrayOfRanges, |
michael@0 | 264 | nsCOMArray<nsIDOMNode>& outArrayOfNodes, |
michael@0 | 265 | EditAction inOperationType, |
michael@0 | 266 | bool aDontTouchContent=false); |
michael@0 | 267 | nsresult GetChildNodesForOperation(nsIDOMNode *inNode, |
michael@0 | 268 | nsCOMArray<nsIDOMNode>& outArrayOfNodes); |
michael@0 | 269 | nsresult GetNodesFromPoint(DOMPoint point, |
michael@0 | 270 | EditAction operation, |
michael@0 | 271 | nsCOMArray<nsIDOMNode>& arrayOfNodes, |
michael@0 | 272 | bool dontTouchContent); |
michael@0 | 273 | nsresult GetNodesFromSelection(nsISelection *selection, |
michael@0 | 274 | EditAction operation, |
michael@0 | 275 | nsCOMArray<nsIDOMNode>& arrayOfNodes, |
michael@0 | 276 | bool aDontTouchContent=false); |
michael@0 | 277 | nsresult GetListActionNodes(nsCOMArray<nsIDOMNode> &outArrayOfNodes, bool aEntireList, bool aDontTouchContent=false); |
michael@0 | 278 | void GetDefinitionListItemTypes(mozilla::dom::Element* aElement, bool* aDT, bool* aDD); |
michael@0 | 279 | nsresult GetParagraphFormatNodes(nsCOMArray<nsIDOMNode>& outArrayOfNodes, bool aDontTouchContent=false); |
michael@0 | 280 | nsresult LookInsideDivBQandList(nsCOMArray<nsIDOMNode>& aNodeArray); |
michael@0 | 281 | nsresult BustUpInlinesAtRangeEndpoints(nsRangeStore &inRange); |
michael@0 | 282 | nsresult BustUpInlinesAtBRs(nsIDOMNode *inNode, |
michael@0 | 283 | nsCOMArray<nsIDOMNode>& outArrayOfNodes); |
michael@0 | 284 | nsCOMPtr<nsIDOMNode> GetHighestInlineParent(nsIDOMNode* aNode); |
michael@0 | 285 | nsresult MakeTransitionList(nsCOMArray<nsIDOMNode>& inArrayOfNodes, |
michael@0 | 286 | nsTArray<bool> &inTransitionArray); |
michael@0 | 287 | nsresult RemoveBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes); |
michael@0 | 288 | nsresult ApplyBlockStyle(nsCOMArray<nsIDOMNode>& arrayOfNodes, const nsAString *aBlockTag); |
michael@0 | 289 | nsresult MakeBlockquote(nsCOMArray<nsIDOMNode>& arrayOfNodes); |
michael@0 | 290 | nsresult SplitAsNeeded(const nsAString *aTag, nsCOMPtr<nsIDOMNode> *inOutParent, int32_t *inOutOffset); |
michael@0 | 291 | nsresult AddTerminatingBR(nsIDOMNode *aBlock); |
michael@0 | 292 | nsresult JoinNodesSmart( nsIDOMNode *aNodeLeft, |
michael@0 | 293 | nsIDOMNode *aNodeRight, |
michael@0 | 294 | nsCOMPtr<nsIDOMNode> *aOutMergeParent, |
michael@0 | 295 | int32_t *aOutMergeOffset); |
michael@0 | 296 | nsresult GetTopEnclosingMailCite(nsIDOMNode *aNode, nsCOMPtr<nsIDOMNode> *aOutCiteNode, bool aPlaintext); |
michael@0 | 297 | nsresult PopListItem(nsIDOMNode *aListItem, bool *aOutOfList); |
michael@0 | 298 | nsresult RemoveListStructure(nsIDOMNode *aList); |
michael@0 | 299 | nsresult CacheInlineStyles(nsIDOMNode *aNode); |
michael@0 | 300 | nsresult ReapplyCachedStyles(); |
michael@0 | 301 | void ClearCachedStyles(); |
michael@0 | 302 | nsresult AdjustSpecialBreaks(bool aSafeToAskFrames = false); |
michael@0 | 303 | nsresult AdjustWhitespace(nsISelection *aSelection); |
michael@0 | 304 | nsresult PinSelectionToNewBlock(nsISelection *aSelection); |
michael@0 | 305 | nsresult CheckInterlinePosition(nsISelection *aSelection); |
michael@0 | 306 | nsresult AdjustSelection(nsISelection *aSelection, nsIEditor::EDirection aAction); |
michael@0 | 307 | nsresult FindNearSelectableNode(nsIDOMNode *aSelNode, |
michael@0 | 308 | int32_t aSelOffset, |
michael@0 | 309 | nsIEditor::EDirection &aDirection, |
michael@0 | 310 | nsCOMPtr<nsIDOMNode> *outSelectableNode); |
michael@0 | 311 | /** |
michael@0 | 312 | * Returns true if aNode1 or aNode2 or both is the descendant of some type of |
michael@0 | 313 | * table element, but their nearest table element ancestors differ. "Table |
michael@0 | 314 | * element" here includes not just <table> but also <td>, <tbody>, <tr>, etc. |
michael@0 | 315 | * The nodes count as being their own descendants for this purpose, so a |
michael@0 | 316 | * table element is its own nearest table element ancestor. |
michael@0 | 317 | */ |
michael@0 | 318 | bool InDifferentTableElements(nsIDOMNode* aNode1, nsIDOMNode* aNode2); |
michael@0 | 319 | bool InDifferentTableElements(nsINode* aNode1, nsINode* aNode2); |
michael@0 | 320 | nsresult RemoveEmptyNodes(); |
michael@0 | 321 | nsresult SelectionEndpointInNode(nsINode *aNode, bool *aResult); |
michael@0 | 322 | nsresult UpdateDocChangeRange(nsIDOMRange *aRange); |
michael@0 | 323 | nsresult ConfirmSelectionInBody(); |
michael@0 | 324 | nsresult InsertMozBRIfNeeded(nsIDOMNode *aNode); |
michael@0 | 325 | bool IsEmptyInline(nsIDOMNode *aNode); |
michael@0 | 326 | bool ListIsEmptyLine(nsCOMArray<nsIDOMNode> &arrayOfNodes); |
michael@0 | 327 | nsresult RemoveAlignment(nsIDOMNode * aNode, const nsAString & aAlignType, bool aChildrenOnly); |
michael@0 | 328 | nsresult MakeSureElemStartsOrEndsOnCR(nsIDOMNode *aNode, bool aStarts); |
michael@0 | 329 | nsresult AlignBlock(nsIDOMElement * aElement, const nsAString * aAlignType, bool aContentsOnly); |
michael@0 | 330 | nsresult RelativeChangeIndentationOfElementNode(nsIDOMNode *aNode, int8_t aRelativeChange); |
michael@0 | 331 | void DocumentModifiedWorker(); |
michael@0 | 332 | |
michael@0 | 333 | // data members |
michael@0 | 334 | protected: |
michael@0 | 335 | nsHTMLEditor *mHTMLEditor; |
michael@0 | 336 | nsRefPtr<nsRange> mDocChangeRange; |
michael@0 | 337 | bool mListenerEnabled; |
michael@0 | 338 | bool mReturnInEmptyLIKillsList; |
michael@0 | 339 | bool mDidDeleteSelection; |
michael@0 | 340 | bool mDidRangedDelete; |
michael@0 | 341 | bool mRestoreContentEditableCount; |
michael@0 | 342 | nsRefPtr<nsRange> mUtilRange; |
michael@0 | 343 | uint32_t mJoinOffset; // need to remember an int across willJoin/didJoin... |
michael@0 | 344 | nsCOMPtr<nsIDOMNode> mNewBlock; |
michael@0 | 345 | nsRefPtr<nsRangeStore> mRangeItem; |
michael@0 | 346 | StyleCache mCachedStyles[SIZE_STYLE_TABLE]; |
michael@0 | 347 | }; |
michael@0 | 348 | |
michael@0 | 349 | #endif //nsHTMLEditRules_h__ |
michael@0 | 350 |