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

Side by Side Diff: Source/core/editing/InsertTextCommand.h

Issue 23822003: Have EditCommand classes deal with Document references, not pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 30 matching lines...) Expand all
41 TextInsertionMarkerSupplier() { } 41 TextInsertionMarkerSupplier() { }
42 }; 42 };
43 43
44 class InsertTextCommand : public CompositeEditCommand { 44 class InsertTextCommand : public CompositeEditCommand {
45 public: 45 public:
46 enum RebalanceType { 46 enum RebalanceType {
47 RebalanceLeadingAndTrailingWhitespaces, 47 RebalanceLeadingAndTrailingWhitespaces,
48 RebalanceAllWhitespaces 48 RebalanceAllWhitespaces
49 }; 49 };
50 50
51 static PassRefPtr<InsertTextCommand> create(Document* document, const String & text, bool selectInsertedText = false, 51 static PassRefPtr<InsertTextCommand> create(Document& document, const String & text, bool selectInsertedText = false,
52 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces) 52 RebalanceType rebalanceType = RebalanceLeadingAndTrailingWhitespaces)
53 { 53 {
54 return adoptRef(new InsertTextCommand(document, text, selectInsertedText , rebalanceType)); 54 return adoptRef(new InsertTextCommand(document, text, selectInsertedText , rebalanceType));
55 } 55 }
56 56
57 static PassRefPtr<InsertTextCommand> createWithMarkerSupplier(Document* docu ment, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier ) 57 static PassRefPtr<InsertTextCommand> createWithMarkerSupplier(Document& docu ment, const String& text, PassRefPtr<TextInsertionMarkerSupplier> markerSupplier )
58 { 58 {
59 return adoptRef(new InsertTextCommand(document, text, markerSupplier)); 59 return adoptRef(new InsertTextCommand(document, text, markerSupplier));
60 } 60 }
61 61
62 private: 62 private:
63 63
64 InsertTextCommand(Document*, const String& text, bool selectInsertedText, Re balanceType); 64 InsertTextCommand(Document&, const String& text, bool selectInsertedText, Re balanceType);
65 InsertTextCommand(Document*, const String& text, PassRefPtr<TextInsertionMar kerSupplier>); 65 InsertTextCommand(Document&, const String& text, PassRefPtr<TextInsertionMar kerSupplier>);
66 66
67 void deleteCharacter(); 67 void deleteCharacter();
68 68
69 virtual void doApply(); 69 virtual void doApply();
70 70
71 Position positionInsideTextNode(const Position&); 71 Position positionInsideTextNode(const Position&);
72 Position insertTab(const Position&); 72 Position insertTab(const Position&);
73 73
74 bool performTrivialReplace(const String&, bool selectInsertedText); 74 bool performTrivialReplace(const String&, bool selectInsertedText);
75 bool performOverwrite(const String&, bool selectInsertedText); 75 bool performOverwrite(const String&, bool selectInsertedText);
76 void setEndingSelectionWithoutValidation(const Position& startPosition, cons t Position& endPosition); 76 void setEndingSelectionWithoutValidation(const Position& startPosition, cons t Position& endPosition);
77 77
78 friend class TypingCommand; 78 friend class TypingCommand;
79 79
80 String m_text; 80 String m_text;
81 bool m_selectInsertedText; 81 bool m_selectInsertedText;
82 RebalanceType m_rebalanceType; 82 RebalanceType m_rebalanceType;
83 RefPtr<TextInsertionMarkerSupplier> m_markerSupplier; 83 RefPtr<TextInsertionMarkerSupplier> m_markerSupplier;
84 }; 84 };
85 85
86 } // namespace WebCore 86 } // namespace WebCore
87 87
88 #endif // InsertTextCommand_h 88 #endif // InsertTextCommand_h
OLDNEW
« no previous file with comments | « Source/core/editing/InsertParagraphSeparatorCommand.cpp ('k') | Source/core/editing/InsertTextCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698