OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2010 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 17 matching lines...) Expand all Loading... |
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 // ModifySelectionListLevelCommand provides functions useful for both increasing
and decreasing the list level. | 33 // ModifySelectionListLevelCommand provides functions useful for both increasing
and decreasing the list level. |
34 // It is the base class of IncreaseSelectionListLevelCommand and DecreaseSelecti
onListLevelCommand. | 34 // It is the base class of IncreaseSelectionListLevelCommand and DecreaseSelecti
onListLevelCommand. |
35 // It is not used on its own. | 35 // It is not used on its own. |
36 class ModifySelectionListLevelCommand : public CompositeEditCommand { | 36 class ModifySelectionListLevelCommand : public CompositeEditCommand { |
37 protected: | 37 protected: |
38 explicit ModifySelectionListLevelCommand(Document*); | 38 explicit ModifySelectionListLevelCommand(Document&); |
39 | 39 |
40 void appendSiblingNodeRange(Node* startNode, Node* endNode, Element* newPare
nt); | 40 void appendSiblingNodeRange(Node* startNode, Node* endNode, Element* newPare
nt); |
41 void insertSiblingNodeRangeBefore(Node* startNode, Node* endNode, Node* refN
ode); | 41 void insertSiblingNodeRangeBefore(Node* startNode, Node* endNode, Node* refN
ode); |
42 void insertSiblingNodeRangeAfter(Node* startNode, Node* endNode, Node* refNo
de); | 42 void insertSiblingNodeRangeAfter(Node* startNode, Node* endNode, Node* refNo
de); |
43 | 43 |
44 private: | 44 private: |
45 virtual bool preservesTypingStyle() const; | 45 virtual bool preservesTypingStyle() const; |
46 }; | 46 }; |
47 | 47 |
48 // IncreaseSelectionListLevelCommand moves the selected list items one level dee
per. | 48 // IncreaseSelectionListLevelCommand moves the selected list items one level dee
per. |
49 class IncreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand
{ | 49 class IncreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand
{ |
50 public: | 50 public: |
51 static bool canIncreaseSelectionListLevel(Document*); | 51 static bool canIncreaseSelectionListLevel(Document&); |
52 static PassRefPtr<Node> increaseSelectionListLevel(Document*); | 52 static PassRefPtr<Node> increaseSelectionListLevel(Document&); |
53 static PassRefPtr<Node> increaseSelectionListLevelOrdered(Document*); | 53 static PassRefPtr<Node> increaseSelectionListLevelOrdered(Document&); |
54 static PassRefPtr<Node> increaseSelectionListLevelUnordered(Document*); | 54 static PassRefPtr<Node> increaseSelectionListLevelUnordered(Document&); |
55 | 55 |
56 private: | 56 private: |
57 enum Type { InheritedListType, OrderedList, UnorderedList }; | 57 enum Type { InheritedListType, OrderedList, UnorderedList }; |
58 static PassRefPtr<Node> increaseSelectionListLevel(Document*, Type); | 58 static PassRefPtr<Node> increaseSelectionListLevel(Document&, Type); |
59 | 59 |
60 static PassRefPtr<IncreaseSelectionListLevelCommand> create(Document* docume
nt, Type type) | 60 static PassRefPtr<IncreaseSelectionListLevelCommand> create(Document& docume
nt, Type type) |
61 { | 61 { |
62 return adoptRef(new IncreaseSelectionListLevelCommand(document, type)); | 62 return adoptRef(new IncreaseSelectionListLevelCommand(document, type)); |
63 } | 63 } |
64 | 64 |
65 IncreaseSelectionListLevelCommand(Document*, Type); | 65 IncreaseSelectionListLevelCommand(Document&, Type); |
66 | 66 |
67 virtual void doApply(); | 67 virtual void doApply(); |
68 | 68 |
69 Type m_listType; | 69 Type m_listType; |
70 RefPtr<Node> m_listElement; | 70 RefPtr<Node> m_listElement; |
71 }; | 71 }; |
72 | 72 |
73 // DecreaseSelectionListLevelCommand moves the selected list items one level sha
llower. | 73 // DecreaseSelectionListLevelCommand moves the selected list items one level sha
llower. |
74 class DecreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand
{ | 74 class DecreaseSelectionListLevelCommand : public ModifySelectionListLevelCommand
{ |
75 public: | 75 public: |
76 static bool canDecreaseSelectionListLevel(Document*); | 76 static bool canDecreaseSelectionListLevel(Document&); |
77 static void decreaseSelectionListLevel(Document*); | 77 static void decreaseSelectionListLevel(Document&); |
78 | 78 |
79 private: | 79 private: |
80 static PassRefPtr<DecreaseSelectionListLevelCommand> create(Document* docume
nt) | 80 static PassRefPtr<DecreaseSelectionListLevelCommand> create(Document& docume
nt) |
81 { | 81 { |
82 return adoptRef(new DecreaseSelectionListLevelCommand(document)); | 82 return adoptRef(new DecreaseSelectionListLevelCommand(document)); |
83 } | 83 } |
84 | 84 |
85 explicit DecreaseSelectionListLevelCommand(Document*); | 85 explicit DecreaseSelectionListLevelCommand(Document&); |
86 | 86 |
87 virtual void doApply(); | 87 virtual void doApply(); |
88 }; | 88 }; |
89 | 89 |
90 } // namespace WebCore | 90 } // namespace WebCore |
91 | 91 |
92 #endif // ModifySelectionListLevel_h | 92 #endif // ModifySelectionListLevel_h |
OLD | NEW |