mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1341137 part 1 - Make Selection::addRange silently reject ranges that have a different root. r=smaug
This commit is contained in:
parent
73c8a5366c
commit
51817b4c94
@ -4964,6 +4964,16 @@ Selection::AddRange(nsIDOMRange* aDOMRange)
|
||||
void
|
||||
Selection::AddRange(nsRange& aRange, ErrorResult& aRv)
|
||||
{
|
||||
nsINode* rangeRoot = aRange.GetRoot();
|
||||
nsIDocument* doc = GetParentObject();
|
||||
if (doc != rangeRoot && (!rangeRoot ||
|
||||
doc != rangeRoot->GetComposedDoc())) {
|
||||
// http://w3c.github.io/selection-api/#dom-selection-addrange
|
||||
// "... if the root of the range's boundary points are the document
|
||||
// associated with context object. Otherwise, this method must do nothing."
|
||||
return;
|
||||
}
|
||||
|
||||
// This inserts a table cell range in proper document order
|
||||
// and returns NS_OK if range doesn't contain just one table cell
|
||||
bool didAddRange;
|
||||
|
Loading…
Reference in New Issue
Block a user