Fix for bug 83078 (document.write of 'LINK' (ext. stylesheet) causes duplicate content). Call UpdateAllContexts when a stylesheet is add/removed/enabled/disabled. r=harishd, sr=jst, a=chofmann.

This commit is contained in:
peterv%netscape.com 2001-05-30 20:35:20 +00:00
Родитель 7db715079e
Коммит 3740f9b3fe
1 изменённых файлов: 39 добавлений и 20 удалений

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

@ -235,7 +235,8 @@ public:
NS_IMETHOD_(void) Notify(nsITimer *timer);
// nsICSSLoaderObserver
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet*aSheet, PRBool aNotify);
NS_IMETHOD StyleSheetLoaded(nsICSSStyleSheet* aSheet,
PRBool aNotify) { return NS_OK; };
// nsIDocumentObserver
NS_IMETHOD BeginUpdate(nsIDocument *aDocument);
@ -275,12 +276,12 @@ public:
nsIContent* aChild,
PRInt32 aIndexInContainer) { return NS_OK; }
NS_IMETHOD StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet) { return NS_OK; }
nsIStyleSheet* aStyleSheet);
NS_IMETHOD StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet) { return NS_OK; }
nsIStyleSheet* aStyleSheet);
NS_IMETHOD StyleSheetDisabledStateChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aDisabled) { return NS_OK; }
PRBool aDisabled);
NS_IMETHOD StyleRuleChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
nsIStyleRule* aStyleRule,
@ -3948,22 +3949,6 @@ HTMLContentSink::ProcessLink(nsIHTMLContent* aElement, const nsAReadableString&
return result;
}
NS_IMETHODIMP
HTMLContentSink::StyleSheetLoaded(nsICSSStyleSheet* aSheet,
PRBool aDidNotify)
{
// If there was a notification done for this style sheet, we know
// that frames have been created for all content seen so far
// (processing of a new style sheet causes recreation of the frame
// model). As a result, all contexts should update their notion of
// how much frame creation has happened.
if (aDidNotify) {
UpdateAllContexts();
}
return NS_OK;
}
nsresult
HTMLContentSink::ProcessStyleLink(nsIHTMLContent* aElement,
const nsString& aHref, const nsString& aRel,
@ -4417,6 +4402,40 @@ HTMLContentSink::EndUpdate(nsIDocument *aDocument)
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::StyleSheetAdded(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
// Processing of a new style sheet causes recreation of the frame
// model. As a result, all contexts should update their notion of
// how much frame creation has happened.
UpdateAllContexts();
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::StyleSheetRemoved(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet)
{
// Removing a style sheet causes recreation of the frame model.
// As a result, all contexts should update their notion of how
// much frame creation has happened.
UpdateAllContexts();
return NS_OK;
}
NS_IMETHODIMP
HTMLContentSink::StyleSheetDisabledStateChanged(nsIDocument *aDocument,
nsIStyleSheet* aStyleSheet,
PRBool aDisabled)
{
// Disabling/enabling a style sheet causes recreation of the frame
// model. As a result, all contexts should update their notion of
// how much frame creation has happened.
UpdateAllContexts();
return NS_OK;
}
nsresult
HTMLContentSink::ResumeParsing()
{