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

Side by Side Diff: third_party/WebKit/Source/core/editing/Editor.cpp

Issue 2581073003: [Editing] Introduce |EditCommandComposition::willUn/Reapply()| in prepare for 'beforeinput' (2/3) (Closed)
Patch Set: Created 4 years 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) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved.
3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 void Editor::copyImage(const HitTestResult& result) { 1250 void Editor::copyImage(const HitTestResult& result) {
1251 writeImageNodeToPasteboard(Pasteboard::generalPasteboard(), 1251 writeImageNodeToPasteboard(Pasteboard::generalPasteboard(),
1252 result.innerNodeOrImageMapImage(), 1252 result.innerNodeOrImageMapImage(),
1253 result.altDisplayString()); 1253 result.altDisplayString());
1254 } 1254 }
1255 1255
1256 bool Editor::canUndo() { 1256 bool Editor::canUndo() {
1257 return m_undoStack->canUndo(); 1257 return m_undoStack->canUndo();
1258 } 1258 }
1259 1259
1260 // TODO(chongz): Fire 'beforeinput' for user triggered undo. 1260 void Editor::undo(EditCommandSource source) {
1261 void Editor::undo(EditCommandSource) { 1261 m_undoStack->undo(source);
1262 m_undoStack->undo();
1263 } 1262 }
1264 1263
1265 bool Editor::canRedo() { 1264 bool Editor::canRedo() {
1266 return m_undoStack->canRedo(); 1265 return m_undoStack->canRedo();
1267 } 1266 }
1268 1267
1269 // TODO(chongz): Fire 'beforeinput' for user triggered redo. 1268 void Editor::redo(EditCommandSource source) {
1270 void Editor::redo(EditCommandSource) { 1269 m_undoStack->redo(source);
1271 m_undoStack->redo();
1272 } 1270 }
1273 1271
1274 void Editor::setBaseWritingDirection(WritingDirection direction) { 1272 void Editor::setBaseWritingDirection(WritingDirection direction) {
1275 Element* focusedElement = frame().document()->focusedElement(); 1273 Element* focusedElement = frame().document()->focusedElement();
1276 if (isTextControlElement(focusedElement)) { 1274 if (isTextControlElement(focusedElement)) {
1277 if (direction == NaturalWritingDirection) 1275 if (direction == NaturalWritingDirection)
1278 return; 1276 return;
1279 focusedElement->setAttribute( 1277 focusedElement->setAttribute(
1280 dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl"); 1278 dirAttr, direction == LeftToRightWritingDirection ? "ltr" : "rtl");
1281 focusedElement->dispatchInputEvent(); 1279 focusedElement->dispatchInputEvent();
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1709 } 1707 }
1710 1708
1711 DEFINE_TRACE(Editor) { 1709 DEFINE_TRACE(Editor) {
1712 visitor->trace(m_frame); 1710 visitor->trace(m_frame);
1713 visitor->trace(m_lastEditCommand); 1711 visitor->trace(m_lastEditCommand);
1714 visitor->trace(m_undoStack); 1712 visitor->trace(m_undoStack);
1715 visitor->trace(m_mark); 1713 visitor->trace(m_mark);
1716 } 1714 }
1717 1715
1718 } // namespace blink 1716 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698