mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 01:48:05 +00:00
Bug 346373: Resync children when parent spellcheck attribute changes.
r=bzbarsky sr=sicking
This commit is contained in:
parent
b0949e6412
commit
581157178e
@ -1704,10 +1704,7 @@ nsGenericHTMLElement::AfterSetAttr(PRInt32 aNamespaceID, nsIAtom* aName,
|
|||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
}
|
}
|
||||||
else if (aNotify && aName == nsHTMLAtoms::spellcheck) {
|
else if (aNotify && aName == nsHTMLAtoms::spellcheck) {
|
||||||
nsCOMPtr<nsIEditor> editor = GetAssociatedEditor();
|
SyncEditorsOnSubtree(this);
|
||||||
if (editor) {
|
|
||||||
editor->SyncRealTimeSpell();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4146,3 +4143,28 @@ nsGenericHTMLElement::IsCurrentBodyElement()
|
|||||||
htmlDocument->GetBody(getter_AddRefs(htmlElement));
|
htmlDocument->GetBody(getter_AddRefs(htmlElement));
|
||||||
return htmlElement == bodyElement;
|
return htmlElement == bodyElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// static
|
||||||
|
void
|
||||||
|
nsGenericHTMLElement::SyncEditorsOnSubtree(nsIContent* content)
|
||||||
|
{
|
||||||
|
/* Sync this node */
|
||||||
|
nsGenericHTMLElement* element = FromContent(content);
|
||||||
|
if (element) {
|
||||||
|
nsCOMPtr<nsIEditor> editor = element->GetAssociatedEditor();
|
||||||
|
if (editor) {
|
||||||
|
editor->SyncRealTimeSpell();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sync all children */
|
||||||
|
PRUint32 childCount = content->GetChildCount();
|
||||||
|
for (PRUint32 i = 0; i < childCount; ++i) {
|
||||||
|
nsIContent* childContent = content->GetChildAt(i);
|
||||||
|
NS_ASSERTION(childContent,
|
||||||
|
"DOM mutated unexpectedly while syncing editors!");
|
||||||
|
if (childContent) {
|
||||||
|
SyncEditorsOnSubtree(childContent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -766,6 +766,12 @@ protected:
|
|||||||
* Returns true if this is the current document's body element
|
* Returns true if this is the current document's body element
|
||||||
*/
|
*/
|
||||||
PRBool IsCurrentBodyElement();
|
PRBool IsCurrentBodyElement();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ensures all editors associated with a subtree are synced, for purposes of
|
||||||
|
* spellchecking.
|
||||||
|
*/
|
||||||
|
static void SyncEditorsOnSubtree(nsIContent* content);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user