| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #define DeleteSelectionCommand_h | 27 #define DeleteSelectionCommand_h |
| 28 | 28 |
| 29 #include "core/editing/CompositeEditCommand.h" | 29 #include "core/editing/CompositeEditCommand.h" |
| 30 | 30 |
| 31 namespace WebCore { | 31 namespace WebCore { |
| 32 | 32 |
| 33 class EditingStyle; | 33 class EditingStyle; |
| 34 | 34 |
| 35 class DeleteSelectionCommand FINAL : public CompositeEditCommand { | 35 class DeleteSelectionCommand FINAL : public CompositeEditCommand { |
| 36 public: | 36 public: |
| 37 static PassRefPtr<DeleteSelectionCommand> create(Document& document, bool sm
artDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElem
ents = false, bool sanitizeMarkup = true) | 37 static PassRefPtrWillBeRawPtr<DeleteSelectionCommand> create(Document& docum
ent, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expandFo
rSpecialElements = false, bool sanitizeMarkup = true) |
| 38 { | 38 { |
| 39 return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeB
locksAfterDelete, expandForSpecialElements, sanitizeMarkup)); | 39 return adoptRefWillBeNoop(new DeleteSelectionCommand(document, smartDele
te, mergeBlocksAfterDelete, expandForSpecialElements, sanitizeMarkup)); |
| 40 } | 40 } |
| 41 static PassRefPtr<DeleteSelectionCommand> create(const VisibleSelection& sel
ection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expan
dForSpecialElements = false, bool sanitizeMarkup = true) | 41 static PassRefPtrWillBeRawPtr<DeleteSelectionCommand> create(const VisibleSe
lection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true
, bool expandForSpecialElements = false, bool sanitizeMarkup = true) |
| 42 { | 42 { |
| 43 return adoptRef(new DeleteSelectionCommand(selection, smartDelete, merge
BlocksAfterDelete, expandForSpecialElements, sanitizeMarkup)); | 43 return adoptRefWillBeNoop(new DeleteSelectionCommand(selection, smartDel
ete, mergeBlocksAfterDelete, expandForSpecialElements, sanitizeMarkup)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void trace(Visitor*) OVERRIDE; |
| 47 |
| 46 private: | 48 private: |
| 47 DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDel
ete, bool expandForSpecialElements, bool santizeMarkup); | 49 DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDel
ete, bool expandForSpecialElements, bool santizeMarkup); |
| 48 DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool merge
BlocksAfterDelete, bool expandForSpecialElements, bool sanitizeMarkup); | 50 DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool merge
BlocksAfterDelete, bool expandForSpecialElements, bool sanitizeMarkup); |
| 49 | 51 |
| 50 virtual void doApply() OVERRIDE; | 52 virtual void doApply() OVERRIDE; |
| 51 virtual EditAction editingAction() const OVERRIDE; | 53 virtual EditAction editingAction() const OVERRIDE; |
| 52 | 54 |
| 53 virtual bool preservesTypingStyle() const OVERRIDE; | 55 virtual bool preservesTypingStyle() const OVERRIDE; |
| 54 | 56 |
| 55 void initializeStartEnd(Position&, Position&); | 57 void initializeStartEnd(Position&, Position&); |
| 56 void setStartingSelectionOnSmartDelete(const Position&, const Position&); | 58 void setStartingSelectionOnSmartDelete(const Position&, const Position&); |
| 57 void initializePositionData(); | 59 void initializePositionData(); |
| 58 void saveTypingStyleState(); | 60 void saveTypingStyleState(); |
| 59 bool handleSpecialCaseBRDelete(); | 61 bool handleSpecialCaseBRDelete(); |
| 60 void handleGeneralDelete(); | 62 void handleGeneralDelete(); |
| 61 void fixupWhitespace(); | 63 void fixupWhitespace(); |
| 62 void mergeParagraphs(); | 64 void mergeParagraphs(); |
| 63 void removePreviouslySelectedEmptyTableRows(); | 65 void removePreviouslySelectedEmptyTableRows(); |
| 64 void calculateTypingStyleAfterDelete(); | 66 void calculateTypingStyleAfterDelete(); |
| 65 void clearTransientState(); | 67 void clearTransientState(); |
| 66 void makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); | 68 void makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); |
| 67 virtual void removeNode(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditabl
e = DoNotAssumeContentIsAlwaysEditable) OVERRIDE; | 69 virtual void removeNode(PassRefPtrWillBeRawPtr<Node>, ShouldAssumeContentIsA
lwaysEditable = DoNotAssumeContentIsAlwaysEditable) OVERRIDE; |
| 68 virtual void deleteTextFromNode(PassRefPtrWillBeRawPtr<Text>, unsigned, unsi
gned) OVERRIDE; | 70 virtual void deleteTextFromNode(PassRefPtrWillBeRawPtr<Text>, unsigned, unsi
gned) OVERRIDE; |
| 69 void removeRedundantBlocks(); | 71 void removeRedundantBlocks(); |
| 70 | 72 |
| 71 bool m_hasSelectionToDelete; | 73 bool m_hasSelectionToDelete; |
| 72 bool m_smartDelete; | 74 bool m_smartDelete; |
| 73 bool m_mergeBlocksAfterDelete; | 75 bool m_mergeBlocksAfterDelete; |
| 74 bool m_needPlaceholder; | 76 bool m_needPlaceholder; |
| 75 bool m_expandForSpecialElements; | 77 bool m_expandForSpecialElements; |
| 76 bool m_pruneStartBlockIfNecessary; | 78 bool m_pruneStartBlockIfNecessary; |
| 77 bool m_startsAtEmptyLine; | 79 bool m_startsAtEmptyLine; |
| 78 bool m_sanitizeMarkup; | 80 bool m_sanitizeMarkup; |
| 79 | 81 |
| 80 // This data is transient and should be cleared at the end of the doApply fu
nction. | 82 // This data is transient and should be cleared at the end of the doApply fu
nction. |
| 81 VisibleSelection m_selectionToDelete; | 83 VisibleSelection m_selectionToDelete; |
| 82 Position m_upstreamStart; | 84 Position m_upstreamStart; |
| 83 Position m_downstreamStart; | 85 Position m_downstreamStart; |
| 84 Position m_upstreamEnd; | 86 Position m_upstreamEnd; |
| 85 Position m_downstreamEnd; | 87 Position m_downstreamEnd; |
| 86 Position m_endingPosition; | 88 Position m_endingPosition; |
| 87 Position m_leadingWhitespace; | 89 Position m_leadingWhitespace; |
| 88 Position m_trailingWhitespace; | 90 Position m_trailingWhitespace; |
| 89 RefPtr<Node> m_startBlock; | 91 RefPtrWillBeMember<Node> m_startBlock; |
| 90 RefPtr<Node> m_endBlock; | 92 RefPtrWillBeMember<Node> m_endBlock; |
| 91 RefPtr<EditingStyle> m_typingStyle; | 93 RefPtrWillBeMember<EditingStyle> m_typingStyle; |
| 92 RefPtr<EditingStyle> m_deleteIntoBlockquoteStyle; | 94 RefPtrWillBeMember<EditingStyle> m_deleteIntoBlockquoteStyle; |
| 93 RefPtr<Node> m_startRoot; | 95 RefPtrWillBeMember<Node> m_startRoot; |
| 94 RefPtr<Node> m_endRoot; | 96 RefPtrWillBeMember<Node> m_endRoot; |
| 95 RefPtr<Node> m_startTableRow; | 97 RefPtrWillBeMember<Node> m_startTableRow; |
| 96 RefPtr<Node> m_endTableRow; | 98 RefPtrWillBeMember<Node> m_endTableRow; |
| 97 RefPtr<Node> m_temporaryPlaceholder; | 99 RefPtrWillBeMember<Node> m_temporaryPlaceholder; |
| 98 }; | 100 }; |
| 99 | 101 |
| 100 } // namespace WebCore | 102 } // namespace WebCore |
| 101 | 103 |
| 102 #endif // DeleteSelectionCommand_h | 104 #endif // DeleteSelectionCommand_h |
| OLD | NEW |