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

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

Issue 2469483002: [InputEvent] Add prefixes 'history*' and 'format*' to |inputType| (Closed)
Patch Set: CL format Created 4 years, 1 month 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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
854 return correctedSelection; 854 return correctedSelection;
855 } 855 }
856 856
857 void Editor::unappliedEditing(EditCommandComposition* cmd) { 857 void Editor::unappliedEditing(EditCommandComposition* cmd) {
858 EventQueueScope scope; 858 EventQueueScope scope;
859 859
860 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), 860 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(),
861 cmd->endingRootEditableElement()); 861 cmd->endingRootEditableElement());
862 dispatchInputEventEditableContentChanged( 862 dispatchInputEventEditableContentChanged(
863 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), 863 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(),
864 InputEvent::InputType::Undo, nullAtom, 864 InputEvent::InputType::HistoryUndo, nullAtom,
865 InputEvent::EventIsComposing::NotComposing); 865 InputEvent::EventIsComposing::NotComposing);
866 866
867 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 867 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
868 // needs to be audited. See http://crbug.com/590369 for more details. 868 // needs to be audited. See http://crbug.com/590369 for more details.
869 // In the long term, we should stop editing commands from storing 869 // In the long term, we should stop editing commands from storing
870 // VisibleSelections as starting and ending selections. 870 // VisibleSelections as starting and ending selections.
871 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets(); 871 frame().document()->updateStyleAndLayoutIgnorePendingStylesheets();
872 872
873 VisibleSelection newSelection = 873 VisibleSelection newSelection =
874 correctedVisibleSelection(cmd->startingSelection()); 874 correctedVisibleSelection(cmd->startingSelection());
875 if (newSelection.start().document() == frame().document() && 875 if (newSelection.start().document() == frame().document() &&
876 newSelection.end().document() == frame().document()) 876 newSelection.end().document() == frame().document())
877 changeSelectionAfterCommand( 877 changeSelectionAfterCommand(
878 newSelection, 878 newSelection,
879 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle); 879 FrameSelection::CloseTyping | FrameSelection::ClearTypingStyle);
880 880
881 m_lastEditCommand = nullptr; 881 m_lastEditCommand = nullptr;
882 m_undoStack->registerRedoStep(cmd); 882 m_undoStack->registerRedoStep(cmd);
883 respondToChangedContents(newSelection); 883 respondToChangedContents(newSelection);
884 } 884 }
885 885
886 void Editor::reappliedEditing(EditCommandComposition* cmd) { 886 void Editor::reappliedEditing(EditCommandComposition* cmd) {
887 EventQueueScope scope; 887 EventQueueScope scope;
888 888
889 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(), 889 dispatchEditableContentChangedEvents(cmd->startingRootEditableElement(),
890 cmd->endingRootEditableElement()); 890 cmd->endingRootEditableElement());
891 dispatchInputEventEditableContentChanged( 891 dispatchInputEventEditableContentChanged(
892 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(), 892 cmd->startingRootEditableElement(), cmd->endingRootEditableElement(),
893 InputEvent::InputType::Redo, nullAtom, 893 InputEvent::InputType::HistoryRedo, nullAtom,
894 InputEvent::EventIsComposing::NotComposing); 894 InputEvent::EventIsComposing::NotComposing);
895 895
896 // TODO(yosin): Since |dispatchEditableContentChangedEvents()| and 896 // TODO(yosin): Since |dispatchEditableContentChangedEvents()| and
897 // |dispatchInputEventEditableContentChanged()|, we would like to know 897 // |dispatchInputEventEditableContentChanged()|, we would like to know
898 // such case. Once we have a case, this |DCHECK()| should be replaced 898 // such case. Once we have a case, this |DCHECK()| should be replaced
899 // with if-statement. 899 // with if-statement.
900 DCHECK(frame().document()); 900 DCHECK(frame().document());
901 VisibleSelection newSelection(cmd->endingSelection()); 901 VisibleSelection newSelection(cmd->endingSelection());
902 if (newSelection.isValidFor(*frame().document())) 902 if (newSelection.isValidFor(*frame().document()))
903 changeSelectionAfterCommand( 903 changeSelectionAfterCommand(
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 } 1245 }
1246 1246
1247 MutableStylePropertySet* style = 1247 MutableStylePropertySet* style =
1248 MutableStylePropertySet::create(HTMLQuirksMode); 1248 MutableStylePropertySet::create(HTMLQuirksMode);
1249 style->setProperty( 1249 style->setProperty(
1250 CSSPropertyDirection, 1250 CSSPropertyDirection,
1251 direction == LeftToRightWritingDirection 1251 direction == LeftToRightWritingDirection
1252 ? "ltr" 1252 ? "ltr"
1253 : direction == RightToLeftWritingDirection ? "rtl" : "inherit", 1253 : direction == RightToLeftWritingDirection ? "rtl" : "inherit",
1254 false); 1254 false);
1255 applyParagraphStyleToSelection(style, 1255 applyParagraphStyleToSelection(
1256 InputEvent::InputType::SetWritingDirection); 1256 style, InputEvent::InputType::FormatSetBlockTextDirection);
1257 } 1257 }
1258 1258
1259 void Editor::revealSelectionAfterEditingOperation( 1259 void Editor::revealSelectionAfterEditingOperation(
1260 const ScrollAlignment& alignment, 1260 const ScrollAlignment& alignment,
1261 RevealExtentOption revealExtentOption) { 1261 RevealExtentOption revealExtentOption) {
1262 if (m_preventRevealSelection) 1262 if (m_preventRevealSelection)
1263 return; 1263 return;
1264 frame().selection().revealSelection(alignment, revealExtentOption); 1264 frame().selection().revealSelection(alignment, revealExtentOption);
1265 } 1265 }
1266 1266
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1648 } 1648 }
1649 1649
1650 DEFINE_TRACE(Editor) { 1650 DEFINE_TRACE(Editor) {
1651 visitor->trace(m_frame); 1651 visitor->trace(m_frame);
1652 visitor->trace(m_lastEditCommand); 1652 visitor->trace(m_lastEditCommand);
1653 visitor->trace(m_undoStack); 1653 visitor->trace(m_undoStack);
1654 visitor->trace(m_mark); 1654 visitor->trace(m_mark);
1655 } 1655 }
1656 1656
1657 } // namespace blink 1657 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698