Fix for 67739. r=pierre,attinasi sr=ben

This commit is contained in:
hyatt%netscape.com 2001-02-15 21:24:47 +00:00
Родитель decfc48502
Коммит 093c9c2e71
19 изменённых файлов: 201 добавлений и 2239 удалений

Просмотреть файл

@ -35,6 +35,7 @@ class nsIPresContext;
class nsIContent;
class nsISupportsArray;
class nsIAtom;
class nsICSSPseudoComparator;
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
@ -63,6 +64,7 @@ public:
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsISupportsArray* aResults) = 0;
// Test if style is dependent on content state

Просмотреть файл

@ -164,7 +164,8 @@ public:
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique = PR_FALSE);
PRBool aForceUnique = PR_FALSE,
nsICSSPseudoComparator* aComparator = nsnull);
virtual nsIStyleContext* ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
@ -949,21 +950,24 @@ struct PseudoRulesMatchingData {
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsISupportsArray* aResults)
: mPresContext(aPresContext),
mMedium(aMedium),
mParentContent(aParentContent),
mPseudoTag(aPseudoTag),
mParentContext(aParentContext),
mComparator(aComparator),
mResults(aResults)
{
}
nsIPresContext* mPresContext;
nsIAtom* mMedium;
nsIContent* mParentContent;
nsIAtom* mPseudoTag;
nsIStyleContext* mParentContext;
nsISupportsArray* mResults;
nsIPresContext* mPresContext;
nsIAtom* mMedium;
nsIContent* mParentContent;
nsIAtom* mPseudoTag;
nsIStyleContext* mParentContext;
nsICSSPseudoComparator* mComparator;
nsISupportsArray* mResults;
};
static PRBool
@ -974,7 +978,7 @@ EnumPseudoRulesMatching(nsISupports* aProcessor, void* aData)
processor->RulesMatching(data->mPresContext, data->mMedium,
data->mParentContent, data->mPseudoTag,
data->mParentContext, data->mResults);
data->mParentContext, data->mComparator, data->mResults);
return PR_TRUE;
}
@ -982,7 +986,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator)
{
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
STYLESET_START_TIMER(NS_TIMER_STYLE_RESOLUTION);
@ -1000,7 +1005,7 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIAtom* medium = nsnull;
aPresContext->GetMedium(&medium);
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
aPseudoTag, aParentContext, rules);
aPseudoTag, aParentContext, aComparator, rules);
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
PRBool usedRules = PR_FALSE;
@ -1056,7 +1061,7 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIAtom* medium = nsnull;
aPresContext->GetMedium(&medium);
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
aPseudoTag, aParentContext, rules);
aPseudoTag, aParentContext, nsnull, rules);
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
PRBool usedRules = PR_FALSE;

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsICSSPseudoComparator_h___
#define nsICSSPseudoComparator_h___
// {4B122120-0F2D-4e88-AFE9-84A9AE2404E5}
#define NS_ICSS_PSEUDO_COMPARATOR_IID \
{ 0x4b122120, 0xf2d, 0x4e88, { 0xaf, 0xe9, 0x84, 0xa9, 0xae, 0x24, 0x4, 0xe5 } }
class nsIAtom;
struct nsCSSSelector;
class nsICSSPseudoComparator: public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_ICSS_PSEUDO_COMPARATOR_IID; return iid; }
NS_IMETHOD PseudoMatches(nsIAtom* aTag, nsCSSSelector* aSelector, PRBool* aResult)=0;
};
#endif /* nsICSSPseudoComparator_h___ */

Просмотреть файл

@ -633,6 +633,18 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsIStyleContext** aResult)
{
return ResolvePseudoStyleWithComparator(aParentContent, aPseudoTag, aParentContext,
aForceUnique, nsnull, aResult);
}
NS_IMETHODIMP
nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
@ -645,7 +657,7 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
if (NS_SUCCEEDED(rv)) {
if (set) {
result = set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
aParentContext, aForceUnique, aComparator);
if (nsnull == result) {
rv = NS_ERROR_OUT_OF_MEMORY;
}

Просмотреть файл

@ -60,6 +60,7 @@ class nsString;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
#define NS_IPRESCONTEXT_IID \
{ 0x0a5d12e0, 0x944e, 0x11d1, \
@ -181,6 +182,21 @@ public:
PRBool aForceUnique,
nsIStyleContext** aResult) = 0;
/**
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
* The tag should be lowercase and inclue the colon.
* ie: NS_NewAtom(":first-line");
*
* Instead of matching solely on aPseudoTag, a comparator function can be
* passed in to test.
*/
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult) = 0;
/**
* Probe style for a pseudo frame within the given aParentContent & aParentContext.
* This will return nsnull id there are no explicit rules for the pseudo element.

Просмотреть файл

@ -60,6 +60,7 @@ class nsString;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
#define NS_IPRESCONTEXT_IID \
{ 0x0a5d12e0, 0x944e, 0x11d1, \
@ -181,6 +182,21 @@ public:
PRBool aForceUnique,
nsIStyleContext** aResult) = 0;
/**
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
* The tag should be lowercase and inclue the colon.
* ie: NS_NewAtom(":first-line");
*
* Instead of matching solely on aPseudoTag, a comparator function can be
* passed in to test.
*/
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult) = 0;
/**
* Probe style for a pseudo frame within the given aParentContent & aParentContext.
* This will return nsnull id there are no explicit rules for the pseudo element.

Просмотреть файл

@ -1,76 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsIStyleRuleProcessor_h___
#define nsIStyleRuleProcessor_h___
#include <stdio.h>
#include "nslayout.h"
#include "nsISupports.h"
class nsISizeOfHandler;
class nsIStyleSheet;
class nsIStyleContext;
class nsIPresContext;
class nsIContent;
class nsISupportsArray;
class nsIAtom;
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
{0x015575fe, 0x7b6c, 0x11d3, {0xba, 0x05, 0x00, 0x10, 0x83, 0x02, 0x3c, 0x2b}}
/* The style rule processor interface is a mechanism to seperate the matching
* of style rules from style sheet instances.
* Simple style sheets can and will act as their own processor.
* Sheets where rule ordering interlaces between multiple sheets, will need to
* share a single rule processor between them (CSS sheets do this for cascading order)
*/
class nsIStyleRuleProcessor : public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_ISTYLE_RULE_PROCESSOR_IID; return iid; }
// populate supports array with nsIStyleRule*
// rules are ordered, those with higher precedence come last
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent,
nsIStyleContext* aParentContext,
nsISupportsArray* aResults) = 0;
NS_IMETHOD RulesMatching(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsISupportsArray* aResults) = 0;
// Test if style is dependent on content state
NS_IMETHOD HasStateDependentStyle(nsIPresContext* aPresContext,
nsIAtom* aMedium,
nsIContent* aContent) = 0;
virtual void SizeOf(nsISizeOfHandler *aSizeofHandler, PRUint32 &aSize) = 0;
};
#endif /* nsIStyleRuleProcessor_h___ */

Просмотреть файл

@ -42,6 +42,8 @@ struct nsFindFrameHint;
#include "nsVoidArray.h"
class nsISizeOfHandler;
class nsICSSPseudoComparator;
#define SHARE_STYLECONTEXTS
#ifdef SHARE_STYLECONTEXTS
@ -105,7 +107,8 @@ public:
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique = PR_FALSE) = 0;
PRBool aForceUnique = PR_FALSE,
nsICSSPseudoComparator* aComparator = nsnull) = 0;
// This funtions just like ResolvePseudoStyleFor except that it will
// return nsnull if there are no explicit style rules for that

Просмотреть файл

@ -60,6 +60,7 @@ class nsString;
class nsIEventStateManager;
class nsIURI;
class nsILookAndFeel;
class nsICSSPseudoComparator;
#define NS_IPRESCONTEXT_IID \
{ 0x0a5d12e0, 0x944e, 0x11d1, \
@ -181,6 +182,21 @@ public:
PRBool aForceUnique,
nsIStyleContext** aResult) = 0;
/**
* Resolve style for a pseudo frame within the given aParentContent & aParentContext.
* The tag should be lowercase and inclue the colon.
* ie: NS_NewAtom(":first-line");
*
* Instead of matching solely on aPseudoTag, a comparator function can be
* passed in to test.
*/
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult) = 0;
/**
* Probe style for a pseudo frame within the given aParentContent & aParentContext.
* This will return nsnull id there are no explicit rules for the pseudo element.

Просмотреть файл

@ -633,6 +633,18 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsIStyleContext** aResult)
{
return ResolvePseudoStyleWithComparator(aParentContent, aPseudoTag, aParentContext,
aForceUnique, nsnull, aResult);
}
NS_IMETHODIMP
nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult)
{
NS_PRECONDITION(nsnull != aResult, "null ptr");
if (nsnull == aResult) {
@ -645,7 +657,7 @@ nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
if (NS_SUCCEEDED(rv)) {
if (set) {
result = set->ResolvePseudoStyleFor(this, aParentContent, aPseudoTag,
aParentContext, aForceUnique);
aParentContext, aForceUnique, aComparator);
if (nsnull == result) {
rv = NS_ERROR_OUT_OF_MEMORY;
}

Просмотреть файл

@ -83,6 +83,12 @@ public:
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsIStyleContext** aResult);
NS_IMETHOD ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator,
nsIStyleContext** aResult);
NS_IMETHOD ProbePseudoStyleContextFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -6,6 +6,7 @@ nsCSSAtoms.h
nsCSSAtomList.h
nsICSSLoader.h
nsICSSParser.h
nsICSSPseudoComparator.h
nsICSSStyleSheet.h
nsStyleUtil.h
nsICSSLoaderObserver.h

Просмотреть файл

@ -33,6 +33,7 @@ EXPORTS = \
nsCSSAtomList.h \
nsICSSLoader.h \
nsICSSParser.h \
nsICSSPseudoComparator.h \
nsICSSStyleSheet.h \
nsStyleUtil.h \
nsICSSLoaderObserver.h \

Просмотреть файл

@ -21,7 +21,7 @@
DEPTH=..\..\..\..
EXPORTS=nsCSSAtoms.h nsCSSAtomList.h nsICSSLoader.h nsICSSParser.h nsICSSStyleSheet.h nsStyleUtil.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h
EXPORTS=nsCSSAtoms.h nsCSSAtomList.h nsICSSLoader.h nsICSSParser.h nsICSSPseudoComparator.h nsICSSStyleSheet.h nsStyleUtil.h nsICSSLoaderObserver.h nsIComputedDOMStyle.h
MODULE=raptor
include <$(DEPTH)\config\rules.mak>

Просмотреть файл

Просмотреть файл

@ -0,0 +1,39 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
#ifndef nsICSSPseudoComparator_h___
#define nsICSSPseudoComparator_h___
// {4B122120-0F2D-4e88-AFE9-84A9AE2404E5}
#define NS_ICSS_PSEUDO_COMPARATOR_IID \
{ 0x4b122120, 0xf2d, 0x4e88, { 0xaf, 0xe9, 0x84, 0xa9, 0xae, 0x24, 0x4, 0xe5 } }
class nsIAtom;
struct nsCSSSelector;
class nsICSSPseudoComparator: public nsISupports {
public:
static const nsIID& GetIID() { static nsIID iid = NS_ICSS_PSEUDO_COMPARATOR_IID; return iid; }
NS_IMETHOD PseudoMatches(nsIAtom* aTag, nsCSSSelector* aSelector, PRBool* aResult)=0;
};
#endif /* nsICSSPseudoComparator_h___ */

Просмотреть файл

@ -35,6 +35,7 @@ class nsIPresContext;
class nsIContent;
class nsISupportsArray;
class nsIAtom;
class nsICSSPseudoComparator;
// IID for the nsIStyleRuleProcessor interface {015575fe-7b6c-11d3-ba05-001083023c2b}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
@ -63,6 +64,7 @@ public:
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsISupportsArray* aResults) = 0;
// Test if style is dependent on content state

Просмотреть файл

@ -164,7 +164,8 @@ public:
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique = PR_FALSE);
PRBool aForceUnique = PR_FALSE,
nsICSSPseudoComparator* aComparator = nsnull);
virtual nsIStyleContext* ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIContent* aParentContent,
@ -949,21 +950,24 @@ struct PseudoRulesMatchingData {
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator,
nsISupportsArray* aResults)
: mPresContext(aPresContext),
mMedium(aMedium),
mParentContent(aParentContent),
mPseudoTag(aPseudoTag),
mParentContext(aParentContext),
mComparator(aComparator),
mResults(aResults)
{
}
nsIPresContext* mPresContext;
nsIAtom* mMedium;
nsIContent* mParentContent;
nsIAtom* mPseudoTag;
nsIStyleContext* mParentContext;
nsISupportsArray* mResults;
nsIPresContext* mPresContext;
nsIAtom* mMedium;
nsIContent* mParentContent;
nsIAtom* mPseudoTag;
nsIStyleContext* mParentContext;
nsICSSPseudoComparator* mComparator;
nsISupportsArray* mResults;
};
static PRBool
@ -974,7 +978,7 @@ EnumPseudoRulesMatching(nsISupports* aProcessor, void* aData)
processor->RulesMatching(data->mPresContext, data->mMedium,
data->mParentContent, data->mPseudoTag,
data->mParentContext, data->mResults);
data->mParentContext, data->mComparator, data->mResults);
return PR_TRUE;
}
@ -982,7 +986,8 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsIStyleContext* aParentContext,
PRBool aForceUnique)
PRBool aForceUnique,
nsICSSPseudoComparator* aComparator)
{
MOZ_TIMER_DEBUGLOG(("Start: StyleSetImpl::ResolvePseudoStyleFor(), this=%p\n", this));
STYLESET_START_TIMER(NS_TIMER_STYLE_RESOLUTION);
@ -1000,7 +1005,7 @@ nsIStyleContext* StyleSetImpl::ResolvePseudoStyleFor(nsIPresContext* aPresContex
nsIAtom* medium = nsnull;
aPresContext->GetMedium(&medium);
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
aPseudoTag, aParentContext, rules);
aPseudoTag, aParentContext, aComparator, rules);
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
PRBool usedRules = PR_FALSE;
@ -1056,7 +1061,7 @@ nsIStyleContext* StyleSetImpl::ProbePseudoStyleFor(nsIPresContext* aPresContext,
nsIAtom* medium = nsnull;
aPresContext->GetMedium(&medium);
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
aPseudoTag, aParentContext, rules);
aPseudoTag, aParentContext, nsnull, rules);
WalkRuleProcessors(EnumPseudoRulesMatching, &data, aParentContent);
PRBool usedRules = PR_FALSE;