зеркало из https://github.com/mozilla/gecko-dev.git
More nsIPresContext deCOMtamination (bug 229371). Removed GetBaseURL, rename GetMedium to Medium and inline it, remove virtual style resolution methods that forward to style set (callers will call style set methods directly). Removed PresContext parameter to StyleSet style resolution functions. r+sr=dbaron.
This commit is contained in:
Родитель
6d8fc90771
Коммит
bc74f0b352
|
@ -317,11 +317,10 @@ nsStyleSet::EnableQuirkStyleSheet(PRBool aEnable)
|
|||
|
||||
struct RulesMatchingData : public ElementRuleProcessorData {
|
||||
RulesMatchingData(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: ElementRuleProcessorData(aPresContext, aContent, aRuleWalker),
|
||||
mMedium(aMedium)
|
||||
mMedium(aPresContext->Medium())
|
||||
{
|
||||
}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -504,27 +503,24 @@ PRBool nsStyleSet::BuildDefaultStyleData(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsStyleSet::ResolveStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext* presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aContent, "must have content");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(aContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content must be element");
|
||||
|
||||
if (aContent && aPresContext) {
|
||||
if (aContent && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
RulesMatchingData data(aPresContext, medium, aContent, mRuleWalker);
|
||||
RulesMatchingData data(presContext, aContent, mRuleWalker);
|
||||
FileRules(EnumRulesMatching, &data);
|
||||
result = GetContext(aPresContext, aParentContext, nsnull).get();
|
||||
result = GetContext(presContext, aParentContext, nsnull).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -535,19 +531,17 @@ nsStyleSet::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext)
|
||||
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
|
||||
if (aPresContext) {
|
||||
if (presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
result = GetContext(aPresContext, aParentContext,
|
||||
result = GetContext(presContext, aParentContext,
|
||||
nsCSSAnonBoxes::mozNonElement).get();
|
||||
NS_ASSERTION(mRuleWalker->AtRoot(), "rule walker must be at root");
|
||||
}
|
||||
|
@ -559,14 +553,13 @@ nsStyleSet::ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
|||
|
||||
struct PseudoRulesMatchingData : public PseudoRuleProcessorData {
|
||||
PseudoRulesMatchingData(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: PseudoRuleProcessorData(aPresContext, aParentContent, aPseudoTag,
|
||||
aComparator, aRuleWalker),
|
||||
mMedium(aMedium)
|
||||
mMedium(aPresContext->Medium())
|
||||
{
|
||||
}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -582,32 +575,29 @@ EnumPseudoRulesMatching(nsIStyleRuleProcessor* aProcessor, void* aData)
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsStyleSet::ResolvePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(!aParentContent ||
|
||||
aParentContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content (if non-null) must be element");
|
||||
|
||||
if (aPseudoTag && aPresContext) {
|
||||
if (aPseudoTag && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
|
||||
aPseudoTag, aComparator, mRuleWalker);
|
||||
PseudoRulesMatchingData data(presContext, aParentContent, aPseudoTag,
|
||||
aComparator, mRuleWalker);
|
||||
FileRules(EnumPseudoRulesMatching, &data);
|
||||
|
||||
result = GetContext(aPresContext, aParentContext, aPseudoTag).get();
|
||||
result = GetContext(presContext, aParentContext, aPseudoTag).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -618,32 +608,29 @@ nsStyleSet::ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(!aParentContent ||
|
||||
aParentContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content (if non-null) must be element");
|
||||
|
||||
if (aPseudoTag && aPresContext) {
|
||||
if (aPseudoTag && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
|
||||
aPseudoTag, nsnull, mRuleWalker);
|
||||
PseudoRulesMatchingData data(presContext, aParentContent, aPseudoTag,
|
||||
nsnull, mRuleWalker);
|
||||
FileRules(EnumPseudoRulesMatching, &data);
|
||||
|
||||
if (!mRuleWalker->AtRoot())
|
||||
result = GetContext(aPresContext, aParentContext, aPseudoTag).get();
|
||||
result = GetContext(presContext, aParentContext, aPseudoTag).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -762,10 +749,10 @@ nsStyleSet::ReParentStyleContext(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
struct StatefulData : public StateRuleProcessorData {
|
||||
StatefulData(nsIPresContext* aPresContext, nsIAtom* aMedium,
|
||||
StatefulData(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, PRInt32 aStateMask)
|
||||
: StateRuleProcessorData(aPresContext, aContent, aStateMask),
|
||||
mMedium(aMedium),
|
||||
mMedium(aPresContext->Medium()),
|
||||
mHint(nsReStyleHint(0))
|
||||
{}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -795,9 +782,7 @@ nsStyleSet::HasStateDependentStyle(nsIPresContext* aPresContext,
|
|||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count())) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
StatefulData data(aPresContext, medium, aContent, aStateMask);
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
@ -806,10 +791,10 @@ nsStyleSet::HasStateDependentStyle(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
struct AttributeData : public AttributeRuleProcessorData {
|
||||
AttributeData(nsIPresContext* aPresContext, nsIAtom* aMedium,
|
||||
nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType)
|
||||
AttributeData(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType)
|
||||
: AttributeRuleProcessorData(aPresContext, aContent, aAttribute, aModType),
|
||||
mMedium(aMedium),
|
||||
mMedium(aPresContext->Medium()),
|
||||
mHint(nsReStyleHint(0))
|
||||
{}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -840,9 +825,7 @@ nsStyleSet::HasAttributeDependentStyle(nsIPresContext* aPresContext,
|
|||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count())) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
AttributeData data(aPresContext, medium, aContent, aAttribute, aModType);
|
||||
AttributeData data(aPresContext, aContent, aAttribute, aModType);
|
||||
WalkRuleProcessors(SheetHasAttributeStyle, &data);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ class nsStyleSet
|
|||
|
||||
// get a style context for a non-pseudo frame.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aParentContext);
|
||||
ResolveStyleFor(nsIContent* aContent, nsStyleContext* aParentContext);
|
||||
|
||||
// Get a style context for a non-element (which no rules will match).
|
||||
// Eventually, this should go away and we shouldn't even create style
|
||||
|
@ -90,26 +88,23 @@ class nsStyleSet
|
|||
// represents everything except the first letter.)
|
||||
//
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext);
|
||||
ResolveStyleForNonElement(nsStyleContext* aParentContext);
|
||||
|
||||
// get a style context for a pseudo-element (i.e.,
|
||||
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|;
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator = nsnull);
|
||||
ResolvePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator = nsnull);
|
||||
|
||||
// This funtions just like ResolvePseudoStyleFor except that it will
|
||||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
ProbePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
// Begin ignoring style context destruction, to avoid lots of unnecessary
|
||||
// work on document teardown.
|
||||
|
@ -213,6 +208,8 @@ class nsStyleSet
|
|||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag);
|
||||
|
||||
nsIPresContext* PresContext() { return mRuleTree->GetPresContext(); }
|
||||
|
||||
static nsIURI *gQuirkURI;
|
||||
|
||||
nsCOMArray<nsIStyleSheet> mSheets[eSheetTypeCount];
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsMediaDocument.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#define AUTOMATIC_IMAGE_RESIZING_PREF "browser.enable_automatic_image_resizing"
|
||||
|
||||
|
@ -533,7 +534,7 @@ nsImageDocument::CheckOverflowing()
|
|||
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(mBodyContent);
|
||||
nsRefPtr<nsStyleContext> styleContext =
|
||||
context->ResolveStyleContextFor(content, nsnull);
|
||||
context->StyleSet()->ResolveStyleFor(content, nsnull);
|
||||
|
||||
const nsStyleMargin* marginData = styleContext->GetStyleMargin();
|
||||
nsMargin margin;
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
||||
#define DEBUG_ComputedDOMStyle
|
||||
|
@ -2912,10 +2913,12 @@ nsComputedDOMStyle::GetStyleData(nsStyleStructID aID,
|
|||
presShell->GetPresContext(getter_AddRefs(pctx));
|
||||
if (pctx) {
|
||||
nsStyleContext* sctx;
|
||||
nsStyleSet *styleSet = presShell->StyleSet();
|
||||
if (!mPseudo) {
|
||||
sctx = pctx->ResolveStyleContextFor(mContent, nsnull).get();
|
||||
sctx = styleSet->ResolveStyleFor(mContent, nsnull).get();
|
||||
} else {
|
||||
sctx = pctx->ResolvePseudoStyleContextFor(mContent, mPseudo, nsnull).get();
|
||||
sctx = styleSet->ResolvePseudoStyleFor(mContent, mPseudo,
|
||||
nsnull).get();
|
||||
}
|
||||
if (sctx) {
|
||||
aStyleStruct = sctx->GetStyleData(aID);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
nsInspectorCSSUtils::nsInspectorCSSUtils()
|
||||
{
|
||||
|
@ -159,10 +160,12 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
|||
if (!presContext)
|
||||
return nsnull;
|
||||
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return presContext->ResolveStyleContextFor(aContent, parentContext);
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
return presContext->ResolveStyleContextForNonElement(parentContext);
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return styleSet->ResolveStyleFor(aContent, parentContext);
|
||||
|
||||
return styleSet->ResolveStyleForNonElement(parentContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -1519,11 +1519,13 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
if (!aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return PR_FALSE;
|
||||
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
// Probe for the existence of the pseudo-element
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ProbePseudoStyleContextFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
pseudoStyleContext = styleSet->ProbePseudoStyleFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
|
||||
if (pseudoStyleContext) {
|
||||
// |ProbePseudoStyleContext| checks the 'display' property and the
|
||||
|
@ -1540,9 +1542,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
}
|
||||
nsStyleContext* parentSC = aStyleContext->GetParent();
|
||||
nsRefPtr<nsStyleContext> wrapperSC;
|
||||
wrapperSC = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
wrapperPseudo,
|
||||
parentSC);
|
||||
wrapperSC = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
wrapperPseudo, parentSC);
|
||||
// |aFrame| is already the correct parent.
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, aFrame,
|
||||
wrapperSC, nsnull, *aWrapperFrame);
|
||||
|
@ -1572,7 +1573,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
// Create another pseudo style context to use for all the generated child
|
||||
// frames
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(pseudoStyleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(pseudoStyleContext);
|
||||
|
||||
// Now create content objects (and child frames) for each value of the
|
||||
// 'content' property
|
||||
|
@ -1917,9 +1918,9 @@ nsCSSFrameConstructor::CreatePseudoTableFrame(nsIPresShell* aPresShel
|
|||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
// create the SC for the inner table which will be the parent of the outer table's SC
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::table,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::table,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudoOuter = aState.mPseudoFrames.mTableOuter;
|
||||
nsPseudoFrameData& pseudoInner = aState.mPseudoFrames.mTableInner;
|
||||
|
@ -1965,9 +1966,9 @@ nsCSSFrameConstructor::CreatePseudoRowGroupFrame(nsIPresShell* aPresS
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRowGroup,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRowGroup,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mRowGroup;
|
||||
|
||||
|
@ -2009,9 +2010,9 @@ nsCSSFrameConstructor::CreatePseudoColGroupFrame(nsIPresShell* aPresS
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mColGroup;
|
||||
|
||||
|
@ -2051,9 +2052,9 @@ nsCSSFrameConstructor::CreatePseudoRowFrame(nsIPresShell* aPresShell,
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRow,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRow,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mRow;
|
||||
|
||||
|
@ -2094,9 +2095,9 @@ nsCSSFrameConstructor::CreatePseudoCellFrame(nsIPresShell* aPresShell
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableCell,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableCell,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudoOuter = aState.mPseudoFrames.mCellOuter;
|
||||
nsPseudoFrameData& pseudoInner = aState.mPseudoFrames.mCellInner;
|
||||
|
@ -2462,9 +2463,8 @@ nsCSSFrameConstructor::ConstructTableFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// create the pseudo SC for the outer table as a child of the inner SC
|
||||
nsRefPtr<nsStyleContext> outerStyleContext;
|
||||
outerStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::tableOuter,
|
||||
aStyleContext);
|
||||
outerStyleContext = aPresShell->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::tableOuter, aStyleContext);
|
||||
|
||||
// Init the table outer frame and see if we need to create a view, e.g.
|
||||
// the frame is absolutely positioned
|
||||
|
@ -2854,9 +2854,10 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
|
||||
// Resolve pseudo style and initialize the body cell frame
|
||||
nsRefPtr<nsStyleContext> innerPseudoStyle;
|
||||
innerPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::cellContent,
|
||||
aStyleContext);
|
||||
innerPseudoStyle = aPresShell->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::cellContent, aStyleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
aNewCellOuterFrame, innerPseudoStyle, nsnull, aNewCellInnerFrame);
|
||||
|
||||
|
@ -3283,8 +3284,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// --------- CREATE AREA OR BOX FRAME -------
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement,
|
||||
aParentStyleContext);
|
||||
styleContext = aPresShell->StyleSet()->ResolveStyleFor(aDocElement,
|
||||
aParentStyleContext);
|
||||
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
|
||||
|
@ -3519,10 +3520,11 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
// --------- BUILD VIEWPORT -----------
|
||||
nsIFrame* viewportFrame = nsnull;
|
||||
nsRefPtr<nsStyleContext> viewportPseudoStyle;
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
viewportPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::viewport,
|
||||
nsnull);
|
||||
viewportPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::viewport,
|
||||
nsnull);
|
||||
|
||||
NS_NewViewportFrame(aPresShell, &viewportFrame);
|
||||
|
||||
|
@ -3652,7 +3654,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// see if the style is overflow: hidden, first on the document element
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, nsnull);
|
||||
styleContext = styleSet->ResolveStyleFor(aDocElement, nsnull);
|
||||
if (styleContext) {
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
|
||||
|
@ -3681,8 +3683,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
if (bodyElement) {
|
||||
nsRefPtr<nsStyleContext> bodyContext;
|
||||
bodyContext = aPresContext->ResolveStyleContextFor(bodyElement,
|
||||
styleContext);
|
||||
bodyContext = styleSet->ResolveStyleFor(bodyElement, styleContext);
|
||||
if (bodyContext) {
|
||||
const nsStyleDisplay* display = bodyContext->GetStyleDisplay();
|
||||
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
|
||||
|
@ -3707,9 +3708,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// If paginated, make sure we don't put scrollbars in
|
||||
if (isPaginated && !printPreviewContext)
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
else if (isScrollable) {
|
||||
|
||||
// Build the frame. We give it the content we are wrapping which is the document,
|
||||
|
@ -3718,9 +3719,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// resolve a context for the scrollframe
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::viewportScroll,
|
||||
viewportPseudoStyle);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::viewportScroll,
|
||||
viewportPseudoStyle);
|
||||
|
||||
|
||||
nsIFrame* newScrollableFrame = nsnull;
|
||||
|
@ -3754,18 +3755,18 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
} else {
|
||||
// If no scrollbars and xul, don't build a scrollframe at all.
|
||||
if (isXUL) {
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
} else {
|
||||
// if HTML the always create a scrollframe so anchors work. That way you can scroll to
|
||||
// anchors even if we don't have scrollbars.
|
||||
|
||||
// create a style context for the scrollport of the viewport
|
||||
nsRefPtr<nsStyleContext> scrollPseudoStyle;
|
||||
scrollPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
viewportPseudoStyle);
|
||||
scrollPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
viewportPseudoStyle);
|
||||
|
||||
// create scrollframe
|
||||
nsIFrame* scrollFrame = nsnull;
|
||||
|
@ -3775,9 +3776,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
scrollFrame->Init(aPresContext, nsnull, parentFrame, scrollPseudoStyle, nsnull);
|
||||
|
||||
// resolve a new style for the root frame
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
scrollPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
scrollPseudoStyle);
|
||||
|
||||
// Inform the view manager about the root scrollable view
|
||||
nsIView* view = scrollFrame->GetView();
|
||||
|
@ -3851,11 +3852,13 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
|||
return rv;
|
||||
|
||||
nsStyleContext* parentStyleContext = aParentFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
nsRefPtr<nsStyleContext> pagePseudoStyle;
|
||||
pagePseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::page,
|
||||
parentStyleContext);
|
||||
pagePseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::page,
|
||||
parentStyleContext);
|
||||
|
||||
// Initialize the page frame and force it to have a view. This makes printing of
|
||||
// the pages easier and faster.
|
||||
aPageFrame->Init(aPresContext, nsnull, aParentFrame, pagePseudoStyle, aPrevPageFrame);
|
||||
|
@ -3867,9 +3870,10 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
|||
NS_NewPageContentFrame(aPresShell, &aPageContentFrame);
|
||||
|
||||
nsRefPtr<nsStyleContext> pageContentPseudoStyle;
|
||||
pageContentPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::pageContent,
|
||||
pagePseudoStyle);
|
||||
pageContentPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::pageContent,
|
||||
pagePseudoStyle);
|
||||
|
||||
// Initialize the page content frame and force it to have a view. Also make it the
|
||||
// containing block for fixed elements which are repeated on every page.
|
||||
aPageContentFrame->Init(aPresContext, nsnull, aPageFrame, pageContentPseudoStyle, nsnull);
|
||||
|
@ -3903,7 +3907,8 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
|
|||
// The placeholder frame gets a pseudo style context
|
||||
nsRefPtr<nsStyleContext> placeholderStyle;
|
||||
nsStyleContext* parentContext = aStyleContext->GetParent();
|
||||
placeholderStyle = aPresContext->ResolveStyleContextForNonElement(parentContext);
|
||||
placeholderStyle = aPresShell->StyleSet()->
|
||||
ResolveStyleForNonElement(parentContext);
|
||||
placeholderFrame->Init(aPresContext, aContent, aParentFrame,
|
||||
placeholderStyle, nsnull);
|
||||
|
||||
|
@ -3935,9 +3940,9 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShel
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> radioStyle;
|
||||
radioStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::radio,
|
||||
aStyleContext);
|
||||
radioStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::radio,
|
||||
aStyleContext);
|
||||
nsIRadioControlFrame* radio = nsnull;
|
||||
if (aNewFrame != nsnull && NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsIRadioControlFrame), (void**)&radio))) {
|
||||
radio->SetRadioButtonFaceStyleContext(radioStyle);
|
||||
|
@ -3960,9 +3965,9 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> checkboxStyle;
|
||||
checkboxStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::check,
|
||||
aStyleContext);
|
||||
checkboxStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::check,
|
||||
aStyleContext);
|
||||
nsICheckboxControlFrame* checkbox = nsnull;
|
||||
if (aNewFrame != nsnull &&
|
||||
NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsICheckboxControlFrame), (void**)&checkbox))) {
|
||||
|
@ -4049,9 +4054,9 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// Resolve psuedo element style for the dropdown list
|
||||
nsRefPtr<nsStyleContext> listStyle;
|
||||
listStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::dropDownList,
|
||||
aStyleContext);
|
||||
listStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::dropDownList,
|
||||
aStyleContext);
|
||||
|
||||
// Initialize the scroll frame positioned. Note that it is NOT
|
||||
// initialized as absolutely positioned.
|
||||
|
@ -4303,9 +4308,9 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
// Resolve style and initialize the frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::fieldsetContent,
|
||||
aStyleContext);
|
||||
styleContext = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::fieldsetContent,
|
||||
aStyleContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
newFrame, styleContext, nsnull, areaFrame);
|
||||
|
||||
|
@ -5788,17 +5793,19 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||
|
||||
// we used the style that was passed in. So resolve another one.
|
||||
nsRefPtr<nsStyleContext> scrollPseudoStyle;
|
||||
scrollPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
contentStyle);
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
scrollPseudoStyle = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
contentStyle);
|
||||
|
||||
contentStyle = scrollPseudoStyle;
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
parentFrame, contentStyle, nsnull, scrollFrame);
|
||||
|
||||
nsStyleContext* aScrolledChildStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
aScrolledPseudo,
|
||||
contentStyle).get();
|
||||
nsStyleContext* aScrolledChildStyle = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
aScrolledPseudo,
|
||||
contentStyle).get();
|
||||
|
||||
aScrollableFrame = scrollFrame;
|
||||
|
||||
|
@ -6509,15 +6516,17 @@ nsCSSFrameConstructor::ResolveStyleContext(nsIPresContext* aPresContext,
|
|||
parentStyleContext = parentStyleContext->GetParent();
|
||||
}
|
||||
|
||||
nsStyleSet *styleSet = aPresContext->StyleSet();
|
||||
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
||||
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
||||
return styleSet->ResolveStyleFor(aContent, parentStyleContext);
|
||||
} else {
|
||||
|
||||
NS_ASSERTION(aContent->Tag() == nsLayoutAtoms::textTagName,
|
||||
"shouldn't waste time creating style contexts for "
|
||||
"comments and processing instructions");
|
||||
|
||||
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
return styleSet->ResolveStyleForNonElement(parentStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6618,14 +6627,15 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
// block so that it can mix better with other surrounding MathML markups
|
||||
|
||||
nsStyleContext* parentContext = aParentFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
// first, create a MathML mrow frame that will wrap the block frame
|
||||
rv = NS_NewMathMLmrowFrame(aPresShell, &newFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRefPtr<nsStyleContext> mrowContext;
|
||||
mrowContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::mozMathInline,
|
||||
parentContext);
|
||||
mrowContext = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::mozMathInline,
|
||||
parentContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame,
|
||||
mrowContext, nsnull, newFrame);
|
||||
|
||||
|
@ -6634,16 +6644,16 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewBlockFrame(aPresShell, &blockFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRefPtr<nsStyleContext> blockContext;
|
||||
blockContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mrowContext);
|
||||
blockContext = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mrowContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, newFrame,
|
||||
blockContext, nsnull, blockFrame);
|
||||
|
||||
// then, create the table frame itself
|
||||
nsRefPtr<nsStyleContext> tableContext;
|
||||
tableContext = aPresContext->ResolveStyleContextFor(aContent,
|
||||
blockContext);
|
||||
tableContext = styleSet->ResolveStyleFor(aContent, blockContext);
|
||||
|
||||
nsFrameItems tempItems;
|
||||
nsIFrame* outerTable;
|
||||
nsIFrame* innerTable;
|
||||
|
@ -6923,9 +6933,9 @@ nsCSSFrameConstructor::ConstructPageBreakFrame(nsIPresShell* aPresShe
|
|||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
nsRefPtr<nsStyleContext> pseudoStyle;
|
||||
pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::pageBreak,
|
||||
aStyleContext);
|
||||
pseudoStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::pageBreak,
|
||||
aStyleContext);
|
||||
nsIFrame* pageBreakFrame;
|
||||
nsresult rv = NS_NewPageBreakFrame(aPresShell, &pageBreakFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -10197,7 +10207,8 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||
NS_NewTextFrame(aPresShell, &textFrame);
|
||||
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(aStyleContext);
|
||||
textStyleContext = aPresShell->StyleSet()->
|
||||
ResolveStyleForNonElement(aStyleContext);
|
||||
|
||||
textFrame->Init(aPresContext, altTextContent, containerFrame,
|
||||
textStyleContext, nsnull);
|
||||
|
@ -11214,15 +11225,15 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIPresContext* aPresContex
|
|||
nsIContent* aContent)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsIFrameManager *frameManager = shell->GetFrameManager();
|
||||
|
||||
nsStyleContext *oldContext = frameManager->GetUndisplayedContent(aContent);
|
||||
if (oldContext) {
|
||||
// The parent has a frame, so try resolving a new context.
|
||||
nsRefPtr<nsStyleContext> newContext =
|
||||
aPresContext->ResolveStyleContextFor(aContent,
|
||||
oldContext->GetParent());
|
||||
nsRefPtr<nsStyleContext> newContext = shell->StyleSet()->
|
||||
ResolveStyleFor(aContent, oldContext->GetParent());
|
||||
|
||||
frameManager->ChangeUndisplayedContent(aContent, newContext);
|
||||
if (newContext->GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_NONE) {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
|
@ -11330,9 +11341,9 @@ nsCSSFrameConstructor::GetFirstLetterStyle(nsIPresContext* aPresContext,
|
|||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
if (aContent) {
|
||||
return aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSPseudoElements::firstLetter,
|
||||
aStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSPseudoElements::firstLetter, aStyleContext);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -11343,9 +11354,9 @@ nsCSSFrameConstructor::GetFirstLineStyle(nsIPresContext* aPresContext,
|
|||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
if (aContent) {
|
||||
return aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSPseudoElements::firstLine,
|
||||
aStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSPseudoElements::firstLine, aStyleContext);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -11883,6 +11894,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
{
|
||||
// Create the first-letter-frame
|
||||
nsIFrame* letterFrame;
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
NS_NewFirstLetterFrame(aPresShell, &letterFrame);
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
|
@ -11893,7 +11905,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
// letter frame and will have the float property set on it; the text
|
||||
// frame shouldn't have that set).
|
||||
nsRefPtr<nsStyleContext> textSC;
|
||||
textSC = aPresContext->ResolveStyleContextForNonElement(aStyleContext);
|
||||
textSC = styleSet->ResolveStyleForNonElement(aStyleContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
letterFrame, textSC, nsnull, aTextFrame);
|
||||
|
||||
|
@ -11920,7 +11932,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
nsStyleContext* parentStyleContext = aStyleContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
newSC = styleSet->ResolveStyleForNonElement(parentStyleContext);
|
||||
if (newSC) {
|
||||
nextTextFrame->SetStyleContext(aPresContext, newSC);
|
||||
}
|
||||
|
@ -11983,9 +11995,11 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIPresShell* aPresShell, nsIPresContex
|
|||
letterFrame->Init(aPresContext, aTextContent, aParentFrame,
|
||||
sc, nsnull);
|
||||
nsRefPtr<nsStyleContext> textSC;
|
||||
textSC = aPresContext->ResolveStyleContextForNonElement(sc);
|
||||
textSC = aPresContext->StyleSet()->ResolveStyleForNonElement(sc);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
letterFrame, textSC, nsnull, textFrame);
|
||||
letterFrame, textSC, nsnull, textFrame);
|
||||
|
||||
letterFrame->SetInitialChildList(aPresContext, nsnull, textFrame);
|
||||
aResult.childList = aResult.lastChild = letterFrame;
|
||||
}
|
||||
|
@ -12183,7 +12197,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
return NS_OK;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentSC);
|
||||
newSC = aPresShell->StyleSet()->ResolveStyleForNonElement(parentSC);
|
||||
if (!newSC) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12271,7 +12285,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
|
|||
break;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentSC);
|
||||
newSC = aPresShell->StyleSet()->ResolveStyleForNonElement(parentSC);
|
||||
if (!newSC) {
|
||||
break;
|
||||
}
|
||||
|
@ -12638,8 +12652,8 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> blockSC;
|
||||
blockSC = aPresContext->ResolvePseudoStyleContextFor(aContent, blockStyle,
|
||||
aStyleContext);
|
||||
blockSC = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent, blockStyle,
|
||||
aStyleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
aParentFrame, blockSC, nsnull, blockFrame);
|
||||
|
@ -13102,9 +13116,9 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext,
|
|||
nsStyleContext* styleContext = aFrame->GetStyleContext();
|
||||
|
||||
nsRefPtr<nsStyleContext> blockSC;
|
||||
blockSC = aPresContext->ResolvePseudoStyleContextFor(content,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
styleContext);
|
||||
blockSC = shell->StyleSet()->ResolvePseudoStyleFor(content,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
styleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, content,
|
||||
nsnull, blockSC, nsnull, blockFrame);
|
||||
|
|
|
@ -1556,6 +1556,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
// that the frame has the last reference to it, so AddRef it here.
|
||||
|
||||
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
||||
nsStyleSet* styleSet = aPresContext->StyleSet();
|
||||
|
||||
if (oldContext) {
|
||||
oldContext->AddRef();
|
||||
|
@ -1594,7 +1595,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
if (pseudoTag == nsCSSAnonBoxes::mozNonElement) {
|
||||
NS_ASSERTION(localContent,
|
||||
"non pseudo-element frame without content node");
|
||||
newContext = aPresContext->ResolveStyleContextForNonElement(parentContext).get();
|
||||
newContext = styleSet->ResolveStyleForNonElement(parentContext).get();
|
||||
}
|
||||
else if (pseudoTag) {
|
||||
nsIContent* pseudoContent =
|
||||
|
@ -1602,9 +1603,9 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
if (pseudoTag == nsCSSPseudoElements::before ||
|
||||
pseudoTag == nsCSSPseudoElements::after) {
|
||||
// XXX what other pseudos do we need to treat like this?
|
||||
newContext = aPresContext->ProbePseudoStyleContextFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
newContext = styleSet->ProbePseudoStyleFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
if (!newContext) {
|
||||
// This pseudo should no longer exist; gotta reframe
|
||||
NS_UpdateHint(aMinChange, nsChangeHint_ReconstructFrame);
|
||||
|
@ -1615,15 +1616,15 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
newContext->AddRef();
|
||||
}
|
||||
} else {
|
||||
newContext = aPresContext->ResolvePseudoStyleContextFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
newContext = styleSet->ResolvePseudoStyleFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
}
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(localContent,
|
||||
"non pseudo-element frame without content node");
|
||||
newContext = aPresContext->ResolveStyleContextFor(content, parentContext).get();
|
||||
newContext = styleSet->ResolveStyleFor(content, parentContext).get();
|
||||
}
|
||||
NS_ASSERTION(newContext, "failed to get new style context");
|
||||
if (newContext) {
|
||||
|
@ -1680,9 +1681,9 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(pseudoTag &&
|
||||
pseudoTag != nsCSSAnonBoxes::mozNonElement,
|
||||
"extra style context is not pseudo element");
|
||||
newExtraContext = aPresContext->ResolvePseudoStyleContextFor(content,
|
||||
pseudoTag,
|
||||
newContext).get();
|
||||
newExtraContext = styleSet->ResolvePseudoStyleFor(content,
|
||||
pseudoTag,
|
||||
newContext).get();
|
||||
if (newExtraContext) {
|
||||
if (oldExtraContext != newExtraContext) {
|
||||
aMinChange = CaptureChange(oldExtraContext, newExtraContext, aFrame,
|
||||
|
@ -1707,18 +1708,18 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
nsRefPtr<nsStyleContext> undisplayedContext;
|
||||
pseudoTag = undisplayed->mStyle->GetPseudoType();
|
||||
if (pseudoTag == nsnull) { // child content
|
||||
undisplayedContext = aPresContext->ResolveStyleContextFor(undisplayed->mContent,
|
||||
newContext);
|
||||
undisplayedContext = styleSet->ResolveStyleFor(undisplayed->mContent,
|
||||
newContext);
|
||||
}
|
||||
else if (pseudoTag == nsCSSAnonBoxes::mozNonElement) {
|
||||
undisplayedContext = aPresContext->ResolveStyleContextForNonElement(newContext);
|
||||
undisplayedContext = styleSet->ResolveStyleForNonElement(newContext);
|
||||
}
|
||||
else { // pseudo element
|
||||
NS_NOTREACHED("no pseudo elements in undisplayed map");
|
||||
NS_ASSERTION(pseudoTag, "pseudo element without tag");
|
||||
undisplayedContext = aPresContext->ResolvePseudoStyleContextFor(localContent,
|
||||
pseudoTag,
|
||||
newContext);
|
||||
undisplayedContext = styleSet->ResolvePseudoStyleFor(localContent,
|
||||
pseudoTag,
|
||||
newContext);
|
||||
}
|
||||
if (undisplayedContext) {
|
||||
const nsStyleDisplay* display = undisplayedContext->GetStyleDisplay();
|
||||
|
|
|
@ -47,6 +47,7 @@ class nsIView;
|
|||
#include "prtypes.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
/**
|
||||
* nsLayoutUtils is a namespace class used for various helper
|
||||
|
@ -162,9 +163,8 @@ public:
|
|||
|
||||
nsRefPtr<nsStyleContext> pseudoContext;
|
||||
if (aContent) {
|
||||
pseudoContext = aPresContext->ProbePseudoStyleContextFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
pseudoContext = aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(aContent, aPseudoElement, aStyleContext);
|
||||
}
|
||||
return pseudoContext != nsnull;
|
||||
}
|
||||
|
|
|
@ -573,7 +573,7 @@ nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsPresContext::ClearStyleDataAndReflow()
|
||||
{
|
||||
if (mShell) {
|
||||
|
@ -586,8 +586,6 @@ nsPresContext::ClearStyleDataAndReflow()
|
|||
// then we only need to repaint...
|
||||
mShell->StyleChangeReflow();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -611,7 +609,7 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
|||
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,13 +678,13 @@ nsPresContext::SetShell(nsIPresShell* aShell)
|
|||
if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) {
|
||||
NS_ASSERTION(doc, "expect document here");
|
||||
if (doc) {
|
||||
mBaseURL = doc->GetBaseURI();
|
||||
nsIURI *baseURI = doc->GetBaseURI();
|
||||
|
||||
if (!mNeverAnimate && mBaseURL) {
|
||||
if (!mNeverAnimate && baseURI) {
|
||||
PRBool isChrome = PR_FALSE;
|
||||
PRBool isRes = PR_FALSE;
|
||||
mBaseURL->SchemeIs("chrome", &isChrome);
|
||||
mBaseURL->SchemeIs("resource", &isRes);
|
||||
baseURI->SchemeIs("chrome", &isChrome);
|
||||
baseURI->SchemeIs("resource", &isRes);
|
||||
|
||||
if (!isChrome && !isRes)
|
||||
mImageAnimationMode = mImageAnimationModePref;
|
||||
|
@ -746,7 +744,7 @@ nsPresContext::Observe(nsISupports* aSubject,
|
|||
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData).get());
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -839,62 +837,11 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode)
|
|||
mImageAnimationMode = aMode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetBaseURL(nsIURI** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
*aResult = mBaseURL;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ResolveStyleFor(this, aContent, aParentContext);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolveStyleContextForNonElement(nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ResolveStyleForNonElement(this, aParentContext);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return ResolvePseudoStyleWithComparator(aParentContent, aPseudoTag,
|
||||
aParentContext, nsnull);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator)
|
||||
{
|
||||
return mShell->StyleSet()->ResolvePseudoStyleFor(this, aParentContent,
|
||||
aPseudoTag, aParentContext,
|
||||
aComparator);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ProbePseudoStyleFor(this, aParentContent,
|
||||
aPseudoTag, aParentContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult)
|
||||
{
|
||||
nsRefPtr<nsStyleContext> sc;
|
||||
sc = ResolveStyleContextFor(aContent, nsnull);
|
||||
sc = StyleSet()->ResolveStyleFor(aContent, nsnull);
|
||||
NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE);
|
||||
|
||||
*aResult = sc->GetStyleDisplay()->mBinding;
|
||||
|
@ -1497,7 +1444,7 @@ NS_IMETHODIMP nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow)
|
|||
SetVisualMode(IsVisualCharset(mCharset) );
|
||||
}
|
||||
if (mShell && aForceReflow) {
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1621,7 +1568,8 @@ nsPresContext::SysColorChanged()
|
|||
// data without reflowing/updating views will lead to incorrect change hints
|
||||
// later, because when generating change hints, any style structs which have
|
||||
// been cleared and not reread are assumed to not be used at all.
|
||||
return ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -141,6 +141,9 @@ public:
|
|||
|
||||
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
|
||||
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
||||
#endif
|
||||
nsIFrameManager* GetFrameManager()
|
||||
{ return GetPresShell()->GetFrameManager(); }
|
||||
|
||||
|
@ -165,85 +168,22 @@ public:
|
|||
*/
|
||||
nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
|
||||
|
||||
/**
|
||||
* Get base url for presentation
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult) = 0;
|
||||
|
||||
/**
|
||||
* Get medium of presentation
|
||||
*/
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
nsIAtom* Medium() { return mMedium; }
|
||||
|
||||
/**
|
||||
* Clear style data from the root frame downwards, and reflow.
|
||||
*/
|
||||
NS_IMETHOD ClearStyleDataAndReflow(void) = 0;
|
||||
virtual void ClearStyleDataAndReflow() = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for the given piece of content that will be a child
|
||||
* of the aParentContext. Don't use this for pseudo frames.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a non-element content node (i.e., one that is
|
||||
* guaranteed not to match any rules). Eventually such nodes
|
||||
* shouldn't have style contexts at all, but this at least prevents
|
||||
* the rule matching.
|
||||
*
|
||||
* XXX This is temporary. It should go away when we stop creating
|
||||
* style contexts for text nodes and placeholder frames. (We also use
|
||||
* it once to create a style context for the nsFirstLetterFrame that
|
||||
* represents everything except the first letter.)
|
||||
*
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextForNonElement(nsStyleContext* aParentContext) = 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");
|
||||
*/
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 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.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator) = 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.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve a new style context for a content node and return the URL
|
||||
* for its XBL binding, or null if it has no binding specified in CSS.
|
||||
*/
|
||||
NS_IMETHOD GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0;
|
||||
virtual nsresult GetXBLBindingURL(nsIContent* aContent,
|
||||
nsIURI** aResult) = 0;
|
||||
|
||||
/**
|
||||
* For a given frame tree, get a new style context that is the equivalent
|
||||
|
@ -568,6 +508,8 @@ protected:
|
|||
// from gfx back to layout.
|
||||
nsIEventStateManager* mEventManager; // [STRONG]
|
||||
nsILookAndFeel* mLookAndFeel; // [STRONG]
|
||||
nsIAtom* mMedium; // initialized by subclass ctors;
|
||||
// weak pointer to static atom
|
||||
|
||||
nsCompatibility mCompatibilityMode;
|
||||
PRUint16 mImageAnimationMode;
|
||||
|
|
|
@ -141,6 +141,9 @@ public:
|
|||
|
||||
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
|
||||
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
||||
#endif
|
||||
nsIFrameManager* GetFrameManager()
|
||||
{ return GetPresShell()->GetFrameManager(); }
|
||||
|
||||
|
@ -165,85 +168,22 @@ public:
|
|||
*/
|
||||
nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
|
||||
|
||||
/**
|
||||
* Get base url for presentation
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult) = 0;
|
||||
|
||||
/**
|
||||
* Get medium of presentation
|
||||
*/
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
nsIAtom* Medium() { return mMedium; }
|
||||
|
||||
/**
|
||||
* Clear style data from the root frame downwards, and reflow.
|
||||
*/
|
||||
NS_IMETHOD ClearStyleDataAndReflow(void) = 0;
|
||||
virtual void ClearStyleDataAndReflow() = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for the given piece of content that will be a child
|
||||
* of the aParentContext. Don't use this for pseudo frames.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a non-element content node (i.e., one that is
|
||||
* guaranteed not to match any rules). Eventually such nodes
|
||||
* shouldn't have style contexts at all, but this at least prevents
|
||||
* the rule matching.
|
||||
*
|
||||
* XXX This is temporary. It should go away when we stop creating
|
||||
* style contexts for text nodes and placeholder frames. (We also use
|
||||
* it once to create a style context for the nsFirstLetterFrame that
|
||||
* represents everything except the first letter.)
|
||||
*
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextForNonElement(nsStyleContext* aParentContext) = 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");
|
||||
*/
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 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.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator) = 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.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve a new style context for a content node and return the URL
|
||||
* for its XBL binding, or null if it has no binding specified in CSS.
|
||||
*/
|
||||
NS_IMETHOD GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0;
|
||||
virtual nsresult GetXBLBindingURL(nsIContent* aContent,
|
||||
nsIURI** aResult) = 0;
|
||||
|
||||
/**
|
||||
* For a given frame tree, get a new style context that is the equivalent
|
||||
|
@ -568,6 +508,8 @@ protected:
|
|||
// from gfx back to layout.
|
||||
nsIEventStateManager* mEventManager; // [STRONG]
|
||||
nsILookAndFeel* mLookAndFeel; // [STRONG]
|
||||
nsIAtom* mMedium; // initialized by subclass ctors;
|
||||
// weak pointer to static atom
|
||||
|
||||
nsCompatibility mCompatibilityMode;
|
||||
PRUint16 mImageAnimationMode;
|
||||
|
|
|
@ -47,6 +47,7 @@ class nsIView;
|
|||
#include "prtypes.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
/**
|
||||
* nsLayoutUtils is a namespace class used for various helper
|
||||
|
@ -162,9 +163,8 @@ public:
|
|||
|
||||
nsRefPtr<nsStyleContext> pseudoContext;
|
||||
if (aContent) {
|
||||
pseudoContext = aPresContext->ProbePseudoStyleContextFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
pseudoContext = aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(aContent, aPseudoElement, aStyleContext);
|
||||
}
|
||||
return pseudoContext != nsnull;
|
||||
}
|
||||
|
|
|
@ -141,6 +141,9 @@ public:
|
|||
|
||||
nsIDocument* GetDocument() { return GetPresShell()->GetDocument(); }
|
||||
nsIViewManager* GetViewManager() { return GetPresShell()->GetViewManager(); }
|
||||
#ifdef _IMPL_NS_LAYOUT
|
||||
nsStyleSet* StyleSet() { return GetPresShell()->StyleSet(); }
|
||||
#endif
|
||||
nsIFrameManager* GetFrameManager()
|
||||
{ return GetPresShell()->GetFrameManager(); }
|
||||
|
||||
|
@ -165,85 +168,22 @@ public:
|
|||
*/
|
||||
nsILookAndFeel* LookAndFeel() { return mLookAndFeel; }
|
||||
|
||||
/**
|
||||
* Get base url for presentation
|
||||
*/
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult) = 0;
|
||||
|
||||
/**
|
||||
* Get medium of presentation
|
||||
*/
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
nsIAtom* Medium() { return mMedium; }
|
||||
|
||||
/**
|
||||
* Clear style data from the root frame downwards, and reflow.
|
||||
*/
|
||||
NS_IMETHOD ClearStyleDataAndReflow(void) = 0;
|
||||
virtual void ClearStyleDataAndReflow() = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for the given piece of content that will be a child
|
||||
* of the aParentContext. Don't use this for pseudo frames.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve style for a non-element content node (i.e., one that is
|
||||
* guaranteed not to match any rules). Eventually such nodes
|
||||
* shouldn't have style contexts at all, but this at least prevents
|
||||
* the rule matching.
|
||||
*
|
||||
* XXX This is temporary. It should go away when we stop creating
|
||||
* style contexts for text nodes and placeholder frames. (We also use
|
||||
* it once to create a style context for the nsFirstLetterFrame that
|
||||
* represents everything except the first letter.)
|
||||
*
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextForNonElement(nsStyleContext* aParentContext) = 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");
|
||||
*/
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 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.
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator) = 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.
|
||||
* The tag should be lowercase and inclue the colon.
|
||||
* ie: NS_NewAtom(":first-line");
|
||||
*/
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Resolve a new style context for a content node and return the URL
|
||||
* for its XBL binding, or null if it has no binding specified in CSS.
|
||||
*/
|
||||
NS_IMETHOD GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult) = 0;
|
||||
virtual nsresult GetXBLBindingURL(nsIContent* aContent,
|
||||
nsIURI** aResult) = 0;
|
||||
|
||||
/**
|
||||
* For a given frame tree, get a new style context that is the equivalent
|
||||
|
@ -568,6 +508,8 @@ protected:
|
|||
// from gfx back to layout.
|
||||
nsIEventStateManager* mEventManager; // [STRONG]
|
||||
nsILookAndFeel* mLookAndFeel; // [STRONG]
|
||||
nsIAtom* mMedium; // initialized by subclass ctors;
|
||||
// weak pointer to static atom
|
||||
|
||||
nsCompatibility mCompatibilityMode;
|
||||
PRUint16 mImageAnimationMode;
|
||||
|
|
|
@ -44,7 +44,6 @@ public:
|
|||
GalleyContext();
|
||||
~GalleyContext();
|
||||
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMedium);
|
||||
NS_IMETHOD IsPaginated(PRBool* aResult);
|
||||
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { return NS_ERROR_FAILURE; }
|
||||
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
|
||||
|
@ -54,24 +53,13 @@ public:
|
|||
|
||||
GalleyContext::GalleyContext()
|
||||
{
|
||||
mMedium = nsLayoutAtoms::screen;
|
||||
}
|
||||
|
||||
GalleyContext::~GalleyContext()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GalleyContext::GetMedium(nsIAtom** aResult)
|
||||
{
|
||||
NS_PRECONDITION(nsnull != aResult, "null ptr");
|
||||
if (nsnull == aResult) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
*aResult = nsLayoutAtoms::screen;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
GalleyContext::IsPaginated(PRBool* aResult)
|
||||
{
|
||||
|
|
|
@ -573,7 +573,7 @@ nsPresContext::GetCachedIntPref(PRUint32 aPrefType, PRInt32& aValue)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
void
|
||||
nsPresContext::ClearStyleDataAndReflow()
|
||||
{
|
||||
if (mShell) {
|
||||
|
@ -586,8 +586,6 @@ nsPresContext::ClearStyleDataAndReflow()
|
|||
// then we only need to repaint...
|
||||
mShell->StyleChangeReflow();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -611,7 +609,7 @@ nsPresContext::PreferenceChanged(const char* aPrefName)
|
|||
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -680,13 +678,13 @@ nsPresContext::SetShell(nsIPresShell* aShell)
|
|||
if (NS_SUCCEEDED(mShell->GetDocument(getter_AddRefs(doc)))) {
|
||||
NS_ASSERTION(doc, "expect document here");
|
||||
if (doc) {
|
||||
mBaseURL = doc->GetBaseURI();
|
||||
nsIURI *baseURI = doc->GetBaseURI();
|
||||
|
||||
if (!mNeverAnimate && mBaseURL) {
|
||||
if (!mNeverAnimate && baseURI) {
|
||||
PRBool isChrome = PR_FALSE;
|
||||
PRBool isRes = PR_FALSE;
|
||||
mBaseURL->SchemeIs("chrome", &isChrome);
|
||||
mBaseURL->SchemeIs("resource", &isRes);
|
||||
baseURI->SchemeIs("chrome", &isChrome);
|
||||
baseURI->SchemeIs("resource", &isRes);
|
||||
|
||||
if (!isChrome && !isRes)
|
||||
mImageAnimationMode = mImageAnimationModePref;
|
||||
|
@ -746,7 +744,7 @@ nsPresContext::Observe(nsISupports* aSubject,
|
|||
UpdateCharSet(NS_LossyConvertUCS2toASCII(aData).get());
|
||||
if (mDeviceContext) {
|
||||
mDeviceContext->FlushFontCache();
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -839,62 +837,11 @@ nsPresContext::SetImageAnimationMode(PRUint16 aMode)
|
|||
mImageAnimationMode = aMode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPresContext::GetBaseURL(nsIURI** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
*aResult = mBaseURL;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolveStyleContextFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ResolveStyleFor(this, aContent, aParentContext);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolveStyleContextForNonElement(nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ResolveStyleForNonElement(this, aParentContext);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return ResolvePseudoStyleWithComparator(aParentContent, aPseudoTag,
|
||||
aParentContext, nsnull);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator)
|
||||
{
|
||||
return mShell->StyleSet()->ResolvePseudoStyleFor(this, aParentContent,
|
||||
aPseudoTag, aParentContext,
|
||||
aComparator);
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsPresContext::ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return mShell->StyleSet()->ProbePseudoStyleFor(this, aParentContent,
|
||||
aPseudoTag, aParentContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsPresContext::GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult)
|
||||
{
|
||||
nsRefPtr<nsStyleContext> sc;
|
||||
sc = ResolveStyleContextFor(aContent, nsnull);
|
||||
sc = StyleSet()->ResolveStyleFor(aContent, nsnull);
|
||||
NS_ENSURE_TRUE(sc, NS_ERROR_FAILURE);
|
||||
|
||||
*aResult = sc->GetStyleDisplay()->mBinding;
|
||||
|
@ -1497,7 +1444,7 @@ NS_IMETHODIMP nsPresContext::SetBidi(PRUint32 aSource, PRBool aForceReflow)
|
|||
SetVisualMode(IsVisualCharset(mCharset) );
|
||||
}
|
||||
if (mShell && aForceReflow) {
|
||||
ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1621,7 +1568,8 @@ nsPresContext::SysColorChanged()
|
|||
// data without reflowing/updating views will lead to incorrect change hints
|
||||
// later, because when generating change hints, any style structs which have
|
||||
// been cleared and not reread are assumed to not be used at all.
|
||||
return ClearStyleDataAndReflow();
|
||||
nsPresContext::ClearStyleDataAndReflow();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -71,33 +71,9 @@ public:
|
|||
NS_IMETHOD SetShell(nsIPresShell* aShell);
|
||||
virtual void SetCompatibilityMode(nsCompatibility aMode);
|
||||
virtual void SetImageAnimationMode(PRUint16 aMode);
|
||||
NS_IMETHOD GetBaseURL(nsIURI** aURLResult);
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMediumResult) = 0;
|
||||
NS_IMETHOD ClearStyleDataAndReflow(void);
|
||||
virtual void ClearStyleDataAndReflow();
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextFor(nsIContent* aContent, nsStyleContext* aParentContext);
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolveStyleContextForNonElement(nsStyleContext* aParentContext);
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleWithComparator(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator);
|
||||
|
||||
virtual already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleContextFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
NS_IMETHOD GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult);
|
||||
virtual nsresult GetXBLBindingURL(nsIContent* aContent, nsIURI** aResult);
|
||||
NS_IMETHOD ReParentStyleContext(nsIFrame* aFrame,
|
||||
nsStyleContext* aNewParentContext);
|
||||
NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIFontMetrics** aResult);
|
||||
|
@ -245,8 +221,6 @@ protected:
|
|||
|
||||
nsSupportsHashtable mImageLoaders;
|
||||
|
||||
nsCOMPtr<nsIURI> mBaseURL;
|
||||
|
||||
PRPackedBool mImageAnimationStopped; // image animation stopped
|
||||
PRPackedBool mNeverAnimate; // never animate images
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
PrintContext();
|
||||
~PrintContext();
|
||||
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMedium);
|
||||
NS_IMETHOD IsPaginated(PRBool* aResult);
|
||||
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { return NS_ERROR_FAILURE; }
|
||||
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
|
||||
|
@ -82,6 +81,7 @@ PrintContext::PrintContext() :
|
|||
// Printed images are never animated
|
||||
mImageAnimationMode = imgIContainer::kDontAnimMode;
|
||||
mNeverAnimate = PR_TRUE;
|
||||
mMedium = nsLayoutAtoms::print;
|
||||
}
|
||||
|
||||
PrintContext::~PrintContext()
|
||||
|
@ -107,15 +107,6 @@ PrintContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return nsPresContext::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PrintContext::GetMedium(nsIAtom** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = nsLayoutAtoms::print;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PrintContext::IsPaginated(PRBool* aResult)
|
||||
{
|
||||
|
|
|
@ -56,7 +56,6 @@ public:
|
|||
// another class. Only the base class should use NS_DECL_ISUPPORTS
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
NS_IMETHOD GetMedium(nsIAtom** aMedium);
|
||||
NS_IMETHOD IsPaginated(PRBool* aResult);
|
||||
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { mCanPaginatedScroll = aResult; return NS_OK; }
|
||||
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult);
|
||||
|
@ -85,6 +84,7 @@ PrintPreviewContext::PrintPreviewContext() :
|
|||
// Printed images are never animated
|
||||
mImageAnimationMode = imgIContainer::kDontAnimMode;
|
||||
mNeverAnimate = PR_TRUE;
|
||||
mMedium = nsLayoutAtoms::print;
|
||||
}
|
||||
|
||||
PrintPreviewContext::~PrintPreviewContext()
|
||||
|
@ -108,15 +108,6 @@ PrintPreviewContext::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
|||
return nsPresContext::QueryInterface(aIID, aInstancePtr);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PrintPreviewContext::GetMedium(nsIAtom** aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
*aResult = nsLayoutAtoms::print;
|
||||
NS_ADDREF(*aResult);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PrintPreviewContext::IsPaginated(PRBool* aResult)
|
||||
{
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#define ACTIVE "active"
|
||||
#define HOVER "hover"
|
||||
|
@ -309,16 +310,17 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext* aPresContext)
|
|||
{
|
||||
// get all the styles
|
||||
nsStyleContext* context = mFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresContext->StyleSet();
|
||||
|
||||
// style for the inner such as a dotted line (Windows)
|
||||
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusInner,
|
||||
context);
|
||||
mInnerFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusInner,
|
||||
context);
|
||||
|
||||
// style for outer focus like a ridged border (MAC).
|
||||
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusOuter,
|
||||
context);
|
||||
mOuterFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusOuter,
|
||||
context);
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||
|
@ -2031,15 +2032,17 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mDisplayFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// create the style context for the anonymous frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
if (!styleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// create a text frame and put it inside the block frame
|
||||
|
@ -2047,7 +2050,7 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mTextFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
|
||||
mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
|
||||
|
@ -2159,6 +2162,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (aContent == content.get()) {
|
||||
// Get PresShell
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
// Start by by creating a containing frame
|
||||
nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
|
||||
|
@ -2167,9 +2171,9 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
|
||||
// create the style context for the anonymous block frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
if (!styleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// Create a text frame and put it inside the block frame
|
||||
|
@ -2177,7 +2181,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mTextFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// initialize the text frame
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsLayoutAtoms.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
// MouseEvent suppression in PP
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
@ -237,7 +238,8 @@ nsGfxButtonControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!newFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = aPresContext->StyleSet()->
|
||||
ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
if (styleContext) {
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsStyleSet.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
|
@ -137,14 +138,15 @@ nsHTMLButtonControlFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsIFrame* areaFrame;
|
||||
NS_NewAreaFrame(aPresContext->PresShell(), &areaFrame, flags);
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
NS_NewAreaFrame(shell, &areaFrame, flags);
|
||||
mFrames.SetFrames(areaFrame);
|
||||
|
||||
// Resolve style and initialize the frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::buttonContent,
|
||||
mStyleContext);
|
||||
styleContext = shell->StyleSet()->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::buttonContent,
|
||||
mStyleContext);
|
||||
mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -5935,10 +5935,14 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
pseudoElement = nsCSSPseudoElements::mozListNumber;
|
||||
break;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> kidSC = aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoElement, mStyleContext);
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
|
||||
nsRefPtr<nsStyleContext> kidSC = shell->StyleSet()->
|
||||
ResolvePseudoStyleFor(mContent, pseudoElement, mStyleContext);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new (aPresContext->PresShell()) nsBulletFrame;
|
||||
mBullet = new (shell) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsLineBox.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
class nsBlockReflowState;
|
||||
class nsBulletFrame;
|
||||
|
@ -205,9 +206,9 @@ protected:
|
|||
|
||||
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext)
|
||||
{
|
||||
return aPresContext->ProbePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::firstLetter,
|
||||
mStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::firstLetter, mStyleContext);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#define nsFirstLetterFrameSuper nsHTMLContainerFrame
|
||||
|
||||
|
@ -142,7 +143,8 @@ nsFirstLetterFrame::Init(nsIPresContext* aPresContext,
|
|||
// a style context like we would for a text node.
|
||||
nsStyleContext* parentStyleContext = aContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
newSC = aPresContext->StyleSet()->
|
||||
ResolveStyleForNonElement(parentStyleContext);
|
||||
if (newSC)
|
||||
aContext = newSC;
|
||||
}
|
||||
|
@ -370,7 +372,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
|
|||
if (kidContent) {
|
||||
NS_ASSERTION(kidContent->IsContentOfType(nsIContent::eTEXT),
|
||||
"should contain only text nodes");
|
||||
sc = aPresContext->ResolveStyleContextForNonElement(mStyleContext);
|
||||
sc = aPresContext->StyleSet()->ResolveStyleForNonElement(mStyleContext);
|
||||
if (sc) {
|
||||
kid->SetStyleContext(aPresContext, sc);
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
// masks for mEdgeVisibility
|
||||
#define LEFT_VIS 0x0001
|
||||
|
@ -403,7 +404,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
nsRefPtr<nsStyleContext> kidSC;
|
||||
nsresult result;
|
||||
|
||||
kidSC = aPresContext->ResolveStyleContextFor(child, mStyleContext);
|
||||
kidSC = shell->StyleSet()->ResolveStyleFor(child, mStyleContext);
|
||||
if (tag == nsHTMLAtoms::frameset) {
|
||||
result = NS_NewHTMLFramesetFrame(shell, &frame);
|
||||
|
||||
|
@ -445,9 +446,9 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
// should just have null content, if we support that
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new (shell) nsHTMLFramesetBlankFrame;
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::framesetBlank,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = shell->StyleSet()->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::framesetBlank,
|
||||
mStyleContext);
|
||||
if(blankFrame)
|
||||
blankFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
|
@ -979,6 +980,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
||||
// Always get the size so that the caller knows how big we are
|
||||
|
@ -1073,9 +1075,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
PR_FALSE,
|
||||
PR_FALSE);
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::horizontalFramesetBorder,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::horizontalFramesetBorder,
|
||||
mStyleContext);
|
||||
borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
mChildCount++;
|
||||
|
@ -1102,9 +1104,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::verticalFramesetBorder,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::verticalFramesetBorder,
|
||||
mStyleContext);
|
||||
borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
mChildCount++;
|
||||
|
|
|
@ -1053,9 +1053,10 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// style context thus removing the :first-line style. This way
|
||||
// we behave as if an anonymous (unstyled) span was the child
|
||||
// of the parent frame.
|
||||
nsRefPtr<nsStyleContext> newSC = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::mozLineFrame,
|
||||
parentContext);
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::mozLineFrame, parentContext);
|
||||
if (newSC) {
|
||||
// Switch to the new style context.
|
||||
SetStyleContext(aPresContext, newSC);
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#endif
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#include "nsBidiFrames.h"
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -1006,9 +1007,9 @@ DrawSelectionIterator::DrawSelectionIterator(nsIContent *aContent,
|
|||
|
||||
if (aContent) {
|
||||
nsRefPtr<nsStyleContext> sc;
|
||||
sc = aPresContext->ProbePseudoStyleContextFor(aContent->GetParent(),
|
||||
nsCSSPseudoElements::mozSelection,
|
||||
aStyleContext);
|
||||
sc = aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(aContent->GetParent(),
|
||||
nsCSSPseudoElements::mozSelection, aStyleContext);
|
||||
if (sc) {
|
||||
mSelectionPseudoStyle = PR_TRUE;
|
||||
const nsStyleBackground* bg = sc->GetStyleBackground();
|
||||
|
|
|
@ -5935,10 +5935,14 @@ nsBlockFrame::SetInitialChildList(nsIPresContext* aPresContext,
|
|||
pseudoElement = nsCSSPseudoElements::mozListNumber;
|
||||
break;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> kidSC = aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoElement, mStyleContext);
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
|
||||
nsRefPtr<nsStyleContext> kidSC = shell->StyleSet()->
|
||||
ResolvePseudoStyleFor(mContent, pseudoElement, mStyleContext);
|
||||
|
||||
// Create bullet frame
|
||||
mBullet = new (aPresContext->PresShell()) nsBulletFrame;
|
||||
mBullet = new (shell) nsBulletFrame;
|
||||
|
||||
if (nsnull == mBullet) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsLineBox.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
class nsBlockReflowState;
|
||||
class nsBulletFrame;
|
||||
|
@ -205,9 +206,9 @@ protected:
|
|||
|
||||
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsIPresContext* aPresContext)
|
||||
{
|
||||
return aPresContext->ProbePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::firstLetter,
|
||||
mStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::firstLetter, mStyleContext);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsLayoutAtoms.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#define nsFirstLetterFrameSuper nsHTMLContainerFrame
|
||||
|
||||
|
@ -142,7 +143,8 @@ nsFirstLetterFrame::Init(nsIPresContext* aPresContext,
|
|||
// a style context like we would for a text node.
|
||||
nsStyleContext* parentStyleContext = aContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
newSC = aPresContext->StyleSet()->
|
||||
ResolveStyleForNonElement(parentStyleContext);
|
||||
if (newSC)
|
||||
aContext = newSC;
|
||||
}
|
||||
|
@ -370,7 +372,7 @@ nsFirstLetterFrame::DrainOverflowFrames(nsIPresContext* aPresContext)
|
|||
if (kidContent) {
|
||||
NS_ASSERTION(kidContent->IsContentOfType(nsIContent::eTEXT),
|
||||
"should contain only text nodes");
|
||||
sc = aPresContext->ResolveStyleContextForNonElement(mStyleContext);
|
||||
sc = aPresContext->StyleSet()->ResolveStyleForNonElement(mStyleContext);
|
||||
if (sc) {
|
||||
kid->SetStyleContext(aPresContext, sc);
|
||||
}
|
||||
|
|
|
@ -1556,6 +1556,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
// that the frame has the last reference to it, so AddRef it here.
|
||||
|
||||
nsStyleContext* oldContext = aFrame->GetStyleContext();
|
||||
nsStyleSet* styleSet = aPresContext->StyleSet();
|
||||
|
||||
if (oldContext) {
|
||||
oldContext->AddRef();
|
||||
|
@ -1594,7 +1595,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
if (pseudoTag == nsCSSAnonBoxes::mozNonElement) {
|
||||
NS_ASSERTION(localContent,
|
||||
"non pseudo-element frame without content node");
|
||||
newContext = aPresContext->ResolveStyleContextForNonElement(parentContext).get();
|
||||
newContext = styleSet->ResolveStyleForNonElement(parentContext).get();
|
||||
}
|
||||
else if (pseudoTag) {
|
||||
nsIContent* pseudoContent =
|
||||
|
@ -1602,9 +1603,9 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
if (pseudoTag == nsCSSPseudoElements::before ||
|
||||
pseudoTag == nsCSSPseudoElements::after) {
|
||||
// XXX what other pseudos do we need to treat like this?
|
||||
newContext = aPresContext->ProbePseudoStyleContextFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
newContext = styleSet->ProbePseudoStyleFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
if (!newContext) {
|
||||
// This pseudo should no longer exist; gotta reframe
|
||||
NS_UpdateHint(aMinChange, nsChangeHint_ReconstructFrame);
|
||||
|
@ -1615,15 +1616,15 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
newContext->AddRef();
|
||||
}
|
||||
} else {
|
||||
newContext = aPresContext->ResolvePseudoStyleContextFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
newContext = styleSet->ResolvePseudoStyleFor(pseudoContent,
|
||||
pseudoTag,
|
||||
parentContext).get();
|
||||
}
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(localContent,
|
||||
"non pseudo-element frame without content node");
|
||||
newContext = aPresContext->ResolveStyleContextFor(content, parentContext).get();
|
||||
newContext = styleSet->ResolveStyleFor(content, parentContext).get();
|
||||
}
|
||||
NS_ASSERTION(newContext, "failed to get new style context");
|
||||
if (newContext) {
|
||||
|
@ -1680,9 +1681,9 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
NS_ASSERTION(pseudoTag &&
|
||||
pseudoTag != nsCSSAnonBoxes::mozNonElement,
|
||||
"extra style context is not pseudo element");
|
||||
newExtraContext = aPresContext->ResolvePseudoStyleContextFor(content,
|
||||
pseudoTag,
|
||||
newContext).get();
|
||||
newExtraContext = styleSet->ResolvePseudoStyleFor(content,
|
||||
pseudoTag,
|
||||
newContext).get();
|
||||
if (newExtraContext) {
|
||||
if (oldExtraContext != newExtraContext) {
|
||||
aMinChange = CaptureChange(oldExtraContext, newExtraContext, aFrame,
|
||||
|
@ -1707,18 +1708,18 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
|||
nsRefPtr<nsStyleContext> undisplayedContext;
|
||||
pseudoTag = undisplayed->mStyle->GetPseudoType();
|
||||
if (pseudoTag == nsnull) { // child content
|
||||
undisplayedContext = aPresContext->ResolveStyleContextFor(undisplayed->mContent,
|
||||
newContext);
|
||||
undisplayedContext = styleSet->ResolveStyleFor(undisplayed->mContent,
|
||||
newContext);
|
||||
}
|
||||
else if (pseudoTag == nsCSSAnonBoxes::mozNonElement) {
|
||||
undisplayedContext = aPresContext->ResolveStyleContextForNonElement(newContext);
|
||||
undisplayedContext = styleSet->ResolveStyleForNonElement(newContext);
|
||||
}
|
||||
else { // pseudo element
|
||||
NS_NOTREACHED("no pseudo elements in undisplayed map");
|
||||
NS_ASSERTION(pseudoTag, "pseudo element without tag");
|
||||
undisplayedContext = aPresContext->ResolvePseudoStyleContextFor(localContent,
|
||||
pseudoTag,
|
||||
newContext);
|
||||
undisplayedContext = styleSet->ResolvePseudoStyleFor(localContent,
|
||||
pseudoTag,
|
||||
newContext);
|
||||
}
|
||||
if (undisplayedContext) {
|
||||
const nsStyleDisplay* display = undisplayedContext->GetStyleDisplay();
|
||||
|
|
|
@ -1053,9 +1053,10 @@ nsFirstLineFrame::Reflow(nsIPresContext* aPresContext,
|
|||
// style context thus removing the :first-line style. This way
|
||||
// we behave as if an anonymous (unstyled) span was the child
|
||||
// of the parent frame.
|
||||
nsRefPtr<nsStyleContext> newSC = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::mozLineFrame,
|
||||
parentContext);
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::mozLineFrame, parentContext);
|
||||
if (newSC) {
|
||||
// Switch to the new style context.
|
||||
SetStyleContext(aPresContext, newSC);
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#endif
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#include "nsBidiFrames.h"
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -1006,9 +1007,9 @@ DrawSelectionIterator::DrawSelectionIterator(nsIContent *aContent,
|
|||
|
||||
if (aContent) {
|
||||
nsRefPtr<nsStyleContext> sc;
|
||||
sc = aPresContext->ProbePseudoStyleContextFor(aContent->GetParent(),
|
||||
nsCSSPseudoElements::mozSelection,
|
||||
aStyleContext);
|
||||
sc = aPresContext->StyleSet()->
|
||||
ProbePseudoStyleFor(aContent->GetParent(),
|
||||
nsCSSPseudoElements::mozSelection, aStyleContext);
|
||||
if (sc) {
|
||||
mSelectionPseudoStyle = PR_TRUE;
|
||||
const nsStyleBackground* bg = sc->GetStyleBackground();
|
||||
|
|
|
@ -56,6 +56,7 @@
|
|||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
// masks for mEdgeVisibility
|
||||
#define LEFT_VIS 0x0001
|
||||
|
@ -403,7 +404,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
nsRefPtr<nsStyleContext> kidSC;
|
||||
nsresult result;
|
||||
|
||||
kidSC = aPresContext->ResolveStyleContextFor(child, mStyleContext);
|
||||
kidSC = shell->StyleSet()->ResolveStyleFor(child, mStyleContext);
|
||||
if (tag == nsHTMLAtoms::frameset) {
|
||||
result = NS_NewHTMLFramesetFrame(shell, &frame);
|
||||
|
||||
|
@ -445,9 +446,9 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext,
|
|||
// should just have null content, if we support that
|
||||
nsHTMLFramesetBlankFrame* blankFrame = new (shell) nsHTMLFramesetBlankFrame;
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::framesetBlank,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = shell->StyleSet()->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::framesetBlank,
|
||||
mStyleContext);
|
||||
if(blankFrame)
|
||||
blankFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
|
@ -979,6 +980,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason);
|
||||
DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus);
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
//printf("FramesetFrame2::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
|
||||
// Always get the size so that the caller knows how big we are
|
||||
|
@ -1073,9 +1075,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
PR_FALSE,
|
||||
PR_FALSE);
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::horizontalFramesetBorder,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::horizontalFramesetBorder,
|
||||
mStyleContext);
|
||||
borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
mChildCount++;
|
||||
|
@ -1102,9 +1104,9 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
|
|||
PR_TRUE,
|
||||
PR_FALSE);
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSPseudoElements::verticalFramesetBorder,
|
||||
mStyleContext);
|
||||
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSPseudoElements::verticalFramesetBorder,
|
||||
mStyleContext);
|
||||
borderFrame->Init(aPresContext, mContent, this, pseudoStyleContext, nsnull);
|
||||
|
||||
mChildCount++;
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#include "nsHTMLAtoms.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsINameSpaceManager.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#define ACTIVE "active"
|
||||
#define HOVER "hover"
|
||||
|
@ -309,16 +310,17 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext* aPresContext)
|
|||
{
|
||||
// get all the styles
|
||||
nsStyleContext* context = mFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresContext->StyleSet();
|
||||
|
||||
// style for the inner such as a dotted line (Windows)
|
||||
mInnerFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusInner,
|
||||
context);
|
||||
mInnerFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusInner,
|
||||
context);
|
||||
|
||||
// style for outer focus like a ridged border (MAC).
|
||||
mOuterFocusStyle = aPresContext->ProbePseudoStyleContextFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusOuter,
|
||||
context);
|
||||
mOuterFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
|
||||
nsCSSPseudoElements::mozFocusOuter,
|
||||
context);
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
|
|
|
@ -84,6 +84,7 @@
|
|||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
static NS_DEFINE_CID(kTextNodeCID, NS_TEXTNODE_CID);
|
||||
static NS_DEFINE_CID(kHTMLElementFactoryCID, NS_HTML_ELEMENT_FACTORY_CID);
|
||||
|
@ -2031,15 +2032,17 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mDisplayFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// create the style context for the anonymous frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
if (!styleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// create a text frame and put it inside the block frame
|
||||
|
@ -2047,7 +2050,7 @@ nsComboboxControlFrame::CreateDisplayFrame(nsIPresContext* aPresContext)
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mTextFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mDisplayContent));
|
||||
mTextFrame->Init(aPresContext, content, mDisplayFrame, textStyleContext, nsnull);
|
||||
|
@ -2159,6 +2162,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (aContent == content.get()) {
|
||||
// Get PresShell
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsStyleSet *styleSet = shell->StyleSet();
|
||||
|
||||
// Start by by creating a containing frame
|
||||
nsresult rv = NS_NewBlockFrame(shell, (nsIFrame**)&mDisplayFrame, NS_BLOCK_SPACE_MGR);
|
||||
|
@ -2167,9 +2171,9 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
|
||||
// create the style context for the anonymous block frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
|
||||
mStyleContext);
|
||||
if (!styleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// Create a text frame and put it inside the block frame
|
||||
|
@ -2177,7 +2181,7 @@ nsComboboxControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!mTextFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
// initialize the text frame
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsLayoutAtoms.h"
|
||||
#include "nsReflowPath.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
// MouseEvent suppression in PP
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
|
@ -237,7 +238,8 @@ nsGfxButtonControlFrame::CreateFrameFor(nsIPresContext* aPresContext,
|
|||
if (NS_FAILED(rv)) { return rv; }
|
||||
if (!newFrame) { return NS_ERROR_NULL_POINTER; }
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(styleContext);
|
||||
textStyleContext = aPresContext->StyleSet()->
|
||||
ResolveStyleForNonElement(styleContext);
|
||||
if (!textStyleContext) { return NS_ERROR_NULL_POINTER; }
|
||||
|
||||
if (styleContext) {
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsIDOMHTMLButtonElement.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsStyleSet.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
#endif
|
||||
|
@ -137,14 +138,15 @@ nsHTMLButtonControlFrame::Init(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsIFrame* areaFrame;
|
||||
NS_NewAreaFrame(aPresContext->PresShell(), &areaFrame, flags);
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
NS_NewAreaFrame(shell, &areaFrame, flags);
|
||||
mFrames.SetFrames(areaFrame);
|
||||
|
||||
// Resolve style and initialize the frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::buttonContent,
|
||||
mStyleContext);
|
||||
styleContext = shell->StyleSet()->ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::buttonContent,
|
||||
mStyleContext);
|
||||
mFrames.FirstChild()->Init(aPresContext, mContent, this, styleContext, nsnull);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -1519,11 +1519,13 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
if (!aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return PR_FALSE;
|
||||
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
// Probe for the existence of the pseudo-element
|
||||
nsRefPtr<nsStyleContext> pseudoStyleContext;
|
||||
pseudoStyleContext = aPresContext->ProbePseudoStyleContextFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
pseudoStyleContext = styleSet->ProbePseudoStyleFor(aContent,
|
||||
aPseudoElement,
|
||||
aStyleContext);
|
||||
|
||||
if (pseudoStyleContext) {
|
||||
// |ProbePseudoStyleContext| checks the 'display' property and the
|
||||
|
@ -1540,9 +1542,8 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
}
|
||||
nsStyleContext* parentSC = aStyleContext->GetParent();
|
||||
nsRefPtr<nsStyleContext> wrapperSC;
|
||||
wrapperSC = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
wrapperPseudo,
|
||||
parentSC);
|
||||
wrapperSC = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
wrapperPseudo, parentSC);
|
||||
// |aFrame| is already the correct parent.
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, aFrame,
|
||||
wrapperSC, nsnull, *aWrapperFrame);
|
||||
|
@ -1572,7 +1573,7 @@ nsCSSFrameConstructor::CreateGeneratedContentFrame(nsIPresShell* aPresShe
|
|||
// Create another pseudo style context to use for all the generated child
|
||||
// frames
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(pseudoStyleContext);
|
||||
textStyleContext = styleSet->ResolveStyleForNonElement(pseudoStyleContext);
|
||||
|
||||
// Now create content objects (and child frames) for each value of the
|
||||
// 'content' property
|
||||
|
@ -1917,9 +1918,9 @@ nsCSSFrameConstructor::CreatePseudoTableFrame(nsIPresShell* aPresShel
|
|||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
// create the SC for the inner table which will be the parent of the outer table's SC
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::table,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::table,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudoOuter = aState.mPseudoFrames.mTableOuter;
|
||||
nsPseudoFrameData& pseudoInner = aState.mPseudoFrames.mTableInner;
|
||||
|
@ -1965,9 +1966,9 @@ nsCSSFrameConstructor::CreatePseudoRowGroupFrame(nsIPresShell* aPresS
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRowGroup,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRowGroup,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mRowGroup;
|
||||
|
||||
|
@ -2009,9 +2010,9 @@ nsCSSFrameConstructor::CreatePseudoColGroupFrame(nsIPresShell* aPresS
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mColGroup;
|
||||
|
||||
|
@ -2051,9 +2052,9 @@ nsCSSFrameConstructor::CreatePseudoRowFrame(nsIPresShell* aPresShell,
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRow,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableRow,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudo = aState.mPseudoFrames.mRow;
|
||||
|
||||
|
@ -2094,9 +2095,9 @@ nsCSSFrameConstructor::CreatePseudoCellFrame(nsIPresShell* aPresShell
|
|||
parentStyle = parentFrame->GetStyleContext();
|
||||
nsIContent* parentContent = parentFrame->GetContent();
|
||||
|
||||
childStyle = aPresContext->ResolvePseudoStyleContextFor(parentContent,
|
||||
nsCSSAnonBoxes::tableCell,
|
||||
parentStyle);
|
||||
childStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
|
||||
nsCSSAnonBoxes::tableCell,
|
||||
parentStyle);
|
||||
|
||||
nsPseudoFrameData& pseudoOuter = aState.mPseudoFrames.mCellOuter;
|
||||
nsPseudoFrameData& pseudoInner = aState.mPseudoFrames.mCellInner;
|
||||
|
@ -2462,9 +2463,8 @@ nsCSSFrameConstructor::ConstructTableFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// create the pseudo SC for the outer table as a child of the inner SC
|
||||
nsRefPtr<nsStyleContext> outerStyleContext;
|
||||
outerStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::tableOuter,
|
||||
aStyleContext);
|
||||
outerStyleContext = aPresShell->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::tableOuter, aStyleContext);
|
||||
|
||||
// Init the table outer frame and see if we need to create a view, e.g.
|
||||
// the frame is absolutely positioned
|
||||
|
@ -2854,9 +2854,10 @@ nsCSSFrameConstructor::ConstructTableCellFrame(nsIPresShell* aPresShe
|
|||
|
||||
// Resolve pseudo style and initialize the body cell frame
|
||||
nsRefPtr<nsStyleContext> innerPseudoStyle;
|
||||
innerPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::cellContent,
|
||||
aStyleContext);
|
||||
innerPseudoStyle = aPresShell->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::cellContent, aStyleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
aNewCellOuterFrame, innerPseudoStyle, nsnull, aNewCellInnerFrame);
|
||||
|
||||
|
@ -3283,8 +3284,8 @@ nsCSSFrameConstructor::ConstructDocElementFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// --------- CREATE AREA OR BOX FRAME -------
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement,
|
||||
aParentStyleContext);
|
||||
styleContext = aPresShell->StyleSet()->ResolveStyleFor(aDocElement,
|
||||
aParentStyleContext);
|
||||
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
|
||||
|
@ -3519,10 +3520,11 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
// --------- BUILD VIEWPORT -----------
|
||||
nsIFrame* viewportFrame = nsnull;
|
||||
nsRefPtr<nsStyleContext> viewportPseudoStyle;
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
viewportPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::viewport,
|
||||
nsnull);
|
||||
viewportPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::viewport,
|
||||
nsnull);
|
||||
|
||||
NS_NewViewportFrame(aPresShell, &viewportFrame);
|
||||
|
||||
|
@ -3652,7 +3654,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// see if the style is overflow: hidden, first on the document element
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolveStyleContextFor(aDocElement, nsnull);
|
||||
styleContext = styleSet->ResolveStyleFor(aDocElement, nsnull);
|
||||
if (styleContext) {
|
||||
const nsStyleDisplay* display = styleContext->GetStyleDisplay();
|
||||
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
|
||||
|
@ -3681,8 +3683,7 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
if (bodyElement) {
|
||||
nsRefPtr<nsStyleContext> bodyContext;
|
||||
bodyContext = aPresContext->ResolveStyleContextFor(bodyElement,
|
||||
styleContext);
|
||||
bodyContext = styleSet->ResolveStyleFor(bodyElement, styleContext);
|
||||
if (bodyContext) {
|
||||
const nsStyleDisplay* display = bodyContext->GetStyleDisplay();
|
||||
if (display->mOverflow == NS_STYLE_OVERFLOW_HIDDEN ||
|
||||
|
@ -3707,9 +3708,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// If paginated, make sure we don't put scrollbars in
|
||||
if (isPaginated && !printPreviewContext)
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
else if (isScrollable) {
|
||||
|
||||
// Build the frame. We give it the content we are wrapping which is the document,
|
||||
|
@ -3718,9 +3719,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// resolve a context for the scrollframe
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::viewportScroll,
|
||||
viewportPseudoStyle);
|
||||
styleContext = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::viewportScroll,
|
||||
viewportPseudoStyle);
|
||||
|
||||
|
||||
nsIFrame* newScrollableFrame = nsnull;
|
||||
|
@ -3754,18 +3755,18 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
} else {
|
||||
// If no scrollbars and xul, don't build a scrollframe at all.
|
||||
if (isXUL) {
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
viewportPseudoStyle);
|
||||
} else {
|
||||
// if HTML the always create a scrollframe so anchors work. That way you can scroll to
|
||||
// anchors even if we don't have scrollbars.
|
||||
|
||||
// create a style context for the scrollport of the viewport
|
||||
nsRefPtr<nsStyleContext> scrollPseudoStyle;
|
||||
scrollPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
viewportPseudoStyle);
|
||||
scrollPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
viewportPseudoStyle);
|
||||
|
||||
// create scrollframe
|
||||
nsIFrame* scrollFrame = nsnull;
|
||||
|
@ -3775,9 +3776,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIPresShell* aPresShell,
|
|||
scrollFrame->Init(aPresContext, nsnull, parentFrame, scrollPseudoStyle, nsnull);
|
||||
|
||||
// resolve a new style for the root frame
|
||||
rootPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
rootPseudo,
|
||||
scrollPseudoStyle);
|
||||
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
rootPseudo,
|
||||
scrollPseudoStyle);
|
||||
|
||||
// Inform the view manager about the root scrollable view
|
||||
nsIView* view = scrollFrame->GetView();
|
||||
|
@ -3851,11 +3852,13 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
|||
return rv;
|
||||
|
||||
nsStyleContext* parentStyleContext = aParentFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
nsRefPtr<nsStyleContext> pagePseudoStyle;
|
||||
pagePseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::page,
|
||||
parentStyleContext);
|
||||
pagePseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::page,
|
||||
parentStyleContext);
|
||||
|
||||
// Initialize the page frame and force it to have a view. This makes printing of
|
||||
// the pages easier and faster.
|
||||
aPageFrame->Init(aPresContext, nsnull, aParentFrame, pagePseudoStyle, aPrevPageFrame);
|
||||
|
@ -3867,9 +3870,10 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
|
|||
NS_NewPageContentFrame(aPresShell, &aPageContentFrame);
|
||||
|
||||
nsRefPtr<nsStyleContext> pageContentPseudoStyle;
|
||||
pageContentPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::pageContent,
|
||||
pagePseudoStyle);
|
||||
pageContentPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::pageContent,
|
||||
pagePseudoStyle);
|
||||
|
||||
// Initialize the page content frame and force it to have a view. Also make it the
|
||||
// containing block for fixed elements which are repeated on every page.
|
||||
aPageContentFrame->Init(aPresContext, nsnull, aPageFrame, pageContentPseudoStyle, nsnull);
|
||||
|
@ -3903,7 +3907,8 @@ nsCSSFrameConstructor::CreatePlaceholderFrameFor(nsIPresShell* aPresShell,
|
|||
// The placeholder frame gets a pseudo style context
|
||||
nsRefPtr<nsStyleContext> placeholderStyle;
|
||||
nsStyleContext* parentContext = aStyleContext->GetParent();
|
||||
placeholderStyle = aPresContext->ResolveStyleContextForNonElement(parentContext);
|
||||
placeholderStyle = aPresShell->StyleSet()->
|
||||
ResolveStyleForNonElement(parentContext);
|
||||
placeholderFrame->Init(aPresContext, aContent, aParentFrame,
|
||||
placeholderStyle, nsnull);
|
||||
|
||||
|
@ -3935,9 +3940,9 @@ nsCSSFrameConstructor::ConstructRadioControlFrame(nsIPresShell* aPresShel
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> radioStyle;
|
||||
radioStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::radio,
|
||||
aStyleContext);
|
||||
radioStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::radio,
|
||||
aStyleContext);
|
||||
nsIRadioControlFrame* radio = nsnull;
|
||||
if (aNewFrame != nsnull && NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsIRadioControlFrame), (void**)&radio))) {
|
||||
radio->SetRadioButtonFaceStyleContext(radioStyle);
|
||||
|
@ -3960,9 +3965,9 @@ nsCSSFrameConstructor::ConstructCheckboxControlFrame(nsIPresShell* aPresShell
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> checkboxStyle;
|
||||
checkboxStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::check,
|
||||
aStyleContext);
|
||||
checkboxStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::check,
|
||||
aStyleContext);
|
||||
nsICheckboxControlFrame* checkbox = nsnull;
|
||||
if (aNewFrame != nsnull &&
|
||||
NS_SUCCEEDED(aNewFrame->QueryInterface(NS_GET_IID(nsICheckboxControlFrame), (void**)&checkbox))) {
|
||||
|
@ -4049,9 +4054,9 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsIPresShell* aPresShell,
|
|||
|
||||
// Resolve psuedo element style for the dropdown list
|
||||
nsRefPtr<nsStyleContext> listStyle;
|
||||
listStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::dropDownList,
|
||||
aStyleContext);
|
||||
listStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::dropDownList,
|
||||
aStyleContext);
|
||||
|
||||
// Initialize the scroll frame positioned. Note that it is NOT
|
||||
// initialized as absolutely positioned.
|
||||
|
@ -4303,9 +4308,9 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsIPresShell* aPresShel
|
|||
|
||||
// Resolve style and initialize the frame
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::fieldsetContent,
|
||||
aStyleContext);
|
||||
styleContext = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::fieldsetContent,
|
||||
aStyleContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
newFrame, styleContext, nsnull, areaFrame);
|
||||
|
||||
|
@ -5788,17 +5793,19 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsIPresShell* aPresSh
|
|||
|
||||
// we used the style that was passed in. So resolve another one.
|
||||
nsRefPtr<nsStyleContext> scrollPseudoStyle;
|
||||
scrollPseudoStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
contentStyle);
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
scrollPseudoStyle = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::scrolledContent,
|
||||
contentStyle);
|
||||
|
||||
contentStyle = scrollPseudoStyle;
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
parentFrame, contentStyle, nsnull, scrollFrame);
|
||||
|
||||
nsStyleContext* aScrolledChildStyle = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
aScrolledPseudo,
|
||||
contentStyle).get();
|
||||
nsStyleContext* aScrolledChildStyle = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
aScrolledPseudo,
|
||||
contentStyle).get();
|
||||
|
||||
aScrollableFrame = scrollFrame;
|
||||
|
||||
|
@ -6509,15 +6516,17 @@ nsCSSFrameConstructor::ResolveStyleContext(nsIPresContext* aPresContext,
|
|||
parentStyleContext = parentStyleContext->GetParent();
|
||||
}
|
||||
|
||||
nsStyleSet *styleSet = aPresContext->StyleSet();
|
||||
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT)) {
|
||||
return aPresContext->ResolveStyleContextFor(aContent, parentStyleContext);
|
||||
return styleSet->ResolveStyleFor(aContent, parentStyleContext);
|
||||
} else {
|
||||
|
||||
NS_ASSERTION(aContent->Tag() == nsLayoutAtoms::textTagName,
|
||||
"shouldn't waste time creating style contexts for "
|
||||
"comments and processing instructions");
|
||||
|
||||
return aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
return styleSet->ResolveStyleForNonElement(parentStyleContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6618,14 +6627,15 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
// block so that it can mix better with other surrounding MathML markups
|
||||
|
||||
nsStyleContext* parentContext = aParentFrame->GetStyleContext();
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
// first, create a MathML mrow frame that will wrap the block frame
|
||||
rv = NS_NewMathMLmrowFrame(aPresShell, &newFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRefPtr<nsStyleContext> mrowContext;
|
||||
mrowContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::mozMathInline,
|
||||
parentContext);
|
||||
mrowContext = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::mozMathInline,
|
||||
parentContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, aParentFrame,
|
||||
mrowContext, nsnull, newFrame);
|
||||
|
||||
|
@ -6634,16 +6644,16 @@ nsCSSFrameConstructor::ConstructMathMLFrame(nsIPresShell* aPresShell,
|
|||
rv = NS_NewBlockFrame(aPresShell, &blockFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRefPtr<nsStyleContext> blockContext;
|
||||
blockContext = aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mrowContext);
|
||||
blockContext = styleSet->ResolvePseudoStyleFor(aContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mrowContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent, newFrame,
|
||||
blockContext, nsnull, blockFrame);
|
||||
|
||||
// then, create the table frame itself
|
||||
nsRefPtr<nsStyleContext> tableContext;
|
||||
tableContext = aPresContext->ResolveStyleContextFor(aContent,
|
||||
blockContext);
|
||||
tableContext = styleSet->ResolveStyleFor(aContent, blockContext);
|
||||
|
||||
nsFrameItems tempItems;
|
||||
nsIFrame* outerTable;
|
||||
nsIFrame* innerTable;
|
||||
|
@ -6923,9 +6933,9 @@ nsCSSFrameConstructor::ConstructPageBreakFrame(nsIPresShell* aPresShe
|
|||
nsFrameItems& aFrameItems)
|
||||
{
|
||||
nsRefPtr<nsStyleContext> pseudoStyle;
|
||||
pseudoStyle = aPresContext->ResolvePseudoStyleContextFor(nsnull,
|
||||
nsCSSAnonBoxes::pageBreak,
|
||||
aStyleContext);
|
||||
pseudoStyle = aPresShell->StyleSet()->ResolvePseudoStyleFor(nsnull,
|
||||
nsCSSAnonBoxes::pageBreak,
|
||||
aStyleContext);
|
||||
nsIFrame* pageBreakFrame;
|
||||
nsresult rv = NS_NewPageBreakFrame(aPresShell, &pageBreakFrame);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
|
@ -10197,7 +10207,8 @@ nsCSSFrameConstructor::ConstructAlternateFrame(nsIPresShell* aPresShell,
|
|||
NS_NewTextFrame(aPresShell, &textFrame);
|
||||
|
||||
nsRefPtr<nsStyleContext> textStyleContext;
|
||||
textStyleContext = aPresContext->ResolveStyleContextForNonElement(aStyleContext);
|
||||
textStyleContext = aPresShell->StyleSet()->
|
||||
ResolveStyleForNonElement(aStyleContext);
|
||||
|
||||
textFrame->Init(aPresContext, altTextContent, containerFrame,
|
||||
textStyleContext, nsnull);
|
||||
|
@ -11214,15 +11225,15 @@ nsCSSFrameConstructor::MaybeRecreateFramesForContent(nsIPresContext* aPresContex
|
|||
nsIContent* aContent)
|
||||
{
|
||||
nsresult result = NS_OK;
|
||||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
aPresContext->PresShell()->GetFrameManager(getter_AddRefs(frameManager));
|
||||
nsIPresShell *shell = aPresContext->PresShell();
|
||||
nsIFrameManager *frameManager = shell->GetFrameManager();
|
||||
|
||||
nsStyleContext *oldContext = frameManager->GetUndisplayedContent(aContent);
|
||||
if (oldContext) {
|
||||
// The parent has a frame, so try resolving a new context.
|
||||
nsRefPtr<nsStyleContext> newContext =
|
||||
aPresContext->ResolveStyleContextFor(aContent,
|
||||
oldContext->GetParent());
|
||||
nsRefPtr<nsStyleContext> newContext = shell->StyleSet()->
|
||||
ResolveStyleFor(aContent, oldContext->GetParent());
|
||||
|
||||
frameManager->ChangeUndisplayedContent(aContent, newContext);
|
||||
if (newContext->GetStyleDisplay()->mDisplay != NS_STYLE_DISPLAY_NONE) {
|
||||
result = RecreateFramesForContent(aPresContext, aContent);
|
||||
|
@ -11330,9 +11341,9 @@ nsCSSFrameConstructor::GetFirstLetterStyle(nsIPresContext* aPresContext,
|
|||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
if (aContent) {
|
||||
return aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSPseudoElements::firstLetter,
|
||||
aStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSPseudoElements::firstLetter, aStyleContext);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -11343,9 +11354,9 @@ nsCSSFrameConstructor::GetFirstLineStyle(nsIPresContext* aPresContext,
|
|||
nsStyleContext* aStyleContext)
|
||||
{
|
||||
if (aContent) {
|
||||
return aPresContext->ResolvePseudoStyleContextFor(aContent,
|
||||
nsCSSPseudoElements::firstLine,
|
||||
aStyleContext);
|
||||
return aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent,
|
||||
nsCSSPseudoElements::firstLine, aStyleContext);
|
||||
}
|
||||
return nsnull;
|
||||
}
|
||||
|
@ -11883,6 +11894,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
{
|
||||
// Create the first-letter-frame
|
||||
nsIFrame* letterFrame;
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
NS_NewFirstLetterFrame(aPresShell, &letterFrame);
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
|
@ -11893,7 +11905,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
// letter frame and will have the float property set on it; the text
|
||||
// frame shouldn't have that set).
|
||||
nsRefPtr<nsStyleContext> textSC;
|
||||
textSC = aPresContext->ResolveStyleContextForNonElement(aStyleContext);
|
||||
textSC = styleSet->ResolveStyleForNonElement(aStyleContext);
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
letterFrame, textSC, nsnull, aTextFrame);
|
||||
|
||||
|
@ -11920,7 +11932,7 @@ nsCSSFrameConstructor::CreateFloatingLetterFrame(
|
|||
nsStyleContext* parentStyleContext = aStyleContext->GetParent();
|
||||
if (parentStyleContext) {
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentStyleContext);
|
||||
newSC = styleSet->ResolveStyleForNonElement(parentStyleContext);
|
||||
if (newSC) {
|
||||
nextTextFrame->SetStyleContext(aPresContext, newSC);
|
||||
}
|
||||
|
@ -11983,9 +11995,11 @@ nsCSSFrameConstructor::CreateLetterFrame(nsIPresShell* aPresShell, nsIPresContex
|
|||
letterFrame->Init(aPresContext, aTextContent, aParentFrame,
|
||||
sc, nsnull);
|
||||
nsRefPtr<nsStyleContext> textSC;
|
||||
textSC = aPresContext->ResolveStyleContextForNonElement(sc);
|
||||
textSC = aPresContext->StyleSet()->ResolveStyleForNonElement(sc);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aTextContent,
|
||||
letterFrame, textSC, nsnull, textFrame);
|
||||
letterFrame, textSC, nsnull, textFrame);
|
||||
|
||||
letterFrame->SetInitialChildList(aPresContext, nsnull, textFrame);
|
||||
aResult.childList = aResult.lastChild = letterFrame;
|
||||
}
|
||||
|
@ -12183,7 +12197,7 @@ nsCSSFrameConstructor::RemoveFloatingFirstLetterFrames(
|
|||
return NS_OK;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentSC);
|
||||
newSC = aPresShell->StyleSet()->ResolveStyleForNonElement(parentSC);
|
||||
if (!newSC) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -12271,7 +12285,7 @@ nsCSSFrameConstructor::RemoveFirstLetterFrames(nsIPresContext* aPresContext,
|
|||
break;
|
||||
}
|
||||
nsRefPtr<nsStyleContext> newSC;
|
||||
newSC = aPresContext->ResolveStyleContextForNonElement(parentSC);
|
||||
newSC = aPresShell->StyleSet()->ResolveStyleForNonElement(parentSC);
|
||||
if (!newSC) {
|
||||
break;
|
||||
}
|
||||
|
@ -12638,8 +12652,8 @@ nsCSSFrameConstructor::ConstructInline(nsIPresShell* aPresShell,
|
|||
}
|
||||
|
||||
nsRefPtr<nsStyleContext> blockSC;
|
||||
blockSC = aPresContext->ResolvePseudoStyleContextFor(aContent, blockStyle,
|
||||
aStyleContext);
|
||||
blockSC = aPresShell->StyleSet()->ResolvePseudoStyleFor(aContent, blockStyle,
|
||||
aStyleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, aContent,
|
||||
aParentFrame, blockSC, nsnull, blockFrame);
|
||||
|
@ -13102,9 +13116,9 @@ nsCSSFrameConstructor::SplitToContainingBlock(nsIPresContext* aPresContext,
|
|||
nsStyleContext* styleContext = aFrame->GetStyleContext();
|
||||
|
||||
nsRefPtr<nsStyleContext> blockSC;
|
||||
blockSC = aPresContext->ResolvePseudoStyleContextFor(content,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
styleContext);
|
||||
blockSC = shell->StyleSet()->ResolvePseudoStyleFor(content,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
styleContext);
|
||||
|
||||
InitAndRestoreFrame(aPresContext, aState, content,
|
||||
nsnull, blockSC, nsnull, blockFrame);
|
||||
|
|
|
@ -38,6 +38,7 @@ REQUIRES = xpcom \
|
|||
view \
|
||||
accessibility \
|
||||
necko \
|
||||
webshell \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "nsLayoutErrors.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
@ -814,15 +815,15 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsIPresContext& aPresContext,
|
|||
nsTableColGroupType aColGroupType)
|
||||
{
|
||||
nsIContent* colGroupContent = GetContent();
|
||||
nsIPresShell *shell = aPresContext.PresShell();
|
||||
|
||||
nsRefPtr<nsStyleContext> colGroupStyle;
|
||||
colGroupStyle = aPresContext.ResolvePseudoStyleContextFor(colGroupContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
mStyleContext);
|
||||
colGroupStyle = shell->StyleSet()->ResolvePseudoStyleFor(colGroupContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
mStyleContext);
|
||||
// Create a col group frame
|
||||
nsIFrame* newFrame;
|
||||
nsresult result = NS_NewTableColGroupFrame(aPresContext.PresShell(),
|
||||
&newFrame);
|
||||
nsresult result = NS_NewTableColGroupFrame(shell, &newFrame);
|
||||
if (NS_SUCCEEDED(result) && newFrame) {
|
||||
((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType);
|
||||
newFrame->Init(&aPresContext, colGroupContent, this, colGroupStyle, nsnull);
|
||||
|
@ -898,6 +899,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|||
{
|
||||
*aFirstNewFrame = nsnull;
|
||||
nsIFrame* lastColFrame = nsnull;
|
||||
nsIPresShell *shell = aPresContext.PresShell();
|
||||
|
||||
// Get the last col frame
|
||||
nsIFrame* childFrame = aColGroupFrame.GetFirstChild(nsnull);
|
||||
|
@ -926,16 +928,16 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|||
// all other anonymous cols use a pseudo style context of the col group
|
||||
iContent = aColGroupFrame.GetContent();
|
||||
parentStyleContext = aColGroupFrame.GetStyleContext();
|
||||
styleContext = aPresContext.ResolvePseudoStyleContextFor(iContent,
|
||||
nsCSSAnonBoxes::tableCol,
|
||||
parentStyleContext);
|
||||
styleContext = shell->StyleSet()->ResolvePseudoStyleFor(iContent,
|
||||
nsCSSAnonBoxes::tableCol,
|
||||
parentStyleContext);
|
||||
}
|
||||
// ASSERTION to check for bug 54454 sneaking back in...
|
||||
NS_ASSERTION(iContent, "null content in CreateAnonymousColFrames");
|
||||
|
||||
// create the new col frame
|
||||
nsIFrame* colFrame;
|
||||
NS_NewTableColFrame(aPresContext.PresShell(), &colFrame);
|
||||
NS_NewTableColFrame(shell, &colFrame);
|
||||
((nsTableColFrame *) colFrame)->SetColType(aColType);
|
||||
colFrame->Init(&aPresContext, iContent, &aColGroupFrame,
|
||||
styleContext, nsnull);
|
||||
|
|
|
@ -50,6 +50,7 @@
|
|||
#include "nsInlineFrame.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
@ -291,7 +292,8 @@ TestReflowUnmapped(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
@ -384,7 +386,8 @@ TestChildrenThatDontFit(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
@ -556,7 +559,8 @@ TestOverflow(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
@ -668,7 +672,8 @@ TestPushingPulling(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
@ -1089,7 +1094,8 @@ TestSplittableChildren(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
@ -1448,7 +1454,8 @@ TestMaxElementSize(nsIPresContext* presContext)
|
|||
// Create an inline frame for the HTML container and set its
|
||||
// style context
|
||||
InlineFrame* f = new InlineFrame(b, 0, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext = presContext->ResolveStyleContextFor(b, nsnull);
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = presContext->StyleSet()->ResolveStyleFor(b, nsnull);
|
||||
|
||||
f->SetStyleContext(presContext,styleContext);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsMathMLChar.h"
|
||||
#include "nsMathMLContainerFrame.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
NS_DEFINE_CID(kInlineFrameCID, NS_INLINE_FRAME_CID);
|
||||
|
||||
|
@ -712,9 +713,10 @@ nsMathMLContainerFrame::WrapForeignFrames(nsIPresContext* aPresContext)
|
|||
&wrapper);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
nsRefPtr<nsStyleContext> newStyleContext;
|
||||
newStyleContext = aPresContext->ResolvePseudoStyleContextFor(mContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mStyleContext);
|
||||
newStyleContext = aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(mContent,
|
||||
nsCSSAnonBoxes::mozAnonymousBlock,
|
||||
mStyleContext);
|
||||
rv = wrapper->Init(aPresContext, mContent, this, newStyleContext, nsnull);
|
||||
if (NS_FAILED(rv)) {
|
||||
wrapper->Destroy(aPresContext);
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "nsIURI.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
static NS_DEFINE_CID(kCSSStyleSheetCID, NS_CSS_STYLESHEET_CID);
|
||||
|
||||
|
||||
|
@ -117,8 +118,9 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsIPresContext* aPresContext,
|
|||
nsCSSAnonBoxes::mozMathStretchy :
|
||||
nsCSSAnonBoxes::mozMathAnonymous; // savings
|
||||
nsRefPtr<nsStyleContext> newStyleContext;
|
||||
newStyleContext = aPresContext->ResolvePseudoStyleContextFor(aContent, pseudoStyle,
|
||||
aParentStyleContext);
|
||||
newStyleContext = aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent, pseudoStyle, aParentStyleContext);
|
||||
|
||||
if (newStyleContext)
|
||||
aMathMLChar->SetStyleContext(newStyleContext);
|
||||
}
|
||||
|
@ -505,7 +507,7 @@ GetMathMLAttributeStyleSheet(nsIPresContext* aPresContext,
|
|||
*aSheet = nsnull;
|
||||
|
||||
// first, look if the attribute stylesheet is already there
|
||||
nsStyleSet *styleSet = aPresContext->PresShell()->StyleSet();
|
||||
nsStyleSet *styleSet = aPresContext->StyleSet();
|
||||
NS_ASSERTION(styleSet, "no style set");
|
||||
|
||||
nsAutoString title;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
|
||||
#include "nsMathMLmactionFrame.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
//
|
||||
// <maction> -- bind actions to a subexpression - implementation
|
||||
|
@ -142,8 +143,9 @@ nsMathMLmactionFrame::Init(nsIPresContext* aPresContext,
|
|||
|
||||
// then, re-resolve our style
|
||||
nsStyleContext* parentStyleContext = aParent->GetStyleContext();
|
||||
newStyleContext = aPresContext->ResolveStyleContextFor(aContent,
|
||||
parentStyleContext);
|
||||
newStyleContext = aPresContext->StyleSet()->
|
||||
ResolveStyleFor(aContent, parentStyleContext);
|
||||
|
||||
if (!newStyleContext)
|
||||
mRestyle.Truncate();
|
||||
else {
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
#include "nsIDocument.h"
|
||||
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
||||
#define DEBUG_ComputedDOMStyle
|
||||
|
@ -2912,10 +2913,12 @@ nsComputedDOMStyle::GetStyleData(nsStyleStructID aID,
|
|||
presShell->GetPresContext(getter_AddRefs(pctx));
|
||||
if (pctx) {
|
||||
nsStyleContext* sctx;
|
||||
nsStyleSet *styleSet = presShell->StyleSet();
|
||||
if (!mPseudo) {
|
||||
sctx = pctx->ResolveStyleContextFor(mContent, nsnull).get();
|
||||
sctx = styleSet->ResolveStyleFor(mContent, nsnull).get();
|
||||
} else {
|
||||
sctx = pctx->ResolvePseudoStyleContextFor(mContent, mPseudo, nsnull).get();
|
||||
sctx = styleSet->ResolvePseudoStyleFor(mContent, mPseudo,
|
||||
nsnull).get();
|
||||
}
|
||||
if (sctx) {
|
||||
aStyleStruct = sctx->GetStyleData(aID);
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "nsIPresShell.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
nsInspectorCSSUtils::nsInspectorCSSUtils()
|
||||
{
|
||||
|
@ -159,10 +160,12 @@ nsInspectorCSSUtils::GetStyleContextForContent(nsIContent* aContent,
|
|||
if (!presContext)
|
||||
return nsnull;
|
||||
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return presContext->ResolveStyleContextFor(aContent, parentContext);
|
||||
nsStyleSet *styleSet = aPresShell->StyleSet();
|
||||
|
||||
return presContext->ResolveStyleContextForNonElement(parentContext);
|
||||
if (aContent->IsContentOfType(nsIContent::eELEMENT))
|
||||
return styleSet->ResolveStyleFor(aContent, parentContext);
|
||||
|
||||
return styleSet->ResolveStyleForNonElement(parentContext);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -317,11 +317,10 @@ nsStyleSet::EnableQuirkStyleSheet(PRBool aEnable)
|
|||
|
||||
struct RulesMatchingData : public ElementRuleProcessorData {
|
||||
RulesMatchingData(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aContent,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: ElementRuleProcessorData(aPresContext, aContent, aRuleWalker),
|
||||
mMedium(aMedium)
|
||||
mMedium(aPresContext->Medium())
|
||||
{
|
||||
}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -504,27 +503,24 @@ PRBool nsStyleSet::BuildDefaultStyleData(nsIPresContext* aPresContext)
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsStyleSet::ResolveStyleFor(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext* presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aContent, "must have content");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(aContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content must be element");
|
||||
|
||||
if (aContent && aPresContext) {
|
||||
if (aContent && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
RulesMatchingData data(aPresContext, medium, aContent, mRuleWalker);
|
||||
RulesMatchingData data(presContext, aContent, mRuleWalker);
|
||||
FileRules(EnumRulesMatching, &data);
|
||||
result = GetContext(aPresContext, aParentContext, nsnull).get();
|
||||
result = GetContext(presContext, aParentContext, nsnull).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -535,19 +531,17 @@ nsStyleSet::ResolveStyleFor(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext)
|
||||
nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
|
||||
if (aPresContext) {
|
||||
if (presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
result = GetContext(aPresContext, aParentContext,
|
||||
result = GetContext(presContext, aParentContext,
|
||||
nsCSSAnonBoxes::mozNonElement).get();
|
||||
NS_ASSERTION(mRuleWalker->AtRoot(), "rule walker must be at root");
|
||||
}
|
||||
|
@ -559,14 +553,13 @@ nsStyleSet::ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
|||
|
||||
struct PseudoRulesMatchingData : public PseudoRuleProcessorData {
|
||||
PseudoRulesMatchingData(nsIPresContext* aPresContext,
|
||||
nsIAtom* aMedium,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsICSSPseudoComparator* aComparator,
|
||||
nsRuleWalker* aRuleWalker)
|
||||
: PseudoRuleProcessorData(aPresContext, aParentContent, aPseudoTag,
|
||||
aComparator, aRuleWalker),
|
||||
mMedium(aMedium)
|
||||
mMedium(aPresContext->Medium())
|
||||
{
|
||||
}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -582,32 +575,29 @@ EnumPseudoRulesMatching(nsIStyleRuleProcessor* aProcessor, void* aData)
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsStyleSet::ResolvePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(!aParentContent ||
|
||||
aParentContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content (if non-null) must be element");
|
||||
|
||||
if (aPseudoTag && aPresContext) {
|
||||
if (aPseudoTag && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
|
||||
aPseudoTag, aComparator, mRuleWalker);
|
||||
PseudoRulesMatchingData data(presContext, aParentContent, aPseudoTag,
|
||||
aComparator, mRuleWalker);
|
||||
FileRules(EnumPseudoRulesMatching, &data);
|
||||
|
||||
result = GetContext(aPresContext, aParentContext, aPseudoTag).get();
|
||||
result = GetContext(presContext, aParentContext, aPseudoTag).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -618,32 +608,29 @@ nsStyleSet::ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
nsStyleSet::ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
nsStyleContext* result = nsnull;
|
||||
nsIPresContext *presContext = PresContext();
|
||||
|
||||
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
|
||||
NS_ASSERTION(aPresContext, "must have pres context");
|
||||
NS_ASSERTION(!aParentContent ||
|
||||
aParentContent->IsContentOfType(nsIContent::eELEMENT),
|
||||
"content (if non-null) must be element");
|
||||
|
||||
if (aPseudoTag && aPresContext) {
|
||||
if (aPseudoTag && presContext) {
|
||||
if (mRuleProcessors[eAgentSheet].Count() ||
|
||||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count()) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
PseudoRulesMatchingData data(aPresContext, medium, aParentContent,
|
||||
aPseudoTag, nsnull, mRuleWalker);
|
||||
PseudoRulesMatchingData data(presContext, aParentContent, aPseudoTag,
|
||||
nsnull, mRuleWalker);
|
||||
FileRules(EnumPseudoRulesMatching, &data);
|
||||
|
||||
if (!mRuleWalker->AtRoot())
|
||||
result = GetContext(aPresContext, aParentContext, aPseudoTag).get();
|
||||
result = GetContext(presContext, aParentContext, aPseudoTag).get();
|
||||
|
||||
// Now reset the walker back to the root of the tree.
|
||||
mRuleWalker->Reset();
|
||||
|
@ -762,10 +749,10 @@ nsStyleSet::ReParentStyleContext(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
struct StatefulData : public StateRuleProcessorData {
|
||||
StatefulData(nsIPresContext* aPresContext, nsIAtom* aMedium,
|
||||
StatefulData(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, PRInt32 aStateMask)
|
||||
: StateRuleProcessorData(aPresContext, aContent, aStateMask),
|
||||
mMedium(aMedium),
|
||||
mMedium(aPresContext->Medium()),
|
||||
mHint(nsReStyleHint(0))
|
||||
{}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -795,9 +782,7 @@ nsStyleSet::HasStateDependentStyle(nsIPresContext* aPresContext,
|
|||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count())) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
StatefulData data(aPresContext, medium, aContent, aStateMask);
|
||||
StatefulData data(aPresContext, aContent, aStateMask);
|
||||
WalkRuleProcessors(SheetHasStatefulStyle, &data);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
@ -806,10 +791,10 @@ nsStyleSet::HasStateDependentStyle(nsIPresContext* aPresContext,
|
|||
}
|
||||
|
||||
struct AttributeData : public AttributeRuleProcessorData {
|
||||
AttributeData(nsIPresContext* aPresContext, nsIAtom* aMedium,
|
||||
nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType)
|
||||
AttributeData(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent, nsIAtom* aAttribute, PRInt32 aModType)
|
||||
: AttributeRuleProcessorData(aPresContext, aContent, aAttribute, aModType),
|
||||
mMedium(aMedium),
|
||||
mMedium(aPresContext->Medium()),
|
||||
mHint(nsReStyleHint(0))
|
||||
{}
|
||||
nsIAtom* mMedium;
|
||||
|
@ -840,9 +825,7 @@ nsStyleSet::HasAttributeDependentStyle(nsIPresContext* aPresContext,
|
|||
mRuleProcessors[eUserSheet].Count() ||
|
||||
mRuleProcessors[eDocSheet].Count() ||
|
||||
mRuleProcessors[eOverrideSheet].Count())) {
|
||||
nsCOMPtr<nsIAtom> medium;
|
||||
aPresContext->GetMedium(getter_AddRefs(medium));
|
||||
AttributeData data(aPresContext, medium, aContent, aAttribute, aModType);
|
||||
AttributeData data(aPresContext, aContent, aAttribute, aModType);
|
||||
WalkRuleProcessors(SheetHasAttributeStyle, &data);
|
||||
result = data.mHint;
|
||||
}
|
||||
|
|
|
@ -75,9 +75,7 @@ class nsStyleSet
|
|||
|
||||
// get a style context for a non-pseudo frame.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aContent,
|
||||
nsStyleContext* aParentContext);
|
||||
ResolveStyleFor(nsIContent* aContent, nsStyleContext* aParentContext);
|
||||
|
||||
// Get a style context for a non-element (which no rules will match).
|
||||
// Eventually, this should go away and we shouldn't even create style
|
||||
|
@ -90,26 +88,23 @@ class nsStyleSet
|
|||
// represents everything except the first letter.)
|
||||
//
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForNonElement(nsIPresContext* aPresContext,
|
||||
nsStyleContext* aParentContext);
|
||||
ResolveStyleForNonElement(nsStyleContext* aParentContext);
|
||||
|
||||
// get a style context for a pseudo-element (i.e.,
|
||||
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|;
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator = nsnull);
|
||||
ResolvePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
nsICSSPseudoComparator* aComparator = nsnull);
|
||||
|
||||
// This funtions just like ResolvePseudoStyleFor except that it will
|
||||
// return nsnull if there are no explicit style rules for that
|
||||
// pseudo element.
|
||||
already_AddRefed<nsStyleContext>
|
||||
ProbePseudoStyleFor(nsIPresContext* aPresContext,
|
||||
nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
ProbePseudoStyleFor(nsIContent* aParentContent,
|
||||
nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
// Begin ignoring style context destruction, to avoid lots of unnecessary
|
||||
// work on document teardown.
|
||||
|
@ -213,6 +208,8 @@ class nsStyleSet
|
|||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag);
|
||||
|
||||
nsIPresContext* PresContext() { return mRuleTree->GetPresContext(); }
|
||||
|
||||
static nsIURI *gQuirkURI;
|
||||
|
||||
nsCOMArray<nsIStyleSheet> mSheets[eSheetTypeCount];
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
#include "nsLayoutErrors.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
|
||||
/********************************************************************************
|
||||
|
@ -814,15 +815,15 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsIPresContext& aPresContext,
|
|||
nsTableColGroupType aColGroupType)
|
||||
{
|
||||
nsIContent* colGroupContent = GetContent();
|
||||
nsIPresShell *shell = aPresContext.PresShell();
|
||||
|
||||
nsRefPtr<nsStyleContext> colGroupStyle;
|
||||
colGroupStyle = aPresContext.ResolvePseudoStyleContextFor(colGroupContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
mStyleContext);
|
||||
colGroupStyle = shell->StyleSet()->ResolvePseudoStyleFor(colGroupContent,
|
||||
nsCSSAnonBoxes::tableColGroup,
|
||||
mStyleContext);
|
||||
// Create a col group frame
|
||||
nsIFrame* newFrame;
|
||||
nsresult result = NS_NewTableColGroupFrame(aPresContext.PresShell(),
|
||||
&newFrame);
|
||||
nsresult result = NS_NewTableColGroupFrame(shell, &newFrame);
|
||||
if (NS_SUCCEEDED(result) && newFrame) {
|
||||
((nsTableColGroupFrame *)newFrame)->SetColType(aColGroupType);
|
||||
newFrame->Init(&aPresContext, colGroupContent, this, colGroupStyle, nsnull);
|
||||
|
@ -898,6 +899,7 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|||
{
|
||||
*aFirstNewFrame = nsnull;
|
||||
nsIFrame* lastColFrame = nsnull;
|
||||
nsIPresShell *shell = aPresContext.PresShell();
|
||||
|
||||
// Get the last col frame
|
||||
nsIFrame* childFrame = aColGroupFrame.GetFirstChild(nsnull);
|
||||
|
@ -926,16 +928,16 @@ nsTableFrame::CreateAnonymousColFrames(nsIPresContext& aPresContext,
|
|||
// all other anonymous cols use a pseudo style context of the col group
|
||||
iContent = aColGroupFrame.GetContent();
|
||||
parentStyleContext = aColGroupFrame.GetStyleContext();
|
||||
styleContext = aPresContext.ResolvePseudoStyleContextFor(iContent,
|
||||
nsCSSAnonBoxes::tableCol,
|
||||
parentStyleContext);
|
||||
styleContext = shell->StyleSet()->ResolvePseudoStyleFor(iContent,
|
||||
nsCSSAnonBoxes::tableCol,
|
||||
parentStyleContext);
|
||||
}
|
||||
// ASSERTION to check for bug 54454 sneaking back in...
|
||||
NS_ASSERTION(iContent, "null content in CreateAnonymousColFrames");
|
||||
|
||||
// create the new col frame
|
||||
nsIFrame* colFrame;
|
||||
NS_NewTableColFrame(aPresContext.PresShell(), &colFrame);
|
||||
NS_NewTableColFrame(shell, &colFrame);
|
||||
((nsTableColFrame *) colFrame)->SetColType(aColType);
|
||||
colFrame->Init(&aPresContext, iContent, &aColGroupFrame,
|
||||
styleContext, nsnull);
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
#include "nsIFontMetrics.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
/////////////// nsListScrollSmoother //////////////////
|
||||
|
||||
|
@ -710,8 +711,9 @@ nsListBoxBodyFrame::ComputeIntrinsicWidth(nsBoxLayoutState& aBoxLayoutState)
|
|||
|
||||
if (firstRowContent) {
|
||||
nsRefPtr<nsStyleContext> styleContext;
|
||||
styleContext = aBoxLayoutState.GetPresContext()->ResolveStyleContextFor(firstRowContent,
|
||||
nsnull);
|
||||
nsIPresContext *presContext = aBoxLayoutState.GetPresContext();
|
||||
styleContext = presContext->StyleSet()->
|
||||
ResolveStyleFor(firstRowContent, nsnull);
|
||||
|
||||
nscoord width = 0;
|
||||
nsMargin margin(0,0,0,0);
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsContentCID.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
const PRInt32 kMaxZ = 0x7fffffff; //XXX: Shouldn't there be a define somewhere for MaxInt for PRInt32
|
||||
// was used in nsSplitterFrame::Init but now commented out
|
||||
|
@ -353,7 +354,8 @@ nsSplitterFrame::Init(nsIPresContext* aPresContext,
|
|||
aContent->SetAttr(kNameSpaceID_None, nsXULAtoms::orient,
|
||||
NS_LITERAL_STRING("vertical"), PR_FALSE);
|
||||
nsStyleContext* parent = aContext->GetParent();
|
||||
newContext = aPresContext->ResolveStyleContextFor(aContent, parent);
|
||||
newContext = aPresContext->StyleSet()->
|
||||
ResolveStyleFor(aContent, parent);
|
||||
aContext = newContext;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ REQUIRES = xpcom \
|
|||
imglib2 \
|
||||
xpconnect \
|
||||
js \
|
||||
webshell \
|
||||
$(NULL)
|
||||
|
||||
CPPSRCS = \
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
#include "imgIContainer.h"
|
||||
#include "imgIContainerObserver.h"
|
||||
#include "imgILoader.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
#ifdef IBMBIDI
|
||||
#include "nsBidiPresUtils.h"
|
||||
|
@ -176,10 +177,9 @@ nsTreeStyleCache::GetStyleContext(nsICSSPseudoComparator* aComparator,
|
|||
result = NS_STATIC_CAST(nsStyleContext*, mCache->Get(currState));
|
||||
if (!result) {
|
||||
// We missed the cache. Resolve this pseudo-style.
|
||||
result = aPresContext->ResolvePseudoStyleWithComparator(aContent,
|
||||
aPseudoElement,
|
||||
aContext,
|
||||
aComparator).get();
|
||||
result = aPresContext->StyleSet()->
|
||||
ResolvePseudoStyleFor(aContent, aPseudoElement,
|
||||
aContext, aComparator).get();
|
||||
|
||||
// Put the style context in our table, transferring the owning reference to the table.
|
||||
if (!mCache) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче