From 4b202376f192e67a2ef8e2c9a3c5e3c1b1e66224 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 --- .../html/document/src/nsHTMLContentSink.cpp | 27 +++++++++++++++---- htmlparser/src/CNavDTD.cpp | 2 +- htmlparser/src/COtherDTD.cpp | 2 +- htmlparser/src/nsHTMLContentSink.cpp | 3 ++- htmlparser/src/nsHTMLContentSink.h | 4 ++- htmlparser/src/nsIContentSink.h | 4 ++- htmlparser/src/nsIHTMLContentSink.h | 5 +++- .../html/document/src/nsHTMLContentSink.cpp | 27 +++++++++++++++---- parser/htmlparser/src/CNavDTD.cpp | 2 +- parser/htmlparser/src/COtherDTD.cpp | 2 +- parser/htmlparser/src/nsHTMLContentSink.cpp | 3 ++- parser/htmlparser/src/nsHTMLContentSink.h | 4 ++- parser/htmlparser/src/nsIContentSink.h | 4 ++- parser/htmlparser/src/nsIHTMLContentSink.h | 5 +++- 14 files changed, 72 insertions(+), 22 deletions(-) diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index ebf392c2783c..82e24e805187 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/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/htmlparser/src/CNavDTD.cpp b/htmlparser/src/CNavDTD.cpp index ccfab970e1e1..db531c7579d0 100644 --- a/htmlparser/src/CNavDTD.cpp +++ b/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/htmlparser/src/COtherDTD.cpp b/htmlparser/src/COtherDTD.cpp index 34576ef25a04..702336c0dc88 100644 --- a/htmlparser/src/COtherDTD.cpp +++ b/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/htmlparser/src/nsHTMLContentSink.cpp b/htmlparser/src/nsHTMLContentSink.cpp index 3e355127b734..864573e8696c 100644 --- a/htmlparser/src/nsHTMLContentSink.cpp +++ b/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/htmlparser/src/nsHTMLContentSink.h b/htmlparser/src/nsHTMLContentSink.h index 21e2f8954823..afc368ac34ba 100644 --- a/htmlparser/src/nsHTMLContentSink.h +++ b/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/htmlparser/src/nsIContentSink.h b/htmlparser/src/nsIContentSink.h index 425ebc0c68b6..08222789f569 100644 --- a/htmlparser/src/nsIContentSink.h +++ b/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/htmlparser/src/nsIHTMLContentSink.h b/htmlparser/src/nsIHTMLContentSink.h index a75f5813c2b2..8eb6934f33e5 100644 --- a/htmlparser/src/nsIHTMLContentSink.h +++ b/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/layout/html/document/src/nsHTMLContentSink.cpp b/layout/html/document/src/nsHTMLContentSink.cpp index ebf392c2783c..82e24e805187 100644 --- a/layout/html/document/src/nsHTMLContentSink.cpp +++ b/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/parser/htmlparser/src/CNavDTD.cpp b/parser/htmlparser/src/CNavDTD.cpp index ccfab970e1e1..db531c7579d0 100644 --- a/parser/htmlparser/src/CNavDTD.cpp +++ b/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/parser/htmlparser/src/COtherDTD.cpp b/parser/htmlparser/src/COtherDTD.cpp index 34576ef25a04..702336c0dc88 100644 --- a/parser/htmlparser/src/COtherDTD.cpp +++ b/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/parser/htmlparser/src/nsHTMLContentSink.cpp b/parser/htmlparser/src/nsHTMLContentSink.cpp index 3e355127b734..864573e8696c 100644 --- a/parser/htmlparser/src/nsHTMLContentSink.cpp +++ b/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/parser/htmlparser/src/nsHTMLContentSink.h b/parser/htmlparser/src/nsHTMLContentSink.h index 21e2f8954823..afc368ac34ba 100644 --- a/parser/htmlparser/src/nsHTMLContentSink.h +++ b/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/parser/htmlparser/src/nsIContentSink.h b/parser/htmlparser/src/nsIContentSink.h index 425ebc0c68b6..08222789f569 100644 --- a/parser/htmlparser/src/nsIContentSink.h +++ b/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/parser/htmlparser/src/nsIHTMLContentSink.h b/parser/htmlparser/src/nsIHTMLContentSink.h index a75f5813c2b2..8eb6934f33e5 100644 --- a/parser/htmlparser/src/nsIHTMLContentSink.h +++ b/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; + };