| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef InsertIncrementalTextCommand_h |
| 6 #define InsertIncrementalTextCommand_h |
| 7 |
| 8 #include "core/editing/commands/CompositeEditCommand.h" |
| 9 |
| 10 namespace blink { |
| 11 |
| 12 class InsertIncrementalTextCommand final : public CompositeEditCommand { |
| 13 public: |
| 14 enum RebalanceType { |
| 15 RebalanceLeadingAndTrailingWhitespaces, |
| 16 RebalanceAllWhitespaces |
| 17 }; |
| 18 |
| 19 static InsertIncrementalTextCommand* create( |
| 20 Document& document, |
| 21 const String& text, |
| 22 bool selectInsertedText = false, |
| 23 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces) { |
| 24 return new InsertIncrementalTextCommand(document, text, selectInsertedText, |
| 25 rebalanceType); |
| 26 } |
| 27 |
| 28 String textDataForInputEvent() const final; |
| 29 |
| 30 private: |
| 31 InsertIncrementalTextCommand(Document&, |
| 32 const String& text, |
| 33 bool selectInsertedText, |
| 34 RebalanceType); |
| 35 |
| 36 void doApply(EditingState*) override; |
| 37 |
| 38 Position positionInsideTextNode(const Position&, EditingState*); |
| 39 Position insertTab(const Position&, EditingState*); |
| 40 |
| 41 bool performTrivialReplace(const String&, bool selectInsertedText); |
| 42 bool performOverwrite(const String&, bool selectInsertedText); |
| 43 void setEndingSelectionWithoutValidation(const Position& startPosition, |
| 44 const Position& endPosition); |
| 45 |
| 46 void setSelection(const size_t start, const size_t end, LocalFrame*); |
| 47 |
| 48 friend class TypingCommand; |
| 49 |
| 50 String m_text; |
| 51 bool m_selectInsertedText; |
| 52 RebalanceType m_rebalanceType; |
| 53 }; |
| 54 |
| 55 } // namespace blink |
| 56 |
| 57 #endif // InsertIncrementalTextCommand_h |
| OLD | NEW |