Closed Bug 375684 Opened 16 years ago Closed 16 years ago
assertion when dragging the source is the document root node
The assertion at http://lxr.mozilla.org/mozilla/source/layout/base/nsPresShell.cpp#5090 shouldn't be used as the range can have the start and end as the document root node, and the ancestor becomes the document. See the attached testcase. nsINode* ancestor = nsContentUtils::GetCommonAncestor(range->GetStartParent(), range->GetEndParent()); NS_ASSERTION(!ancestor || ancestor->IsNodeOfType(nsINode::eCONTENT), "common ancestor is not content"); roc, I guess in this case, we should just get the document root node and use that?
Why are we getting the common ancestor of the nodes' parents? Couldn't/shouldn't we just get the common ancestor of the nodes themselves?
If you're referring to GetStartParent/GetEndParent, they are just perhaps misnamed, they return the nodes themselves.
OK then, GetCommonAncestor should be returning the root node, right? The common ancestor of two references to the same node is that node.
This is because nsRange::SelectNode(node) gets the parent of node and then sets the end points based on that. So I think if the start or end point is the root node, we should just use the root frame instead.
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.