Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: third_party/WebKit/Source/core/editing/commands/TextInsertionBaseCommand.h

Issue 1753703005: Simplify TypingCommand::insertText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2012 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 22 matching lines...) Expand all
33 namespace blink { 33 namespace blink {
34 34
35 class Document; 35 class Document;
36 36
37 class TextInsertionBaseCommand : public CompositeEditCommand { 37 class TextInsertionBaseCommand : public CompositeEditCommand {
38 public: 38 public:
39 ~TextInsertionBaseCommand() override { } 39 ~TextInsertionBaseCommand() override { }
40 40
41 protected: 41 protected:
42 explicit TextInsertionBaseCommand(Document&); 42 explicit TextInsertionBaseCommand(Document&);
43 static void applyTextInsertionCommand(LocalFrame*, PassRefPtrWillBeRawPtr<Te xtInsertionBaseCommand>, const VisibleSelection& selectionForInsertion, const Vi sibleSelection& endingSelection);
44 }; 43 };
45 44
46 String dispatchBeforeTextInsertedEvent(const String& text, const VisibleSelectio n& selectionForInsertion, bool insertionIsForUpdatingComposition); 45 String dispatchBeforeTextInsertedEvent(const String& text, const VisibleSelectio n& selectionForInsertion, bool insertionIsForUpdatingComposition);
47 bool canAppendNewLineFeedToSelection(const VisibleSelection&); 46 bool canAppendNewLineFeedToSelection(const VisibleSelection&);
48 47
49 // LineOperation should define member function "opeartor (size_t lineOffset, siz e_t lineLength, bool isLastLine)". 48 // LineOperation should define member function "opeartor (size_t lineOffset, siz e_t lineLength, bool isLastLine)".
50 // lienLength doesn't include the newline character. So the value of lineLength could be 0. 49 // lienLength doesn't include the newline character. So the value of lineLength could be 0.
51 template <class LineOperation> 50 template <class LineOperation>
52 void forEachLineInString(const String& string, const LineOperation& operation, E ditingState* editingState) 51 void forEachLineInString(const String& string, const LineOperation& operation, E ditingState* editingState)
53 { 52 {
(...skipping 10 matching lines...) Expand all
64 } else { 63 } else {
65 unsigned length = string.length(); 64 unsigned length = string.length();
66 if (length != offset) 65 if (length != offset)
67 operation(offset, length - offset, true, editingState); 66 operation(offset, length - offset, true, editingState);
68 } 67 }
69 } 68 }
70 69
71 } // namespace blink 70 } // namespace blink
72 71
73 #endif 72 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698