From 92f8d12843058769dbd61ffc502abaf094a16d29 Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Fri, 19 Feb 1999 00:53:09 +0000 Subject: [PATCH] Added pseudo style for 'page' element git-svn-id: svn://10.0.0.236/trunk@21244 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/shared/public/nsLayoutAtoms.h | 1 + mozilla/content/shared/src/nsLayoutAtoms.cpp | 3 +++ mozilla/layout/base/nsCSSFrameConstructor.cpp | 10 ++++++++-- mozilla/layout/base/nsLayoutAtoms.cpp | 3 +++ mozilla/layout/base/nsLayoutAtoms.h | 1 + mozilla/layout/base/public/nsLayoutAtoms.h | 1 + mozilla/layout/base/src/nsLayoutAtoms.cpp | 3 +++ mozilla/layout/html/document/src/ua.css | 5 +++++ .../layout/html/style/src/nsCSSFrameConstructor.cpp | 10 ++++++++-- mozilla/layout/style/ua.css | 5 +++++ 10 files changed, 38 insertions(+), 4 deletions(-) diff --git a/mozilla/content/shared/public/nsLayoutAtoms.h b/mozilla/content/shared/public/nsLayoutAtoms.h index ce7947ac1f7..627f3f1a2b6 100644 --- a/mozilla/content/shared/public/nsLayoutAtoms.h +++ b/mozilla/content/shared/public/nsLayoutAtoms.h @@ -61,6 +61,7 @@ public: static nsIAtom* commentTagName; static nsIAtom* textTagName; static nsIAtom* viewportPseudo; + static nsIAtom* pagePseudo; // Alphabetical list of frame types static nsIAtom* areaFrame; diff --git a/mozilla/content/shared/src/nsLayoutAtoms.cpp b/mozilla/content/shared/src/nsLayoutAtoms.cpp index 5e7ba8a2850..d2901d378d9 100644 --- a/mozilla/content/shared/src/nsLayoutAtoms.cpp +++ b/mozilla/content/shared/src/nsLayoutAtoms.cpp @@ -47,6 +47,7 @@ nsIAtom* nsLayoutAtoms::floaterList; nsIAtom* nsLayoutAtoms::commentTagName; nsIAtom* nsLayoutAtoms::textTagName; nsIAtom* nsLayoutAtoms::viewportPseudo; +nsIAtom* nsLayoutAtoms::pagePseudo; // frame types nsIAtom* nsLayoutAtoms::areaFrame; @@ -84,6 +85,7 @@ void nsLayoutAtoms::AddrefAtoms() commentTagName = NS_NewAtom("__moz_comment"); textTagName = NS_NewAtom("__moz_text"); viewportPseudo = NS_NewAtom(":-moz-viewport"); + pagePseudo = NS_NewAtom(":-moz-page"); areaFrame = NS_NewAtom("AreaFrame"); pageFrame = NS_NewAtom("PageFrame"); @@ -122,6 +124,7 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(commentTagName); NS_RELEASE(textTagName); NS_RELEASE(viewportPseudo); + NS_RELEASE(pagePseudo); NS_RELEASE(areaFrame); NS_RELEASE(pageFrame); diff --git a/mozilla/layout/base/nsCSSFrameConstructor.cpp b/mozilla/layout/base/nsCSSFrameConstructor.cpp index 78d2a80e99b..478886fa844 100644 --- a/mozilla/layout/base/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/base/nsCSSFrameConstructor.cpp @@ -1411,9 +1411,15 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, // Initialize the page and force it to have a view. This makes printing of // the pages easier and faster. // XXX Use a PAGE style context... - pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, viewportPseudoStyle); + nsCOMPtr pagePseudoStyle; + + aPresContext->ResolvePseudoStyleContextFor(nsnull, nsLayoutAtoms::pagePseudo, + viewportPseudoStyle, PR_FALSE, + getter_AddRefs(pagePseudoStyle)); + + pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, pagePseudoStyle); nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame, - viewportPseudoStyle, PR_TRUE); + pagePseudoStyle, PR_TRUE); // The eventual parent of the document element frame mDocElementContainingBlock = pageFrame; diff --git a/mozilla/layout/base/nsLayoutAtoms.cpp b/mozilla/layout/base/nsLayoutAtoms.cpp index 5e7ba8a2850..d2901d378d9 100644 --- a/mozilla/layout/base/nsLayoutAtoms.cpp +++ b/mozilla/layout/base/nsLayoutAtoms.cpp @@ -47,6 +47,7 @@ nsIAtom* nsLayoutAtoms::floaterList; nsIAtom* nsLayoutAtoms::commentTagName; nsIAtom* nsLayoutAtoms::textTagName; nsIAtom* nsLayoutAtoms::viewportPseudo; +nsIAtom* nsLayoutAtoms::pagePseudo; // frame types nsIAtom* nsLayoutAtoms::areaFrame; @@ -84,6 +85,7 @@ void nsLayoutAtoms::AddrefAtoms() commentTagName = NS_NewAtom("__moz_comment"); textTagName = NS_NewAtom("__moz_text"); viewportPseudo = NS_NewAtom(":-moz-viewport"); + pagePseudo = NS_NewAtom(":-moz-page"); areaFrame = NS_NewAtom("AreaFrame"); pageFrame = NS_NewAtom("PageFrame"); @@ -122,6 +124,7 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(commentTagName); NS_RELEASE(textTagName); NS_RELEASE(viewportPseudo); + NS_RELEASE(pagePseudo); NS_RELEASE(areaFrame); NS_RELEASE(pageFrame); diff --git a/mozilla/layout/base/nsLayoutAtoms.h b/mozilla/layout/base/nsLayoutAtoms.h index ce7947ac1f7..627f3f1a2b6 100644 --- a/mozilla/layout/base/nsLayoutAtoms.h +++ b/mozilla/layout/base/nsLayoutAtoms.h @@ -61,6 +61,7 @@ public: static nsIAtom* commentTagName; static nsIAtom* textTagName; static nsIAtom* viewportPseudo; + static nsIAtom* pagePseudo; // Alphabetical list of frame types static nsIAtom* areaFrame; diff --git a/mozilla/layout/base/public/nsLayoutAtoms.h b/mozilla/layout/base/public/nsLayoutAtoms.h index ce7947ac1f7..627f3f1a2b6 100644 --- a/mozilla/layout/base/public/nsLayoutAtoms.h +++ b/mozilla/layout/base/public/nsLayoutAtoms.h @@ -61,6 +61,7 @@ public: static nsIAtom* commentTagName; static nsIAtom* textTagName; static nsIAtom* viewportPseudo; + static nsIAtom* pagePseudo; // Alphabetical list of frame types static nsIAtom* areaFrame; diff --git a/mozilla/layout/base/src/nsLayoutAtoms.cpp b/mozilla/layout/base/src/nsLayoutAtoms.cpp index 5e7ba8a2850..d2901d378d9 100644 --- a/mozilla/layout/base/src/nsLayoutAtoms.cpp +++ b/mozilla/layout/base/src/nsLayoutAtoms.cpp @@ -47,6 +47,7 @@ nsIAtom* nsLayoutAtoms::floaterList; nsIAtom* nsLayoutAtoms::commentTagName; nsIAtom* nsLayoutAtoms::textTagName; nsIAtom* nsLayoutAtoms::viewportPseudo; +nsIAtom* nsLayoutAtoms::pagePseudo; // frame types nsIAtom* nsLayoutAtoms::areaFrame; @@ -84,6 +85,7 @@ void nsLayoutAtoms::AddrefAtoms() commentTagName = NS_NewAtom("__moz_comment"); textTagName = NS_NewAtom("__moz_text"); viewportPseudo = NS_NewAtom(":-moz-viewport"); + pagePseudo = NS_NewAtom(":-moz-page"); areaFrame = NS_NewAtom("AreaFrame"); pageFrame = NS_NewAtom("PageFrame"); @@ -122,6 +124,7 @@ void nsLayoutAtoms::ReleaseAtoms() NS_RELEASE(commentTagName); NS_RELEASE(textTagName); NS_RELEASE(viewportPseudo); + NS_RELEASE(pagePseudo); NS_RELEASE(areaFrame); NS_RELEASE(pageFrame); diff --git a/mozilla/layout/html/document/src/ua.css b/mozilla/layout/html/document/src/ua.css index 52d5bfb7966..fd5c925687b 100644 --- a/mozilla/layout/html/document/src/ua.css +++ b/mozilla/layout/html/document/src/ua.css @@ -682,6 +682,11 @@ param { background-color: inherit; } +/* XXX Temporary until @page is supported... */ +:-moz-page { + background: none; +} + :root { display: block; background-color: inherit; diff --git a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp index 78d2a80e99b..478886fa844 100644 --- a/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp +++ b/mozilla/layout/html/style/src/nsCSSFrameConstructor.cpp @@ -1411,9 +1411,15 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresContext* aPresContext, // Initialize the page and force it to have a view. This makes printing of // the pages easier and faster. // XXX Use a PAGE style context... - pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, viewportPseudoStyle); + nsCOMPtr pagePseudoStyle; + + aPresContext->ResolvePseudoStyleContextFor(nsnull, nsLayoutAtoms::pagePseudo, + viewportPseudoStyle, PR_FALSE, + getter_AddRefs(pagePseudoStyle)); + + pageFrame->Init(*aPresContext, nsnull, pageSequenceFrame, pagePseudoStyle); nsHTMLContainerFrame::CreateViewForFrame(*aPresContext, pageFrame, - viewportPseudoStyle, PR_TRUE); + pagePseudoStyle, PR_TRUE); // The eventual parent of the document element frame mDocElementContainingBlock = pageFrame; diff --git a/mozilla/layout/style/ua.css b/mozilla/layout/style/ua.css index 52d5bfb7966..fd5c925687b 100644 --- a/mozilla/layout/style/ua.css +++ b/mozilla/layout/style/ua.css @@ -682,6 +682,11 @@ param { background-color: inherit; } +/* XXX Temporary until @page is supported... */ +:-moz-page { + background: none; +} + :root { display: block; background-color: inherit;