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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #ifndef DeleteSelectionCommand_h | 26 #ifndef DeleteSelectionCommand_h |
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 : 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 PassRefPtr<DeleteSelectionCommand> create(Document& document, bool sm
artDelete = false, bool mergeBlocksAfterDelete = true, bool expandForSpecialElem
ents = false, bool sanitizeMarkup = true) |
38 { | 38 { |
39 return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeB
locksAfterDelete, expandForSpecialElements, sanitizeMarkup)); | 39 return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeB
locksAfterDelete, 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 PassRefPtr<DeleteSelectionCommand> create(const VisibleSelection& sel
ection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool expan
dForSpecialElements = false, bool sanitizeMarkup = true) |
42 { | 42 { |
43 return adoptRef(new DeleteSelectionCommand(selection, smartDelete, merge
BlocksAfterDelete, expandForSpecialElements, sanitizeMarkup)); | 43 return adoptRef(new DeleteSelectionCommand(selection, smartDelete, merge
BlocksAfterDelete, expandForSpecialElements, sanitizeMarkup)); |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDel
ete, bool expandForSpecialElements, bool santizeMarkup); | 47 DeleteSelectionCommand(Document&, bool smartDelete, bool mergeBlocksAfterDel
ete, bool expandForSpecialElements, bool santizeMarkup); |
48 DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool merge
BlocksAfterDelete, bool expandForSpecialElements, bool sanitizeMarkup); | 48 DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool merge
BlocksAfterDelete, bool expandForSpecialElements, bool sanitizeMarkup); |
49 | 49 |
50 virtual void doApply(); | 50 virtual void doApply() OVERRIDE; |
51 virtual EditAction editingAction() const; | 51 virtual EditAction editingAction() const OVERRIDE; |
52 | 52 |
53 virtual bool preservesTypingStyle() const; | 53 virtual bool preservesTypingStyle() const OVERRIDE; |
54 | 54 |
55 void initializeStartEnd(Position&, Position&); | 55 void initializeStartEnd(Position&, Position&); |
56 void setStartingSelectionOnSmartDelete(const Position&, const Position&); | 56 void setStartingSelectionOnSmartDelete(const Position&, const Position&); |
57 void initializePositionData(); | 57 void initializePositionData(); |
58 void saveTypingStyleState(); | 58 void saveTypingStyleState(); |
59 void insertPlaceholderForAncestorBlockContent(); | 59 void insertPlaceholderForAncestorBlockContent(); |
60 bool handleSpecialCaseBRDelete(); | 60 bool handleSpecialCaseBRDelete(); |
61 void handleGeneralDelete(); | 61 void handleGeneralDelete(); |
62 void fixupWhitespace(); | 62 void fixupWhitespace(); |
63 void mergeParagraphs(); | 63 void mergeParagraphs(); |
64 void removePreviouslySelectedEmptyTableRows(); | 64 void removePreviouslySelectedEmptyTableRows(); |
65 void calculateEndingPosition(); | 65 void calculateEndingPosition(); |
66 void calculateTypingStyleAfterDelete(); | 66 void calculateTypingStyleAfterDelete(); |
67 void clearTransientState(); | 67 void clearTransientState(); |
68 void makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); | 68 void makeStylingElementsDirectChildrenOfEditableRootToPreventStyleLoss(); |
69 virtual void removeNode(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditabl
e = DoNotAssumeContentIsAlwaysEditable); | 69 virtual void removeNode(PassRefPtr<Node>, ShouldAssumeContentIsAlwaysEditabl
e = DoNotAssumeContentIsAlwaysEditable) OVERRIDE; |
70 virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned, unsigned); | 70 virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned, unsigned) OVERRI
DE; |
71 void removeRedundantBlocks(); | 71 void removeRedundantBlocks(); |
72 | 72 |
73 bool m_hasSelectionToDelete; | 73 bool m_hasSelectionToDelete; |
74 bool m_smartDelete; | 74 bool m_smartDelete; |
75 bool m_mergeBlocksAfterDelete; | 75 bool m_mergeBlocksAfterDelete; |
76 bool m_needPlaceholder; | 76 bool m_needPlaceholder; |
77 bool m_expandForSpecialElements; | 77 bool m_expandForSpecialElements; |
78 bool m_pruneStartBlockIfNecessary; | 78 bool m_pruneStartBlockIfNecessary; |
79 bool m_startsAtEmptyLine; | 79 bool m_startsAtEmptyLine; |
80 bool m_sanitizeMarkup; | 80 bool m_sanitizeMarkup; |
(...skipping 14 matching lines...) Expand all Loading... |
95 RefPtr<Node> m_startRoot; | 95 RefPtr<Node> m_startRoot; |
96 RefPtr<Node> m_endRoot; | 96 RefPtr<Node> m_endRoot; |
97 RefPtr<Node> m_startTableRow; | 97 RefPtr<Node> m_startTableRow; |
98 RefPtr<Node> m_endTableRow; | 98 RefPtr<Node> m_endTableRow; |
99 RefPtr<Node> m_temporaryPlaceholder; | 99 RefPtr<Node> m_temporaryPlaceholder; |
100 }; | 100 }; |
101 | 101 |
102 } // namespace WebCore | 102 } // namespace WebCore |
103 | 103 |
104 #endif // DeleteSelectionCommand_h | 104 #endif // DeleteSelectionCommand_h |
OLD | NEW |