From 63134a16f29e448889c4ef87c4f4710aef2aa77c Mon Sep 17 00:00:00 2001 From: rickg Date: Tue, 23 Jun 1998 01:34:25 +0000 Subject: [PATCH] added support for doc quality git-svn-id: svn://10.0.0.236/trunk@4259 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/document/src/nsHTMLContentSink.cpp | 27 +++++++++++++++---- mozilla/htmlparser/src/CNavDTD.cpp | 2 +- mozilla/htmlparser/src/COtherDTD.cpp | 2 +- mozilla/htmlparser/src/nsHTMLContentSink.cpp | 3 ++- mozilla/htmlparser/src/nsHTMLContentSink.h | 4 ++- mozilla/htmlparser/src/nsIContentSink.h | 4 ++- mozilla/htmlparser/src/nsIHTMLContentSink.h | 5 +++- .../html/document/src/nsHTMLContentSink.cpp | 27 +++++++++++++++---- mozilla/parser/htmlparser/src/CNavDTD.cpp | 2 +- mozilla/parser/htmlparser/src/COtherDTD.cpp | 2 +- .../htmlparser/src/nsHTMLContentSink.cpp | 3 ++- .../parser/htmlparser/src/nsHTMLContentSink.h | 4 ++- .../parser/htmlparser/src/nsIContentSink.h | 4 ++- .../htmlparser/src/nsIHTMLContentSink.h | 5 +++- 14 files changed, 72 insertions(+), 22 deletions(-) diff --git a/mozilla/content/html/document/src/nsHTMLContentSink.cpp b/mozilla/content/html/document/src/nsHTMLContentSink.cpp index ebf392c2783..82e24e80518 100644 --- a/mozilla/content/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/content/html/document/src/nsHTMLContentSink.cpp @@ -23,6 +23,7 @@ #include "nsHTMLDocument.h" #include "nsIPresShell.h" #include "nsIPresContext.h" +#include "nsIViewManager.h" #include "nsHTMLTokens.h" #include "nsCRT.h" #include "prtime.h" @@ -132,7 +133,7 @@ public: virtual PRBool AddLeaf(const nsIParserNode& aNode); virtual void WillBuildModel(void); - virtual void DidBuildModel(void); + virtual void DidBuildModel(PRInt32 aQualityLevel); virtual void WillInterrupt(void); virtual void WillResume(void); @@ -1367,16 +1368,31 @@ HTMLContentSink::WillBuildModel(void) StartLayout(); } + /** * This method gets called when the parser concludes the process * of building the content model via the content sink. * - * @update 5/7/98 gess + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; + * @update 6/21/98 gess */ -void -HTMLContentSink::DidBuildModel(void) -{ +void HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) { PR_LogPrint("DidBuildModel"); + + PRInt32 i, ns = mDocument->GetNumberOfShells(); + for (i = 0; i < ns; i++) { + nsIPresShell* shell = mDocument->GetShellAt(i); + if (nsnull != shell) { + nsIViewManager* vm = shell->GetViewManager(); + if(vm) { + vm->SetQuality(nsContentQuality(aQualityLevel)); + } + NS_RELEASE(vm); + NS_RELEASE(shell); + } + } + ReflowNewContent(); mDocument->EndLoad(); } @@ -1404,6 +1420,7 @@ HTMLContentSink::WillResume(void) { } + //---------------------------------------------------------------------- nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult, diff --git a/mozilla/htmlparser/src/CNavDTD.cpp b/mozilla/htmlparser/src/CNavDTD.cpp index ccfab970e1e..db531c7579d 100644 --- a/mozilla/htmlparser/src/CNavDTD.cpp +++ b/mozilla/htmlparser/src/CNavDTD.cpp @@ -301,7 +301,7 @@ PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){ CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE); } if(mSink) { - mSink->DidBuildModel(); + mSink->DidBuildModel(1); } return result; diff --git a/mozilla/htmlparser/src/COtherDTD.cpp b/mozilla/htmlparser/src/COtherDTD.cpp index 34576ef25a0..702336c0dc8 100644 --- a/mozilla/htmlparser/src/COtherDTD.cpp +++ b/mozilla/htmlparser/src/COtherDTD.cpp @@ -303,7 +303,7 @@ PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){ CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE); } if(mSink) { - mSink->DidBuildModel(); + mSink->DidBuildModel(0); } return result; diff --git a/mozilla/htmlparser/src/nsHTMLContentSink.cpp b/mozilla/htmlparser/src/nsHTMLContentSink.cpp index 3e355127b73..864573e8696 100644 --- a/mozilla/htmlparser/src/nsHTMLContentSink.cpp +++ b/mozilla/htmlparser/src/nsHTMLContentSink.cpp @@ -442,7 +442,7 @@ void nsHTMLContentSink::WillBuildModel(void){ * * @update 5/7/98 gess */ -void nsHTMLContentSink::DidBuildModel(void){ +void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){ } /** @@ -465,3 +465,4 @@ void nsHTMLContentSink::WillResume(void) { } + diff --git a/mozilla/htmlparser/src/nsHTMLContentSink.h b/mozilla/htmlparser/src/nsHTMLContentSink.h index 21e2f895482..afc368ac34b 100644 --- a/mozilla/htmlparser/src/nsHTMLContentSink.h +++ b/mozilla/htmlparser/src/nsHTMLContentSink.h @@ -127,9 +127,11 @@ class nsHTMLContentSink : public nsIHTMLContentSink { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void); + virtual void DidBuildModel(PRInt32 aQualityLevel); /** * This method gets called when the parser gets i/o blocked, diff --git a/mozilla/htmlparser/src/nsIContentSink.h b/mozilla/htmlparser/src/nsIContentSink.h index 425ebc0c68b..08222789f56 100644 --- a/mozilla/htmlparser/src/nsIContentSink.h +++ b/mozilla/htmlparser/src/nsIContentSink.h @@ -92,9 +92,11 @@ class nsIContentSink : public nsISupports { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void)=0; + virtual void DidBuildModel(PRInt32 aQualityLevel)=0; /** * This method gets called when the parser gets i/o blocked, diff --git a/mozilla/htmlparser/src/nsIHTMLContentSink.h b/mozilla/htmlparser/src/nsIHTMLContentSink.h index a75f5813c2b..8eb6934f33e 100644 --- a/mozilla/htmlparser/src/nsIHTMLContentSink.h +++ b/mozilla/htmlparser/src/nsIHTMLContentSink.h @@ -226,9 +226,11 @@ class nsIHTMLContentSink : public nsIContentSink { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void)=0; + virtual void DidBuildModel(PRInt32 aQualityLevel)=0; /** * This method gets called when the parser gets i/o blocked, @@ -246,6 +248,7 @@ class nsIHTMLContentSink : public nsIContentSink { * @update 5/7/98 gess */ virtual void WillResume(void)=0; + }; diff --git a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp index ebf392c2783..82e24e80518 100644 --- a/mozilla/layout/html/document/src/nsHTMLContentSink.cpp +++ b/mozilla/layout/html/document/src/nsHTMLContentSink.cpp @@ -23,6 +23,7 @@ #include "nsHTMLDocument.h" #include "nsIPresShell.h" #include "nsIPresContext.h" +#include "nsIViewManager.h" #include "nsHTMLTokens.h" #include "nsCRT.h" #include "prtime.h" @@ -132,7 +133,7 @@ public: virtual PRBool AddLeaf(const nsIParserNode& aNode); virtual void WillBuildModel(void); - virtual void DidBuildModel(void); + virtual void DidBuildModel(PRInt32 aQualityLevel); virtual void WillInterrupt(void); virtual void WillResume(void); @@ -1367,16 +1368,31 @@ HTMLContentSink::WillBuildModel(void) StartLayout(); } + /** * This method gets called when the parser concludes the process * of building the content model via the content sink. * - * @update 5/7/98 gess + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; + * @update 6/21/98 gess */ -void -HTMLContentSink::DidBuildModel(void) -{ +void HTMLContentSink::DidBuildModel(PRInt32 aQualityLevel) { PR_LogPrint("DidBuildModel"); + + PRInt32 i, ns = mDocument->GetNumberOfShells(); + for (i = 0; i < ns; i++) { + nsIPresShell* shell = mDocument->GetShellAt(i); + if (nsnull != shell) { + nsIViewManager* vm = shell->GetViewManager(); + if(vm) { + vm->SetQuality(nsContentQuality(aQualityLevel)); + } + NS_RELEASE(vm); + NS_RELEASE(shell); + } + } + ReflowNewContent(); mDocument->EndLoad(); } @@ -1404,6 +1420,7 @@ HTMLContentSink::WillResume(void) { } + //---------------------------------------------------------------------- nsresult NS_NewHTMLContentSink(nsIHTMLContentSink** aInstancePtrResult, diff --git a/mozilla/parser/htmlparser/src/CNavDTD.cpp b/mozilla/parser/htmlparser/src/CNavDTD.cpp index ccfab970e1e..db531c7579d 100644 --- a/mozilla/parser/htmlparser/src/CNavDTD.cpp +++ b/mozilla/parser/htmlparser/src/CNavDTD.cpp @@ -301,7 +301,7 @@ PRInt32 CNavDTD::DidBuildModel(PRInt32 anErrorCode){ CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE); } if(mSink) { - mSink->DidBuildModel(); + mSink->DidBuildModel(1); } return result; diff --git a/mozilla/parser/htmlparser/src/COtherDTD.cpp b/mozilla/parser/htmlparser/src/COtherDTD.cpp index 34576ef25a0..702336c0dc8 100644 --- a/mozilla/parser/htmlparser/src/COtherDTD.cpp +++ b/mozilla/parser/htmlparser/src/COtherDTD.cpp @@ -303,7 +303,7 @@ PRInt32 COtherDTD::DidBuildModel(PRInt32 anErrorCode){ CloseContainersTo(0,eHTMLTag_unknown,PR_FALSE); } if(mSink) { - mSink->DidBuildModel(); + mSink->DidBuildModel(0); } return result; diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSink.cpp b/mozilla/parser/htmlparser/src/nsHTMLContentSink.cpp index 3e355127b73..864573e8696 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSink.cpp +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSink.cpp @@ -442,7 +442,7 @@ void nsHTMLContentSink::WillBuildModel(void){ * * @update 5/7/98 gess */ -void nsHTMLContentSink::DidBuildModel(void){ +void nsHTMLContentSink::DidBuildModel(PRInt32 aQualityLevel){ } /** @@ -465,3 +465,4 @@ void nsHTMLContentSink::WillResume(void) { } + diff --git a/mozilla/parser/htmlparser/src/nsHTMLContentSink.h b/mozilla/parser/htmlparser/src/nsHTMLContentSink.h index 21e2f895482..afc368ac34b 100644 --- a/mozilla/parser/htmlparser/src/nsHTMLContentSink.h +++ b/mozilla/parser/htmlparser/src/nsHTMLContentSink.h @@ -127,9 +127,11 @@ class nsHTMLContentSink : public nsIHTMLContentSink { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void); + virtual void DidBuildModel(PRInt32 aQualityLevel); /** * This method gets called when the parser gets i/o blocked, diff --git a/mozilla/parser/htmlparser/src/nsIContentSink.h b/mozilla/parser/htmlparser/src/nsIContentSink.h index 425ebc0c68b..08222789f56 100644 --- a/mozilla/parser/htmlparser/src/nsIContentSink.h +++ b/mozilla/parser/htmlparser/src/nsIContentSink.h @@ -92,9 +92,11 @@ class nsIContentSink : public nsISupports { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void)=0; + virtual void DidBuildModel(PRInt32 aQualityLevel)=0; /** * This method gets called when the parser gets i/o blocked, diff --git a/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h b/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h index a75f5813c2b..8eb6934f33e 100644 --- a/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h +++ b/mozilla/parser/htmlparser/src/nsIHTMLContentSink.h @@ -226,9 +226,11 @@ class nsIHTMLContentSink : public nsIContentSink { * This method gets called when the parser concludes the process * of building the content model via the content sink. * + * @param aQualityLevel describes how well formed the doc was. + * 0=GOOD; 1=FAIR; 2=POOR; * @update 5/7/98 gess */ - virtual void DidBuildModel(void)=0; + virtual void DidBuildModel(PRInt32 aQualityLevel)=0; /** * This method gets called when the parser gets i/o blocked, @@ -246,6 +248,7 @@ class nsIHTMLContentSink : public nsIContentSink { * @update 5/7/98 gess */ virtual void WillResume(void)=0; + };