Backing out bug 525608 and bug 525952

This commit is contained in:
Boris Zbarsky 2009-12-10 18:28:08 -08:00
Родитель 7fb24e97d7
Коммит 8202b90f61
48 изменённых файлов: 1030 добавлений и 1650 удалений

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

@ -5140,8 +5140,6 @@ nsGenericElement::GetLinkTarget(nsAString& aTarget)
}
// NOTE: The aPresContext pointer is NOT addrefed.
// *aSelectorList might be null even if NS_OK is returned; this
// happens when all the selectors were pseudo-element selectors.
static nsresult
ParseSelectorList(nsINode* aNode,
const nsAString& aSelectorString,
@ -5157,28 +5155,13 @@ ParseSelectorList(nsINode* aNode,
nsresult rv = doc->CSSLoader()->GetParserFor(nsnull, getter_AddRefs(parser));
NS_ENSURE_SUCCESS(rv, rv);
nsCSSSelectorList* selectorList;
rv = parser->ParseSelectorString(aSelectorString,
doc->GetDocumentURI(),
0, // XXXbz get the right line number!
&selectorList);
aSelectorList);
doc->CSSLoader()->RecycleParser(parser);
NS_ENSURE_SUCCESS(rv, rv);
// Filter out pseudo-element selectors from selectorList
nsCSSSelectorList** slot = &selectorList;
do {
nsCSSSelectorList* cur = *slot;
if (cur->mSelectors->IsPseudoElement()) {
*slot = cur->mNext;
cur->mNext = nsnull;
delete cur;
} else {
slot = &cur->mNext;
}
} while (*slot);
*aSelectorList = selectorList;
// It's not strictly necessary to have a prescontext here, but it's
// a bit of an optimization for various stuff.
*aPresContext = nsnull;

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

@ -1945,19 +1945,15 @@ nsCanvasRenderingContext2D::SetFont(const nsAString& font)
return rv;
nsCOMArray<nsIStyleRule> parentRules;
parentRules.AppendObject(parentRule);
parentContext =
styleSet->ResolveStyleForRules(nsnull, nsnull,
nsCSSPseudoElements::ePseudo_NotPseudoElement,
nsnull, parentRules);
parentContext = styleSet->ResolveStyleForRules(nsnull, nsnull,
nsnull, parentRules);
}
if (!parentContext)
return NS_ERROR_FAILURE;
nsRefPtr<nsStyleContext> sc =
styleSet->ResolveStyleForRules(parentContext, nsnull,
nsCSSPseudoElements::ePseudo_NotPseudoElement,
nsnull, rules);
styleSet->ResolveStyleForRules(parentContext, nsnull, nsnull, rules);
if (!sc)
return NS_ERROR_FAILURE;
const nsStyleFont* fontStyle = sc->GetStyleFont();

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

@ -1272,7 +1272,8 @@ nsBindingManager::WalkRules(nsIStyleRuleProcessor::EnumFunc aFunc,
{
*aCutOffInheritance = PR_FALSE;
NS_ASSERTION(aData->mContent, "How did that happen?");
if (!aData->mContent)
return NS_OK;
// Walk the binding scope chain, starting with the binding attached to our
// content, up till we run out of scopes or we get cut off.

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

@ -137,4 +137,3 @@ PEMQNoMinMaxWithoutValue=Media features with min- or max- must have a value.
PEMQExpectedFeatureValue=Found invalid value for media feature.
PEBadFontBlockStart=Expected '{' to begin @font-face rule but found '%1$S'.
PEBadFontBlockEnd=Expected '}' to end @font-face rule but found '%1$S'.
PEAnonBoxNotAlone=Did not expect anonymous box.

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

@ -87,6 +87,7 @@
#include "nsStyleChangeList.h"
#include "nsIFormControl.h"
#include "nsCSSAnonBoxes.h"
#include "nsCSSPseudoElements.h"
#include "nsIDeviceContext.h"
#include "nsTextFragment.h"
#include "nsIAnonymousContentCreator.h"
@ -1824,7 +1825,7 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
nsIFrame* aParentFrame,
nsIContent* aParentContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
nsIAtom* aPseudoElement,
FrameConstructionItemList& aItems)
{
// XXXbz is this ever true?
@ -1835,15 +1836,15 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
// Probe for the existence of the pseudo-element
nsRefPtr<nsStyleContext> pseudoStyleContext;
pseudoStyleContext = styleSet->ProbePseudoElementStyle(aParentContent,
aPseudoElement,
aStyleContext);
pseudoStyleContext = styleSet->ProbePseudoStyleFor(aParentContent,
aPseudoElement,
aStyleContext);
if (!pseudoStyleContext)
return;
// |ProbePseudoStyleFor| checked the 'display' property and the
// |ContentCount()| of the 'content' property for us.
nsCOMPtr<nsINodeInfo> nodeInfo;
nsIAtom* elemName = aPseudoElement == nsCSSPseudoElements::ePseudo_before ?
nsIAtom* elemName = aPseudoElement == nsCSSPseudoElements::before ?
nsGkAtoms::mozgeneratedcontentbefore : nsGkAtoms::mozgeneratedcontentafter;
nodeInfo = mDocument->NodeInfoManager()->GetNodeInfo(elemName, nsnull,
kNameSpaceID_None);
@ -2030,7 +2031,7 @@ nsCSSFrameConstructor::ConstructTable(nsFrameConstructorState& aState,
// create the pseudo SC for the outer table as a child of the inner SC
nsRefPtr<nsStyleContext> outerStyleContext;
outerStyleContext = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::tableOuter, styleContext);
ResolvePseudoStyleFor(content, nsCSSAnonBoxes::tableOuter, styleContext);
// Create the outer table frame which holds the caption and inner table frame
nsIFrame* newFrame;
@ -2234,7 +2235,7 @@ nsCSSFrameConstructor::ConstructTableCell(nsFrameConstructorState& aState,
// Resolve pseudo style and initialize the body cell frame
nsRefPtr<nsStyleContext> innerPseudoStyle;
innerPseudoStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::cellContent, styleContext);
ResolvePseudoStyleFor(content, nsCSSAnonBoxes::cellContent, styleContext);
// Create a block frame that will format the cell's content
PRBool isBlock;
@ -2669,8 +2670,9 @@ nsCSSFrameConstructor::ConstructRootFrame(nsIFrame** aNewFrame)
nsIFrame* viewportFrame = nsnull;
nsRefPtr<nsStyleContext> viewportPseudoStyle;
viewportPseudoStyle =
styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::viewport, nsnull);
viewportPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::viewport,
nsnull);
viewportFrame = NS_NewViewportFrame(mPresShell, viewportPseudoStyle);
@ -2862,8 +2864,9 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
nsStyleSet* styleSet = mPresShell->StyleSet();
// If paginated, make sure we don't put scrollbars in
if (!isScrollable) {
rootPseudoStyle = styleSet->ResolveAnonymousBoxStyle(rootPseudo,
viewportPseudoStyle);
rootPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
rootPseudo,
viewportPseudoStyle);
} else {
if (rootPseudo == nsCSSAnonBoxes::canvas) {
rootPseudo = nsCSSAnonBoxes::scrolledCanvas;
@ -2880,8 +2883,9 @@ nsCSSFrameConstructor::SetUpDocElementContainingBlock(nsIContent* aDocElement)
// resolve a context for the scrollframe
nsRefPtr<nsStyleContext> styleContext;
styleContext = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::viewportScroll,
viewportPseudoStyle);
styleContext = styleSet->ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::viewportScroll,
viewportPseudoStyle);
// Note that the viewport scrollframe is always built with
// overflow:auto style. This forces the scroll frame to create
@ -2954,8 +2958,9 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
nsStyleSet *styleSet = aPresShell->StyleSet();
nsRefPtr<nsStyleContext> pagePseudoStyle;
pagePseudoStyle = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::page,
parentStyleContext);
pagePseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::page,
parentStyleContext);
aPageFrame = NS_NewPageFrame(aPresShell, pagePseudoStyle);
if (NS_UNLIKELY(!aPageFrame))
@ -2966,9 +2971,9 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
aPageFrame->Init(nsnull, aParentFrame, aPrevPageFrame);
nsRefPtr<nsStyleContext> pageContentPseudoStyle;
pageContentPseudoStyle =
styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::pageContent,
pagePseudoStyle);
pageContentPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::pageContent,
pagePseudoStyle);
nsIFrame* pageContentFrame = NS_NewPageContentFrame(aPresShell, pageContentPseudoStyle);
if (NS_UNLIKELY(!pageContentFrame))
@ -2986,8 +2991,9 @@ nsCSSFrameConstructor::ConstructPageFrame(nsIPresShell* aPresShell,
mFixedContainingBlock = pageContentFrame;
nsRefPtr<nsStyleContext> canvasPseudoStyle;
canvasPseudoStyle = styleSet->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::canvas,
pageContentPseudoStyle);
canvasPseudoStyle = styleSet->ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::canvas,
pageContentPseudoStyle);
aCanvasFrame = NS_NewCanvasFrame(aPresShell, canvasPseudoStyle);
if (NS_UNLIKELY(!aCanvasFrame))
@ -3078,8 +3084,9 @@ nsCSSFrameConstructor::ConstructButtonFrame(nsFrameConstructorState& aState,
nsRefPtr<nsStyleContext> innerBlockContext;
innerBlockContext =
mPresShell->StyleSet()->ResolveAnonymousBoxStyle(nsCSSAnonBoxes::buttonContent,
styleContext);
mPresShell->StyleSet()->ResolvePseudoStyleFor(content,
nsCSSAnonBoxes::buttonContent,
styleContext);
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, innerBlockContext,
NS_BLOCK_FLOAT_MGR);
@ -3217,8 +3224,9 @@ nsCSSFrameConstructor::ConstructSelectFrame(nsFrameConstructorState& aState,
// Resolve pseudo element style for the dropdown list
nsRefPtr<nsStyleContext> listStyle;
listStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::dropDownList, styleContext);
listStyle = mPresShell->StyleSet()->ResolvePseudoStyleFor(content,
nsCSSAnonBoxes::dropDownList,
styleContext);
// Create a listbox
nsIFrame* listFrame = NS_NewListControlFrame(mPresShell, listStyle);
@ -3414,8 +3422,10 @@ nsCSSFrameConstructor::ConstructFieldSetFrame(nsFrameConstructorState& aState,
// Resolve style and initialize the frame
nsRefPtr<nsStyleContext> fieldsetContentStyle;
fieldsetContentStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::fieldsetContent, styleContext);
fieldsetContentStyle =
mPresShell->StyleSet()->ResolvePseudoStyleFor(content,
nsCSSAnonBoxes::fieldsetContent,
styleContext);
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, fieldsetContentStyle,
NS_BLOCK_FLOAT_MGR |
@ -4381,8 +4391,9 @@ nsCSSFrameConstructor::BeginBuildingScrollFrame(nsFrameConstructorState& aState,
// we used the style that was passed in. So resolve another one.
nsStyleSet *styleSet = mPresShell->StyleSet();
nsStyleContext* aScrolledChildStyle =
styleSet->ResolveAnonymousBoxStyle(aScrolledPseudo, contentStyle).get();
nsStyleContext* aScrolledChildStyle = styleSet->ResolvePseudoStyleFor(aContent,
aScrolledPseudo,
contentStyle).get();
if (gfxScrollFrame) {
gfxScrollFrame->SetInitialChildList(nsnull, anonymousItems);
@ -4741,9 +4752,9 @@ nsCSSFrameConstructor::FlushAccumulatedBlock(nsFrameConstructorState& aState,
nsCSSAnonBoxes::mozMathMLAnonymousBlock)->GetStyleContext();
nsStyleSet *styleSet = mPresShell->StyleSet();
nsRefPtr<nsStyleContext> blockContext;
blockContext = styleSet->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozMathMLAnonymousBlock,
parentContext);
blockContext = styleSet->ResolvePseudoStyleFor(aContent,
nsCSSAnonBoxes::mozMathMLAnonymousBlock,
parentContext);
// then, create a block frame that will wrap the child frames. Make it a
// MathML frame so that Get(Absolute/Float)ContainingBlockFor know that this
@ -5056,7 +5067,8 @@ nsCSSFrameConstructor::ConstructSVGForeignObjectFrame(nsFrameConstructorState& a
nsRefPtr<nsStyleContext> innerPseudoStyle;
innerPseudoStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozSVGForeignContent, styleContext);
ResolvePseudoStyleFor(content,
nsCSSAnonBoxes::mozSVGForeignContent, styleContext);
nsIFrame* blockFrame = NS_NewBlockFrame(mPresShell, innerPseudoStyle,
NS_BLOCK_FLOAT_MGR |
@ -5099,8 +5111,8 @@ nsCSSFrameConstructor::AddPageBreakItem(nsIContent* aContent,
// for user-modify.)
pseudoStyle =
mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::pageBreak,
aMainStyleContext->GetParent());
ResolvePseudoStyleFor(nsnull, nsCSSAnonBoxes::pageBreak,
aMainStyleContext->GetParent());
NS_ASSERTION(pseudoStyle->GetStyleDisplay()->mDisplay ==
NS_STYLE_DISPLAY_BLOCK, "Unexpected display");
@ -5700,7 +5712,7 @@ AdjustAppendParentForAfterContent(nsPresContext* aPresContext,
// of style first, since nsLayoutUtils::GetAfterFrame is sorta expensive.
nsStyleContext* parentStyle = aParentFrame->GetStyleContext();
if (nsLayoutUtils::HasPseudoStyle(aContainer, parentStyle,
nsCSSPseudoElements::ePseudo_after,
nsCSSPseudoElements::after,
aPresContext)) {
nsIFrame* afterFrame = nsLayoutUtils::GetAfterFrame(aParentFrame);
if (afterFrame) {
@ -9235,9 +9247,8 @@ nsCSSFrameConstructor::GetFirstLetterStyle(nsIContent* aContent,
{
if (aContent) {
return mPresShell->StyleSet()->
ResolvePseudoElementStyle(aContent,
nsCSSPseudoElements::ePseudo_firstLetter,
aStyleContext);
ResolvePseudoStyleFor(aContent,
nsCSSPseudoElements::firstLetter, aStyleContext);
}
return nsnull;
}
@ -9248,9 +9259,8 @@ nsCSSFrameConstructor::GetFirstLineStyle(nsIContent* aContent,
{
if (aContent) {
return mPresShell->StyleSet()->
ResolvePseudoElementStyle(aContent,
nsCSSPseudoElements::ePseudo_firstLine,
aStyleContext);
ResolvePseudoStyleFor(aContent,
nsCSSPseudoElements::firstLine, aStyleContext);
}
return nsnull;
}
@ -9262,7 +9272,7 @@ nsCSSFrameConstructor::ShouldHaveFirstLetterStyle(nsIContent* aContent,
nsStyleContext* aStyleContext)
{
return nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
nsCSSPseudoElements::ePseudo_firstLetter,
nsCSSPseudoElements::firstLetter,
mPresShell->GetPresContext());
}
@ -9282,7 +9292,7 @@ nsCSSFrameConstructor::ShouldHaveFirstLineStyle(nsIContent* aContent,
{
PRBool hasFirstLine =
nsLayoutUtils::HasPseudoStyle(aContent, aStyleContext,
nsCSSPseudoElements::ePseudo_firstLine,
nsCSSPseudoElements::firstLine,
mPresShell->GetPresContext());
if (hasFirstLine) {
// But disable for fieldsets
@ -9508,7 +9518,9 @@ nsCSSFrameConstructor::CreateNeededTablePseudos(FrameConstructionItemList& aItem
}
nsRefPtr<nsStyleContext> wrapperStyle =
mPresShell->StyleSet()->ResolveAnonymousBoxStyle(pseudoType, parentStyle);
mPresShell->StyleSet()->ResolvePseudoStyleFor(parentContent,
pseudoType,
parentStyle);
FrameConstructionItem* newItem =
new FrameConstructionItem(&pseudoData.mFCData,
// Use the content of our parent frame
@ -9661,8 +9673,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
styleContext =
nsFrame::CorrectStyleParentFrame(aFrame, nsnull)->GetStyleContext();
// Probe for generated content before
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
nsCSSPseudoElements::ePseudo_before,
CreateGeneratedContentItem(aState, aFrame, aContent,
styleContext, nsCSSPseudoElements::before,
itemsToConstruct);
}
@ -9677,8 +9689,8 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
if (aCanHaveGeneratedContent) {
// Probe for generated content after
CreateGeneratedContentItem(aState, aFrame, aContent, styleContext,
nsCSSPseudoElements::ePseudo_after,
CreateGeneratedContentItem(aState, aFrame, aContent,
styleContext, nsCSSPseudoElements::after,
itemsToConstruct);
}
}
@ -9731,8 +9743,9 @@ nsCSSFrameConstructor::ProcessChildren(nsFrameConstructorState& aState,
"FrameConstructor");
nsRefPtr<nsStyleContext> blockSC = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozXULAnonymousBlock,
frameStyleContext);
ResolvePseudoStyleFor(aContent,
nsCSSAnonBoxes::mozXULAnonymousBlock,
frameStyleContext);
nsIFrame *blockFrame = NS_NewBlockFrame(mPresShell, blockSC);
// We might, in theory, want to set NS_BLOCK_FLOAT_MGR and
// NS_BLOCK_MARGIN_ROOT, but I think it's a bad idea given that
@ -10682,7 +10695,8 @@ nsCSSFrameConstructor::ConstructBlock(nsFrameConstructorState& aState,
// See if we need to create a view
nsHTMLContainerFrame::CreateViewForFrame(columnSetFrame, PR_FALSE);
blockStyle = mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::columnContent, aStyleContext);
ResolvePseudoStyleFor(aContent, nsCSSAnonBoxes::columnContent,
aStyleContext);
parent = columnSetFrame;
*aNewFrame = columnSetFrame;
@ -10886,10 +10900,11 @@ nsCSSFrameConstructor::CreateIBSiblings(nsFrameConstructorState& aState,
// Resolve the right style context for our anonymous blocks.
nsRefPtr<nsStyleContext> blockSC =
mPresShell->StyleSet()->
ResolveAnonymousBoxStyle(aIsPositioned ?
nsCSSAnonBoxes::mozAnonymousPositionedBlock :
nsCSSAnonBoxes::mozAnonymousBlock,
styleContext);
ResolvePseudoStyleFor(content,
aIsPositioned ?
nsCSSAnonBoxes::mozAnonymousPositionedBlock :
nsCSSAnonBoxes::mozAnonymousBlock,
styleContext);
nsIFrame* lastNewInline = aInitialInline->GetFirstContinuation();
do {
@ -10967,8 +10982,8 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
// Probe for generated content before
nsStyleContext* const parentStyleContext = aParentItem.mStyleContext;
nsIContent* const parentContent = aParentItem.mContent;
CreateGeneratedContentItem(aState, nsnull, parentContent, parentStyleContext,
nsCSSPseudoElements::ePseudo_before,
CreateGeneratedContentItem(aState, nsnull, parentContent,
parentStyleContext, nsCSSPseudoElements::before,
aParentItem.mChildItems);
ChildIterator iter, last;
@ -10995,8 +11010,8 @@ nsCSSFrameConstructor::BuildInlineChildItems(nsFrameConstructorState& aState,
}
// Probe for generated content after
CreateGeneratedContentItem(aState, nsnull, parentContent, parentStyleContext,
nsCSSPseudoElements::ePseudo_after,
CreateGeneratedContentItem(aState, nsnull, parentContent,
parentStyleContext, nsCSSPseudoElements::after,
aParentItem.mChildItems);
aParentItem.mIsAllInline = aParentItem.mChildItems.AreAllItemsInline();

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

@ -52,7 +52,6 @@
#include "nsHashKeys.h"
#include "nsThreadUtils.h"
#include "nsPageContentFrame.h"
#include "nsCSSPseudoElements.h"
class nsIDocument;
struct nsFrameItems;
@ -437,11 +436,11 @@ private:
PRUint32 aContentIndex);
// aFrame may be null; this method doesn't use it directly in any case.
void CreateGeneratedContentItem(nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
void CreateGeneratedContentItem(nsFrameConstructorState& aState,
nsIFrame* aFrame,
nsIContent* aContent,
nsStyleContext* aStyleContext,
nsIAtom* aPseudoElement,
FrameConstructionItemList& aItems);
// This method can change aFrameList: it can chop off the beginning and put

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

@ -949,7 +949,6 @@ TryStartingTransition(nsPresContext *aPresContext, nsIContent *aContent,
*aNewStyleContext = aPresContext->StyleSet()->ResolveStyleForRules(
(*aNewStyleContext)->GetParent(),
(*aNewStyleContext)->GetPseudo(),
(*aNewStyleContext)->GetPseudoType(),
(*aNewStyleContext)->GetRuleNode(),
rules);
}
@ -1234,7 +1233,6 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
if (oldContext) {
oldContext->AddRef();
nsIAtom* const pseudoTag = oldContext->GetPseudo();
const nsCSSPseudoElements::Type pseudoType = oldContext->GetPseudoType();
nsIContent* localContent = aFrame->GetContent();
// |content| is the node that we used for rule matching of
// normal elements (not pseudo-elements) and for which we generate
@ -1336,9 +1334,9 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
if (pseudoTag == nsCSSPseudoElements::before ||
pseudoTag == nsCSSPseudoElements::after) {
// XXX what other pseudos do we need to treat like this?
newContext = styleSet->ProbePseudoElementStyle(pseudoContent,
pseudoType,
parentContext);
newContext = styleSet->ProbePseudoStyleFor(pseudoContent,
pseudoTag,
parentContext);
if (!newContext) {
// This pseudo should no longer exist; gotta reframe
NS_UpdateHint(aMinChange, nsChangeHint_ReconstructFrame);
@ -1347,24 +1345,18 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// We're reframing anyway; just keep the same context
newContext = oldContext;
}
} else if (pseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
newContext = styleSet->ResolveAnonymousBoxStyle(pseudoTag,
parentContext);
} else {
// Don't expect XUL tree stuff here, since it needs a comparator and
// all.
NS_ASSERTION(pseudoType <
nsCSSPseudoElements::ePseudo_PseudoElementCount,
"Unexpected pseudo type");
if (pseudoTag == nsCSSPseudoElements::firstLetter) {
NS_ASSERTION(aFrame->GetType() == nsGkAtoms::letterFrame,
"firstLetter pseudoTag without a nsFirstLetterFrame");
nsBlockFrame* block = nsBlockFrame::GetNearestAncestorBlock(aFrame);
pseudoContent = block->GetContent();
} else if (pseudoTag == nsCSSAnonBoxes::pageBreak) {
pseudoContent = nsnull;
}
newContext = styleSet->ResolvePseudoElementStyle(pseudoContent,
pseudoType,
parentContext);
newContext = styleSet->ResolvePseudoStyleFor(pseudoContent,
pseudoTag,
parentContext);
}
}
else {
@ -1414,25 +1406,12 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
if (oldExtraContext) {
nsRefPtr<nsStyleContext> newExtraContext;
nsIAtom* const extraPseudoTag = oldExtraContext->GetPseudo();
const nsCSSPseudoElements::Type extraPseudoType =
oldExtraContext->GetPseudoType();
NS_ASSERTION(extraPseudoTag &&
extraPseudoTag != nsCSSAnonBoxes::mozNonElement,
"extra style context is not pseudo element");
if (extraPseudoType == nsCSSPseudoElements::ePseudo_AnonBox) {
newExtraContext = styleSet->ResolveAnonymousBoxStyle(extraPseudoTag,
newContext);
}
else {
// Don't expect XUL tree stuff here, since it needs a comparator and
// all.
NS_ASSERTION(extraPseudoType <
nsCSSPseudoElements::ePseudo_PseudoElementCount,
"Unexpected type");
newExtraContext = styleSet->ResolvePseudoElementStyle(content,
extraPseudoType,
newContext);
}
newExtraContext = styleSet->ResolvePseudoStyleFor(content,
extraPseudoTag,
newContext);
if (newExtraContext) {
if (oldExtraContext != newExtraContext) {
aMinChange = CaptureChange(oldExtraContext, newExtraContext,
@ -1510,7 +1489,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// :before style context.
if (!nsLayoutUtils::GetBeforeFrame(aFrame) &&
nsLayoutUtils::HasPseudoStyle(localContent, newContext,
nsCSSPseudoElements::ePseudo_before,
nsCSSPseudoElements::before,
aPresContext)) {
// Have to create the new :before frame
NS_UpdateHint(aMinChange, nsChangeHint_ReconstructFrame);
@ -1536,7 +1515,7 @@ nsFrameManager::ReResolveStyleContext(nsPresContext *aPresContext,
// Getting the :after frame is more expensive than getting the pseudo
// context, so get the pseudo context first.
if (nsLayoutUtils::HasPseudoStyle(localContent, newContext,
nsCSSPseudoElements::ePseudo_after,
nsCSSPseudoElements::after,
aPresContext) &&
!nsLayoutUtils::GetAfterFrame(aFrame)) {
// have to create the new :after frame

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

@ -64,7 +64,6 @@ class nsClientRectList;
#include "nsIPrincipal.h"
#include "gfxPattern.h"
#include "imgIContainer.h"
#include "nsCSSPseudoElements.h"
class nsBlockFrame;
class nsTextFragment;
@ -328,21 +327,22 @@ public:
*
* @param aContent the content node we're looking at
* @param aStyleContext aContent's style context
* @param aPseudoElement the id of the pseudo style we care about
* @param aPseudoElement the name of the pseudo style we care about
* @param aPresContext the presentation context
* @return whether aContent has aPseudoElement style attached to it
*/
static PRBool HasPseudoStyle(nsIContent* aContent,
nsStyleContext* aStyleContext,
nsCSSPseudoElements::Type aPseudoElement,
nsIAtom* aPseudoElement,
nsPresContext* aPresContext)
{
NS_PRECONDITION(aPresContext, "Must have a prescontext");
NS_PRECONDITION(aPseudoElement, "Must have a pseudo name");
nsRefPtr<nsStyleContext> pseudoContext;
if (aContent) {
pseudoContext = aPresContext->StyleSet()->
ProbePseudoElementStyle(aContent, aPseudoElement, aStyleContext);
ProbePseudoStyleFor(aContent, aPseudoElement, aStyleContext);
}
return pseudoContext != nsnull;
}

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

@ -385,16 +385,14 @@ nsButtonFrameRenderer::ReResolveStyles(nsPresContext* aPresContext)
nsStyleSet *styleSet = aPresContext->StyleSet();
// style for the inner such as a dotted line (Windows)
mInnerFocusStyle =
styleSet->ProbePseudoElementStyle(mFrame->GetContent(),
nsCSSPseudoElements::ePseudo_mozFocusInner,
context);
mInnerFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusInner,
context);
// style for outer focus like a ridged border (MAC).
mOuterFocusStyle =
styleSet->ProbePseudoElementStyle(mFrame->GetContent(),
nsCSSPseudoElements::ePseudo_mozFocusOuter,
context);
mOuterFocusStyle = styleSet->ProbePseudoStyleFor(mFrame->GetContent(),
nsCSSPseudoElements::mozFocusOuter,
context);
}
nsStyleContext*

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

@ -1162,8 +1162,9 @@ nsComboboxControlFrame::CreateFrameFor(nsIContent* aContent)
// create the style contexts for the anonymous block frame and text frame
nsRefPtr<nsStyleContext> styleContext;
styleContext = styleSet->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
mStyleContext);
ResolvePseudoStyleFor(mContent,
nsCSSAnonBoxes::mozDisplayComboboxControlFrame,
mStyleContext);
if (NS_UNLIKELY(!styleContext)) {
return nsnull;
}

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

@ -6365,25 +6365,24 @@ nsBlockFrame::SetInitialChildList(nsIAtom* aListName,
(nsnull == mBullet)) {
// Resolve style for the bullet frame
const nsStyleList* styleList = GetStyleList();
nsCSSPseudoElements::Type pseudoType;
nsIAtom *pseudoElement;
switch (styleList->mListStyleType) {
case NS_STYLE_LIST_STYLE_DISC:
case NS_STYLE_LIST_STYLE_CIRCLE:
case NS_STYLE_LIST_STYLE_SQUARE:
pseudoType = nsCSSPseudoElements::ePseudo_mozListBullet;
pseudoElement = nsCSSPseudoElements::mozListBullet;
break;
default:
pseudoType = nsCSSPseudoElements::ePseudo_mozListNumber;
pseudoElement = nsCSSPseudoElements::mozListNumber;
break;
}
nsIPresShell *shell = presContext->PresShell();
nsStyleContext* parentStyle =
CorrectStyleParentFrame(this,
nsCSSPseudoElements::GetPseudoAtom(pseudoType))->GetStyleContext();
CorrectStyleParentFrame(this, pseudoElement)->GetStyleContext();
nsRefPtr<nsStyleContext> kidSC = shell->StyleSet()->
ResolvePseudoElementStyle(mContent, pseudoType, parentStyle);
ResolvePseudoStyleFor(mContent, pseudoElement, parentStyle);
// Create bullet frame
nsBulletFrame* bullet = new (shell) nsBulletFrame(kidSC);

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

@ -337,9 +337,8 @@ protected:
already_AddRefed<nsStyleContext> GetFirstLetterStyle(nsPresContext* aPresContext)
{
return aPresContext->StyleSet()->
ProbePseudoElementStyle(mContent,
nsCSSPseudoElements::ePseudo_firstLetter,
mStyleContext);
ProbePseudoStyleFor(mContent,
nsCSSPseudoElements::firstLetter, mStyleContext);
}
#endif

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

@ -68,6 +68,7 @@
#include "nsIServiceManager.h"
#include "nsIDOMMutationEvent.h"
#include "nsINameSpaceManager.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSAnonBoxes.h"
#include "nsAutoPtr.h"
#include "nsStyleSet.h"
@ -429,7 +430,7 @@ nsHTMLFramesetFrame::Init(nsIContent* aContent,
for (int blankX = mChildCount; blankX < numCells; blankX++) {
nsRefPtr<nsStyleContext> pseudoStyleContext;
pseudoStyleContext = shell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::framesetBlank, mStyleContext);
ResolvePseudoStyleFor(nsnull, nsCSSAnonBoxes::framesetBlank, mStyleContext);
if (!pseudoStyleContext) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -1041,9 +1042,9 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
if (firstTime) { // create horizontal border
nsRefPtr<nsStyleContext> pseudoStyleContext;
pseudoStyleContext = styleSet->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::horizontalFramesetBorder,
mStyleContext);
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
nsCSSPseudoElements::horizontalFramesetBorder,
mStyleContext);
borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoStyleContext,
borderWidth,
@ -1077,9 +1078,9 @@ nsHTMLFramesetFrame::Reflow(nsPresContext* aPresContext,
if (firstTime) { // create vertical border
nsRefPtr<nsStyleContext> pseudoStyleContext;
pseudoStyleContext = styleSet->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::verticalFramesetBorder,
mStyleContext);
pseudoStyleContext = styleSet->ResolvePseudoStyleFor(mContent,
nsCSSPseudoElements::verticalFramesetBorder,
mStyleContext);
borderFrame = new (shell) nsHTMLFramesetBorderFrame(pseudoStyleContext,
borderWidth,

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

@ -1057,7 +1057,8 @@ nsFirstLineFrame::Reflow(nsPresContext* aPresContext,
// of the parent frame.
nsRefPtr<nsStyleContext> newSC;
newSC = aPresContext->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::mozLineFrame, parentContext);
ResolvePseudoStyleFor(nsnull,
nsCSSAnonBoxes::mozLineFrame, parentContext);
if (newSC) {
// Switch to the new style context.
SetStyleContext(newSC);

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

@ -3162,9 +3162,8 @@ nsTextPaintStyle::InitSelectionColors()
selectionStatus == nsISelectionController::SELECTION_ON) {
nsRefPtr<nsStyleContext> sc = nsnull;
sc = mPresContext->StyleSet()->
ProbePseudoElementStyle(selectionContent,
nsCSSPseudoElements::ePseudo_mozSelection,
mFrame->GetStyleContext());
ProbePseudoStyleFor(selectionContent, nsCSSPseudoElements::mozSelection,
mFrame->GetStyleContext());
// Use -moz-selection pseudo class.
if (sc) {
const nsStyleBackground* bg = sc->GetStyleBackground();

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

@ -65,6 +65,9 @@ math[mode="display"], math[display="block"] {
math[display="inline"] {
display: inline;
}
::-moz-math-inline {
display: inline;
}
/**************************************************************************/
/* Style switching during frame construction depending on the context of <mi>:
@ -405,11 +408,8 @@ mtd[-moz-math-columnline="dashed"] {
font-family: serif; /* an empty family is ignored as an error and behaves like inherit */
/* background-color: #3C6; */
}
/* Don't actually style -moz-math-anonymous by default */
/*
::-moz-math-anonymous {
}
*/
/**********************************************************************/
/* Hide embedded semantic MathML content (as opposed to presentational

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

@ -39,7 +39,7 @@
#include "nsINameSpaceManager.h"
#include "nsMathMLFrame.h"
#include "nsMathMLChar.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSAnonBoxes.h"
// used to map attributes into CSS rules
#include "nsIDocument.h"
@ -164,12 +164,12 @@ nsMathMLFrame::ResolveMathMLCharStyle(nsPresContext* aPresContext,
nsMathMLChar* aMathMLChar,
PRBool aIsMutableChar)
{
nsCSSPseudoElements::Type pseudoType = (aIsMutableChar) ?
nsCSSPseudoElements::ePseudo_mozMathStretchy :
nsCSSPseudoElements::ePseudo_mozMathAnonymous; // savings
nsIAtom* pseudoStyle = (aIsMutableChar) ?
nsCSSAnonBoxes::mozMathStretchy :
nsCSSAnonBoxes::mozMathAnonymous; // savings
nsRefPtr<nsStyleContext> newStyleContext;
newStyleContext = aPresContext->StyleSet()->
ResolvePseudoElementStyle(aContent, pseudoType, aParentStyleContext);
ResolvePseudoStyleFor(aContent, pseudoStyle, aParentStyleContext);
if (newStyleContext)
aMathMLChar->SetStyleContext(newStyleContext);

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

@ -259,6 +259,10 @@ select:empty {
-moz-box-sizing: border-box ! important;
}
select::-moz-scrolled-content {
display: block !important;
}
option {
display: block;
float: none !important;

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

@ -59,10 +59,6 @@ CSS_ANON_BOX(mozAnonymousPositionedBlock, ":-moz-anonymous-positioned-block")
CSS_ANON_BOX(mozMathMLAnonymousBlock, ":-moz-mathml-anonymous-block")
CSS_ANON_BOX(mozXULAnonymousBlock, ":-moz-xul-anonymous-block")
// Framesets
CSS_ANON_BOX(horizontalFramesetBorder, ":-moz-hframeset-border")
CSS_ANON_BOX(verticalFramesetBorder, ":-moz-vframeset-border")
CSS_ANON_BOX(mozLineFrame, ":-moz-line-frame")
CSS_ANON_BOX(buttonContent, ":-moz-button-content")
@ -109,6 +105,12 @@ CSS_ANON_BOX(moztreeprogressmeter, ":-moz-tree-progressmeter")
CSS_ANON_BOX(moztreedropfeedback, ":-moz-tree-drop-feedback")
#endif
#ifdef MOZ_MATHML
CSS_ANON_BOX(mozMathStretchy, ":-moz-math-stretchy")
CSS_ANON_BOX(mozMathAnonymous, ":-moz-math-anonymous")
CSS_ANON_BOX(mozMathInline, ":-moz-math-inline")
#endif
#ifdef MOZ_SVG
CSS_ANON_BOX(mozSVGForeignContent, ":-moz-svg-foreign-content")
#endif

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

@ -354,8 +354,7 @@ protected:
nsCSSSelector& aSelector,
PRBool aIsNegated,
nsIAtom** aPseudoElement,
nsPseudoClassList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType);
nsPseudoClassList** aPseudoElementArgs);
nsSelectorParsingStatus ParseAttributeSelector(PRInt32& aDataMask,
nsCSSSelector& aSelector);
@ -365,20 +364,17 @@ protected:
PRBool aIsNegated);
nsSelectorParsingStatus ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector,
nsIAtom* aPseudo,
nsCSSPseudoClasses::Type aType);
nsIAtom* aPseudo);
nsSelectorParsingStatus ParsePseudoClassWithNthPairArg(nsCSSSelector& aSelector,
nsIAtom* aPseudo,
nsCSSPseudoClasses::Type aType);
nsIAtom* aPseudo);
nsSelectorParsingStatus ParseNegatedSimpleSelector(PRInt32& aDataMask,
nsCSSSelector& aSelector);
nsSelectorParsingStatus ParseSelector(nsCSSSelector& aSelectorResult,
nsIAtom** aPseudoElement,
nsPseudoClassList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType);
nsPseudoClassList** aPseudoElementArgs);
// If aTerminateAtBrace is true, the selector list is done when we
// hit a '{'. Otherwise, it's done when we hit EOF.
@ -2501,11 +2497,9 @@ CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList)
}
nsCOMPtr<nsIAtom> pseudoElement;
nsAutoPtr<nsPseudoClassList> pseudoElementArgs;
nsCSSPseudoElements::Type pseudoElementType;
nsSelectorParsingStatus parsingStatus =
ParseSelector(*newSelector, getter_AddRefs(pseudoElement),
getter_Transfers(pseudoElementArgs),
&pseudoElementType);
getter_Transfers(pseudoElementArgs));
if (parsingStatus == eSelectorParsingStatus_Empty) {
if (!list) {
REPORT_UNEXPECTED(PESelectorGroupNoSelector);
@ -2516,12 +2510,6 @@ CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList)
list = nsnull;
break;
}
if (pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox &&
(list || !IsUniversalSelector(*newSelector))) {
REPORT_UNEXPECTED(PEAnonBoxNotAlone);
list = nsnull;
break;
}
if (nsnull == list) {
list = new nsCSSSelectorList();
if (nsnull == list) {
@ -2529,16 +2517,16 @@ CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList)
return PR_FALSE;
}
}
list->AddSelector(newSelector);
nsCSSSelector* listSel = list->mSelectors;
// We got a pseudo-element (or anonymous box). We actually
// represent pseudo-elements as a child of the rest of the selector.
if (pseudoElement) {
if (pseudoElementType != nsCSSPseudoElements::ePseudo_AnonBox) {
if (listSel->mNext || !IsUniversalSelector(*listSel)) {
// We need to put the pseudo-element on a new selector that's a
// child of the current one.
// child of the current one. (If it's the only thing in the
// entire selector group, we can just put it on this one.)
listSel->mOperator = PRUnichar('>');
nsAutoPtr<nsCSSSelector> empty(new nsCSSSelector());
if (!empty) {
@ -2556,7 +2544,6 @@ CSSParserImpl::ParseSelectorGroup(nsCSSSelectorList*& aList)
"already initialized");
listSel->mLowercaseTag.swap(pseudoElement);
listSel->mPseudoClassList = pseudoElementArgs.forget();
listSel->SetPseudoType(pseudoElementType);
havePseudoElement = PR_TRUE;
}
@ -3004,8 +2991,7 @@ CSSParserImpl::ParsePseudoSelector(PRInt32& aDataMask,
nsCSSSelector& aSelector,
PRBool aIsNegated,
nsIAtom** aPseudoElement,
nsPseudoClassList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType)
nsPseudoClassList** aPseudoElementArgs)
{
NS_ASSERTION(aIsNegated || (aPseudoElement && aPseudoElementArgs),
"expected location to store pseudo element");
@ -3049,10 +3035,8 @@ CSSParserImpl::ParsePseudoSelector(PRInt32& aDataMask,
// stash away some info about this pseudo so we only have to get it once.
PRBool isTreePseudo = PR_FALSE;
nsCSSPseudoElements::Type pseudoElementType =
nsCSSPseudoElements::GetPseudoType(pseudo);
#ifdef MOZ_XUL
isTreePseudo = (pseudoElementType == nsCSSPseudoElements::ePseudo_XULTree);
isTreePseudo = nsCSSAnonBoxes::IsTreePseudoElement(pseudo);
// If a tree pseudo-element is using the function syntax, it will
// get isTree set here and will pass the check below that only
// allows functions if they are in our list of things allowed to be
@ -3062,23 +3046,12 @@ CSSParserImpl::ParsePseudoSelector(PRInt32& aDataMask,
// desired.
PRBool isTree = (eCSSToken_Function == mToken.mType) && isTreePseudo;
#endif
PRBool isPseudoElement =
(pseudoElementType < nsCSSPseudoElements::ePseudo_PseudoElementCount);
PRBool isPseudoElement = nsCSSPseudoElements::IsPseudoElement(pseudo);
// anonymous boxes are only allowed if they're the tree boxes or we have
// enabled unsafe rules
PRBool isAnonBox = isTreePseudo ||
(pseudoElementType == nsCSSPseudoElements::ePseudo_AnonBox &&
mUnsafeRulesEnabled);
nsCSSPseudoClasses::Type pseudoClassType =
nsCSSPseudoClasses::GetPseudoType(pseudo);
PRBool isPseudoClass =
(pseudoClassType != nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
NS_ASSERTION(!isPseudoClass ||
pseudoElementType == nsCSSPseudoElements::ePseudo_NotPseudoElement,
"Why is this atom both a pseudo-class and a pseudo-element?");
NS_ASSERTION(isPseudoClass + isPseudoElement + isAnonBox <= 1,
"Shouldn't be more than one of these");
PRBool isAnonBox = nsCSSAnonBoxes::IsAnonBox(pseudo) &&
(mUnsafeRulesEnabled || isTreePseudo);
PRBool isPseudoClass = nsCSSPseudoClasses::IsPseudoClass(pseudo);
if (!isPseudoClass && !isPseudoElement && !isAnonBox) {
// Not a pseudo-class, not a pseudo-element.... forget it
@ -3129,20 +3102,20 @@ CSSParserImpl::ParsePseudoSelector(PRInt32& aDataMask,
aDataMask |= SEL_MASK_PCLASS;
if (nsCSSPseudoClasses::HasStringArg(pseudo)) {
nsSelectorParsingStatus parsingStatus =
ParsePseudoClassWithIdentArg(aSelector, pseudo, pseudoClassType);
ParsePseudoClassWithIdentArg(aSelector, pseudo);
if (eSelectorParsingStatus_Continue != parsingStatus) {
return parsingStatus;
}
}
else if (nsCSSPseudoClasses::HasNthPairArg(pseudo)) {
nsSelectorParsingStatus parsingStatus =
ParsePseudoClassWithNthPairArg(aSelector, pseudo, pseudoClassType);
ParsePseudoClassWithNthPairArg(aSelector, pseudo);
if (eSelectorParsingStatus_Continue != parsingStatus) {
return parsingStatus;
}
}
else {
aSelector.AddPseudoClass(pseudo, pseudoClassType);
aSelector.AddPseudoClass(pseudo);
}
}
else if (isPseudoElement || isAnonBox) {
@ -3171,7 +3144,6 @@ CSSParserImpl::ParsePseudoSelector(PRInt32& aDataMask,
if (0 == (aDataMask & SEL_MASK_PELEM)) {
aDataMask |= SEL_MASK_PELEM;
NS_ADDREF(*aPseudoElement = pseudo);
*aPseudoElementType = pseudoElementType;
#ifdef MOZ_XUL
if (isTree) {
@ -3263,7 +3235,7 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask,
}
else if (mToken.IsSymbol(':')) { // :pseudo
parsingStatus = ParsePseudoSelector(aDataMask, *newSel, PR_TRUE,
nsnull, nsnull, nsnull);
nsnull, nsnull);
}
else if (mToken.IsSymbol('[')) { // [attribute
parsingStatus = ParseAttributeSelector(aDataMask, *newSel);
@ -3295,8 +3267,7 @@ CSSParserImpl::ParseNegatedSimpleSelector(PRInt32& aDataMask,
//
CSSParserImpl::nsSelectorParsingStatus
CSSParserImpl::ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector,
nsIAtom* aPseudo,
nsCSSPseudoClasses::Type aType)
nsIAtom* aPseudo)
{
// Check if we have the first parenthesis
if (!ExpectSymbol('(', PR_FALSE)) {
@ -3325,7 +3296,7 @@ CSSParserImpl::ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector,
}
// Add the pseudo with the language parameter
aSelector.AddPseudoClass(aPseudo, aType, mToken.mIdent.get());
aSelector.AddPseudoClass(aPseudo, mToken.mIdent.get());
// close the parenthesis
if (!ExpectSymbol(')', PR_TRUE)) {
@ -3339,8 +3310,7 @@ CSSParserImpl::ParsePseudoClassWithIdentArg(nsCSSSelector& aSelector,
CSSParserImpl::nsSelectorParsingStatus
CSSParserImpl::ParsePseudoClassWithNthPairArg(nsCSSSelector& aSelector,
nsIAtom* aPseudo,
nsCSSPseudoClasses::Type aType)
nsIAtom* aPseudo)
{
PRInt32 numbers[2] = { 0, 0 };
PRBool lookForB = PR_TRUE;
@ -3463,7 +3433,7 @@ CSSParserImpl::ParsePseudoClassWithNthPairArg(nsCSSSelector& aSelector,
// XXX Call SkipUntil to the next ")"?
return eSelectorParsingStatus_Error;
}
aSelector.AddPseudoClass(aPseudo, aType, numbers);
aSelector.AddPseudoClass(aPseudo, numbers);
return eSelectorParsingStatus_Continue;
}
@ -3475,8 +3445,7 @@ CSSParserImpl::ParsePseudoClassWithNthPairArg(nsCSSSelector& aSelector,
CSSParserImpl::nsSelectorParsingStatus
CSSParserImpl::ParseSelector(nsCSSSelector& aSelector,
nsIAtom** aPseudoElement,
nsPseudoClassList** aPseudoElementArgs,
nsCSSPseudoElements::Type* aPseudoElementType)
nsPseudoClassList** aPseudoElementArgs)
{
if (! GetToken(PR_TRUE)) {
REPORT_UNEXPECTED_EOF(PESelectorEOF);
@ -3499,8 +3468,7 @@ CSSParserImpl::ParseSelector(nsCSSSelector& aSelector,
}
else if (mToken.IsSymbol(':')) { // :pseudo
parsingStatus = ParsePseudoSelector(dataMask, aSelector, PR_FALSE,
aPseudoElement, aPseudoElementArgs,
aPseudoElementType);
aPseudoElement, aPseudoElementArgs);
}
else if (mToken.IsSymbol('[')) { // [attribute
parsingStatus = ParseAttributeSelector(dataMask, aSelector);
@ -3912,8 +3880,7 @@ CSSParserImpl::ParseTreePseudoElement(nsPseudoClassList **aPseudoElementArgs)
}
if (eCSSToken_Ident == mToken.mType) {
nsCOMPtr<nsIAtom> pseudo = do_GetAtom(mToken.mIdent);
fakeSelector.AddPseudoClass(pseudo,
nsCSSPseudoClasses::ePseudoClass_NotPseudoClass);
fakeSelector.AddPseudoClass(pseudo);
}
else if (!mToken.IsSymbol(',')) {
SkipUntil(')');

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

@ -42,29 +42,16 @@
* This file contains the list of nsIAtoms and their values for CSS
* pseudo-classes. It is designed to be used as inline input to
* nsCSSPseudoClasses.cpp *only* through the magic of C preprocessing.
* All entries must be enclosed in the macros CSS_PSEUDO_CLASS or
* CSS_STATE_PSEUDO_CLASS which will have cruel and unusual things
* done to it. The entries should be kept in some sort of logical
* order. The first argument to CSS_PSEUDO_CLASS is the C++
* identifier of the atom. The second argument is the string value of
* the atom. CSS_STATE_PSEUDO_CLASS also takes the name of the state
* bit that the class corresponds to. If CSS_STATE_PSEUDO_CLASS is
* not defined, it'll be automatically defined to CSS_PSEUDO_CLASS.
* All entries must be enclosed in the macro CSS_PSEUDO_CLASS which will
* have cruel and unusual things done to it. The entries should be kept
* in some sort of logical order. The first argument to
* CSS_PSEUDO_CLASS is the C++ identifier of the atom. The second
* argument is the string value of the atom.
*/
// OUTPUT_CLASS=nsCSSPseudoClasses
// MACRO_NAME=CSS_PSEUDO_CLASS
#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
#error "This shouldn't be defined"
#endif
#ifndef CSS_STATE_PSEUDO_CLASS
#define CSS_STATE_PSEUDO_CLASS(_name, _value, _bit) \
CSS_PSEUDO_CLASS(_name, _value)
#define DEFINED_CSS_STATE_PSEUDO_CLASS
#endif
CSS_PSEUDO_CLASS(empty, ":empty")
CSS_PSEUDO_CLASS(mozOnlyWhitespace, ":-moz-only-whitespace")
CSS_PSEUDO_CLASS(mozEmptyExceptChildrenWithLocalname, ":-moz-empty-except-children-with-localname")
@ -77,16 +64,15 @@ CSS_PSEUDO_CLASS(link, ":link")
CSS_PSEUDO_CLASS(mozAnyLink, ":-moz-any-link") // what matches :link or :visited
CSS_PSEUDO_CLASS(visited, ":visited")
CSS_STATE_PSEUDO_CLASS(active, ":active", NS_EVENT_STATE_ACTIVE)
CSS_STATE_PSEUDO_CLASS(checked, ":checked", NS_EVENT_STATE_CHECKED)
CSS_STATE_PSEUDO_CLASS(disabled, ":disabled", NS_EVENT_STATE_DISABLED)
CSS_STATE_PSEUDO_CLASS(enabled, ":enabled", NS_EVENT_STATE_ENABLED)
CSS_STATE_PSEUDO_CLASS(focus, ":focus", NS_EVENT_STATE_FOCUS)
CSS_STATE_PSEUDO_CLASS(hover, ":hover", NS_EVENT_STATE_HOVER)
CSS_STATE_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over", NS_EVENT_STATE_DRAGOVER)
CSS_STATE_PSEUDO_CLASS(target, ":target", NS_EVENT_STATE_URLTARGET)
CSS_STATE_PSEUDO_CLASS(indeterminate, ":indeterminate",
NS_EVENT_STATE_INDETERMINATE)
CSS_PSEUDO_CLASS(active, ":active")
CSS_PSEUDO_CLASS(checked, ":checked")
CSS_PSEUDO_CLASS(disabled, ":disabled")
CSS_PSEUDO_CLASS(enabled, ":enabled")
CSS_PSEUDO_CLASS(focus, ":focus")
CSS_PSEUDO_CLASS(hover, ":hover")
CSS_PSEUDO_CLASS(mozDragOver, ":-moz-drag-over")
CSS_PSEUDO_CLASS(target, ":target")
CSS_PSEUDO_CLASS(indeterminate, ":indeterminate")
CSS_PSEUDO_CLASS(firstChild, ":first-child")
CSS_PSEUDO_CLASS(firstNode, ":-moz-first-node")
@ -102,18 +88,13 @@ CSS_PSEUDO_CLASS(nthOfType, ":nth-of-type")
CSS_PSEUDO_CLASS(nthLastOfType, ":nth-last-of-type")
// Image, object, etc state pseudo-classes
CSS_STATE_PSEUDO_CLASS(mozBroken, ":-moz-broken", NS_EVENT_STATE_BROKEN)
CSS_STATE_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled",
NS_EVENT_STATE_USERDISABLED)
CSS_STATE_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed",
NS_EVENT_STATE_SUPPRESSED)
CSS_STATE_PSEUDO_CLASS(mozLoading, ":-moz-loading", NS_EVENT_STATE_LOADING)
CSS_STATE_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported",
NS_EVENT_STATE_TYPE_UNSUPPORTED)
CSS_STATE_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled",
NS_EVENT_STATE_HANDLER_DISABLED)
CSS_STATE_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked",
NS_EVENT_STATE_HANDLER_BLOCKED)
CSS_PSEUDO_CLASS(mozBroken, ":-moz-broken")
CSS_PSEUDO_CLASS(mozUserDisabled, ":-moz-user-disabled")
CSS_PSEUDO_CLASS(mozSuppressed, ":-moz-suppressed")
CSS_PSEUDO_CLASS(mozLoading, ":-moz-loading")
CSS_PSEUDO_CLASS(mozTypeUnsupported, ":-moz-type-unsupported")
CSS_PSEUDO_CLASS(mozHandlerDisabled, ":-moz-handler-disabled")
CSS_PSEUDO_CLASS(mozHandlerBlocked, ":-moz-handler-blocked")
CSS_PSEUDO_CLASS(mozHasHandlerRef, ":-moz-has-handlerref")
@ -137,26 +118,17 @@ CSS_PSEUDO_CLASS(mozLWThemeBrightText, ":-moz-lwtheme-brighttext")
CSS_PSEUDO_CLASS(mozLWThemeDarkText, ":-moz-lwtheme-darktext")
#ifdef MOZ_MATHML
CSS_STATE_PSEUDO_CLASS(mozMathIncrementScriptLevel,
":-moz-math-increment-script-level",
NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL)
CSS_PSEUDO_CLASS(mozMathIncrementScriptLevel, ":-moz-math-increment-script-level")
#endif
// CSS 3 UI
// http://www.w3.org/TR/2004/CR-css3-ui-20040511/#pseudo-classes
CSS_STATE_PSEUDO_CLASS(required, ":required", NS_EVENT_STATE_REQUIRED)
CSS_STATE_PSEUDO_CLASS(optional, ":optional", NS_EVENT_STATE_OPTIONAL)
CSS_STATE_PSEUDO_CLASS(valid, ":valid", NS_EVENT_STATE_VALID)
CSS_STATE_PSEUDO_CLASS(invalid, ":invalid", NS_EVENT_STATE_INVALID)
CSS_STATE_PSEUDO_CLASS(inRange, ":in-range", NS_EVENT_STATE_INRANGE)
CSS_STATE_PSEUDO_CLASS(outOfRange, ":out-of-range", NS_EVENT_STATE_OUTOFRANGE)
CSS_STATE_PSEUDO_CLASS(defaultPseudo, ":default", NS_EVENT_STATE_DEFAULT)
CSS_STATE_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only",
NS_EVENT_STATE_MOZ_READONLY)
CSS_STATE_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write",
NS_EVENT_STATE_MOZ_READWRITE)
#ifdef DEFINED_CSS_STATE_PSEUDO_CLASS
#undef DEFINED_CSS_STATE_PSEUDO_CLASS
#undef CSS_STATE_PSEUDO_CLASS
#endif
CSS_PSEUDO_CLASS(required, ":required")
CSS_PSEUDO_CLASS(optional, ":optional")
CSS_PSEUDO_CLASS(valid, ":valid")
CSS_PSEUDO_CLASS(invalid, ":invalid")
CSS_PSEUDO_CLASS(inRange, ":in-range")
CSS_PSEUDO_CLASS(outOfRange, ":out-of-range")
CSS_PSEUDO_CLASS(defaultPseudo, ":default")
CSS_PSEUDO_CLASS(mozReadOnly, ":-moz-read-only")
CSS_PSEUDO_CLASS(mozReadWrite, ":-moz-read-write")

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

@ -85,15 +85,3 @@ nsCSSPseudoClasses::HasNthPairArg(nsIAtom* aAtom)
aAtom == nsCSSPseudoClasses::nthOfType ||
aAtom == nsCSSPseudoClasses::nthLastOfType;
}
nsCSSPseudoClasses::Type
nsCSSPseudoClasses::GetPseudoType(nsIAtom* aAtom)
{
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(CSSPseudoClasses_info); ++i) {
if (*CSSPseudoClasses_info[i].mAtom == aAtom) {
return Type(i);
}
}
return nsCSSPseudoClasses::ePseudoClass_NotPseudoClass;
}

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

@ -59,18 +59,6 @@ public:
#define CSS_PSEUDO_CLASS(_name, _value) static nsICSSPseudoClass* _name;
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
enum Type {
#define CSS_PSEUDO_CLASS(_name, _value) \
ePseudoClass_##_name,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
ePseudoClass_Count,
ePseudoClass_NotPseudoClass /* This value MUST be last! SelectorMatches
depends on it. */
};
static Type GetPseudoType(nsIAtom* aAtom);
};
#endif /* nsCSSPseudoClasses_h___ */

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

@ -71,18 +71,11 @@ CSS_PSEUDO_ELEMENT(firstLine, ":first-line",
CSS_PSEUDO_ELEMENT(mozSelection, ":-moz-selection",
CSS_PSEUDO_ELEMENT_CONTAINS_ELEMENTS)
// XXXbz should we really allow random content to style these? Maybe
// use our flags to prevent that?
CSS_PSEUDO_ELEMENT(mozFocusInner, ":-moz-focus-inner", 0)
CSS_PSEUDO_ELEMENT(mozFocusOuter, ":-moz-focus-outer", 0)
// XXXbz should we really allow random content to style these? Maybe
// use our flags to prevent that?
CSS_PSEUDO_ELEMENT(mozListBullet, ":-moz-list-bullet", 0)
CSS_PSEUDO_ELEMENT(mozListNumber, ":-moz-list-number", 0)
#ifdef MOZ_MATHML
CSS_PSEUDO_ELEMENT(mozMathStretchy, ":-moz-math-stretchy", 0)
CSS_PSEUDO_ELEMENT(mozMathAnonymous, ":-moz-math-anonymous", 0)
#endif
CSS_PSEUDO_ELEMENT(horizontalFramesetBorder, ":-moz-hframeset-border", 0)
CSS_PSEUDO_ELEMENT(verticalFramesetBorder, ":-moz-vframeset-border", 0)

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

@ -100,36 +100,6 @@ nsCSSPseudoElements::IsCSS2PseudoElement(nsIAtom *aAtom)
return result;
}
/* static */ nsCSSPseudoElements::Type
nsCSSPseudoElements::GetPseudoType(nsIAtom *aAtom)
{
for (PRUint32 i = 0; i < NS_ARRAY_LENGTH(CSSPseudoElements_info); ++i) {
if (*CSSPseudoElements_info[i].mAtom == aAtom) {
return Type(i);
}
}
if (nsCSSAnonBoxes::IsAnonBox(aAtom)) {
#ifdef MOZ_XUL
if (nsCSSAnonBoxes::IsTreePseudoElement(aAtom)) {
return ePseudo_XULTree;
}
#endif
return ePseudo_AnonBox;
}
return ePseudo_NotPseudoElement;
}
/* static */ nsIAtom*
nsCSSPseudoElements::GetPseudoAtom(Type aType)
{
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
"Unexpected type");
return *CSSPseudoElements_info[aType].mAtom;
}
/* static */ PRUint32
nsCSSPseudoElements::FlagsForPseudoElement(nsIAtom *aAtom)
{

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

@ -79,27 +79,6 @@ public:
#include "nsCSSPseudoElementList.h"
#undef CSS_PSEUDO_ELEMENT
enum Type {
// If the actual pseudo-elements stop being first here, change
// GetPseudoType.
#define CSS_PSEUDO_ELEMENT(_name, _value_, _flags) \
ePseudo_##_name,
#include "nsCSSPseudoElementList.h"
#undef CSS_PSEUDO_ELEMENT
ePseudo_PseudoElementCount,
ePseudo_AnonBox = ePseudo_PseudoElementCount,
#ifdef MOZ_XUL
ePseudo_XULTree,
#endif
ePseudo_NotPseudoElement,
ePseudo_MAX
};
static Type GetPseudoType(nsIAtom* aAtom);
// Get the atom for a given Type. aType must be < ePseudo_PseudoElementCount
static nsIAtom* GetPseudoAtom(Type aType);
private:
static PRUint32 FlagsForPseudoElement(nsIAtom *aAtom);

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

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

@ -83,9 +83,7 @@ public:
/*
* Returns true if the given RuleProcessorData matches one of the
* selectors in aSelectorList. Note that this method will assume
* the matching is not for styling purposes. aSelectorList must not
* include any pseudo-element selectors. aSelectorList is allowed
* to be null; in this case PR_FALSE will be returned.
* the matching is not for styling purposes.
*/
static PRBool SelectorListMatches(RuleProcessorData& aData,
nsCSSSelectorList* aSelectorList);
@ -93,13 +91,7 @@ public:
// nsIStyleRuleProcessor
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
#endif
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData);
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
nsReStyleHint* aResult);

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

@ -82,8 +82,6 @@
#include "nsContentErrors.h"
#include "mozAutoDocUpdate.h"
#include "prlog.h"
#define NS_IF_CLONE(member_) \
PR_BEGIN_MACRO \
if (member_) { \
@ -136,10 +134,8 @@ nsAtomList::~nsAtomList(void)
NS_CSS_DELETE_LIST_MEMBER(nsAtomList, this, mNext);
}
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom,
nsCSSPseudoClasses::Type aType)
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom)
: mAtom(aAtom),
mType(aType),
mNext(nsnull)
{
NS_ASSERTION(!nsCSSPseudoClasses::HasStringArg(aAtom) &&
@ -149,11 +145,8 @@ nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom,
u.mMemory = nsnull;
}
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom,
nsCSSPseudoClasses::Type aType,
const PRUnichar* aString)
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom, const PRUnichar* aString)
: mAtom(aAtom),
mType(aType),
mNext(nsnull)
{
NS_ASSERTION(nsCSSPseudoClasses::HasStringArg(aAtom),
@ -163,11 +156,8 @@ nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom,
u.mString = NS_strdup(aString);
}
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom,
nsCSSPseudoClasses::Type aType,
const PRInt32* aIntPair)
nsPseudoClassList::nsPseudoClassList(nsIAtom* aAtom, const PRInt32* aIntPair)
: mAtom(aAtom),
mType(aType),
mNext(nsnull)
{
NS_ASSERTION(nsCSSPseudoClasses::HasNthPairArg(aAtom),
@ -183,13 +173,13 @@ nsPseudoClassList::Clone(PRBool aDeep) const
{
nsPseudoClassList *result;
if (!u.mMemory) {
result = new nsPseudoClassList(mAtom, mType);
result = new nsPseudoClassList(mAtom);
} else if (nsCSSPseudoClasses::HasStringArg(mAtom)) {
result = new nsPseudoClassList(mAtom, mType, u.mString);
result = new nsPseudoClassList(mAtom, u.mString);
} else {
NS_ASSERTION(nsCSSPseudoClasses::HasNthPairArg(mAtom),
"unexpected pseudo-class");
result = new nsPseudoClassList(mAtom, mType, u.mNumbers);
result = new nsPseudoClassList(mAtom, u.mNumbers);
}
if (aDeep)
@ -290,12 +280,9 @@ nsCSSSelector::nsCSSSelector(void)
mNegations(nsnull),
mNext(nsnull),
mNameSpace(kNameSpaceID_Unknown),
mOperator(0),
mPseudoType(nsCSSPseudoElements::ePseudo_NotPseudoElement)
mOperator(0)
{
MOZ_COUNT_CTOR(nsCSSSelector);
// Make sure mPseudoType can hold all nsCSSPseudoElements::Type values
PR_STATIC_ASSERT(nsCSSPseudoElements::ePseudo_MAX < PR_INT16_MAX);
}
nsCSSSelector*
@ -309,7 +296,6 @@ nsCSSSelector::Clone(PRBool aDeepNext, PRBool aDeepNegations) const
result->mLowercaseTag = mLowercaseTag;
result->mCasedTag = mCasedTag;
result->mOperator = mOperator;
result->mPseudoType = mPseudoType;
NS_IF_CLONE(mIDList);
NS_IF_CLONE(mClassList);
@ -400,24 +386,21 @@ void nsCSSSelector::AddClass(const nsString& aClass)
}
}
void nsCSSSelector::AddPseudoClass(nsIAtom* aPseudoClass,
nsCSSPseudoClasses::Type aType)
void nsCSSSelector::AddPseudoClass(nsIAtom* aPseudoClass)
{
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass, aType));
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass));
}
void nsCSSSelector::AddPseudoClass(nsIAtom* aPseudoClass,
nsCSSPseudoClasses::Type aType,
const PRUnichar* aString)
{
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass, aType, aString));
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass, aString));
}
void nsCSSSelector::AddPseudoClass(nsIAtom* aPseudoClass,
nsCSSPseudoClasses::Type aType,
const PRInt32* aIntPair)
{
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass, aType, aIntPair));
AddPseudoClassInternal(new nsPseudoClassList(aPseudoClass, aIntPair));
}
void nsCSSSelector::AddPseudoClassInternal(nsPseudoClassList *aPseudoClass)

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

@ -325,16 +325,17 @@ nsComputedDOMStyle::GetStyleContextForContent(nsIContent* aContent,
{
NS_ASSERTION(aContent->IsNodeOfType(nsINode::eELEMENT),
"aContent must be an element");
if (!aPseudo) {
// If there's no pres shell, get it from the content
if (!aPresShell) {
aPresShell = GetPresShellForContent(aContent);
if (!aPresShell)
return nsnull;
}
// If there's no pres shell, get it from the content
if (!aPresShell) {
aPresShell = GetPresShellForContent(aContent);
if (!aPresShell)
return nsnull;
aPresShell->FlushPendingNotifications(Flush_Style);
}
aPresShell->FlushPendingNotifications(Flush_Style);
return GetStyleContextForContentNoFlush(aContent, aPseudo, aPresShell);
}
@ -375,7 +376,7 @@ nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
nsIContent* parent = aPseudo ? aContent : aContent->GetParent();
// Don't resolve parent context for document fragments.
if (parent && parent->IsNodeOfType(nsINode::eELEMENT))
parentContext = GetStyleContextForContentNoFlush(parent, nsnull, aPresShell);
parentContext = GetStyleContextForContent(parent, nsnull, aPresShell);
nsPresContext *presContext = aPresShell->GetPresContext();
if (!presContext)
@ -384,11 +385,7 @@ nsComputedDOMStyle::GetStyleContextForContentNoFlush(nsIContent* aContent,
nsStyleSet *styleSet = aPresShell->StyleSet();
if (aPseudo) {
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
return nsnull;
}
return styleSet->ResolvePseudoElementStyle(aContent, type, parentContext);
return styleSet->ResolvePseudoStyleFor(aContent, aPseudo, parentContext);
}
return styleSet->ResolveStyleFor(aContent, parentContext);

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

@ -89,13 +89,7 @@ public:
// nsIStyleRuleProcessor api
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
#endif
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData);
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
nsReStyleHint* aResult);
@ -145,41 +139,29 @@ NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(ElementRuleProcessorData* aData)
{
nsIContent* content = aData->mContent;
// just get the one and only style rule from the content's STYLE attribute
nsICSSStyleRule* rule = content->GetInlineStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
if (content) {
// just get the one and only style rule from the content's STYLE attribute
nsICSSStyleRule* rule = content->GetInlineStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
#ifdef MOZ_SMIL
rule = content->GetSMILOverrideStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
rule = content->GetSMILOverrideStyleRule();
if (rule)
aData->mRuleWalker->Forward(rule);
#endif // MOZ_SMIL
}
return NS_OK;
}
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(PseudoElementRuleProcessorData* aData)
HTMLCSSStyleSheetImpl::RulesMatching(PseudoRuleProcessorData* aData)
{
return NS_OK;
}
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(AnonBoxRuleProcessorData* aData)
{
return NS_OK;
}
#ifdef MOZ_XUL
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::RulesMatching(XULTreeRuleProcessorData* aData)
{
return NS_OK;
}
#endif
NS_IMETHODIMP
HTMLCSSStyleSheetImpl::Init(nsIURI* aURL, nsIDocument* aDocument)
{

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

@ -563,13 +563,7 @@ nsHTMLStyleSheet::MediumFeaturesChanged(nsPresContext* aPresContext,
NS_IMETHODIMP
nsHTMLStyleSheet::RulesMatching(PseudoElementRuleProcessorData* aData)
{
return NS_OK;
}
NS_IMETHODIMP
nsHTMLStyleSheet::RulesMatching(AnonBoxRuleProcessorData* aData)
nsHTMLStyleSheet::RulesMatching(PseudoRuleProcessorData* aData)
{
nsIAtom* pseudoTag = aData->mPseudoTag;
if (pseudoTag == nsCSSAnonBoxes::tableCol) {
@ -581,13 +575,6 @@ nsHTMLStyleSheet::RulesMatching(AnonBoxRuleProcessorData* aData)
return NS_OK;
}
#ifdef MOZ_XUL
NS_IMETHODIMP
nsHTMLStyleSheet::RulesMatching(XULTreeRuleProcessorData* aData)
{
return NS_OK;
}
#endif
// nsIStyleSheet api
NS_IMETHODIMP

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

@ -79,11 +79,7 @@ public:
// nsIStyleRuleProcessor API
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
#endif
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData);
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
nsReStyleHint* aResult);
virtual nsReStyleHint

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

@ -52,8 +52,6 @@
#include "nsCSSProps.h"
#include "nsCSSValue.h"
#include "nsIAtom.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPseudoClasses.h"
class nsIAtom;
class nsCSSDeclaration;
@ -80,11 +78,9 @@ private:
struct nsPseudoClassList {
public:
nsPseudoClassList(nsIAtom* aAtom, nsCSSPseudoClasses::Type aType);
nsPseudoClassList(nsIAtom* aAtom, nsCSSPseudoClasses::Type aType,
const PRUnichar *aString);
nsPseudoClassList(nsIAtom* aAtom, nsCSSPseudoClasses::Type aType,
const PRInt32 *aIntPair);
nsPseudoClassList(nsIAtom* aAtom);
nsPseudoClassList(nsIAtom* aAtom, const PRUnichar *aString);
nsPseudoClassList(nsIAtom* aAtom, const PRInt32 *aIntPair);
~nsPseudoClassList(void);
/** Do a deep clone. Should be used only on the first in the linked list. */
@ -103,7 +99,6 @@ public:
PRUnichar* mString;
PRInt32* mNumbers;
} u;
nsCSSPseudoClasses::Type mType;
nsPseudoClassList* mNext;
private:
nsPseudoClassList* Clone(PRBool aDeep) const;
@ -163,11 +158,9 @@ public:
void SetTag(const nsString& aTag);
void AddID(const nsString& aID);
void AddClass(const nsString& aClass);
void AddPseudoClass(nsIAtom* aPseudoClass, nsCSSPseudoClasses::Type aType);
void AddPseudoClass(nsIAtom* aPseudoClass, nsCSSPseudoClasses::Type aType,
const PRUnichar* aString);
void AddPseudoClass(nsIAtom* aPseudoClass, nsCSSPseudoClasses::Type aType,
const PRInt32* aIntPair);
void AddPseudoClass(nsIAtom* aPseudoClass);
void AddPseudoClass(nsIAtom* aPseudoClass, const PRUnichar* aString);
void AddPseudoClass(nsIAtom* aPseudoClass, const PRInt32* aIntPair);
void AddAttribute(PRInt32 aNameSpace, const nsString& aAttr);
void AddAttribute(PRInt32 aNameSpace, const nsString& aAttr, PRUint8 aFunc,
const nsString& aValue, PRBool aCaseSensitive);
@ -206,15 +199,6 @@ private:
PRInt32 CalcWeightWithoutNegations() const;
public:
// Get and set the selector's pseudo type
nsCSSPseudoElements::Type PseudoType() const {
return static_cast<nsCSSPseudoElements::Type>(mPseudoType);
}
void SetPseudoType(nsCSSPseudoElements::Type aType) {
NS_ASSERTION(aType > PR_INT16_MIN && aType < PR_INT16_MAX, "Out of bounds");
mPseudoType = static_cast<PRInt16>(aType);
}
// For case-sensitive documents, mLowercaseTag is the same as mCasedTag,
// but in case-insensitive documents (HTML) mLowercaseTag is lowercase.
// Also, for pseudo-elements mCasedTag will be null but mLowercaseTag
@ -230,9 +214,7 @@ public:
nsCSSSelector* mNext;
PRInt32 mNameSpace;
PRUnichar mOperator;
private:
// PRInt16 to make sure it packs well with mOperator
PRInt16 mPseudoType;
private:
// These are not supported and are not implemented!
nsCSSSelector(const nsCSSSelector& aCopy);
nsCSSSelector& operator=(const nsCSSSelector& aCopy);

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

@ -51,20 +51,15 @@
struct RuleProcessorData;
struct ElementRuleProcessorData;
struct PseudoElementRuleProcessorData;
struct AnonBoxRuleProcessorData;
#ifdef MOZ_XUL
struct XULTreeRuleProcessorData;
#endif
struct PseudoRuleProcessorData;
struct StateRuleProcessorData;
struct AttributeRuleProcessorData;
class nsPresContext;
// IID for the nsIStyleRuleProcessor interface
// {ec92bc0c-9518-48ea-9289-74e654659be9}
// IID for the nsIStyleRuleProcessor interface {a4ec760e-6bfb-4b9f-bd08-9d1c23b700f6}
#define NS_ISTYLE_RULE_PROCESSOR_IID \
{ 0xec92bc0c, 0x9518, 0x48ea, \
{ 0x92, 0x89, 0x74, 0xe6, 0x54, 0x65, 0x9b, 0xe9 } }
{ 0xa4ec760e, 0x6bfb, 0x4b9f, \
{ 0xbd, 0x08, 0x9d, 0x1c, 0x23, 0xb7, 0x00, 0xf6 } }
/* The style rule processor interface is a mechanism to separate the matching
* of style rules from style sheet instances.
@ -94,20 +89,7 @@ public:
* Just like the previous |RulesMatching|, except for a given content
* node <em>and pseudo-element</em>.
*/
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData) = 0;
/**
* Just like the previous |RulesMatching|, except for a given anonymous box.
*/
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData) = 0;
#ifdef MOZ_XUL
/**
* Just like the previous |RulesMatching|, except for a given content
* node <em>and tree pseudo</em>.
*/
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData) = 0;
#endif
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData) = 0;
/**
* Return how (as described by nsReStyleHint) style can depend on a

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

@ -48,7 +48,6 @@
#include "nsString.h"
#include "nsChangeHint.h"
#include "nsIContent.h"
#include "nsCSSPseudoElements.h"
class nsIStyleSheet;
class nsPresContext;
@ -124,19 +123,19 @@ public:
PRBool aCheckEdgeOnly);
nsPresContext* mPresContext;
nsIContent* mContent; // weak ref, must not be null
nsIContent* mParentContent; // mContent->GetParent(); weak ref
nsIContent* mContent; // weak ref
nsIContent* mParentContent; // if content, content->GetParent(); weak ref
nsRuleWalker* mRuleWalker; // Used to add rules to our results.
nsIContent* mScopedRoot; // Root of scoped stylesheet (set and unset by the supplier of the scoped stylesheet
nsIAtom* mContentTag; // mContent->GetTag()
nsIAtom* mContentID; // mContent->GetID()
PRPackedBool mIsHTMLContent; // whether mContent it's IsHTML()
PRPackedBool mIsHTML; // mIsHTMLContent && IsInHTMLDocument()
PRPackedBool mHasAttributes; // mContent->GetAttrCount() > 0
nsIAtom* mContentTag; // if content, then content->GetTag()
nsIAtom* mContentID; // if styled content, then weak reference to styledcontent->GetID()
PRPackedBool mIsHTMLContent; // if content, then whether it's IsHTML()
PRPackedBool mIsHTML; // if content then mIsHTMLContent && IsInHTMLDocument()
PRPackedBool mHasAttributes; // if content, content->GetAttrCount() > 0
nsCompatibility mCompatMode; // Possibly remove use of this in SelectorMatches?
PRInt32 mNameSpaceID; // mContent->GetNameSapce()
const nsAttrValue* mClasses; // mContent->GetClasses()
PRInt32 mNameSpaceID; // if content, content->GetNameSapce()
const nsAttrValue* mClasses; // if styled content, styledcontent->GetClasses()
// mPreviousSiblingData and mParentData are always RuleProcessorData
// and never a derived class. They are allocated lazily, when
// selectors require matching of prior siblings or ancestors.
@ -154,11 +153,10 @@ private:
// subscript is 0 for nth- and 1 for nth-last-.
PRInt32 mNthIndices[2][2];
// mContentState, mLinkState, mIsLink are initialized lazily.
PRInt32 mContentState; // eventStateMgr->GetContentState() or
// mContent->IntrinsicState() if we have no ESM
PRInt32 mContentState; // if content, eventStateMgr->GetContentState()
nsLinkState mLinkState; // if a link, this is the state, otherwise unknown
PRPackedBool mIsLink; // nsStyleUtil::IsHTMLLink or nsStyleUtil::IsLink
PRPackedBool mIsLink; // if content, calls nsStyleUtil::IsHTMLLink
// or nsStyleUtil::IsLink
PRPackedBool mGotContentState;
PRPackedBool mGotLinkInfo; // Whether we've gotten the right values
// for mLinkState and mIsLink.
@ -171,67 +169,29 @@ struct ElementRuleProcessorData : public RuleProcessorData {
: RuleProcessorData(aPresContext,aContent,aRuleWalker)
{
NS_PRECONDITION(aPresContext, "null pointer");
NS_PRECONDITION(aContent, "null pointer");
NS_PRECONDITION(aRuleWalker, "null pointer");
}
};
struct PseudoElementRuleProcessorData : public RuleProcessorData {
PseudoElementRuleProcessorData(nsPresContext* aPresContext,
nsIContent* aParentContent,
nsRuleWalker* aRuleWalker,
nsCSSPseudoElements::Type aPseudoType)
: RuleProcessorData(aPresContext, aParentContent, aRuleWalker),
mPseudoType(aPseudoType)
{
NS_PRECONDITION(aPresContext, "null pointer");
NS_PRECONDITION(aPseudoType <
nsCSSPseudoElements::ePseudo_PseudoElementCount,
"null pointer");
NS_PRECONDITION(aRuleWalker, "null pointer");
}
nsCSSPseudoElements::Type mPseudoType;
};
struct AnonBoxRuleProcessorData {
AnonBoxRuleProcessorData(nsPresContext* aPresContext,
nsIAtom* aPseudoTag,
nsRuleWalker* aRuleWalker)
: mPresContext(aPresContext),
mPseudoTag(aPseudoTag),
mRuleWalker(aRuleWalker)
{
NS_PRECONDITION(mPresContext, "Must have prescontext");
NS_PRECONDITION(aPseudoTag, "Must have pseudo tag");
NS_PRECONDITION(aRuleWalker, "Must have rule walker");
}
nsPresContext* mPresContext;
nsIAtom* mPseudoTag;
nsRuleWalker* mRuleWalker;
};
#ifdef MOZ_XUL
struct XULTreeRuleProcessorData : public RuleProcessorData {
XULTreeRuleProcessorData(nsPresContext* aPresContext,
nsIContent* aParentContent,
nsRuleWalker* aRuleWalker,
nsIAtom* aPseudoTag,
nsICSSPseudoComparator* aComparator)
: RuleProcessorData(aPresContext, aParentContent, aRuleWalker),
mPseudoTag(aPseudoTag),
mComparator(aComparator)
struct PseudoRuleProcessorData : public RuleProcessorData {
PseudoRuleProcessorData(nsPresContext* aPresContext,
nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsICSSPseudoComparator* aComparator,
nsRuleWalker* aRuleWalker)
: RuleProcessorData(aPresContext, aParentContent, aRuleWalker)
{
NS_PRECONDITION(aPresContext, "null pointer");
NS_PRECONDITION(aPseudoTag, "null pointer");
NS_PRECONDITION(aRuleWalker, "null pointer");
NS_PRECONDITION(aComparator, "must have a comparator");
mPseudoTag = aPseudoTag;
mComparator = aComparator;
}
nsIAtom* mPseudoTag;
nsICSSPseudoComparator* mComparator;
};
#endif
struct StateRuleProcessorData : public RuleProcessorData {
StateRuleProcessorData(nsPresContext* aPresContext,
@ -241,6 +201,7 @@ struct StateRuleProcessorData : public RuleProcessorData {
mStateMask(aStateMask)
{
NS_PRECONDITION(aPresContext, "null pointer");
NS_PRECONDITION(aContent, "null pointer");
}
const PRInt32 mStateMask; // |HasStateDependentStyle| for which state(s)?
// Constants defined in nsIEventStateManager.h .
@ -258,6 +219,7 @@ struct AttributeRuleProcessorData : public RuleProcessorData {
mAttrHasChanged(aAttrHasChanged)
{
NS_PRECONDITION(aPresContext, "null pointer");
NS_PRECONDITION(aContent, "null pointer");
}
nsIAtom* mAttribute; // |HasAttributeDependentStyle| for which attribute?
PRInt32 mModType; // The type of modification (see nsIDOMMutationEvent).

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

@ -816,7 +816,6 @@ StyleWithDeclarationAdded(nsCSSProperty aProperty,
nsStyleSet* styleSet = styleContext->PresContext()->StyleSet();
return styleSet->ResolveStyleForRules(styleContext->GetParent(),
styleContext->GetPseudo(),
styleContext->GetPseudoType(),
styleContext->GetRuleNode(),
ruleArray);
}

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

@ -50,7 +50,6 @@
#include "nsRuleNode.h"
#include "nsStyleContext.h"
#include "prlog.h"
#ifdef DEBUG
// #define NOISY_DEBUG
@ -61,7 +60,6 @@
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode* aRuleNode,
nsPresContext* aPresContext)
: mParent(aParent),
@ -69,12 +67,9 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
mEmptyChild(nsnull),
mPseudoTag(aPseudoTag),
mRuleNode(aRuleNode),
mBits(((PRUint32)aPseudoType) << NS_STYLE_CONTEXT_TYPE_SHIFT),
mBits(0),
mRefCnt(0)
{
PR_STATIC_ASSERT((PR_UINT32_MAX >> NS_STYLE_CONTEXT_TYPE_SHIFT) >
nsCSSPseudoElements::ePseudo_MAX);
mNextSibling = this;
mPrevSibling = this;
if (mParent) {
@ -577,13 +572,11 @@ nsStyleContext::Destroy()
already_AddRefed<nsStyleContext>
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode* aRuleNode,
nsPresContext* aPresContext)
{
nsStyleContext* context =
new (aPresContext) nsStyleContext(aParentContext, aPseudoTag, aPseudoType,
aRuleNode, aPresContext);
nsStyleContext* context = new (aPresContext) nsStyleContext(aParentContext, aPseudoTag,
aRuleNode, aPresContext);
if (context)
context->AddRef();
return context;

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

@ -44,7 +44,6 @@
#include "nsRuleNode.h"
#include "nsIAtom.h"
#include "nsCSSPseudoElements.h"
class nsPresContext;
@ -73,8 +72,7 @@ class nsPresContext;
class nsStyleContext
{
public:
nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsStyleContext(nsStyleContext* aParent, nsIAtom* aPseudoTag,
nsRuleNode* aRuleNode, nsPresContext* aPresContext) NS_HIDDEN;
~nsStyleContext() NS_HIDDEN;
@ -110,10 +108,6 @@ public:
nsStyleContext* GetParent() const { return mParent; }
nsIAtom* GetPseudo() const { return mPseudoTag; }
nsCSSPseudoElements::Type GetPseudoType() const {
return static_cast<nsCSSPseudoElements::Type>(mBits >>
NS_STYLE_CONTEXT_TYPE_SHIFT);
}
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
FindChildWithRules(const nsIAtom* aPseudoTag, nsRuleNode* aRules);
@ -228,7 +222,6 @@ protected:
NS_HIDDEN_(already_AddRefed<nsStyleContext>)
NS_NewStyleContext(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode* aRuleNode,
nsPresContext* aPresContext);
#endif

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

@ -411,11 +411,12 @@ nsStyleSet::EnableQuirkStyleSheet(PRBool aEnable)
#endif
}
template<class T>
static PRBool
EnumRulesMatching(nsIStyleRuleProcessor* aProcessor, void* aData)
{
T* data = static_cast<T*>(aData);
ElementRuleProcessorData* data =
static_cast<ElementRuleProcessorData*>(aData);
aProcessor->RulesMatching(data);
return PR_TRUE;
}
@ -430,17 +431,8 @@ already_AddRefed<nsStyleContext>
nsStyleSet::GetContext(nsPresContext* aPresContext,
nsStyleContext* aParentContext,
nsRuleNode* aRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType)
nsIAtom* aPseudoTag)
{
NS_PRECONDITION((!aPseudoTag &&
aPseudoType ==
nsCSSPseudoElements::ePseudo_NotPseudoElement) ||
(aPseudoTag &&
nsCSSPseudoElements::GetPseudoType(aPseudoTag) ==
aPseudoType),
"Pseudo mismatch");
nsStyleContext* result = nsnull;
if (aParentContext)
@ -454,15 +446,11 @@ nsStyleSet::GetContext(nsPresContext* aPresContext,
#endif
if (!result) {
result = NS_NewStyleContext(aParentContext, aPseudoTag, aPseudoType,
aRuleNode, aPresContext).get();
result = NS_NewStyleContext(aParentContext, aPseudoTag, aRuleNode,
aPresContext).get();
if (!aParentContext && result)
mRoots.AppendElement(result);
}
else {
NS_ASSERTION(result->GetPseudoType() == aPseudoType, "Unexpected type");
NS_ASSERTION(result->GetPseudo() == aPseudoTag, "Unexpected pseudo");
}
return result;
}
@ -530,8 +518,7 @@ nsStyleSet::AssertNoCSSRules(nsRuleNode* aCurrLevelNode,
// Enumerate the rules in a way that cares about the order of the rules.
void
nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
void* aData, nsIContent* aContent,
nsRuleWalker* aRuleWalker)
RuleProcessorData* aData, nsRuleWalker* aRuleWalker)
{
// Cascading order:
// [least important]
@ -564,7 +551,7 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
aRuleWalker->SetLevel(eUserSheet, PR_FALSE, PR_TRUE);
PRBool skipUserStyles =
aContent && aContent->IsInNativeAnonymousSubtree();
aData->mContent && aData->mContent->IsInNativeAnonymousSubtree();
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
(*aCollectorFunc)(mRuleProcessors[eUserSheet], aData);
nsRuleNode* lastUserRN = aRuleWalker->GetCurrentNode();
@ -577,11 +564,9 @@ nsStyleSet::FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
aRuleWalker->SetLevel(eDocSheet, PR_FALSE, PR_TRUE);
PRBool cutOffInheritance = PR_FALSE;
if (mBindingManager && aContent) {
if (mBindingManager) {
// We can supply additional document-level sheets that should be walked.
mBindingManager->WalkRules(aCollectorFunc,
static_cast<RuleProcessorData*>(aData),
&cutOffInheritance);
mBindingManager->WalkRules(aCollectorFunc, aData, &cutOffInheritance);
}
if (!skipUserStyles && !cutOffInheritance &&
mRuleProcessors[eDocSheet]) // NOTE: different
@ -676,7 +661,8 @@ nsStyleSet::WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
if (mRuleProcessors[ePresHintSheet])
(*aFunc)(mRuleProcessors[ePresHintSheet], aData);
PRBool skipUserStyles = aData->mContent->IsInNativeAnonymousSubtree();
PRBool skipUserStyles =
aData->mContent && aData->mContent->IsInNativeAnonymousSubtree();
if (!skipUserStyles && mRuleProcessors[eUserSheet]) // NOTE: different
(*aFunc)(mRuleProcessors[eUserSheet], aData);
@ -747,11 +733,9 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
if (aContent && presContext) {
nsRuleWalker ruleWalker(mRuleTree);
ElementRuleProcessorData data(presContext, aContent, &ruleWalker);
FileRules(EnumRulesMatching<ElementRuleProcessorData>, &data, aContent,
&ruleWalker);
FileRules(EnumRulesMatching, &data, &ruleWalker);
result = GetContext(presContext, aParentContext,
ruleWalker.GetCurrentNode(), nsnull,
nsCSSPseudoElements::ePseudo_NotPseudoElement).get();
ruleWalker.GetCurrentNode(), nsnull).get();
}
return result;
@ -760,7 +744,6 @@ nsStyleSet::ResolveStyleFor(nsIContent* aContent,
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode *aRuleNode,
const nsCOMArray<nsIStyleRule> &aRules)
{
@ -779,8 +762,7 @@ nsStyleSet::ResolveStyleForRules(nsStyleContext* aParentContext,
ruleWalker.Forward(aRules.ObjectAt(i));
}
result = GetContext(presContext, aParentContext,
ruleWalker.GetCurrentNode(), aPseudoTag,
aPseudoType).get();
ruleWalker.GetCurrentNode(), aPseudoTag).get();
}
return result;
}
@ -793,155 +775,129 @@ nsStyleSet::ResolveStyleForNonElement(nsStyleContext* aParentContext)
if (presContext) {
result = GetContext(presContext, aParentContext, mRuleTree,
nsCSSAnonBoxes::mozNonElement,
nsCSSPseudoElements::ePseudo_AnonBox).get();
nsCSSAnonBoxes::mozNonElement).get();
}
return result;
}
void
nsStyleSet::WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
nsStyleSet::WalkRestrictionRule(nsIAtom* aPseudoType,
nsRuleWalker* aRuleWalker)
{
// This needs to match GetPseudoRestriction in nsRuleNode.cpp.
aRuleWalker->SetLevel(eAgentSheet, PR_FALSE, PR_FALSE);
if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLetter)
aRuleWalker->Forward(mFirstLetterRule);
else if (aPseudoType == nsCSSPseudoElements::ePseudo_firstLine)
aRuleWalker->Forward(mFirstLineRule);
if (aPseudoType) {
aRuleWalker->SetLevel(eAgentSheet, PR_FALSE, PR_FALSE);
if (aPseudoType == nsCSSPseudoElements::firstLetter)
aRuleWalker->Forward(mFirstLetterRule);
else if (aPseudoType == nsCSSPseudoElements::firstLine)
aRuleWalker->Forward(mFirstLineRule);
}
}
static PRBool
EnumPseudoRulesMatching(nsIStyleRuleProcessor* aProcessor, void* aData)
{
PseudoRuleProcessorData* data =
static_cast<PseudoRuleProcessorData*>(aData);
aProcessor->RulesMatching(data);
return PR_TRUE;
}
already_AddRefed<nsStyleContext>
nsStyleSet::ResolvePseudoElementStyle(nsIContent* aParentContent,
nsCSSPseudoElements::Type aType,
nsStyleContext* aParentContext)
nsStyleSet::ResolvePseudoStyleFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator)
{
NS_ENSURE_FALSE(mInShutdown, nsnull);
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
"must have pseudo element type");
NS_ASSERTION(aParentContent &&
aParentContent->IsNodeOfType(nsINode::eELEMENT),
"aParentContent must be element");
nsRuleWalker ruleWalker(mRuleTree);
nsStyleContext* result = nsnull;
nsPresContext *presContext = PresContext();
PseudoElementRuleProcessorData data(presContext, aParentContent, &ruleWalker,
aType);
WalkRestrictionRule(aType, &ruleWalker);
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
aParentContent, &ruleWalker);
return GetContext(presContext, aParentContext, ruleWalker.GetCurrentNode(),
nsCSSPseudoElements::GetPseudoAtom(aType), aType);
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
NS_ASSERTION(!aParentContent ||
aParentContent->IsNodeOfType(nsINode::eELEMENT),
"content (if non-null) must be element");
NS_ASSERTION(aParentContent ||
nsCSSAnonBoxes::IsAnonBox(aPseudoTag),
"null content must correspond to anonymous box");
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aPseudoTag) ||
nsCSSPseudoElements::IsPseudoElement(aPseudoTag),
"aPseudoTag must be pseudo-element or anonymous box");
if (aPseudoTag && presContext) {
nsRuleWalker ruleWalker(mRuleTree);
PseudoRuleProcessorData data(presContext, aParentContent, aPseudoTag,
aComparator, &ruleWalker);
WalkRestrictionRule(aPseudoTag, &ruleWalker);
FileRules(EnumPseudoRulesMatching, &data, &ruleWalker);
result = GetContext(presContext, aParentContext,
ruleWalker.GetCurrentNode(), aPseudoTag).get();
}
return result;
}
already_AddRefed<nsStyleContext>
nsStyleSet::ProbePseudoElementStyle(nsIContent* aParentContent,
nsCSSPseudoElements::Type aType,
nsStyleContext* aParentContext)
nsStyleSet::ProbePseudoStyleFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext)
{
NS_ENSURE_FALSE(mInShutdown, nsnull);
NS_ASSERTION(aType < nsCSSPseudoElements::ePseudo_PseudoElementCount,
"must have pseudo element type");
nsStyleContext* result = nsnull;
nsPresContext *presContext = PresContext();
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
NS_ASSERTION(aParentContent &&
aParentContent->IsNodeOfType(nsINode::eELEMENT),
"aParentContent must be element");
//NS_ASSERTION(nsCSSPseudoElements::IsPseudoElement(aPseudoTag),
// "aPseudoTag must be a pseudo-element");
NS_ASSERTION(aParentContent ||
nsCSSAnonBoxes::IsAnonBox(aPseudoTag),
"null content must correspond to anonymous box");
NS_ASSERTION(nsCSSAnonBoxes::IsAnonBox(aPseudoTag) ||
nsCSSPseudoElements::IsPseudoElement(aPseudoTag),
"aPseudoTag must be pseudo-element or anonymous box");
nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
if (aPseudoTag && presContext) {
nsRuleWalker ruleWalker(mRuleTree);
PseudoRuleProcessorData data(presContext, aParentContent, aPseudoTag,
nsnull, &ruleWalker);
WalkRestrictionRule(aPseudoTag, &ruleWalker);
// not the root if there was a restriction rule
nsRuleNode *adjustedRoot = ruleWalker.GetCurrentNode();
FileRules(EnumPseudoRulesMatching, &data, &ruleWalker);
nsPresContext *presContext = PresContext();
nsRuleWalker ruleWalker(mRuleTree);
PseudoElementRuleProcessorData data(presContext, aParentContent, &ruleWalker,
aType);
WalkRestrictionRule(aType, &ruleWalker);
// not the root if there was a restriction rule
nsRuleNode *adjustedRoot = ruleWalker.GetCurrentNode();
FileRules(EnumRulesMatching<PseudoElementRuleProcessorData>, &data,
aParentContent, &ruleWalker);
nsRuleNode *ruleNode = ruleWalker.GetCurrentNode();
if (ruleNode == adjustedRoot) {
return nsnull;
nsRuleNode *ruleNode = ruleWalker.GetCurrentNode();
if (ruleNode != adjustedRoot)
result =
GetContext(presContext, aParentContext, ruleNode, aPseudoTag).get();
}
nsRefPtr<nsStyleContext> result =
GetContext(presContext, aParentContext, ruleNode, pseudoTag, aType);
// For :before and :after pseudo-elements, having display: none or no
// 'content' property is equivalent to not having the pseudo-element
// at all.
if (result &&
(pseudoTag == nsCSSPseudoElements::before ||
pseudoTag == nsCSSPseudoElements::after)) {
(aPseudoTag == nsCSSPseudoElements::before ||
aPseudoTag == nsCSSPseudoElements::after)) {
const nsStyleDisplay *display = result->GetStyleDisplay();
const nsStyleContent *content = result->GetStyleContent();
// XXXldb What is contentCount for |content: ""|?
if (display->mDisplay == NS_STYLE_DISPLAY_NONE ||
content->ContentCount() == 0) {
result->Release();
result = nsnull;
}
}
return result.forget();
return result;
}
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
nsStyleContext* aParentContext)
{
NS_ENSURE_FALSE(mInShutdown, nsnull);
#ifdef DEBUG
PRBool isAnonBox = nsCSSAnonBoxes::IsAnonBox(aPseudoTag)
#ifdef MOZ_XUL
&& !nsCSSAnonBoxes::IsTreePseudoElement(aPseudoTag)
#endif
;
NS_PRECONDITION(isAnonBox, "Unexpected pseudo");
#endif
nsRuleWalker ruleWalker(mRuleTree);
nsPresContext *presContext = PresContext();
AnonBoxRuleProcessorData data(presContext, aPseudoTag, &ruleWalker);
FileRules(EnumRulesMatching<AnonBoxRuleProcessorData>, &data, nsnull,
&ruleWalker);
return GetContext(presContext, aParentContext, ruleWalker.GetCurrentNode(),
aPseudoTag, nsCSSPseudoElements::ePseudo_AnonBox);
}
#ifdef MOZ_XUL
already_AddRefed<nsStyleContext>
nsStyleSet::ResolveXULTreePseudoStyle(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator)
{
NS_ENSURE_FALSE(mInShutdown, nsnull);
NS_ASSERTION(aPseudoTag, "must have pseudo tag");
NS_ASSERTION(aParentContent->IsNodeOfType(nsINode::eELEMENT),
"content (if non-null) must be element");
NS_ASSERTION(nsCSSAnonBoxes::IsTreePseudoElement(aPseudoTag),
"Unexpected pseudo");
nsRuleWalker ruleWalker(mRuleTree);
nsPresContext *presContext = PresContext();
XULTreeRuleProcessorData data(presContext, aParentContent, &ruleWalker,
aPseudoTag, aComparator);
FileRules(EnumRulesMatching<XULTreeRuleProcessorData>, &data, aParentContent,
&ruleWalker);
return GetContext(presContext, aParentContext, ruleWalker.GetCurrentNode(),
aPseudoTag, nsCSSPseudoElements::ePseudo_XULTree);
}
#endif
PRBool
nsStyleSet::AppendFontFaceRules(nsPresContext* aPresContext,
nsTArray<nsFontFaceRuleContainer>& aArray)
@ -1052,12 +1008,10 @@ nsStyleSet::ReParentStyleContext(nsPresContext* aPresContext,
}
else { // really a new parent
nsIAtom* pseudoTag = aStyleContext->GetPseudo();
nsCSSPseudoElements::Type pseudoType = aStyleContext->GetPseudoType();
nsRuleNode* ruleNode = aStyleContext->GetRuleNode();
already_AddRefed<nsStyleContext> result =
GetContext(aPresContext, aNewParentContext, ruleNode, pseudoTag,
pseudoType);
GetContext(aPresContext, aNewParentContext, ruleNode, pseudoTag);
return result;
}
}

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

@ -55,8 +55,6 @@
#include "nsCOMArray.h"
#include "nsAutoPtr.h"
#include "nsIStyleRule.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSAnonBoxes.h"
class nsIURI;
class nsCSSFontFaceRule;
@ -99,7 +97,7 @@ class nsStyleSet
already_AddRefed<nsStyleContext>
ResolveStyleFor(nsIContent* aContent, nsStyleContext* aParentContext);
// Get a style context (with the given parent and pseudo-tag/type) for a
// Get a style context (with the given parent and pseudo-tag) for a
// sequence of style rules consisting of the concatenation of:
// (1) the rule sequence represented by aRuleNode (which is the empty
// sequence if aRuleNode is null or the root of the rule tree), and
@ -107,7 +105,6 @@ class nsStyleSet
already_AddRefed<nsStyleContext>
ResolveStyleForRules(nsStyleContext* aParentContext,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType,
nsRuleNode *aRuleNode,
const nsCOMArray<nsIStyleRule> &aRules);
@ -121,37 +118,23 @@ class nsStyleSet
already_AddRefed<nsStyleContext>
ResolveStyleForNonElement(nsStyleContext* aParentContext);
// Get a style context for a pseudo-element. aParentContent must be
// non-null. aPseudoID is the nsCSSPseudoElements::Type for the
// pseudo-element.
// get a style context for a pseudo-element (i.e.,
// |aPseudoTag == nsCOMPtr<nsIAtom>(do_GetAtom(":first-line"))|, in
// which case aParentContent must be non-null, or an anonymous box, in
// which case it may be null or non-null.
already_AddRefed<nsStyleContext>
ResolvePseudoElementStyle(nsIContent* aParentContent,
nsCSSPseudoElements::Type aType,
nsStyleContext* aParentContext);
ResolvePseudoStyleFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator = nsnull);
// This functions just like ResolvePseudoElementStyle except that it will
// This functions just like ResolvePseudoStyleFor except that it will
// return nsnull if there are no explicit style rules for that
// pseudo element.
// pseudo element. It should be used only for pseudo-elements.
already_AddRefed<nsStyleContext>
ProbePseudoElementStyle(nsIContent* aParentContent,
nsCSSPseudoElements::Type aType,
nsStyleContext* aParentContext);
// Get a style context for an anonymous box. aPseudoTag is the
// pseudo-tag to use and must be non-null.
already_AddRefed<nsStyleContext>
ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext);
#ifdef MOZ_XUL
// Get a style context for a XUL tree pseudo. aPseudoTag is the
// pseudo-tag to use and must be non-null. aParentContent must be
// non-null. aComparator must be non-null.
already_AddRefed<nsStyleContext>
ResolveXULTreePseudoStyle(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext,
nsICSSPseudoComparator* aComparator);
#endif
ProbePseudoStyleFor(nsIContent* aParentContent,
nsIAtom* aPseudoTag,
nsStyleContext* aParentContext);
// Append all the currently-active font face rules to aArray. Return
// true for success and false for failure.
@ -298,7 +281,7 @@ class nsStyleSet
// Move aRuleWalker forward by the appropriate rule if we need to add
// a rule due to property restrictions on pseudo-elements.
void WalkRestrictionRule(nsCSSPseudoElements::Type aPseudoType,
void WalkRestrictionRule(nsIAtom* aPseudoType,
nsRuleWalker* aRuleWalker);
#ifdef DEBUG
@ -317,11 +300,8 @@ class nsStyleSet
// Enumerate the rules in a way that cares about the order of the
// rules.
// aContent is the node the rules are for. It might be null. aData
// is the closure to pass to aCollectorFunc. If aContent is not null,
// aData must be a RuleProcessorData*
void FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
void* aData, nsIContent* aContent, nsRuleWalker* aRuleWalker);
RuleProcessorData* aData, nsRuleWalker* aRuleWalker);
// Enumerate all the rules in a way that doesn't care about the order
// of the rules and break out if the enumeration is halted.
@ -331,8 +311,7 @@ class nsStyleSet
already_AddRefed<nsStyleContext> GetContext(nsPresContext* aPresContext,
nsStyleContext* aParentContext,
nsRuleNode* aRuleNode,
nsIAtom* aPseudoTag,
nsCSSPseudoElements::Type aPseudoType);
nsIAtom* aPseudoTag);
nsPresContext* PresContext() { return mRuleTree->GetPresContext(); }

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

@ -83,9 +83,6 @@ class imgIContainer;
#define NS_STYLE_HAS_TEXT_DECORATIONS 0x01000000
// See nsStyleContext::HasPseudoElementData.
#define NS_STYLE_HAS_PSEUDO_ELEMENT_DATA 0x02000000
// See nsStyleContext::GetPseudoEnum
#define NS_STYLE_CONTEXT_TYPE_MASK 0xf0000000
#define NS_STYLE_CONTEXT_TYPE_SHIFT 28
// Additional bits for nsRuleNode's mDependentBits:
#define NS_RULE_NODE_GC_MARK 0x02000000

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

@ -49,6 +49,7 @@
#include "nsRuleData.h"
#include "nsSMILKeySpline.h"
#include "gfxColor.h"
#include "nsCSSPseudoElements.h"
#include "nsCSSPropertySet.h"
#include "nsStyleAnimation.h"
#include "nsCSSDataBlock.h"
@ -372,10 +373,9 @@ nsTransitionManager::StyleContextChanged(nsIContent *aElement,
return nsnull;
}
nsCSSPseudoElements::Type pseudoType = aNewStyleContext->GetPseudoType();
if (pseudoType != nsCSSPseudoElements::ePseudo_NotPseudoElement &&
pseudoType != nsCSSPseudoElements::ePseudo_before &&
pseudoType != nsCSSPseudoElements::ePseudo_after) {
nsIAtom *pseudo = aNewStyleContext->GetPseudo();
if (pseudo && (pseudo != nsCSSPseudoElements::before &&
pseudo != nsCSSPseudoElements::after)) {
return nsnull;
}
if (aNewStyleContext->GetParent() &&
@ -398,7 +398,9 @@ nsTransitionManager::StyleContextChanged(nsIContent *aElement,
// Check delay and duration first, since they default to zero, and
// when they're both zero, we can ignore the transition.
if (t.GetDelay() != 0.0f || t.GetDuration() != 0.0f) {
et = GetElementTransitions(aElement, pseudoType, PR_FALSE);
et = GetElementTransitions(aElement,
aNewStyleContext->GetPseudo(),
PR_FALSE);
// We might have something to transition. See if any of the
// properties in question changed and are animatable.
@ -612,7 +614,7 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
if (!aElementTransitions) {
aElementTransitions =
GetElementTransitions(aElement, aNewStyleContext->GetPseudoType(),
GetElementTransitions(aElement, aNewStyleContext->GetPseudo(),
PR_TRUE);
if (!aElementTransitions) {
NS_WARNING("allocating ElementTransitions failed");
@ -646,17 +648,16 @@ nsTransitionManager::ConsiderStartingTransition(nsCSSProperty aProperty,
ElementTransitions*
nsTransitionManager::GetElementTransitions(nsIContent *aElement,
nsCSSPseudoElements::Type aPseudoType,
nsIAtom *aPseudo,
PRBool aCreateIfNeeded)
{
nsIAtom *propName;
if (aPseudoType == nsCSSPseudoElements::ePseudo_before) {
if (aPseudo == nsCSSPseudoElements::before) {
propName = nsGkAtoms::transitionsOfBeforeProperty;
} else if (aPseudoType == nsCSSPseudoElements::ePseudo_after) {
} else if (aPseudo == nsCSSPseudoElements::after) {
propName = nsGkAtoms::transitionsOfAfterProperty;
} else {
NS_ASSERTION(aPseudoType == nsCSSPseudoElements::ePseudo_NotPseudoElement ||
!aCreateIfNeeded,
NS_ASSERTION(!aPseudo || !aCreateIfNeeded,
"should never try to create transitions for pseudo "
"other than :before or :after");
propName = nsGkAtoms::transitionsProperty;
@ -710,7 +711,7 @@ NS_IMPL_QUERY_INTERFACE1(nsTransitionManager, nsIStyleRuleProcessor)
nsresult
nsTransitionManager::WalkTransitionRule(RuleProcessorData* aData,
nsCSSPseudoElements::Type aPseudoType)
nsIAtom *aPseudo)
{
if (!aData->mPresContext->IsProcessingAnimationStyleChange()) {
// If we're processing a normal style change rather than one from
@ -725,7 +726,7 @@ nsTransitionManager::WalkTransitionRule(RuleProcessorData* aData,
}
ElementTransitions *et =
GetElementTransitions(aData->mContent, aPseudoType, PR_FALSE);
GetElementTransitions(aData->mContent, aPseudo, PR_FALSE);
if (!et) {
return NS_OK;
}
@ -745,36 +746,20 @@ nsTransitionManager::RulesMatching(ElementRuleProcessorData* aData)
{
NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext,
"pres context mismatch");
return WalkTransitionRule(aData,
nsCSSPseudoElements::ePseudo_NotPseudoElement);
return WalkTransitionRule(aData, nsnull);
}
NS_IMETHODIMP
nsTransitionManager::RulesMatching(PseudoElementRuleProcessorData* aData)
nsTransitionManager::RulesMatching(PseudoRuleProcessorData* aData)
{
NS_ABORT_IF_FALSE(aData->mPresContext == mPresContext,
"pres context mismatch");
// Note: If we're the only thing keeping a pseudo-element frame alive
// (per ProbePseudoStyleContext), we still want to keep it alive, so
// this is ok.
return WalkTransitionRule(aData, aData->mPseudoType);
return WalkTransitionRule(aData, aData->mPseudoTag);
}
NS_IMETHODIMP
nsTransitionManager::RulesMatching(AnonBoxRuleProcessorData* aData)
{
return NS_OK;
}
#ifdef MOZ_XUL
NS_IMETHODIMP
nsTransitionManager::RulesMatching(XULTreeRuleProcessorData* aData)
{
return NS_OK;
}
#endif
NS_IMETHODIMP
nsTransitionManager::HasStateDependentStyle(StateRuleProcessorData* aData,
nsReStyleHint* aResult)

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

@ -44,7 +44,6 @@
#include "nsCSSProperty.h"
#include "nsIStyleRuleProcessor.h"
#include "nsRefreshDriver.h"
#include "nsCSSPseudoElements.h"
class nsStyleContext;
class nsPresContext;
@ -86,11 +85,7 @@ public:
// nsIStyleRuleProcessor
NS_IMETHOD RulesMatching(ElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(PseudoElementRuleProcessorData* aData);
NS_IMETHOD RulesMatching(AnonBoxRuleProcessorData* aData);
#ifdef MOZ_XUL
NS_IMETHOD RulesMatching(XULTreeRuleProcessorData* aData);
#endif
NS_IMETHOD RulesMatching(PseudoRuleProcessorData* aData);
NS_IMETHOD HasStateDependentStyle(StateRuleProcessorData* aData,
nsReStyleHint* aResult);
virtual nsReStyleHint
@ -113,12 +108,11 @@ private:
PRBool *aStartedAny,
nsCSSPropertySet *aWhichStarted);
ElementTransitions* GetElementTransitions(nsIContent *aElement,
nsCSSPseudoElements::Type aPseudoType,
nsIAtom *aPseudo,
PRBool aCreateIfNeeded);
void AddElementTransitions(ElementTransitions* aElementTransitions);
void TransitionsRemoved();
nsresult WalkTransitionRule(RuleProcessorData* aData,
nsCSSPseudoElements::Type aPseudoType);
nsresult WalkTransitionRule(RuleProcessorData* aData, nsIAtom *aPseudo);
PRCList mElementTransitions;
nsPresContext *mPresContext;

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

@ -172,7 +172,6 @@ _TEST_FILES = test_acid3_test46.html \
media_queries_dynamic_xbl_style.css \
bug453896_iframe.html \
bug517224.sjs \
test_bug525952.html \
$(NULL)
_BROWSER_FILES = \

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

@ -1,47 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=525952
-->
<head>
<title>Test for Bug 525952</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525952">Mozilla Bug 525952</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 525952 **/
var bodies = document.querySelectorAll("::before, div::before, body");
is(bodies.length, 1, "Unexpected length");
is(bodies[0], document.body, "Unexpected element");
is(document.querySelector("div > ::after, body"), document.body,
"Unexpected return value");
var emptyList = document.querySelectorAll("::before, div::before");
is(emptyList.length, 0, "Unexpected empty list length");
is(document.querySelectorAll("div > ::after").length, 0,
"Pseudo-element matched something?");
is(document.body.mozMatchesSelector("::first-line"), false,
"body shouldn't match ::first-line");
is(document.body.mozMatchesSelector("::first-line, body"), true,
"body should match 'body'");
is(document.body.mozMatchesSelector("::first-line, body, ::first-letter"), true,
"body should match 'body' here too");
</script>
</pre>
</body>
</html>

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

@ -668,8 +668,9 @@ nsTableFrame::CreateAnonymousColGroupFrame(nsTableColGroupType aColGroupType)
nsIPresShell *shell = presContext->PresShell();
nsRefPtr<nsStyleContext> colGroupStyle;
colGroupStyle = shell->StyleSet()->
ResolveAnonymousBoxStyle(nsCSSAnonBoxes::tableColGroup, mStyleContext);
colGroupStyle = shell->StyleSet()->ResolvePseudoStyleFor(colGroupContent,
nsCSSAnonBoxes::tableColGroup,
mStyleContext);
// Create a col group frame
nsIFrame* newFrame = NS_NewTableColGroupFrame(shell, colGroupStyle);
if (newFrame) {
@ -732,8 +733,9 @@ nsTableFrame::AppendAnonymousColFrames(nsTableColGroupFrame* aColGroupFrame,
// col group
iContent = aColGroupFrame->GetContent();
parentStyleContext = aColGroupFrame->GetStyleContext();
styleContext = shell->StyleSet()->
ResolveAnonymousBoxStyle(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");

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

@ -101,8 +101,8 @@ nsTreeStyleCache::GetStyleContext(nsICSSPseudoComparator* aComparator,
if (!result) {
// We missed the cache. Resolve this pseudo-style.
result = aPresContext->StyleSet()->
ResolveXULTreePseudoStyle(aContent, aPseudoElement,
aContext, aComparator).get();
ResolvePseudoStyleFor(aContent, aPseudoElement,
aContext, aComparator).get();
// Put the style context in our table, transferring the owning reference to the table.
if (!mCache) {