зеркало из https://github.com/mozilla/pjs.git
fixed re-resolve style contexts to handle local pseudo elements
and capture style change information
This commit is contained in:
Родитель
a5e9725c84
Коммит
7eabb8ee51
|
@ -30,7 +30,7 @@ void
|
||||||
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
||||||
{
|
{
|
||||||
mFrame = aFrame;
|
mFrame = aFrame;
|
||||||
ReResolveStyles(aPresContext);
|
ReResolveStyles(aPresContext, 0, nsnull, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -316,7 +316,10 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
|
||||||
* Call this when styles change
|
* Call this when styles change
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
|
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext,
|
||||||
|
PRInt32 aParentChange,
|
||||||
|
nsStyleChangeList* aChangeList,
|
||||||
|
PRInt32* aLocalChange)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get all the styles
|
// get all the styles
|
||||||
|
@ -328,32 +331,40 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
|
||||||
// style that draw an outline around the button
|
// style that draw an outline around the button
|
||||||
|
|
||||||
// see if the outline has changed.
|
// see if the outline has changed.
|
||||||
// nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
|
nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
|
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mOutlineStyle));
|
getter_AddRefs(mOutlineStyle));
|
||||||
|
|
||||||
/*
|
if ((mOutlineStyle && oldOutline) && (mOutlineStyle != oldOutline)) {
|
||||||
if (mOutlineStyle != oldOutline)
|
nsFrame::CaptureStyleChangeFor(mFrame, oldOutline, mOutlineStyle,
|
||||||
{
|
aParentChange, aChangeList, aLocalChange);
|
||||||
// if changed redraw the old rect
|
|
||||||
mFrame->Invalidate(mOutlineRect, PR_TRUE);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// style for the inner such as a dotted line (Windows)
|
// style for the inner such as a dotted line (Windows)
|
||||||
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
|
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
|
||||||
|
nsCOMPtr<nsIStyleContext> oldInnerFocus = mInnerFocusStyle;
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mInnerFocusStyle));
|
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).
|
// style for outer focus like a ridged border (MAC).
|
||||||
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
|
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
|
||||||
|
nsCOMPtr<nsIStyleContext> oldOuterFocus = mOuterFocusStyle;
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mOuterFocusStyle));
|
getter_AddRefs(mOuterFocusStyle));
|
||||||
|
|
||||||
|
if ((mOuterFocusStyle && oldOuterFocus) && (mOuterFocusStyle != oldOuterFocus)) {
|
||||||
|
nsFrame::CaptureStyleChangeFor(mFrame, oldOuterFocus, mOuterFocusStyle,
|
||||||
|
aParentChange, aChangeList, aLocalChange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsFrame.h"
|
#include "nsFrame.h"
|
||||||
|
|
||||||
|
class nsStyleChangeList;
|
||||||
|
|
||||||
class nsButtonFrameRenderer {
|
class nsButtonFrameRenderer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -76,7 +78,10 @@ public:
|
||||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||||
virtual nsMargin GetAddedButtonBorderAndPadding();
|
virtual nsMargin GetAddedButtonBorderAndPadding();
|
||||||
|
|
||||||
virtual void ReResolveStyles(nsIPresContext& aPresContext);
|
virtual void ReResolveStyles(nsIPresContext& aPresContext,
|
||||||
|
PRInt32 aParentChange,
|
||||||
|
nsStyleChangeList* aChangeList,
|
||||||
|
PRInt32* aLocalChange);
|
||||||
|
|
||||||
virtual void Redraw();
|
virtual void Redraw();
|
||||||
|
|
||||||
|
|
|
@ -589,9 +589,12 @@ nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_COMFALSE != rv) {
|
if (NS_COMFALSE != rv) { // frame style changed
|
||||||
mRenderer.ReResolveStyles(*aPresContext);
|
if (aLocalChange) {
|
||||||
|
aParentChange = *aLocalChange; // tell children about or change
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
|
|
@ -224,9 +224,12 @@ nsButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext, nsIS
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_COMFALSE != rv) {
|
if (NS_COMFALSE != rv) { // frame style changed
|
||||||
mRenderer.ReResolveStyles(*aPresContext);
|
if (aLocalChange) {
|
||||||
|
aParentChange = *aLocalChange; // tell children about or change
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ void
|
||||||
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
nsButtonFrameRenderer::SetFrame(nsFrame* aFrame, nsIPresContext& aPresContext)
|
||||||
{
|
{
|
||||||
mFrame = aFrame;
|
mFrame = aFrame;
|
||||||
ReResolveStyles(aPresContext);
|
ReResolveStyles(aPresContext, 0, nsnull, nsnull);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -316,7 +316,10 @@ nsButtonFrameRenderer::GetAddedButtonBorderAndPadding()
|
||||||
* Call this when styles change
|
* Call this when styles change
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
|
nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext,
|
||||||
|
PRInt32 aParentChange,
|
||||||
|
nsStyleChangeList* aChangeList,
|
||||||
|
PRInt32* aLocalChange)
|
||||||
{
|
{
|
||||||
|
|
||||||
// get all the styles
|
// get all the styles
|
||||||
|
@ -328,32 +331,40 @@ nsButtonFrameRenderer::ReResolveStyles(nsIPresContext& aPresContext)
|
||||||
// style that draw an outline around the button
|
// style that draw an outline around the button
|
||||||
|
|
||||||
// see if the outline has changed.
|
// see if the outline has changed.
|
||||||
// nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
|
nsCOMPtr<nsIStyleContext> oldOutline = mOutlineStyle;
|
||||||
|
|
||||||
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
|
nsCOMPtr<nsIAtom> atom ( getter_AddRefs(NS_NewAtom(":-moz-outline")) );
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mOutlineStyle));
|
getter_AddRefs(mOutlineStyle));
|
||||||
|
|
||||||
/*
|
if ((mOutlineStyle && oldOutline) && (mOutlineStyle != oldOutline)) {
|
||||||
if (mOutlineStyle != oldOutline)
|
nsFrame::CaptureStyleChangeFor(mFrame, oldOutline, mOutlineStyle,
|
||||||
{
|
aParentChange, aChangeList, aLocalChange);
|
||||||
// if changed redraw the old rect
|
|
||||||
mFrame->Invalidate(mOutlineRect, PR_TRUE);
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
// style for the inner such as a dotted line (Windows)
|
// style for the inner such as a dotted line (Windows)
|
||||||
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
|
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-inner"));
|
||||||
|
nsCOMPtr<nsIStyleContext> oldInnerFocus = mInnerFocusStyle;
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mInnerFocusStyle));
|
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).
|
// style for outer focus like a ridged border (MAC).
|
||||||
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
|
atom = getter_AddRefs(NS_NewAtom(":-moz-focus-outer"));
|
||||||
|
nsCOMPtr<nsIStyleContext> oldOuterFocus = mOuterFocusStyle;
|
||||||
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
aPresContext.ProbePseudoStyleContextFor(content, atom, context,
|
||||||
PR_FALSE,
|
PR_FALSE,
|
||||||
getter_AddRefs(mOuterFocusStyle));
|
getter_AddRefs(mOuterFocusStyle));
|
||||||
|
|
||||||
|
if ((mOuterFocusStyle && oldOuterFocus) && (mOuterFocusStyle != oldOuterFocus)) {
|
||||||
|
nsFrame::CaptureStyleChangeFor(mFrame, oldOuterFocus, mOuterFocusStyle,
|
||||||
|
aParentChange, aChangeList, aLocalChange);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,8 @@
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
#include "nsFrame.h"
|
#include "nsFrame.h"
|
||||||
|
|
||||||
|
class nsStyleChangeList;
|
||||||
|
|
||||||
class nsButtonFrameRenderer {
|
class nsButtonFrameRenderer {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -76,7 +78,10 @@ public:
|
||||||
virtual nsMargin GetFullButtonBorderAndPadding();
|
virtual nsMargin GetFullButtonBorderAndPadding();
|
||||||
virtual nsMargin GetAddedButtonBorderAndPadding();
|
virtual nsMargin GetAddedButtonBorderAndPadding();
|
||||||
|
|
||||||
virtual void ReResolveStyles(nsIPresContext& aPresContext);
|
virtual void ReResolveStyles(nsIPresContext& aPresContext,
|
||||||
|
PRInt32 aParentChange,
|
||||||
|
nsStyleChangeList* aChangeList,
|
||||||
|
PRInt32* aLocalChange);
|
||||||
|
|
||||||
virtual void Redraw();
|
virtual void Redraw();
|
||||||
|
|
||||||
|
|
|
@ -589,9 +589,12 @@ nsHTMLButtonControlFrame::ReResolveStyleContext ( nsIPresContext* aPresContext,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_COMFALSE != rv) {
|
if (NS_COMFALSE != rv) { // frame style changed
|
||||||
mRenderer.ReResolveStyles(*aPresContext);
|
if (aLocalChange) {
|
||||||
|
aParentChange = *aLocalChange; // tell children about or change
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
|
|
@ -1083,9 +1083,12 @@ nsTitledButtonFrame :: ReResolveStyleContext ( nsIPresContext* aPresContext, nsI
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_COMFALSE != rv) {
|
if (NS_COMFALSE != rv) { // frame style changed
|
||||||
mRenderer.ReResolveStyles(*aPresContext);
|
if (aLocalChange) {
|
||||||
|
aParentChange = *aLocalChange; // tell children about or change
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
mRenderer.ReResolveStyles(*aPresContext, aParentChange, aChangeList, aLocalChange);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче