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

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

Issue 184103011: Clear undo stack when text control is set programatically Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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) 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 935 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 return undoStack->canRedo(); 946 return undoStack->canRedo();
947 return false; 947 return false;
948 } 948 }
949 949
950 void Editor::redo() 950 void Editor::redo()
951 { 951 {
952 if (UndoStack* undoStack = this->undoStack()) 952 if (UndoStack* undoStack = this->undoStack())
953 undoStack->redo(); 953 undoStack->redo();
954 } 954 }
955 955
956 void Editor::clearUndoStack()
957 {
958 if (UndoStack* undoStack = this->undoStack())
959 undoStack->clear();
960 }
961
956 void Editor::setBaseWritingDirection(WritingDirection direction) 962 void Editor::setBaseWritingDirection(WritingDirection direction)
957 { 963 {
958 Node* focusedElement = frame().document()->focusedElement(); 964 Node* focusedElement = frame().document()->focusedElement();
959 if (focusedElement && isHTMLTextFormControlElement(*focusedElement)) { 965 if (focusedElement && isHTMLTextFormControlElement(*focusedElement)) {
960 if (direction == NaturalWritingDirection) 966 if (direction == NaturalWritingDirection)
961 return; 967 return;
962 toHTMLElement(focusedElement)->setAttribute(dirAttr, direction == LeftTo RightWritingDirection ? "ltr" : "rtl"); 968 toHTMLElement(focusedElement)->setAttribute(dirAttr, direction == LeftTo RightWritingDirection ? "ltr" : "rtl");
963 focusedElement->dispatchInputEvent(); 969 focusedElement->dispatchInputEvent();
964 frame().document()->updateStyleIfNeeded(); 970 frame().document()->updateStyleIfNeeded();
965 return; 971 return;
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 return m_frame.spellChecker(); 1237 return m_frame.spellChecker();
1232 } 1238 }
1233 1239
1234 void Editor::toggleOverwriteModeEnabled() 1240 void Editor::toggleOverwriteModeEnabled()
1235 { 1241 {
1236 m_overwriteModeEnabled = !m_overwriteModeEnabled; 1242 m_overwriteModeEnabled = !m_overwriteModeEnabled;
1237 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled); 1243 frame().selection().setShouldShowBlockCursor(m_overwriteModeEnabled);
1238 } 1244 }
1239 1245
1240 } // namespace WebCore 1246 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698