| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 class InsertTextCommand final : public CompositeEditCommand { | 33 class InsertTextCommand final : public CompositeEditCommand { |
| 34 public: | 34 public: |
| 35 enum RebalanceType { | 35 enum RebalanceType { |
| 36 RebalanceLeadingAndTrailingWhitespaces, | 36 RebalanceLeadingAndTrailingWhitespaces, |
| 37 RebalanceAllWhitespaces | 37 RebalanceAllWhitespaces |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 static InsertTextCommand* create( | 40 static InsertTextCommand* create( |
| 41 Document& document, | 41 Document& document, |
| 42 CommandSource source, |
| 42 const String& text, | 43 const String& text, |
| 43 bool selectInsertedText = false, | 44 bool selectInsertedText = false, |
| 44 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces) { | 45 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces) { |
| 45 return new InsertTextCommand(document, text, selectInsertedText, | 46 return new InsertTextCommand(document, source, text, selectInsertedText, |
| 46 rebalanceType); | 47 rebalanceType); |
| 47 } | 48 } |
| 48 | 49 |
| 49 String textDataForInputEvent() const final; | 50 String textDataForInputEvent() const final; |
| 50 | 51 |
| 51 private: | 52 private: |
| 52 InsertTextCommand(Document&, | 53 InsertTextCommand(Document&, |
| 54 CommandSource, |
| 53 const String& text, | 55 const String& text, |
| 54 bool selectInsertedText, | 56 bool selectInsertedText, |
| 55 RebalanceType); | 57 RebalanceType); |
| 56 | 58 |
| 57 void doApply(EditingState*) override; | 59 void doApply(EditingState*) override; |
| 58 | 60 |
| 59 Position positionInsideTextNode(const Position&, EditingState*); | 61 Position positionInsideTextNode(const Position&, EditingState*); |
| 60 Position insertTab(const Position&, EditingState*); | 62 Position insertTab(const Position&, EditingState*); |
| 61 | 63 |
| 62 bool performTrivialReplace(const String&, bool selectInsertedText); | 64 bool performTrivialReplace(const String&, bool selectInsertedText); |
| 63 bool performOverwrite(const String&, bool selectInsertedText); | 65 bool performOverwrite(const String&, bool selectInsertedText); |
| 64 void setEndingSelectionWithoutValidation(const Position& startPosition, | 66 void setEndingSelectionWithoutValidation(const Position& startPosition, |
| 65 const Position& endPosition); | 67 const Position& endPosition); |
| 66 | 68 |
| 67 friend class TypingCommand; | 69 friend class TypingCommand; |
| 68 | 70 |
| 69 String m_text; | 71 String m_text; |
| 70 bool m_selectInsertedText; | 72 bool m_selectInsertedText; |
| 71 RebalanceType m_rebalanceType; | 73 RebalanceType m_rebalanceType; |
| 72 }; | 74 }; |
| 73 | 75 |
| 74 } // namespace blink | 76 } // namespace blink |
| 75 | 77 |
| 76 #endif // InsertTextCommand_h | 78 #endif // InsertTextCommand_h |
| OLD | NEW |