Bug 1181130 - Part 3: Keep track of editable descendants per node and prevent NS_STYLE_USER_SELECT_ALL selection for nodes with editable descendants. r=bz
This commit is contained in:
@@ -525,6 +525,14 @@ nsGenericHTMLElement::IntrinsicState() const
|
||||
return state;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsGenericHTMLElement::EditableInclusiveDescendantCount()
|
||||
{
|
||||
bool isEditable = IsInUncomposedDoc() && HasFlag(NODE_IS_EDITABLE) &&
|
||||
GetContentEditableValue() == eTrue;
|
||||
return EditableDescendantCount() + isEditable;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
||||
nsIContent* aBindingParent,
|
||||
@@ -548,6 +556,7 @@ 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) {
|
||||
@@ -2917,6 +2926,12 @@ nsGenericHTMLElement::ChangeEditableState(int32_t aChange)
|
||||
if (htmlDocument) {
|
||||
htmlDocument->ChangeContentEditableCount(this, aChange);
|
||||
}
|
||||
|
||||
nsIContent* parent = GetParent();
|
||||
while (parent) {
|
||||
parent->ChangeEditableDescendantCount(aChange);
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
}
|
||||
|
||||
if (document->HasFlag(NODE_IS_EDITABLE)) {
|
||||
|
||||
Reference in New Issue
Block a user