From 9b9a796719d7d8dee4e72d97a91ce471359d5c0f Mon Sep 17 00:00:00 2001 From: "troy%netscape.com" Date: Thu, 22 Oct 1998 20:12:34 +0000 Subject: [PATCH] Added new pseudo class style :SCROLLED-CONTENT --- content/html/content/src/nsHTMLAtoms.cpp | 2 ++ content/html/content/src/nsHTMLAtoms.h | 1 + content/html/style/src/nsHTMLStyleSheet.cpp | 5 ++--- content/shared/public/nsHTMLAtoms.h | 1 + content/shared/src/nsHTMLAtoms.cpp | 2 ++ layout/html/base/src/nsHTMLAtoms.cpp | 2 ++ layout/html/base/src/nsHTMLAtoms.h | 1 + layout/html/base/src/nsScrollFrame.cpp | 3 ++- layout/html/document/src/ua.css | 8 ++++++++ layout/html/style/src/nsHTMLStyleSheet.cpp | 5 ++--- layout/style/nsHTMLStyleSheet.cpp | 5 ++--- layout/style/ua.css | 8 ++++++++ 12 files changed, 33 insertions(+), 10 deletions(-) diff --git a/content/html/content/src/nsHTMLAtoms.cpp b/content/html/content/src/nsHTMLAtoms.cpp index 27777f39212c..5c294b59a4e2 100644 --- a/content/html/content/src/nsHTMLAtoms.cpp +++ b/content/html/content/src/nsHTMLAtoms.cpp @@ -183,6 +183,7 @@ nsIAtom* nsHTMLAtoms::rowspan; nsIAtom* nsHTMLAtoms::rules; nsIAtom* nsHTMLAtoms::scheme; nsIAtom* nsHTMLAtoms::scope; +nsIAtom* nsHTMLAtoms::scrolledContentPseudo; nsIAtom* nsHTMLAtoms::scrolling; nsIAtom* nsHTMLAtoms::select; nsIAtom* nsHTMLAtoms::selected; @@ -399,6 +400,7 @@ void nsHTMLAtoms::AddrefAtoms() rules = NS_NewAtom("RULES"); scheme = NS_NewAtom("SCHEME"); scope = NS_NewAtom("SCOPE"); + scrolledContentPseudo = NS_NewAtom(":SCROLLED-CONTENT"); scrolling = NS_NewAtom("SCROLLING"); select = NS_NewAtom("SELECT"); selected = NS_NewAtom("SELECTED"); diff --git a/content/html/content/src/nsHTMLAtoms.h b/content/html/content/src/nsHTMLAtoms.h index 9ee4a4aa4fd1..ad8f32d0fde4 100644 --- a/content/html/content/src/nsHTMLAtoms.h +++ b/content/html/content/src/nsHTMLAtoms.h @@ -217,6 +217,7 @@ public: static nsIAtom* scheme; static nsIAtom* scope; + static nsIAtom* scrolledContentPseudo; static nsIAtom* scrolling; static nsIAtom* select; static nsIAtom* selected; diff --git a/content/html/style/src/nsHTMLStyleSheet.cpp b/content/html/style/src/nsHTMLStyleSheet.cpp index 9058e7047b6a..18bd4c4b8abd 100644 --- a/content/html/style/src/nsHTMLStyleSheet.cpp +++ b/content/html/style/src/nsHTMLStyleSheet.cpp @@ -1517,12 +1517,11 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { // The scroll frame gets the original style context, and the scrolled - // frame gets a pseudo style context. - // XXX Is this the best way to do this? + // frame gets a SCROLLED-CONTENT pseudo class style context. scrollFrame->SetStyleContext(aPresContext, styleContext); nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::columnPseudo, + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::scrolledContentPseudo, scrollFrame); aFrameSubTree->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); diff --git a/content/shared/public/nsHTMLAtoms.h b/content/shared/public/nsHTMLAtoms.h index 9ee4a4aa4fd1..ad8f32d0fde4 100644 --- a/content/shared/public/nsHTMLAtoms.h +++ b/content/shared/public/nsHTMLAtoms.h @@ -217,6 +217,7 @@ public: static nsIAtom* scheme; static nsIAtom* scope; + static nsIAtom* scrolledContentPseudo; static nsIAtom* scrolling; static nsIAtom* select; static nsIAtom* selected; diff --git a/content/shared/src/nsHTMLAtoms.cpp b/content/shared/src/nsHTMLAtoms.cpp index 27777f39212c..5c294b59a4e2 100644 --- a/content/shared/src/nsHTMLAtoms.cpp +++ b/content/shared/src/nsHTMLAtoms.cpp @@ -183,6 +183,7 @@ nsIAtom* nsHTMLAtoms::rowspan; nsIAtom* nsHTMLAtoms::rules; nsIAtom* nsHTMLAtoms::scheme; nsIAtom* nsHTMLAtoms::scope; +nsIAtom* nsHTMLAtoms::scrolledContentPseudo; nsIAtom* nsHTMLAtoms::scrolling; nsIAtom* nsHTMLAtoms::select; nsIAtom* nsHTMLAtoms::selected; @@ -399,6 +400,7 @@ void nsHTMLAtoms::AddrefAtoms() rules = NS_NewAtom("RULES"); scheme = NS_NewAtom("SCHEME"); scope = NS_NewAtom("SCOPE"); + scrolledContentPseudo = NS_NewAtom(":SCROLLED-CONTENT"); scrolling = NS_NewAtom("SCROLLING"); select = NS_NewAtom("SELECT"); selected = NS_NewAtom("SELECTED"); diff --git a/layout/html/base/src/nsHTMLAtoms.cpp b/layout/html/base/src/nsHTMLAtoms.cpp index 27777f39212c..5c294b59a4e2 100644 --- a/layout/html/base/src/nsHTMLAtoms.cpp +++ b/layout/html/base/src/nsHTMLAtoms.cpp @@ -183,6 +183,7 @@ nsIAtom* nsHTMLAtoms::rowspan; nsIAtom* nsHTMLAtoms::rules; nsIAtom* nsHTMLAtoms::scheme; nsIAtom* nsHTMLAtoms::scope; +nsIAtom* nsHTMLAtoms::scrolledContentPseudo; nsIAtom* nsHTMLAtoms::scrolling; nsIAtom* nsHTMLAtoms::select; nsIAtom* nsHTMLAtoms::selected; @@ -399,6 +400,7 @@ void nsHTMLAtoms::AddrefAtoms() rules = NS_NewAtom("RULES"); scheme = NS_NewAtom("SCHEME"); scope = NS_NewAtom("SCOPE"); + scrolledContentPseudo = NS_NewAtom(":SCROLLED-CONTENT"); scrolling = NS_NewAtom("SCROLLING"); select = NS_NewAtom("SELECT"); selected = NS_NewAtom("SELECTED"); diff --git a/layout/html/base/src/nsHTMLAtoms.h b/layout/html/base/src/nsHTMLAtoms.h index 9ee4a4aa4fd1..ad8f32d0fde4 100644 --- a/layout/html/base/src/nsHTMLAtoms.h +++ b/layout/html/base/src/nsHTMLAtoms.h @@ -217,6 +217,7 @@ public: static nsIAtom* scheme; static nsIAtom* scope; + static nsIAtom* scrolledContentPseudo; static nsIAtom* scrolling; static nsIAtom* select; static nsIAtom* selected; diff --git a/layout/html/base/src/nsScrollFrame.cpp b/layout/html/base/src/nsScrollFrame.cpp index 7964a0048d11..ede8a5146713 100644 --- a/layout/html/base/src/nsScrollFrame.cpp +++ b/layout/html/base/src/nsScrollFrame.cpp @@ -277,7 +277,8 @@ nsScrollFrame::CreateScrollingView() if (NS_OK == rv) { // Initialize the scrolling view // XXX Check for opacity... - view->Init(viewManager, mRect, parentView, &kWidgetCID, nsnull, nsnull); + //view->Init(viewManager, mRect, parentView, &kWidgetCID, nsnull, nsnull); + view->Init(viewManager, mRect, parentView, nsnull, nsnull, nsnull); // Insert the view into the view hierarchy viewManager->InsertChild(parentView, view, 0); diff --git a/layout/html/document/src/ua.css b/layout/html/document/src/ua.css index dcdc8e878854..b3d06b33cfef 100644 --- a/layout/html/document/src/ua.css +++ b/layout/html/document/src/ua.css @@ -470,3 +470,11 @@ NOSCRIPT { NOFRAMES { display: none; } + +// Pseudo-classes + +:SCROLLED-CONTENT { + background: inherit; + padding: inherit; +} + diff --git a/layout/html/style/src/nsHTMLStyleSheet.cpp b/layout/html/style/src/nsHTMLStyleSheet.cpp index 9058e7047b6a..18bd4c4b8abd 100644 --- a/layout/html/style/src/nsHTMLStyleSheet.cpp +++ b/layout/html/style/src/nsHTMLStyleSheet.cpp @@ -1517,12 +1517,11 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { // The scroll frame gets the original style context, and the scrolled - // frame gets a pseudo style context. - // XXX Is this the best way to do this? + // frame gets a SCROLLED-CONTENT pseudo class style context. scrollFrame->SetStyleContext(aPresContext, styleContext); nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::columnPseudo, + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::scrolledContentPseudo, scrollFrame); aFrameSubTree->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); diff --git a/layout/style/nsHTMLStyleSheet.cpp b/layout/style/nsHTMLStyleSheet.cpp index 9058e7047b6a..18bd4c4b8abd 100644 --- a/layout/style/nsHTMLStyleSheet.cpp +++ b/layout/style/nsHTMLStyleSheet.cpp @@ -1517,12 +1517,11 @@ HTMLStyleSheetImpl::ConstructFrame(nsIPresContext* aPresContext, if NS_SUCCEEDED(NS_NewScrollFrame(aContent, aParentFrame, scrollFrame)) { // The scroll frame gets the original style context, and the scrolled - // frame gets a pseudo style context. - // XXX Is this the best way to do this? + // frame gets a SCROLLED-CONTENT pseudo class style context. scrollFrame->SetStyleContext(aPresContext, styleContext); nsIStyleContext* pseudoStyle; - pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::columnPseudo, + pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsHTMLAtoms::scrolledContentPseudo, scrollFrame); aFrameSubTree->SetStyleContext(aPresContext, pseudoStyle); NS_RELEASE(pseudoStyle); diff --git a/layout/style/ua.css b/layout/style/ua.css index dcdc8e878854..b3d06b33cfef 100644 --- a/layout/style/ua.css +++ b/layout/style/ua.css @@ -470,3 +470,11 @@ NOSCRIPT { NOFRAMES { display: none; } + +// Pseudo-classes + +:SCROLLED-CONTENT { + background: inherit; + padding: inherit; +} +