added pseudo frame support
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user