20603: In an HTML document, the body node should always be part of the

selection, because output needs to get style nodes on the body. r=sfraser
This commit is contained in:
akkana%netscape.com 1999-12-08 02:05:16 +00:00
Родитель f19ca0df41
Коммит b5d1582420
4 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -3559,5 +3559,22 @@ nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms)
return NS_OK;
}
PRBool
nsHTMLDocument::IsInSelection(nsIDOMSelection* aSelection,
const nsIContent* aContent) const
{
// HTML document has to include body in the selection,
// so that output can see style nodes on the body.
nsIAtom* tag;
nsresult rv = aContent->GetTag(tag);
PRBool retval = (NS_SUCCEEDED(rv) && tag == nsHTMLAtoms::body);
NS_IF_RELEASE(tag);
if (retval)
return retval;
return nsDocument::IsInSelection(aSelection, aContent);
}

Просмотреть файл

@ -133,6 +133,11 @@ public:
*/
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
/*
* Like nsDocument::IsInSelection except it always includes the body node
*/
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
protected:
// Find/Search Method/Data member
PRBool SearchBlock(BlockText & aBlockText,

Просмотреть файл

@ -3559,5 +3559,22 @@ nsHTMLDocument::GetForms(nsIDOMHTMLCollection** aForms)
return NS_OK;
}
PRBool
nsHTMLDocument::IsInSelection(nsIDOMSelection* aSelection,
const nsIContent* aContent) const
{
// HTML document has to include body in the selection,
// so that output can see style nodes on the body.
nsIAtom* tag;
nsresult rv = aContent->GetTag(tag);
PRBool retval = (NS_SUCCEEDED(rv) && tag == nsHTMLAtoms::body);
NS_IF_RELEASE(tag);
if (retval)
return retval;
return nsDocument::IsInSelection(aSelection, aContent);
}

Просмотреть файл

@ -133,6 +133,11 @@ public:
*/
NS_IMETHOD FindNext(const nsString &aSearchStr, PRBool aMatchCase, PRBool aSearchDown, PRBool &aIsFound);
/*
* Like nsDocument::IsInSelection except it always includes the body node
*/
virtual PRBool IsInSelection(nsIDOMSelection* aSelection, const nsIContent *aContent) const;
protected:
// Find/Search Method/Data member
PRBool SearchBlock(BlockText & aBlockText,