mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Backed out changeset: d98cdb0cdd15
This commit is contained in:
parent
b3cbee5843
commit
d1f4783508
@ -3260,13 +3260,12 @@ void
|
||||
nsHTMLDocument::TearingDownEditor(nsIEditor *aEditor)
|
||||
{
|
||||
if (IsEditingOn()) {
|
||||
EditingState oldState = mEditingState;
|
||||
mEditingState = eTearingDown;
|
||||
|
||||
nsCOMPtr<nsIEditorStyleSheets> editorss = do_QueryInterface(aEditor);
|
||||
if (editorss) {
|
||||
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/contenteditable.css"));
|
||||
if (oldState == eDesignMode)
|
||||
if (mEditingState == eDesignMode)
|
||||
editorss->RemoveOverrideStyleSheet(NS_LITERAL_STRING("resource://gre/res/designmode.css"));
|
||||
}
|
||||
}
|
||||
@ -3298,15 +3297,6 @@ nsHTMLDocument::TurnEditingOff()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsHTMLDocument::ReinitEditor()
|
||||
{
|
||||
NS_ASSERTION(mEditingState != eOff, "Editor not inited.");
|
||||
|
||||
TurnEditingOff();
|
||||
return EditingStateChanged();
|
||||
}
|
||||
|
||||
static PRBool HasPresShell(nsPIDOMWindow *aWindow)
|
||||
{
|
||||
nsIDocShell *docShell = aWindow->GetDocShell();
|
||||
|
@ -231,8 +231,6 @@ public:
|
||||
mFragmentParser = aParser;
|
||||
}
|
||||
|
||||
virtual nsresult ReinitEditor();
|
||||
|
||||
virtual nsresult SetEditingState(EditingState aState);
|
||||
|
||||
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
|
||||
|
@ -171,13 +171,6 @@ public:
|
||||
* SetDesignMode().
|
||||
*/
|
||||
virtual nsresult SetEditingState(EditingState aState) = 0;
|
||||
|
||||
/**
|
||||
* Re-inits the editor. Editing must be on from contentEditable or designMode
|
||||
* when calling this.
|
||||
* Required because of the way the editor works. (bug 440614)
|
||||
*/
|
||||
virtual nsresult ReinitEditor() = 0;
|
||||
|
||||
/**
|
||||
* Returns the result of document.all[aID] which can either be a node
|
||||
|
@ -71,7 +71,6 @@ _TEST_FILES = test_bug1682.html \
|
||||
test_bug403868.html \
|
||||
test_bug403868.xhtml \
|
||||
test_bug404320.html \
|
||||
test_bug440614.html \
|
||||
test_form-parsing.html \
|
||||
test_viewport.html \
|
||||
test_documentAll.html \
|
||||
|
@ -1,103 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=440614
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 440614</title>
|
||||
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=440614">Mozilla Bug 440614</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var styleSheets = null;
|
||||
|
||||
function checkStylesheets() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
// Evidently RemoveStyleSheet is the only method in nsIEditorStyleSheets
|
||||
// that would throw. RemoveOverrideStyleSheet returns NS_OK even if the
|
||||
// sheet is not there
|
||||
var removed = 0;
|
||||
try
|
||||
{
|
||||
styleSheets.removeStyleSheet("resource://gre/res/designmode.css");
|
||||
removed++;
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
try {
|
||||
styleSheets.removeStyleSheet("resource://gre/res/contenteditable.css");
|
||||
removed++;
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
is(removed, 0, "Should have thrown if stylesheet was not there");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
/** Not really bug 440614, just found while fixing 440614 **/
|
||||
var editframe = window.frames[0];
|
||||
var editdoc = editframe.document;
|
||||
var editor = null;
|
||||
editdoc.write('');
|
||||
editdoc.close();
|
||||
|
||||
editdoc.designMode='on';
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(editframe);
|
||||
|
||||
styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);
|
||||
|
||||
editdoc.designMode='off';
|
||||
|
||||
checkStylesheets();
|
||||
|
||||
// Let go
|
||||
editor = null;
|
||||
styleSheets = null;
|
||||
|
||||
editdoc.body.contentEditable = true;
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(editframe);
|
||||
|
||||
styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);
|
||||
|
||||
editdoc.body.contentEditable = false;
|
||||
|
||||
checkStylesheets();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
//XXX I don't know if this is necessary, but we're dealing with iframes...
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -86,7 +86,7 @@
|
||||
#include "nsIRenderingContext.h"
|
||||
#include "nsIFrameFrame.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIHTMLDocument.h"
|
||||
#include "nsIDOMNSHTMLDocument.h"
|
||||
#include "nsDisplayList.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsIReflowCallback.h"
|
||||
@ -975,15 +975,21 @@ nsSubDocumentFrame::ShowDocShell()
|
||||
// Trigger editor re-initialization if midas is turned on in the
|
||||
// sub-document. This shouldn't be necessary, but given the way our
|
||||
// editor works, it is. See
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=284245 && 440614
|
||||
// https://bugzilla.mozilla.org/show_bug.cgi?id=284245
|
||||
docShell->GetPresShell(getter_AddRefs(presShell));
|
||||
if (presShell) {
|
||||
nsCOMPtr<nsIHTMLDocument> doc =
|
||||
nsCOMPtr<nsIDOMNSHTMLDocument> doc =
|
||||
do_QueryInterface(presShell->GetDocument());
|
||||
|
||||
// Re-init the editor, if necessary
|
||||
if (doc && doc->IsEditingOn())
|
||||
doc->ReinitEditor();
|
||||
if (doc) {
|
||||
nsAutoString designMode;
|
||||
doc->GetDesignMode(designMode);
|
||||
|
||||
if (designMode.EqualsLiteral("on")) {
|
||||
doc->SetDesignMode(NS_LITERAL_STRING("off"));
|
||||
doc->SetDesignMode(NS_LITERAL_STRING("on"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user