fixed re-resolve style contexts to handle local pseudo elements

and capture style change information
This commit is contained in:
peterl%netscape.com 1999-06-16 06:17:21 +00:00
Родитель 3e70c0acb6
Коммит 8aed081b91
8 изменённых файлов: 72 добавлений и 28 удалений

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

@ -30,7 +30,7 @@ void
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
{
mFrame = aFrame;
ReResolveStyles(aPresContext);
ReResolveStyles(aPresContext, 0, nsnull, nsnull);
}
void
@ -316,7 +316,10 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
* Call this when styles change
*/
void
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext,
PRInt32 aParentChange,
nsStyleChangeList* aChangeList,
PRInt32* aLocalChange)
{
// get all the styles
@ -328,32 +331,40 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
// style that draw an outline around the button
// see if the outline has changed.
// nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mOutlineStyle));
/*
if (mOutlineStyle != oldOutline)
{
// if changed redraw the old rect
mFrame->Invalidate(mOutlineRect, PR_TRUE);
if ((mOutlineStyle && oldOutline) && (mOutlineStyle != oldOutline)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldOutline, mOutlineStyle,
aParentChange, aChangeList, aLocalChange);
}
*/
// style for the inner such as a dotted line (Windows)
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
nsCOMPtr<nsIStyleContext> oldInnerFocus = mInnerFocusStyle;
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mInnerFocusStyle));
if ((mInnerFocusStyle && oldInnerFocus) && (mInnerFocusStyle != oldInnerFocus)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldInnerFocus, mInnerFocusStyle,
aParentChange, aChangeList, aLocalChange);
}
// style for outer focus like a ridged border (MAC).
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
nsCOMPtr<nsIStyleContext> oldOuterFocus = mOuterFocusStyle;
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mOuterFocusStyle));
if ((mOuterFocusStyle && oldOuterFocus) && (mOuterFocusStyle != oldOuterFocus)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldOuterFocus, mOuterFocusStyle,
aParentChange, aChangeList, aLocalChange);
}
}

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

@ -30,6 +30,8 @@
#include "nsCOMPtr.h"
#include "nsFrame.h"
class nsStyleChangeList;
class nsButtonFrameRenderer {
public:
@ -76,7 +78,10 @@ public:
virtual nsMargin GetFullButtonBorderAndPadding();
virtual nsMargin GetAddedButtonBorderAndPadding();
virtual void ReResolveStyles(nsIPresContext& aPresContext);
virtual void ReResolveStyles(nsIPresContext& aPresContext,
PRInt32 aParentChange,
nsStyleChangeList* aChangeList,
PRInt32* aLocalChange);
virtual void Redraw();

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

@ -589,9 +589,12 @@ nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext,
return rv;
}
if (NS_COMFALSE != rv) {
mRenderer.ReResolveStyles(*aPresContext);
if (NS_COMFALSE != rv) { // frame style changed
if (aLocalChange) {
aParentChange = *aLocalChange; // tell children about or change
}
}
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
return rv;

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

@ -224,9 +224,12 @@ nsButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext, nsIS
return rv;
}
if (NS_COMFALSE != rv) {
mRenderer.ReResolveStyles(*aPresContext);
if (NS_COMFALSE != rv) { // frame style changed
if (aLocalChange) {
aParentChange = *aLocalChange; // tell children about or change
}
}
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
return rv;

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

@ -30,7 +30,7 @@ void
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
{
mFrame = aFrame;
ReResolveStyles(aPresContext);
ReResolveStyles(aPresContext, 0, nsnull, nsnull);
}
void
@ -316,7 +316,10 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
* Call this when styles change
*/
void
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext,
PRInt32 aParentChange,
nsStyleChangeList* aChangeList,
PRInt32* aLocalChange)
{
// get all the styles
@ -328,32 +331,40 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
// style that draw an outline around the button
// see if the outline has changed.
// nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mOutlineStyle));
/*
if (mOutlineStyle != oldOutline)
{
// if changed redraw the old rect
mFrame->Invalidate(mOutlineRect, PR_TRUE);
if ((mOutlineStyle && oldOutline) && (mOutlineStyle != oldOutline)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldOutline, mOutlineStyle,
aParentChange, aChangeList, aLocalChange);
}
*/
// style for the inner such as a dotted line (Windows)
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
nsCOMPtr<nsIStyleContext> oldInnerFocus = mInnerFocusStyle;
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mInnerFocusStyle));
if ((mInnerFocusStyle && oldInnerFocus) && (mInnerFocusStyle != oldInnerFocus)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldInnerFocus, mInnerFocusStyle,
aParentChange, aChangeList, aLocalChange);
}
// style for outer focus like a ridged border (MAC).
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
nsCOMPtr<nsIStyleContext> oldOuterFocus = mOuterFocusStyle;
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
PR_FALSE,
getter_AddRefs(mOuterFocusStyle));
if ((mOuterFocusStyle && oldOuterFocus) && (mOuterFocusStyle != oldOuterFocus)) {
nsFrame::CaptureStyleChangeFor(mFrame, oldOuterFocus, mOuterFocusStyle,
aParentChange, aChangeList, aLocalChange);
}
}

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

@ -30,6 +30,8 @@
#include "nsCOMPtr.h"
#include "nsFrame.h"
class nsStyleChangeList;
class nsButtonFrameRenderer {
public:
@ -76,7 +78,10 @@ public:
virtual nsMargin GetFullButtonBorderAndPadding();
virtual nsMargin GetAddedButtonBorderAndPadding();
virtual void ReResolveStyles(nsIPresContext& aPresContext);
virtual void ReResolveStyles(nsIPresContext& aPresContext,
PRInt32 aParentChange,
nsStyleChangeList* aChangeList,
PRInt32* aLocalChange);
virtual void Redraw();

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

@ -589,9 +589,12 @@ nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext,
return rv;
}
if (NS_COMFALSE != rv) {
mRenderer.ReResolveStyles(*aPresContext);
if (NS_COMFALSE != rv) { // frame style changed
if (aLocalChange) {
aParentChange = *aLocalChange; // tell children about or change
}
}
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
return rv;

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

@ -1083,9 +1083,12 @@ nsTitledButtonFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsI
return rv;
}
if (NS_COMFALSE != rv) {
mRenderer.ReResolveStyles(*aPresContext);
if (NS_COMFALSE != rv) { // frame style changed
if (aLocalChange) {
aParentChange = *aLocalChange; // tell children about or change
}
}
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
return rv;