mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-07 23:43:37 +00:00
reversion of patch for 92868, to repair severe regression (129827, a=drivers
This commit is contained in:
parent
ee712156db
commit
146f2a192d
@ -10270,15 +10270,9 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
// Get the frame associated with the content which is the highest in the frame tree
|
||||
nsIFrame* primaryFrame;
|
||||
shell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
// Get the frame associated with the content whose style context is highest in the style context tree
|
||||
nsIFrame* primaryStyleFrame = nsnull;
|
||||
if (primaryFrame) {
|
||||
primaryFrame->GetStyleContextProvider(aPresContext, &primaryStyleFrame);
|
||||
}
|
||||
nsIFrame* primaryFrame;
|
||||
|
||||
shell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
|
||||
PRBool reconstruct = PR_FALSE;
|
||||
PRBool restyle = PR_FALSE;
|
||||
@ -10370,8 +10364,8 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
// This style rule exists and we need to blow away any computed data that this
|
||||
// rule cached in the rule tree.
|
||||
rule = getter_AddRefs((nsIStyleRule*)val.GetISupportsValue());
|
||||
if (primaryStyleFrame)
|
||||
primaryStyleFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
if (primaryFrame)
|
||||
primaryFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
else {
|
||||
// We might be in the undisplayed map. Retrieve the style context from there.
|
||||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
|
@ -1271,11 +1271,13 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
} else {
|
||||
// get the parent context from the frame (indirectly)
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
aFrame->GetStyleContextProvider(aPresContext, &providerFrame); ENSURE_TRUE(providerFrame);
|
||||
nsCOMPtr<nsIStyleContext> providerContext;
|
||||
providerFrame->GetStyleContext(getter_AddRefs(providerContext)); ENSURE_TRUE(providerContext);
|
||||
aParentContext = providerContext->GetParent(); // released later
|
||||
// aParentContext could still be null, since some contexts don't have parents
|
||||
nsContextProviderRelationship relationship;
|
||||
aFrame->GetParentStyleContextProvider(aPresContext,&providerFrame,relationship);
|
||||
if (providerFrame) {
|
||||
providerFrame->GetStyleContext(&aParentContext);
|
||||
} else {
|
||||
// no parent context provider: it is OK, some frames' contexts do not have parents
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(frameType);
|
||||
} else {
|
||||
@ -1678,7 +1680,7 @@ CaptureChange(nsIStyleContext* aOldContext, nsIStyleContext* aNewContext,
|
||||
void
|
||||
FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIStyleContext* aParentContextIn,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsIContent* aParentContent,
|
||||
PRInt32 aAttrNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
@ -1686,6 +1688,8 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
PRInt32 aMinChange,
|
||||
PRInt32& aResultChange)
|
||||
{
|
||||
nsIFrame *resolvedDescendant = nsnull;
|
||||
|
||||
nsIStyleContext* oldContext = nsnull;
|
||||
nsresult result = aFrame->GetStyleContext(&oldContext);
|
||||
if (NS_SUCCEEDED(result) && oldContext) {
|
||||
@ -1708,46 +1712,42 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
nsIStyleContext* parentContext = aParentContextIn;
|
||||
nsIFrame* resolvedDescendant = nsnull;
|
||||
// Get the frame providing the style context. If it differs from aFrame, then
|
||||
// reslove the provider first, since the provider's context is the parent of aFrame's
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
aFrame->GetStyleContextProvider(aPresContext, &providerFrame); ENSURE_TRUE(providerFrame);
|
||||
if (providerFrame == aFrame) {
|
||||
if (parentContext) {
|
||||
// addref the parent since it gets released later
|
||||
NS_ADDREF(parentContext);
|
||||
NOISY_TRACE_FRAME("non-null parent context provided: using it and assuming already resolved",aFrame);
|
||||
} else {
|
||||
nsCOMPtr<nsIStyleContext> frameContext;
|
||||
aFrame->GetStyleContext(getter_AddRefs(frameContext)); ENSURE_TRUE(frameContext);
|
||||
parentContext = frameContext->GetParent(); /* released later */ ENSURE_TRUE(parentContext);
|
||||
if (aParentContext == nsnull) {
|
||||
NOISY_TRACE_FRAME("null parent context in ReResolveStyle: getting provider frame for",aFrame);
|
||||
// get the parent context from the frame (indirectly)
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
nsContextProviderRelationship relationship;
|
||||
aFrame->GetParentStyleContextProvider(aPresContext,&providerFrame,relationship);
|
||||
if (providerFrame) {
|
||||
NOISY_TRACE("provider frame retrieved in ReResolveStyle: ");
|
||||
|
||||
// see if we need to recurse and resolve the provider frame first
|
||||
if (relationship != eContextProvider_Ancestor) {
|
||||
NOISY_TRACE("non-ancestor provider, recursing.\n");
|
||||
// provider is not an ancestor, so assume we have to reresolve it first
|
||||
ReResolveStyleContext(aPresContext, providerFrame, nsnull, content,
|
||||
aAttrNameSpaceID, aAttribute,
|
||||
aChangeList, aMinChange, aResultChange);
|
||||
resolvedDescendant = providerFrame;
|
||||
NOISY_TRACE("returned from recursion, descendant parent context provider resolved.\n");
|
||||
} else {
|
||||
NOISY_TRACE("ancestor provider, assuming already resolved.\n");
|
||||
}
|
||||
providerFrame->GetStyleContext(&aParentContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsIFrame* providerFrameParent;
|
||||
providerFrame->GetParent(&providerFrameParent); ENSURE_TRUE(providerFrameParent);
|
||||
NS_ASSERTION(providerFrameParent == aFrame, "invalid style context provider");
|
||||
// resolve the provider first
|
||||
nsCOMPtr<nsIStyleContext> providerContext;
|
||||
providerFrame->GetStyleContext(getter_AddRefs(providerContext)); ENSURE_TRUE(providerContext);
|
||||
nsIStyleContext* providerContextParent = providerContext->GetParent(); ENSURE_TRUE(providerContextParent);
|
||||
ReResolveStyleContext(aPresContext, providerFrame, providerContextParent, content,
|
||||
aAttrNameSpaceID, aAttribute, aChangeList, aMinChange, aResultChange);
|
||||
NS_RELEASE(providerContextParent);
|
||||
// the provider's new context becomes the parent context of aFrame's context
|
||||
providerFrame->GetStyleContext(&parentContext); /* released later */ ENSURE_TRUE(parentContext);
|
||||
resolvedDescendant = providerFrame; // don't want to re-resolve the provider again
|
||||
} else {
|
||||
// addref the parent passed in so we can release it at the end
|
||||
NS_ADDREF(aParentContext);
|
||||
NOISY_TRACE_FRAME("non-null parent context provided: using it and assuming already resolved",aFrame);
|
||||
}
|
||||
|
||||
// do primary context
|
||||
nsIStyleContext* newContext = nsnull;
|
||||
if (pseudoTag) {
|
||||
nsIContent* pseudoContent = (aParentContent ? aParentContent : localContent);
|
||||
aPresContext->ResolvePseudoStyleContextFor(pseudoContent, pseudoTag, parentContext, PR_FALSE,
|
||||
&newContext);
|
||||
NS_RELEASE(pseudoTag);
|
||||
aPresContext->ResolvePseudoStyleContextFor(pseudoContent, pseudoTag, aParentContext, PR_FALSE,
|
||||
&newContext);
|
||||
NS_RELEASE(pseudoTag);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(localContent,
|
||||
@ -1763,10 +1763,10 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (content->IsContentOfType(nsIContent::eELEMENT) &&
|
||||
frameType != nsLayoutAtoms::placeholderFrame) {
|
||||
aPresContext->ResolveStyleContextFor(content, parentContext,
|
||||
aPresContext->ResolveStyleContextFor(content, aParentContext,
|
||||
PR_TRUE, &newContext);
|
||||
} else {
|
||||
aPresContext->ResolveStyleContextForNonElement(parentContext,
|
||||
aPresContext->ResolveStyleContextForNonElement(aParentContext,
|
||||
PR_TRUE, &newContext);
|
||||
}
|
||||
}
|
||||
@ -1922,7 +1922,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
else { // regular child frame
|
||||
if (child != resolvedDescendant) {
|
||||
ReResolveStyleContext(aPresContext, child, newContext, content,
|
||||
ReResolveStyleContext(aPresContext, child, nsnull, content,
|
||||
aAttrNameSpaceID, aAttribute,
|
||||
aChangeList, aMinChange, childChange);
|
||||
} else {
|
||||
@ -1941,7 +1941,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
|
||||
NS_RELEASE(newContext);
|
||||
NS_IF_RELEASE(localContent);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_IF_RELEASE(aParentContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1096,15 +1096,26 @@ public:
|
||||
PRBool aCommandAdded) = 0;
|
||||
|
||||
/**
|
||||
* Get the frame that is the primary frame associated with the content.
|
||||
* aProviderFrame == aFrame except in the case of an outer table, in
|
||||
* which case it is the inner table.
|
||||
* Called in style ReResolution to get the frame that contains the style context that is the
|
||||
* parent style context for this frame.
|
||||
* @param aProviderFrame: set to the frame who's style context is to be used as the parent context
|
||||
* in reresolving style for this frame. Note that this may or may not be the
|
||||
* parent frame of this frame.
|
||||
* @param aRelatioship : indicates how the provider frame relates to this frame:
|
||||
* i.e. if the parent context provider frame is a child of this frame,
|
||||
* then aRelationship must be set to eContextProvider_Descendant,
|
||||
* if a parent, grandparent etc. set to eContextProvider_Ancestor
|
||||
* (this is used to control recursion in style reresolution)
|
||||
*
|
||||
* @param aPresContext: PresContext
|
||||
* @param aProviderFrame: Set to the primary frame associated with the content
|
||||
* if return value is NS_OK then aProvdierFrame must be set, otherwise it is ignored.
|
||||
*
|
||||
* PRECONDITIONS: aProviderFrame cannot be null
|
||||
* POSTCONDITIONS: *aProfiderFrame will be a valid frame if this routine succeeds
|
||||
* aRelationship will be set to a legal enum value indicating the correct relationship
|
||||
*/
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame) = 0;
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship) = 0;
|
||||
|
||||
/**
|
||||
* Determines whether a frame is visible for painting
|
||||
|
@ -3994,13 +3994,15 @@ nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame)
|
||||
nsFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aPresContext && aProviderFrame, "null arguments: aPresContext and-or aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
// parent context provider is the parent frame by default
|
||||
*aProviderFrame = this;
|
||||
*aProviderFrame = mParent;
|
||||
aRelationship = eContextProvider_Ancestor;
|
||||
}
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -282,8 +282,9 @@ public:
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame);
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
// Check Style Visibility and mState for Selection (when printing)
|
||||
NS_IMETHOD IsVisibleForPainting(nsIPresContext * aPresContext,
|
||||
@ -527,12 +528,4 @@ protected:
|
||||
#endif
|
||||
// End Display Reflow Debugging
|
||||
|
||||
// similar to NS_ENSURE_TRUE but with no return value
|
||||
#define ENSURE_TRUE(x) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!(x)) { \
|
||||
NS_WARNING("ENSURE_TRUE(" #x ") failed"); \
|
||||
return; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#endif /* nsFrame_h___ */
|
||||
|
@ -1096,15 +1096,26 @@ public:
|
||||
PRBool aCommandAdded) = 0;
|
||||
|
||||
/**
|
||||
* Get the frame that is the primary frame associated with the content.
|
||||
* aProviderFrame == aFrame except in the case of an outer table, in
|
||||
* which case it is the inner table.
|
||||
* Called in style ReResolution to get the frame that contains the style context that is the
|
||||
* parent style context for this frame.
|
||||
* @param aProviderFrame: set to the frame who's style context is to be used as the parent context
|
||||
* in reresolving style for this frame. Note that this may or may not be the
|
||||
* parent frame of this frame.
|
||||
* @param aRelatioship : indicates how the provider frame relates to this frame:
|
||||
* i.e. if the parent context provider frame is a child of this frame,
|
||||
* then aRelationship must be set to eContextProvider_Descendant,
|
||||
* if a parent, grandparent etc. set to eContextProvider_Ancestor
|
||||
* (this is used to control recursion in style reresolution)
|
||||
*
|
||||
* @param aPresContext: PresContext
|
||||
* @param aProviderFrame: Set to the primary frame associated with the content
|
||||
* if return value is NS_OK then aProvdierFrame must be set, otherwise it is ignored.
|
||||
*
|
||||
* PRECONDITIONS: aProviderFrame cannot be null
|
||||
* POSTCONDITIONS: *aProfiderFrame will be a valid frame if this routine succeeds
|
||||
* aRelationship will be set to a legal enum value indicating the correct relationship
|
||||
*/
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame) = 0;
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship) = 0;
|
||||
|
||||
/**
|
||||
* Determines whether a frame is visible for painting
|
||||
|
@ -3994,13 +3994,15 @@ nsFrame::ReflowCommandNotify(nsIPresShell* aShell,
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsFrame::GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame)
|
||||
nsFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aPresContext && aProviderFrame, "null arguments: aPresContext and-or aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
// parent context provider is the parent frame by default
|
||||
*aProviderFrame = this;
|
||||
*aProviderFrame = mParent;
|
||||
aRelationship = eContextProvider_Ancestor;
|
||||
}
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -282,8 +282,9 @@ public:
|
||||
NS_IMETHOD GetAccessible(nsIAccessible** aAccessible);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame);
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
// Check Style Visibility and mState for Selection (when printing)
|
||||
NS_IMETHOD IsVisibleForPainting(nsIPresContext * aPresContext,
|
||||
@ -527,12 +528,4 @@ protected:
|
||||
#endif
|
||||
// End Display Reflow Debugging
|
||||
|
||||
// similar to NS_ENSURE_TRUE but with no return value
|
||||
#define ENSURE_TRUE(x) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!(x)) { \
|
||||
NS_WARNING("ENSURE_TRUE(" #x ") failed"); \
|
||||
return; \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
#endif /* nsFrame_h___ */
|
||||
|
@ -1271,11 +1271,13 @@ VerifyContextParent(nsIPresContext* aPresContext, nsIFrame* aFrame,
|
||||
} else {
|
||||
// get the parent context from the frame (indirectly)
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
aFrame->GetStyleContextProvider(aPresContext, &providerFrame); ENSURE_TRUE(providerFrame);
|
||||
nsCOMPtr<nsIStyleContext> providerContext;
|
||||
providerFrame->GetStyleContext(getter_AddRefs(providerContext)); ENSURE_TRUE(providerContext);
|
||||
aParentContext = providerContext->GetParent(); // released later
|
||||
// aParentContext could still be null, since some contexts don't have parents
|
||||
nsContextProviderRelationship relationship;
|
||||
aFrame->GetParentStyleContextProvider(aPresContext,&providerFrame,relationship);
|
||||
if (providerFrame) {
|
||||
providerFrame->GetStyleContext(&aParentContext);
|
||||
} else {
|
||||
// no parent context provider: it is OK, some frames' contexts do not have parents
|
||||
}
|
||||
}
|
||||
NS_IF_RELEASE(frameType);
|
||||
} else {
|
||||
@ -1678,7 +1680,7 @@ CaptureChange(nsIStyleContext* aOldContext, nsIStyleContext* aNewContext,
|
||||
void
|
||||
FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
nsIFrame* aFrame,
|
||||
nsIStyleContext* aParentContextIn,
|
||||
nsIStyleContext* aParentContext,
|
||||
nsIContent* aParentContent,
|
||||
PRInt32 aAttrNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
@ -1686,6 +1688,8 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
PRInt32 aMinChange,
|
||||
PRInt32& aResultChange)
|
||||
{
|
||||
nsIFrame *resolvedDescendant = nsnull;
|
||||
|
||||
nsIStyleContext* oldContext = nsnull;
|
||||
nsresult result = aFrame->GetStyleContext(&oldContext);
|
||||
if (NS_SUCCEEDED(result) && oldContext) {
|
||||
@ -1708,46 +1712,42 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
}
|
||||
|
||||
nsIStyleContext* parentContext = aParentContextIn;
|
||||
nsIFrame* resolvedDescendant = nsnull;
|
||||
// Get the frame providing the style context. If it differs from aFrame, then
|
||||
// reslove the provider first, since the provider's context is the parent of aFrame's
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
aFrame->GetStyleContextProvider(aPresContext, &providerFrame); ENSURE_TRUE(providerFrame);
|
||||
if (providerFrame == aFrame) {
|
||||
if (parentContext) {
|
||||
// addref the parent since it gets released later
|
||||
NS_ADDREF(parentContext);
|
||||
NOISY_TRACE_FRAME("non-null parent context provided: using it and assuming already resolved",aFrame);
|
||||
} else {
|
||||
nsCOMPtr<nsIStyleContext> frameContext;
|
||||
aFrame->GetStyleContext(getter_AddRefs(frameContext)); ENSURE_TRUE(frameContext);
|
||||
parentContext = frameContext->GetParent(); /* released later */ ENSURE_TRUE(parentContext);
|
||||
if (aParentContext == nsnull) {
|
||||
NOISY_TRACE_FRAME("null parent context in ReResolveStyle: getting provider frame for",aFrame);
|
||||
// get the parent context from the frame (indirectly)
|
||||
nsIFrame* providerFrame = nsnull;
|
||||
nsContextProviderRelationship relationship;
|
||||
aFrame->GetParentStyleContextProvider(aPresContext,&providerFrame,relationship);
|
||||
if (providerFrame) {
|
||||
NOISY_TRACE("provider frame retrieved in ReResolveStyle: ");
|
||||
|
||||
// see if we need to recurse and resolve the provider frame first
|
||||
if (relationship != eContextProvider_Ancestor) {
|
||||
NOISY_TRACE("non-ancestor provider, recursing.\n");
|
||||
// provider is not an ancestor, so assume we have to reresolve it first
|
||||
ReResolveStyleContext(aPresContext, providerFrame, nsnull, content,
|
||||
aAttrNameSpaceID, aAttribute,
|
||||
aChangeList, aMinChange, aResultChange);
|
||||
resolvedDescendant = providerFrame;
|
||||
NOISY_TRACE("returned from recursion, descendant parent context provider resolved.\n");
|
||||
} else {
|
||||
NOISY_TRACE("ancestor provider, assuming already resolved.\n");
|
||||
}
|
||||
providerFrame->GetStyleContext(&aParentContext);
|
||||
}
|
||||
}
|
||||
else {
|
||||
nsIFrame* providerFrameParent;
|
||||
providerFrame->GetParent(&providerFrameParent); ENSURE_TRUE(providerFrameParent);
|
||||
NS_ASSERTION(providerFrameParent == aFrame, "invalid style context provider");
|
||||
// resolve the provider first
|
||||
nsCOMPtr<nsIStyleContext> providerContext;
|
||||
providerFrame->GetStyleContext(getter_AddRefs(providerContext)); ENSURE_TRUE(providerContext);
|
||||
nsIStyleContext* providerContextParent = providerContext->GetParent(); ENSURE_TRUE(providerContextParent);
|
||||
ReResolveStyleContext(aPresContext, providerFrame, providerContextParent, content,
|
||||
aAttrNameSpaceID, aAttribute, aChangeList, aMinChange, aResultChange);
|
||||
NS_RELEASE(providerContextParent);
|
||||
// the provider's new context becomes the parent context of aFrame's context
|
||||
providerFrame->GetStyleContext(&parentContext); /* released later */ ENSURE_TRUE(parentContext);
|
||||
resolvedDescendant = providerFrame; // don't want to re-resolve the provider again
|
||||
} else {
|
||||
// addref the parent passed in so we can release it at the end
|
||||
NS_ADDREF(aParentContext);
|
||||
NOISY_TRACE_FRAME("non-null parent context provided: using it and assuming already resolved",aFrame);
|
||||
}
|
||||
|
||||
// do primary context
|
||||
nsIStyleContext* newContext = nsnull;
|
||||
if (pseudoTag) {
|
||||
nsIContent* pseudoContent = (aParentContent ? aParentContent : localContent);
|
||||
aPresContext->ResolvePseudoStyleContextFor(pseudoContent, pseudoTag, parentContext, PR_FALSE,
|
||||
&newContext);
|
||||
NS_RELEASE(pseudoTag);
|
||||
aPresContext->ResolvePseudoStyleContextFor(pseudoContent, pseudoTag, aParentContext, PR_FALSE,
|
||||
&newContext);
|
||||
NS_RELEASE(pseudoTag);
|
||||
}
|
||||
else {
|
||||
NS_ASSERTION(localContent,
|
||||
@ -1763,10 +1763,10 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
aFrame->GetFrameType(getter_AddRefs(frameType));
|
||||
if (content->IsContentOfType(nsIContent::eELEMENT) &&
|
||||
frameType != nsLayoutAtoms::placeholderFrame) {
|
||||
aPresContext->ResolveStyleContextFor(content, parentContext,
|
||||
aPresContext->ResolveStyleContextFor(content, aParentContext,
|
||||
PR_TRUE, &newContext);
|
||||
} else {
|
||||
aPresContext->ResolveStyleContextForNonElement(parentContext,
|
||||
aPresContext->ResolveStyleContextForNonElement(aParentContext,
|
||||
PR_TRUE, &newContext);
|
||||
}
|
||||
}
|
||||
@ -1922,7 +1922,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
}
|
||||
else { // regular child frame
|
||||
if (child != resolvedDescendant) {
|
||||
ReResolveStyleContext(aPresContext, child, newContext, content,
|
||||
ReResolveStyleContext(aPresContext, child, nsnull, content,
|
||||
aAttrNameSpaceID, aAttribute,
|
||||
aChangeList, aMinChange, childChange);
|
||||
} else {
|
||||
@ -1941,7 +1941,7 @@ FrameManager::ReResolveStyleContext(nsIPresContext* aPresContext,
|
||||
|
||||
NS_RELEASE(newContext);
|
||||
NS_IF_RELEASE(localContent);
|
||||
NS_IF_RELEASE(parentContext);
|
||||
NS_IF_RELEASE(aParentContext);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10270,15 +10270,9 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
|
||||
nsCOMPtr<nsIPresShell> shell;
|
||||
aPresContext->GetShell(getter_AddRefs(shell));
|
||||
|
||||
// Get the frame associated with the content which is the highest in the frame tree
|
||||
nsIFrame* primaryFrame;
|
||||
shell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
// Get the frame associated with the content whose style context is highest in the style context tree
|
||||
nsIFrame* primaryStyleFrame = nsnull;
|
||||
if (primaryFrame) {
|
||||
primaryFrame->GetStyleContextProvider(aPresContext, &primaryStyleFrame);
|
||||
}
|
||||
nsIFrame* primaryFrame;
|
||||
|
||||
shell->GetPrimaryFrameFor(aContent, &primaryFrame);
|
||||
|
||||
PRBool reconstruct = PR_FALSE;
|
||||
PRBool restyle = PR_FALSE;
|
||||
@ -10370,8 +10364,8 @@ nsCSSFrameConstructor::AttributeChanged(nsIPresContext* aPresContext,
|
||||
// This style rule exists and we need to blow away any computed data that this
|
||||
// rule cached in the rule tree.
|
||||
rule = getter_AddRefs((nsIStyleRule*)val.GetISupportsValue());
|
||||
if (primaryStyleFrame)
|
||||
primaryStyleFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
if (primaryFrame)
|
||||
primaryFrame->GetStyleContext(getter_AddRefs(styleContext));
|
||||
else {
|
||||
// We might be in the undisplayed map. Retrieve the style context from there.
|
||||
nsCOMPtr<nsIFrameManager> frameManager;
|
||||
|
@ -1756,6 +1756,39 @@ nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext,
|
||||
|
||||
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
||||
|
||||
// GetParentStyleContextProvider:
|
||||
// The grandparent frame is he parent style context provider
|
||||
// That is, the parent of the outerTableFrame is the frame that has our parent style context
|
||||
// NOTE: if ther is a placeholder frame for the outer table, then we use its grandparent frame.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aProviderFrame, "null argument aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
nsIFrame* f;
|
||||
GetParent(&f);
|
||||
NS_ASSERTION(f,"TableFrame has no parent frame");
|
||||
if (f) {
|
||||
// see if there is a placeholder frame representing our parent's place in the frame tree
|
||||
// if there is, we get the parent of that frame as our surrogate grandparent
|
||||
nsIFrame* placeholder = nsnull;
|
||||
GetPlaceholderFor(*aPresContext,*f,&placeholder);
|
||||
if (placeholder) {
|
||||
f = placeholder;
|
||||
}
|
||||
f->GetParent(&f);
|
||||
NS_ASSERTION(f,"TableFrame has no grandparent frame");
|
||||
}
|
||||
// parent context provider is the grandparent frame
|
||||
*aProviderFrame = f;
|
||||
aRelationship = eContextProvider_Ancestor;
|
||||
}
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX this could be made more general to handle row modifications that change the
|
||||
// table height, but first we need to scrutinize every Invalidate
|
||||
static void
|
||||
|
@ -370,6 +370,10 @@ public:
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
static nsMargin GetPadding(const nsHTMLReflowState& aReflowState,
|
||||
const nsTableCellFrame* aCellFrame);
|
||||
|
||||
|
@ -414,20 +414,23 @@ NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIPresContext* aPresContext,
|
||||
return result;
|
||||
}
|
||||
|
||||
// GetStyleContextProvider:
|
||||
// The innerTableFame is the style context provider, which is cached in a data member
|
||||
// GetParentStyleContextProvider:
|
||||
// The innerTableFame is he parent style context provider
|
||||
// Fortunately, we cache that as a data member, so just return the cached pointer value
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame)
|
||||
nsTableOuterFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aProviderFrame && aPresContext, "null argument: aPresContext and-or aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
if (mInnerTableFrame)
|
||||
*aProviderFrame = mInnerTableFrame;
|
||||
else
|
||||
*aProviderFrame = this;
|
||||
// parent context provider is the innerTableFrame
|
||||
NS_ASSERTION(mInnerTableFrame, "innerTableFrame should not be null");
|
||||
*aProviderFrame = mInnerTableFrame;
|
||||
aRelationship = eContextProvider_Descendant;
|
||||
}
|
||||
return (aProviderFrame && mInnerTableFrame) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// INCREMENTAL REFLOW HELPER FUNCTIONS
|
||||
|
@ -171,8 +171,9 @@ public:
|
||||
*/
|
||||
nscoord GetMinCaptionWidth();
|
||||
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame);
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
/*---------------- nsITableLayout methods ------------------------*/
|
||||
|
||||
|
@ -1756,6 +1756,39 @@ nsTableFrame::SetColumnDimensions(nsIPresContext* aPresContext,
|
||||
|
||||
// SEC: TODO need to worry about continuing frames prev/next in flow for splitting across pages.
|
||||
|
||||
// GetParentStyleContextProvider:
|
||||
// The grandparent frame is he parent style context provider
|
||||
// That is, the parent of the outerTableFrame is the frame that has our parent style context
|
||||
// NOTE: if ther is a placeholder frame for the outer table, then we use its grandparent frame.
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsTableFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aProviderFrame, "null argument aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
nsIFrame* f;
|
||||
GetParent(&f);
|
||||
NS_ASSERTION(f,"TableFrame has no parent frame");
|
||||
if (f) {
|
||||
// see if there is a placeholder frame representing our parent's place in the frame tree
|
||||
// if there is, we get the parent of that frame as our surrogate grandparent
|
||||
nsIFrame* placeholder = nsnull;
|
||||
GetPlaceholderFor(*aPresContext,*f,&placeholder);
|
||||
if (placeholder) {
|
||||
f = placeholder;
|
||||
}
|
||||
f->GetParent(&f);
|
||||
NS_ASSERTION(f,"TableFrame has no grandparent frame");
|
||||
}
|
||||
// parent context provider is the grandparent frame
|
||||
*aProviderFrame = f;
|
||||
aRelationship = eContextProvider_Ancestor;
|
||||
}
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// XXX this could be made more general to handle row modifications that change the
|
||||
// table height, but first we need to scrutinize every Invalidate
|
||||
static void
|
||||
|
@ -370,6 +370,10 @@ public:
|
||||
PRBool& aDidBalance,
|
||||
nsReflowStatus& aStatus);
|
||||
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
static nsMargin GetPadding(const nsHTMLReflowState& aReflowState,
|
||||
const nsTableCellFrame* aCellFrame);
|
||||
|
||||
|
@ -414,20 +414,23 @@ NS_IMETHODIMP nsTableOuterFrame::SetSelected(nsIPresContext* aPresContext,
|
||||
return result;
|
||||
}
|
||||
|
||||
// GetStyleContextProvider:
|
||||
// The innerTableFame is the style context provider, which is cached in a data member
|
||||
// GetParentStyleContextProvider:
|
||||
// The innerTableFame is he parent style context provider
|
||||
// Fortunately, we cache that as a data member, so just return the cached pointer value
|
||||
//
|
||||
NS_IMETHODIMP
|
||||
nsTableOuterFrame::GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame)
|
||||
nsTableOuterFrame::GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship)
|
||||
{
|
||||
NS_ASSERTION(aProviderFrame && aPresContext, "null argument: aPresContext and-or aProviderFrame");
|
||||
if (aProviderFrame) {
|
||||
if (mInnerTableFrame)
|
||||
*aProviderFrame = mInnerTableFrame;
|
||||
else
|
||||
*aProviderFrame = this;
|
||||
// parent context provider is the innerTableFrame
|
||||
NS_ASSERTION(mInnerTableFrame, "innerTableFrame should not be null");
|
||||
*aProviderFrame = mInnerTableFrame;
|
||||
aRelationship = eContextProvider_Descendant;
|
||||
}
|
||||
return (aProviderFrame && mInnerTableFrame) ? NS_OK : NS_ERROR_FAILURE;
|
||||
return ((aProviderFrame != nsnull) && (*aProviderFrame != nsnull)) ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// INCREMENTAL REFLOW HELPER FUNCTIONS
|
||||
|
@ -171,8 +171,9 @@ public:
|
||||
*/
|
||||
nscoord GetMinCaptionWidth();
|
||||
|
||||
NS_IMETHOD GetStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame);
|
||||
NS_IMETHOD GetParentStyleContextProvider(nsIPresContext* aPresContext,
|
||||
nsIFrame** aProviderFrame,
|
||||
nsContextProviderRelationship& aRelationship);
|
||||
|
||||
/*---------------- nsITableLayout methods ------------------------*/
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user