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

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

Issue 337473010: Move implementation of WebFrameImpl::executeCommand to Editor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2014-06-27T03:18:08 Created 6 years, 5 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 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 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 * Copyright (C) 2009 Igalia S.L. 4 * Copyright (C) 2009 Igalia S.L.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 Editor::Command Editor::command(const String& commandName) 1668 Editor::Command Editor::command(const String& commandName)
1669 { 1669 {
1670 return Command(internalCommand(commandName), CommandFromMenuOrKeyBinding, &m _frame); 1670 return Command(internalCommand(commandName), CommandFromMenuOrKeyBinding, &m _frame);
1671 } 1671 }
1672 1672
1673 Editor::Command Editor::command(const String& commandName, EditorCommandSource s ource) 1673 Editor::Command Editor::command(const String& commandName, EditorCommandSource s ource)
1674 { 1674 {
1675 return Command(internalCommand(commandName), source, &m_frame); 1675 return Command(internalCommand(commandName), source, &m_frame);
1676 } 1676 }
1677 1677
1678 bool Editor::executeCommand(const String& commandName)
1679 {
1680 // Specially handling commands that Editor::execCommand does not directly
1681 // support.
1682 if (commandName == "DeleteToEndOfParagraph") {
1683 if (!deleteWithDirection(DirectionForward, ParagraphBoundary, true, fals e))
1684 deleteWithDirection(DirectionForward, CharacterGranularity, true, fa lse);
1685 return true;
1686 }
1687 if (commandName == "DeleteBackward")
1688 return command(AtomicString("BackwardDelete")).execute();
1689 if (commandName == "DeleteForward")
1690 return command(AtomicString("ForwardDelete")).execute();
1691 if (commandName == "AdvanceToNextMisspelling") {
1692 // Wee need to pass false here or else the currently selected word will never be skipped.
1693 spellChecker().advanceToNextMisspelling(false);
1694 return true;
1695 }
1696 if (commandName == "ToggleSpellPanel") {
1697 spellChecker().showSpellingGuessPanel();
1698 return true;
1699 }
1700 return command(commandName).execute();
1701 }
1702
1703 bool Editor::executeCommand(const String& commandName, const String& value)
1704 {
1705 // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebK it for editable nodes.
1706 if (!canEdit() && commandName == "moveToBeginningOfDocument")
1707 return m_frame.eventHandler().bubblingScroll(ScrollUp, ScrollByDocument) ;
1708
1709 if (!canEdit() && commandName == "moveToEndOfDocument")
1710 return m_frame.eventHandler().bubblingScroll(ScrollDown, ScrollByDocumen t);
1711
1712 if (commandName == "showGuessPanel") {
1713 spellChecker().showSpellingGuessPanel();
1714 return true;
1715 }
1716
1717 return command(commandName).execute(value);
1718 }
1719
1678 Editor::Command::Command() 1720 Editor::Command::Command()
1679 : m_command(0) 1721 : m_command(0)
1680 { 1722 {
1681 } 1723 }
1682 1724
1683 Editor::Command::Command(const EditorInternalCommand* command, EditorCommandSour ce source, PassRefPtr<LocalFrame> frame) 1725 Editor::Command::Command(const EditorInternalCommand* command, EditorCommandSour ce source, PassRefPtr<LocalFrame> frame)
1684 : m_command(command) 1726 : m_command(command)
1685 , m_source(source) 1727 , m_source(source)
1686 , m_frame(command ? frame : nullptr) 1728 , m_frame(command ? frame : nullptr)
1687 { 1729 {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1751 { 1793 {
1752 return m_command && m_command->isTextInsertion; 1794 return m_command && m_command->isTextInsertion;
1753 } 1795 }
1754 1796
1755 int Editor::Command::idForHistogram() const 1797 int Editor::Command::idForHistogram() const
1756 { 1798 {
1757 return isSupported() ? m_command->idForUserMetrics : 0; 1799 return isSupported() ? m_command->idForUserMetrics : 0;
1758 } 1800 }
1759 1801
1760 } // namespace WebCore 1802 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698