Bug 545775 part.6 makes caret visible r=ehsan

This commit is contained in:
Masayuki Nakano 2010-06-19 19:39:39 +09:00
Родитель b7c33e680f
Коммит b811ef83ef
3 изменённых файлов: 24 добавлений и 10 удалений

Просмотреть файл

@ -5835,6 +5835,11 @@ nsHTMLEditor::ResetRootElementAndEventTarget()
mRootElement = nsnull;
nsresult rv = InstallEventListeners();
NS_ENSURE_SUCCESS(rv, );
// We must have mRootElement now.
nsCOMPtr<nsIDOMElement> root;
rv = GetRootElement(getter_AddRefs(root));
NS_ENSURE_SUCCESS(rv, );
NS_ENSURE_TRUE(mRootElement, );
rv = BeginningOfDocument();

Просмотреть файл

@ -150,7 +150,7 @@ public:
virtual nsresult HandleKeyPressEvent(nsIDOMKeyEvent* aKeyEvent);
virtual PRBool HasFocus();
virtual already_AddRefed<nsPIDOMEventTarget> GetPIDOMEventTarget();
already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
virtual already_AddRefed<nsIContent> FindSelectionRoot(nsINode *aNode);
/* ------------ nsStubMutationObserver overrides --------- */
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED

Просмотреть файл

@ -89,20 +89,27 @@ function onLoadIFrame()
var frameDoc = gIFrame.contentWindow.document;
const kTest = kTests[gTestIndex];
ok(true, "Running " + kTest.description);
if (kTest.args.length == 1) {
kTest.initializer(frameDoc, gSetFocusToIFrame, kTest.args[0]);
} else {
ok(false, "kTests is broken at index=" + gTestIndex);
}
var selCon = gIFrame.contentWindow.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsISelectionDisplay).
QueryInterface(Components.interfaces.nsISelectionController);
var utils = window.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
const nsIDOMNode = Components.interfaces.nsIDOMNode;
// move focus to the HTML editor
const kTest = kTests[gTestIndex];
ok(true, "Running " + kTest.description);
if (kTest.args.length == 1) {
kTest.initializer(frameDoc, gSetFocusToIFrame, kTest.args[0]);
ok(selCon.caretVisible, "caret isn't visible -- " + kTest.description);
} else {
ok(false, "kTests is broken at index=" + gTestIndex);
}
is(utils.IMEStatus, utils.IME_STATUS_ENABLED,
"IME isn't enabled -- " + kTest.description);
synthesizeKey("A", { }, gIFrame.contentWindow);
@ -115,7 +122,9 @@ function onLoadIFrame()
"the content of body isn't text node -- " + kTest.description);
if (content.nodeType == nsIDOMNode.TEXT_NODE) {
is(content.data, "ABC",
"the content of body text isn't 'ABC' -- " + kTest.description);
"the content of body text isn't 'ABC' -- " + kTest.description);
is(frameDoc.body.innerHTML, "ABC",
"the innerHTML of body isn't 'ABC' -- " + kTest.description);
}
}