added pseudo frame support

This commit is contained in:
peterl
1998-05-18 21:11:08 +00:00
parent 3a658860f5
commit d058d81e76
6 changed files with 222 additions and 93 deletions

View File

@@ -23,6 +23,7 @@
#include "nsISupportsArray.h"
#include "nsIHTMLContent.h"
#include "nsIStyleRule.h"
#include "nsIFrame.h"
static NS_DEFINE_IID(kIHTMLStyleSheetIID, NS_IHTML_STYLE_SHEET_IID);
static NS_DEFINE_IID(kIStyleSheetIID, NS_ISTYLE_SHEET_IID);
@@ -46,6 +47,11 @@ public:
nsIFrame* aParentFrame,
nsISupportsArray* aResults);
virtual PRInt32 RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIFrame* aParentFrame,
nsISupportsArray* aResults);
virtual nsIURL* GetURL(void);
// XXX style rule enumerations
@@ -158,25 +164,41 @@ PRInt32 HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
PRInt32 matchCount = 0;
nsIHTMLContent* htmlContent;
// for now, just get the one and only style rule from the content
// this may need some special handling for pseudo-frames
if (NS_OK == aContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent)) {
nsIStyleRule* rule = htmlContent->GetStyleRule();
if (nsnull != rule) {
aResults->AppendElement(rule);
NS_RELEASE(rule);
matchCount++;
}
NS_RELEASE(htmlContent);
nsIContent* parentContent = nsnull;
if (nsnull != aParentFrame) {
aParentFrame->GetContent(parentContent);
}
if (aContent != parentContent) { // if not a pseudo frame...
nsIHTMLContent* htmlContent;
// just get the one and only style rule from the content
if (NS_OK == aContent->QueryInterface(kIHTMLContentIID, (void**)&htmlContent)) {
nsIStyleRule* rule = htmlContent->GetStyleRule();
if (nsnull != rule) {
aResults->AppendElement(rule);
NS_RELEASE(rule);
matchCount++;
}
NS_RELEASE(htmlContent);
}
}
NS_IF_RELEASE(parentContent);
return matchCount;
}
PRInt32 HTMLStyleSheetImpl::RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsIFrame* aParentFrame,
nsISupportsArray* aResults)
{
// no pseudo frame style
return 0;
}
nsIURL* HTMLStyleSheetImpl::GetURL(void)
{
NS_ADDREF(mURL);