зеркало из https://github.com/mozilla/pjs.git
made parent context no longer be optional on re-resolve style context method
This commit is contained in:
Родитель
90eeb983e2
Коммит
e3cd00d3b0
|
@ -1969,7 +1969,15 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// apply changes
|
||||
if (PR_TRUE == restyle) {
|
||||
frame->ReResolveStyleContext(aPresContext, nsnull);
|
||||
nsIStyleContext* frameContext;
|
||||
frame->GetStyleContext(frameContext);
|
||||
NS_ASSERTION(nsnull != frameContext, "frame must have style context");
|
||||
if (nsnull != frameContext) {
|
||||
nsIStyleContext* parentContext = frameContext->GetParent();
|
||||
frame->ReResolveStyleContext(aPresContext, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_RELEASE(frameContext);
|
||||
}
|
||||
}
|
||||
if (PR_TRUE == reframe) {
|
||||
NS_NOTYETIMPLEMENTED("frame change reflow");
|
||||
|
|
|
@ -171,13 +171,14 @@ public:
|
|||
NS_IMETHOD GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const = 0;
|
||||
|
||||
/**
|
||||
* Re-resolve style context and either reset or re-resolve children
|
||||
* This is only used when style context parentage has to change for reflow
|
||||
* purposes. aNewParentContext may be null, in which case the old parent
|
||||
* will be used
|
||||
* Re-resolve style context and either reset or re-resolve children.
|
||||
* This is called in response to style changes that require context
|
||||
* re-resolution.
|
||||
* This is also used when style context parentage has to change for
|
||||
* reflow purposes.
|
||||
*/
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
nsIStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Accessor functions for geometric and content parent.
|
||||
|
|
|
@ -190,14 +190,14 @@ NS_METHOD nsContainerFrame::FirstChild(nsIFrame*& aFirstChild) const
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext)
|
||||
nsIStyleContext* aParentContext)
|
||||
{
|
||||
nsIStyleContext* oldContext = mStyleContext;
|
||||
nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aNewParentContext);
|
||||
nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aParentContext);
|
||||
if (oldContext != mStyleContext) {
|
||||
nsIFrame* child = mFirstChild;
|
||||
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
|
||||
result = child->ReResolveStyleContext(aPresContext, nsnull);
|
||||
result = child->ReResolveStyleContext(aPresContext, mStyleContext);
|
||||
child->GetNextSibling(child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,10 @@ public:
|
|||
NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
|
||||
|
||||
// re-resolve style context for self and children as necessary
|
||||
// Subclasses need to override if they add child lists
|
||||
// Subclasses need to override if they add child lists or
|
||||
// if they alter normal style context inheritance
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext);
|
||||
nsIStyleContext* aParentContext);
|
||||
|
||||
// Debugging
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
|
||||
|
|
|
@ -387,26 +387,19 @@ NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*&
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext)
|
||||
nsIStyleContext* aParentContext)
|
||||
{
|
||||
NS_ASSERTION(nsnull != mStyleContext, "null style context");
|
||||
if (nsnull != mStyleContext) {
|
||||
nsIAtom* pseudoTag = nsnull;
|
||||
mStyleContext->GetPseudoType(pseudoTag);
|
||||
nsIStyleContext* parent = aNewParentContext;
|
||||
if (nsnull == aNewParentContext) {
|
||||
parent = mStyleContext->GetParent();
|
||||
}
|
||||
nsIStyleContext* newContext;
|
||||
if (nsnull != pseudoTag) {
|
||||
newContext =
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, parent);
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext);
|
||||
}
|
||||
else {
|
||||
newContext = aPresContext->ResolveStyleContextFor(mContent, parent);
|
||||
}
|
||||
if (nsnull == aNewParentContext) {
|
||||
NS_IF_RELEASE(parent);
|
||||
newContext = aPresContext->ResolveStyleContextFor(mContent, aParentContext);
|
||||
}
|
||||
|
||||
NS_ASSERTION(nsnull != newContext, "failed to get new style context");
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
|
||||
const nsStyleStruct*& aStyleStruct) const;
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext);
|
||||
nsIStyleContext* aParentContext);
|
||||
NS_IMETHOD GetContentParent(nsIFrame*& aParent) const;
|
||||
NS_IMETHOD SetContentParent(const nsIFrame* aParent);
|
||||
NS_IMETHOD GetGeometricParent(nsIFrame*& aParent) const;
|
||||
|
|
|
@ -171,13 +171,14 @@ public:
|
|||
NS_IMETHOD GetStyleData(nsStyleStructID aSID, const nsStyleStruct*& aStyleStruct) const = 0;
|
||||
|
||||
/**
|
||||
* Re-resolve style context and either reset or re-resolve children
|
||||
* This is only used when style context parentage has to change for reflow
|
||||
* purposes. aNewParentContext may be null, in which case the old parent
|
||||
* will be used
|
||||
* Re-resolve style context and either reset or re-resolve children.
|
||||
* This is called in response to style changes that require context
|
||||
* re-resolution.
|
||||
* This is also used when style context parentage has to change for
|
||||
* reflow purposes.
|
||||
*/
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext) = 0;
|
||||
nsIStyleContext* aParentContext) = 0;
|
||||
|
||||
/**
|
||||
* Accessor functions for geometric and content parent.
|
||||
|
|
|
@ -190,14 +190,14 @@ NS_METHOD nsContainerFrame::FirstChild(nsIFrame*& aFirstChild) const
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsContainerFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext)
|
||||
nsIStyleContext* aParentContext)
|
||||
{
|
||||
nsIStyleContext* oldContext = mStyleContext;
|
||||
nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aNewParentContext);
|
||||
nsresult result = nsFrame::ReResolveStyleContext(aPresContext, aParentContext);
|
||||
if (oldContext != mStyleContext) {
|
||||
nsIFrame* child = mFirstChild;
|
||||
while ((NS_SUCCEEDED(result)) && (nsnull != child)) {
|
||||
result = child->ReResolveStyleContext(aPresContext, nsnull);
|
||||
result = child->ReResolveStyleContext(aPresContext, mStyleContext);
|
||||
child->GetNextSibling(child);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,9 +60,10 @@ public:
|
|||
NS_IMETHOD FirstChild(nsIFrame*& aFirstChild) const;
|
||||
|
||||
// re-resolve style context for self and children as necessary
|
||||
// Subclasses need to override if they add child lists
|
||||
// Subclasses need to override if they add child lists or
|
||||
// if they alter normal style context inheritance
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext);
|
||||
nsIStyleContext* aParentContext);
|
||||
|
||||
// Debugging
|
||||
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0, nsIListFilter *aFilter = nsnull) const;
|
||||
|
|
|
@ -387,26 +387,19 @@ NS_IMETHODIMP nsFrame::GetStyleData(nsStyleStructID aSID, const nsStyleStruct*&
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsFrame::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext)
|
||||
nsIStyleContext* aParentContext)
|
||||
{
|
||||
NS_ASSERTION(nsnull != mStyleContext, "null style context");
|
||||
if (nsnull != mStyleContext) {
|
||||
nsIAtom* pseudoTag = nsnull;
|
||||
mStyleContext->GetPseudoType(pseudoTag);
|
||||
nsIStyleContext* parent = aNewParentContext;
|
||||
if (nsnull == aNewParentContext) {
|
||||
parent = mStyleContext->GetParent();
|
||||
}
|
||||
nsIStyleContext* newContext;
|
||||
if (nsnull != pseudoTag) {
|
||||
newContext =
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, parent);
|
||||
aPresContext->ResolvePseudoStyleContextFor(mContent, pseudoTag, aParentContext);
|
||||
}
|
||||
else {
|
||||
newContext = aPresContext->ResolveStyleContextFor(mContent, parent);
|
||||
}
|
||||
if (nsnull == aNewParentContext) {
|
||||
NS_IF_RELEASE(parent);
|
||||
newContext = aPresContext->ResolveStyleContextFor(mContent, aParentContext);
|
||||
}
|
||||
|
||||
NS_ASSERTION(nsnull != newContext, "failed to get new style context");
|
||||
|
|
|
@ -122,7 +122,7 @@ public:
|
|||
NS_IMETHOD GetStyleData(nsStyleStructID aSID,
|
||||
const nsStyleStruct*& aStyleStruct) const;
|
||||
NS_IMETHOD ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIStyleContext* aNewParentContext);
|
||||
nsIStyleContext* aParentContext);
|
||||
NS_IMETHOD GetContentParent(nsIFrame*& aParent) const;
|
||||
NS_IMETHOD SetContentParent(const nsIFrame* aParent);
|
||||
NS_IMETHOD GetGeometricParent(nsIFrame*& aParent) const;
|
||||
|
|
|
@ -1969,7 +1969,15 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// apply changes
|
||||
if (PR_TRUE == restyle) {
|
||||
frame->ReResolveStyleContext(aPresContext, nsnull);
|
||||
nsIStyleContext* frameContext;
|
||||
frame->GetStyleContext(frameContext);
|
||||
NS_ASSERTION(nsnull != frameContext, "frame must have style context");
|
||||
if (nsnull != frameContext) {
|
||||
nsIStyleContext* parentContext = frameContext->GetParent();
|
||||
frame->ReResolveStyleContext(aPresContext, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_RELEASE(frameContext);
|
||||
}
|
||||
}
|
||||
if (PR_TRUE == reframe) {
|
||||
NS_NOTYETIMPLEMENTED("frame change reflow");
|
||||
|
|
|
@ -1969,7 +1969,15 @@ HTMLStyleSheetImpl::AttributeChanged(nsIPresContext* aPresContext,
|
|||
|
||||
// apply changes
|
||||
if (PR_TRUE == restyle) {
|
||||
frame->ReResolveStyleContext(aPresContext, nsnull);
|
||||
nsIStyleContext* frameContext;
|
||||
frame->GetStyleContext(frameContext);
|
||||
NS_ASSERTION(nsnull != frameContext, "frame must have style context");
|
||||
if (nsnull != frameContext) {
|
||||
nsIStyleContext* parentContext = frameContext->GetParent();
|
||||
frame->ReResolveStyleContext(aPresContext, parentContext);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_RELEASE(frameContext);
|
||||
}
|
||||
}
|
||||
if (PR_TRUE == reframe) {
|
||||
NS_NOTYETIMPLEMENTED("frame change reflow");
|
||||
|
|
Загрузка…
Ссылка в новой задаче