| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 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 26 matching lines...) Expand all Loading... |
| 37 #include "core/editing/iterators/TextIterator.h" | 37 #include "core/editing/iterators/TextIterator.h" |
| 38 #include "core/editing/markers/DocumentMarker.h" | 38 #include "core/editing/markers/DocumentMarker.h" |
| 39 #include "core/events/InputEvent.h" | 39 #include "core/events/InputEvent.h" |
| 40 #include "platform/PasteMode.h" | 40 #include "platform/PasteMode.h" |
| 41 #include "platform/heap/Handle.h" | 41 #include "platform/heap/Handle.h" |
| 42 #include <memory> | 42 #include <memory> |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class CompositeEditCommand; | 46 class CompositeEditCommand; |
| 47 class DragData; | |
| 48 class EditCommandComposition; | 47 class EditCommandComposition; |
| 49 class EditorClient; | 48 class EditorClient; |
| 50 class EditorInternalCommand; | 49 class EditorInternalCommand; |
| 51 class LocalFrame; | 50 class LocalFrame; |
| 52 class HitTestResult; | 51 class HitTestResult; |
| 53 class KillRing; | 52 class KillRing; |
| 54 class Pasteboard; | 53 class Pasteboard; |
| 55 class SpellChecker; | 54 class SpellChecker; |
| 56 class StylePropertySet; | 55 class StylePropertySet; |
| 57 class TextEvent; | 56 class TextEvent; |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 void deleteSelectionWithSmartDelete( | 122 void deleteSelectionWithSmartDelete( |
| 124 DeleteMode, | 123 DeleteMode, |
| 125 InputEvent::InputType, | 124 InputEvent::InputType, |
| 126 const Position& referenceMovePosition = Position()); | 125 const Position& referenceMovePosition = Position()); |
| 127 | 126 |
| 128 void applyStyle(StylePropertySet*, InputEvent::InputType); | 127 void applyStyle(StylePropertySet*, InputEvent::InputType); |
| 129 void applyParagraphStyle(StylePropertySet*, InputEvent::InputType); | 128 void applyParagraphStyle(StylePropertySet*, InputEvent::InputType); |
| 130 void applyStyleToSelection(StylePropertySet*, InputEvent::InputType); | 129 void applyStyleToSelection(StylePropertySet*, InputEvent::InputType); |
| 131 void applyParagraphStyleToSelection(StylePropertySet*, InputEvent::InputType); | 130 void applyParagraphStyleToSelection(StylePropertySet*, InputEvent::InputType); |
| 132 | 131 |
| 132 bool willApplyEditing(CompositeEditCommand*); |
| 133 void appliedEditing(CompositeEditCommand*); | 133 void appliedEditing(CompositeEditCommand*); |
| 134 void unappliedEditing(EditCommandComposition*); | 134 void unappliedEditing(EditCommandComposition*); |
| 135 void reappliedEditing(EditCommandComposition*); | 135 void reappliedEditing(EditCommandComposition*); |
| 136 | 136 |
| 137 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } | 137 void setShouldStyleWithCSS(bool flag) { m_shouldStyleWithCSS = flag; } |
| 138 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } | 138 bool shouldStyleWithCSS() const { return m_shouldStyleWithCSS; } |
| 139 | 139 |
| 140 class CORE_EXPORT Command { | 140 class CORE_EXPORT Command { |
| 141 STACK_ALLOCATED(); | 141 STACK_ALLOCATED(); |
| 142 | 142 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 158 | 158 |
| 159 // Returns 0 if this Command is not supported. | 159 // Returns 0 if this Command is not supported. |
| 160 int idForHistogram() const; | 160 int idForHistogram() const; |
| 161 | 161 |
| 162 private: | 162 private: |
| 163 LocalFrame& frame() const { | 163 LocalFrame& frame() const { |
| 164 DCHECK(m_frame); | 164 DCHECK(m_frame); |
| 165 return *m_frame; | 165 return *m_frame; |
| 166 } | 166 } |
| 167 | 167 |
| 168 // Returns target ranges for the command, currently only supports delete | |
| 169 // related commands. Used by InputEvent. | |
| 170 RangeVector* getTargetRanges() const; | |
| 171 | |
| 172 const EditorInternalCommand* m_command; | 168 const EditorInternalCommand* m_command; |
| 173 EditorCommandSource m_source; | 169 EditorCommandSource m_source; |
| 174 Member<LocalFrame> m_frame; | 170 Member<LocalFrame> m_frame; |
| 175 }; | 171 }; |
| 176 Command createCommand( | 172 Command createCommand( |
| 177 const String& | 173 const String& |
| 178 commandName); // Command source is CommandFromMenuOrKeyBinding. | 174 commandName); // Command source is CommandFromMenuOrKeyBinding. |
| 179 Command createCommand(const String& commandName, EditorCommandSource); | 175 Command createCommand(const String& commandName, EditorCommandSource); |
| 180 | 176 |
| 181 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| | 177 // |Editor::executeCommand| is implementation of |WebFrame::executeCommand| |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void replaceSelectionWithText(const String&, | 255 void replaceSelectionWithText(const String&, |
| 260 bool selectReplacement, | 256 bool selectReplacement, |
| 261 bool smartReplace, | 257 bool smartReplace, |
| 262 InputEvent::InputType); | 258 InputEvent::InputType); |
| 263 | 259 |
| 264 // TODO(xiaochengh): Replace |bool| parameters by |enum|. | 260 // TODO(xiaochengh): Replace |bool| parameters by |enum|. |
| 265 void replaceSelectionAfterDragging(DocumentFragment*, | 261 void replaceSelectionAfterDragging(DocumentFragment*, |
| 266 InsertMode, | 262 InsertMode, |
| 267 DragSourceType); | 263 DragSourceType); |
| 268 | 264 |
| 269 // Return false if frame was destroyed by event handler, should stop executing | |
| 270 // remaining actions. | |
| 271 bool deleteSelectionAfterDraggingWithEvents( | |
| 272 Element* dragSource, | |
| 273 DeleteMode, | |
| 274 const Position& referenceMovePosition); | |
| 275 bool replaceSelectionAfterDraggingWithEvents(Element* dropTarget, | |
| 276 DragData*, | |
| 277 DocumentFragment*, | |
| 278 Range* dropCaretRange, | |
| 279 InsertMode, | |
| 280 DragSourceType); | |
| 281 | |
| 282 EditorParagraphSeparator defaultParagraphSeparator() const { | 265 EditorParagraphSeparator defaultParagraphSeparator() const { |
| 283 return m_defaultParagraphSeparator; | 266 return m_defaultParagraphSeparator; |
| 284 } | 267 } |
| 285 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { | 268 void setDefaultParagraphSeparator(EditorParagraphSeparator separator) { |
| 286 m_defaultParagraphSeparator = separator; | 269 m_defaultParagraphSeparator = separator; |
| 287 } | 270 } |
| 288 | 271 |
| 289 static void tidyUpHTMLStructure(Document&); | 272 static void tidyUpHTMLStructure(Document&); |
| 290 | 273 |
| 291 class RevealSelectionScope { | 274 class RevealSelectionScope { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 310 Member<CompositeEditCommand> m_lastEditCommand; | 293 Member<CompositeEditCommand> m_lastEditCommand; |
| 311 const Member<UndoStack> m_undoStack; | 294 const Member<UndoStack> m_undoStack; |
| 312 int m_preventRevealSelection; | 295 int m_preventRevealSelection; |
| 313 bool m_shouldStartNewKillRingSequence; | 296 bool m_shouldStartNewKillRingSequence; |
| 314 bool m_shouldStyleWithCSS; | 297 bool m_shouldStyleWithCSS; |
| 315 const std::unique_ptr<KillRing> m_killRing; | 298 const std::unique_ptr<KillRing> m_killRing; |
| 316 VisibleSelection m_mark; | 299 VisibleSelection m_mark; |
| 317 bool m_areMarkedTextMatchesHighlighted; | 300 bool m_areMarkedTextMatchesHighlighted; |
| 318 EditorParagraphSeparator m_defaultParagraphSeparator; | 301 EditorParagraphSeparator m_defaultParagraphSeparator; |
| 319 bool m_overwriteModeEnabled; | 302 bool m_overwriteModeEnabled; |
| 303 bool m_executingCommandFromDOM; |
| 320 | 304 |
| 321 explicit Editor(LocalFrame&); | 305 explicit Editor(LocalFrame&); |
| 322 | 306 |
| 323 LocalFrame& frame() const { | 307 LocalFrame& frame() const { |
| 324 DCHECK(m_frame); | 308 DCHECK(m_frame); |
| 325 return *m_frame; | 309 return *m_frame; |
| 326 } | 310 } |
| 327 | 311 |
| 328 bool canDeleteRange(const EphemeralRange&) const; | 312 bool canDeleteRange(const EphemeralRange&) const; |
| 329 | 313 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 m_mark = selection; | 346 m_mark = selection; |
| 363 } | 347 } |
| 364 | 348 |
| 365 inline bool Editor::markedTextMatchesAreHighlighted() const { | 349 inline bool Editor::markedTextMatchesAreHighlighted() const { |
| 366 return m_areMarkedTextMatchesHighlighted; | 350 return m_areMarkedTextMatchesHighlighted; |
| 367 } | 351 } |
| 368 | 352 |
| 369 } // namespace blink | 353 } // namespace blink |
| 370 | 354 |
| 371 #endif // Editor_h | 355 #endif // Editor_h |
| OLD | NEW |