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

Unified Diff: sky/engine/core/dom/Document.cpp

Issue 713563003: Remove execCommand methods from Document. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/dom/Document.cpp
diff --git a/sky/engine/core/dom/Document.cpp b/sky/engine/core/dom/Document.cpp
index d9ac0852757e570a2ae8b02ca071715e4bd7cddb..e5ca8dd024d740bf5eef9183cd2c0802cfa0b8f9 100644
--- a/sky/engine/core/dom/Document.cpp
+++ b/sky/engine/core/dom/Document.cpp
@@ -78,7 +78,6 @@
#include "core/dom/custom/CustomElementRegistrationContext.h"
#include "core/dom/shadow/ElementShadow.h"
#include "core/dom/shadow/ShadowRoot.h"
-#include "core/editing/Editor.h"
#include "core/editing/FrameSelection.h"
#include "core/editing/SpellChecker.h"
#include "core/editing/markup.h"
@@ -2474,66 +2473,6 @@ KURL Document::completeURL(const String& url) const
return KURL(m_baseURL, url);
}
-// Support for Javascript execCommand, and related methods
-
-static Editor::Command command(Document* document, const String& commandName, bool userInterface = false)
-{
- LocalFrame* frame = document->frame();
- if (!frame || frame->document() != document)
- return Editor::Command();
-
- document->updateRenderTreeIfNeeded();
- return frame->editor().command(commandName, userInterface ? CommandFromDOMWithUserInterface : CommandFromDOM);
-}
-
-bool Document::execCommand(const String& commandName, bool userInterface, const String& value)
-{
- // We don't allow recusrive |execCommand()| to protect against attack code.
- // Recursive call of |execCommand()| could be happened by moving iframe
- // with script triggered by insertion, e.g. <iframe src="javascript:...">
- // <iframe onload="...">. This usage is valid as of the specification
- // although, it isn't common use case, rather it is used as attack code.
- static bool inExecCommand = false;
- if (inExecCommand) {
- String message = "We don't execute document.execCommand() this time, because it is called recursively.";
- addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
- return false;
- }
- TemporaryChange<bool> executeScope(inExecCommand, true);
-
- // Postpone DOM mutation events, which can execute scripts and change
- // DOM tree against implementation assumption.
- EventQueueScope eventQueueScope;
- Editor::Command editorCommand = command(this, commandName, userInterface);
- Platform::current()->histogramSparse("WebCore.Document.execCommand", editorCommand.idForHistogram());
- return editorCommand.execute(value);
-}
-
-bool Document::queryCommandEnabled(const String& commandName)
-{
- return command(this, commandName).isEnabled();
-}
-
-bool Document::queryCommandIndeterm(const String& commandName)
-{
- return command(this, commandName).state() == MixedTriState;
-}
-
-bool Document::queryCommandState(const String& commandName)
-{
- return command(this, commandName).state() == TrueTriState;
-}
-
-bool Document::queryCommandSupported(const String& commandName)
-{
- return command(this, commandName).isSupported();
-}
-
-String Document::queryCommandValue(const String& commandName)
-{
- return command(this, commandName).value();
-}
-
KURL Document::openSearchDescriptionURL()
{
return KURL();
« no previous file with comments | « sky/engine/core/dom/Document.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698