mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 06:18:38 +09:00
Issue #2135 - Bug 1066965: Make contentEditable and spellchecking to work in Shadow DOM
This commit is contained in:
parent
b2c77e5eda
commit
010db07bf3
10 changed files with 60 additions and 30 deletions
|
|
@ -463,7 +463,7 @@ nsGenericHTMLElement::IntrinsicState() const
|
|||
uint32_t
|
||||
nsGenericHTMLElement::EditableInclusiveDescendantCount()
|
||||
{
|
||||
bool isEditable = IsInUncomposedDoc() && HasFlag(NODE_IS_EDITABLE) &&
|
||||
bool isEditable = IsInComposedDoc() && HasFlag(NODE_IS_EDITABLE) &&
|
||||
GetContentEditableValue() == eTrue;
|
||||
return EditableDescendantCount() + isEditable;
|
||||
}
|
||||
|
|
@ -484,12 +484,14 @@ nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
aDocument->
|
||||
AddToNameTable(this, GetParsedAttr(nsGkAtoms::name)->GetAtomValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (HasFlag(NODE_IS_EDITABLE) && GetContentEditableValue() == eTrue) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(aDocument);
|
||||
if (htmlDocument) {
|
||||
htmlDocument->ChangeContentEditableCount(this, +1);
|
||||
}
|
||||
if (HasFlag(NODE_IS_EDITABLE) && GetContentEditableValue() == eTrue &&
|
||||
IsInComposedDoc()) {
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument =
|
||||
do_QueryInterface(GetComposedDoc());
|
||||
if (htmlDocument) {
|
||||
htmlDocument->ChangeContentEditableCount(this, +1);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -514,8 +516,7 @@ nsGenericHTMLElement::UnbindFromTree(bool aDeep, bool aNullParent)
|
|||
RemoveFromNameTable();
|
||||
|
||||
if (GetContentEditableValue() == eTrue) {
|
||||
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetUncomposedDoc());
|
||||
nsCOMPtr<nsIHTMLDocument> htmlDocument = do_QueryInterface(GetComposedDoc());
|
||||
if (htmlDocument) {
|
||||
htmlDocument->ChangeContentEditableCount(this, -1);
|
||||
}
|
||||
|
|
@ -2774,8 +2775,7 @@ MakeContentDescendantsEditable(nsIContent *aContent, nsIDocument *aDocument)
|
|||
void
|
||||
nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
||||
{
|
||||
//XXXsmaug Fix this for Shadow DOM, bug 1066965.
|
||||
nsIDocument* document = GetUncomposedDoc();
|
||||
nsIDocument* document = GetComposedDoc();
|
||||
if (!document) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -2788,7 +2788,8 @@ nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
|||
}
|
||||
|
||||
nsIContent* parent = GetParent();
|
||||
while (parent) {
|
||||
// Don't update across Shadow DOM boundary.
|
||||
while (parent && parent->IsElement()) {
|
||||
parent->ChangeEditableDescendantCount(aChange);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue