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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 protected: | 57 protected: |
58 explicit EditCommand(Document&); | 58 explicit EditCommand(Document&); |
59 | 59 |
60 Document& document() const { return *m_document.get(); } | 60 Document& document() const { return *m_document.get(); } |
61 CompositeEditCommand* parent() const { return m_parent; } | 61 CompositeEditCommand* parent() const { return m_parent; } |
62 void setStartingSelection(const VisibleSelection&); | 62 void setStartingSelection(const VisibleSelection&); |
63 void setEndingSelection(const VisibleSelection&); | 63 void setEndingSelection(const VisibleSelection&); |
64 void setEndingSelection(const VisiblePosition&); | 64 void setEndingSelection(const VisiblePosition&); |
65 | 65 |
| 66 // TODO(yosin) |isRenderedCharacter()| should be removed, and we should use |
| 67 // |VisiblePosition::characterAfter()| and |
| 68 // |VisiblePosition::characterBefore()|. |
| 69 static bool isRenderedCharacter(const Position&); |
| 70 |
66 private: | 71 private: |
67 RefPtrWillBeMember<Document> m_document; | 72 RefPtrWillBeMember<Document> m_document; |
68 VisibleSelection m_startingSelection; | 73 VisibleSelection m_startingSelection; |
69 VisibleSelection m_endingSelection; | 74 VisibleSelection m_endingSelection; |
70 RawPtrWillBeMember<CompositeEditCommand> m_parent; | 75 RawPtrWillBeMember<CompositeEditCommand> m_parent; |
71 }; | 76 }; |
72 | 77 |
73 enum ShouldAssumeContentIsAlwaysEditable { | 78 enum ShouldAssumeContentIsAlwaysEditable { |
74 AssumeContentIsAlwaysEditable, | 79 AssumeContentIsAlwaysEditable, |
75 DoNotAssumeContentIsAlwaysEditable, | 80 DoNotAssumeContentIsAlwaysEditable, |
76 }; | 81 }; |
77 | 82 |
78 class SimpleEditCommand : public EditCommand { | 83 class SimpleEditCommand : public EditCommand { |
79 public: | 84 public: |
80 virtual void doUnapply() = 0; | 85 virtual void doUnapply() = 0; |
81 virtual void doReapply(); // calls doApply() | 86 virtual void doReapply(); // calls doApply() |
82 | 87 |
83 protected: | 88 protected: |
84 explicit SimpleEditCommand(Document& document) : EditCommand(document) { } | 89 explicit SimpleEditCommand(Document& document) : EditCommand(document) { } |
85 | 90 |
86 private: | 91 private: |
87 bool isSimpleEditCommand() const final { return true; } | 92 bool isSimpleEditCommand() const final { return true; } |
88 }; | 93 }; |
89 | 94 |
90 DEFINE_TYPE_CASTS(SimpleEditCommand, EditCommand, command, command->isSimpleEdit
Command(), command.isSimpleEditCommand()); | 95 DEFINE_TYPE_CASTS(SimpleEditCommand, EditCommand, command, command->isSimpleEdit
Command(), command.isSimpleEditCommand()); |
91 | 96 |
92 } // namespace blink | 97 } // namespace blink |
93 | 98 |
94 #endif // EditCommand_h | 99 #endif // EditCommand_h |
OLD | NEW |