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

Side by Side Diff: third_party/WebKit/Source/core/dom/Document.cpp

Issue 1637323002: Editing: Tidy up HTML document structure before execCommand(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert the Node.cpp change Created 4 years, 10 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) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2001 Dirk Mueller (mueller@kde.org) 4 * (C) 2001 Dirk Mueller (mueller@kde.org)
5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org) 5 * (C) 2006 Alexey Proskuryakov (ap@webkit.org)
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved. 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2011, 2012 Apple Inc. All r ights reserved.
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved. 8 * Copyright (C) 2008, 2009, 2011, 2012 Google Inc. All rights reserved.
9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2010-2011. All rights reserved.
(...skipping 4437 matching lines...) Expand 10 before | Expand all | Expand 10 after
4448 if (m_isRunningExecCommand) { 4448 if (m_isRunningExecCommand) {
4449 String message = "We don't execute document.execCommand() this time, bec ause it is called recursively."; 4449 String message = "We don't execute document.execCommand() this time, bec ause it is called recursively.";
4450 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage Level, message)); 4450 addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessage Level, message));
4451 return false; 4451 return false;
4452 } 4452 }
4453 TemporaryChange<bool> executeScope(m_isRunningExecCommand, true); 4453 TemporaryChange<bool> executeScope(m_isRunningExecCommand, true);
4454 4454
4455 // Postpone DOM mutation events, which can execute scripts and change 4455 // Postpone DOM mutation events, which can execute scripts and change
4456 // DOM tree against implementation assumption. 4456 // DOM tree against implementation assumption.
4457 EventQueueScope eventQueueScope; 4457 EventQueueScope eventQueueScope;
4458 Editor::tidyUpHTMLStructure(*this);
4458 Editor::Command editorCommand = command(this, commandName); 4459 Editor::Command editorCommand = command(this, commandName);
4459 Platform::current()->histogramSparse("WebCore.Document.execCommand", editorC ommand.idForHistogram()); 4460 Platform::current()->histogramSparse("WebCore.Document.execCommand", editorC ommand.idForHistogram());
4460 return editorCommand.execute(value); 4461 return editorCommand.execute(value);
4461 } 4462 }
4462 4463
4463 bool Document::queryCommandEnabled(const String& commandName, ExceptionState& ex ceptionState) 4464 bool Document::queryCommandEnabled(const String& commandName, ExceptionState& ex ceptionState)
4464 { 4465 {
4465 if (!isHTMLDocument() && !isXHTMLDocument()) { 4466 if (!isHTMLDocument() && !isXHTMLDocument()) {
4466 exceptionState.throwDOMException(InvalidStateError, "queryCommandEnabled is only supported on HTML documents."); 4467 exceptionState.throwDOMException(InvalidStateError, "queryCommandEnabled is only supported on HTML documents.");
4467 return false; 4468 return false;
(...skipping 1456 matching lines...) Expand 10 before | Expand all | Expand 10 after
5924 #ifndef NDEBUG 5925 #ifndef NDEBUG
5925 using namespace blink; 5926 using namespace blink;
5926 void showLiveDocumentInstances() 5927 void showLiveDocumentInstances()
5927 { 5928 {
5928 Document::WeakDocumentSet& set = Document::liveDocumentSet(); 5929 Document::WeakDocumentSet& set = Document::liveDocumentSet();
5929 fprintf(stderr, "There are %u documents currently alive:\n", set.size()); 5930 fprintf(stderr, "There are %u documents currently alive:\n", set.size());
5930 for (Document* document : set) 5931 for (Document* document : set)
5931 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data()); 5932 fprintf(stderr, "- Document %p URL: %s\n", document, document->url().str ing().utf8().data());
5932 } 5933 }
5933 #endif 5934 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698