263671 make nsStyleUserInterface::CalcDifference return correct style hints if
more than one property differs. also handle dynamic cursor changes correctly. r+sr=bz git-svn-id: svn://10.0.0.236/trunk@167058 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -10099,7 +10099,13 @@ nsCSSFrameConstructor::ProcessRestyledFrames(nsStyleChangeList& aChangeList,
|
||||
if (hint & (nsChangeHint_RepaintFrame | nsChangeHint_SyncFrameView)) {
|
||||
ApplyRenderingChangeToTree(aPresContext, frame, nsnull, hint);
|
||||
}
|
||||
if (hint & nsChangeHint_UpdateCursor) {
|
||||
nsIViewManager* viewMgr = aPresContext->GetViewManager();
|
||||
if (viewMgr)
|
||||
viewMgr->SynthesizeMouseMove(PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
// reget from content since it may have been regenerated...
|
||||
if (content) {
|
||||
|
||||
@@ -45,6 +45,7 @@ enum nsChangeHint {
|
||||
nsChangeHint_RepaintFrame = 0x01, // change was visual only (e.g., COLOR=)
|
||||
nsChangeHint_ReflowFrame = 0x02, // change requires reflow (e.g., WIDTH=)
|
||||
nsChangeHint_SyncFrameView = 0x04, // change requires view to be updated, if there is one (e.g., clip:)
|
||||
nsChangeHint_UpdateCursor = 0x10, // The currently shown mouse cursor needs to be updated
|
||||
nsChangeHint_ReconstructFrame = 0x08 // change requires frame change (e.g., display:)
|
||||
// This subsumes all the above
|
||||
// TBD: add nsChangeHint_ForceFrameView to force frame reconstruction if the frame doesn't yet
|
||||
|
||||
@@ -431,7 +431,8 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aOther)
|
||||
// our position in the rule node tree is also the same.
|
||||
PRBool compare = mRuleNode != aOther->mRuleNode;
|
||||
|
||||
nsChangeHint maxHint = NS_STYLE_HINT_FRAMECHANGE;
|
||||
nsChangeHint maxHint = nsChangeHint(NS_STYLE_HINT_FRAMECHANGE |
|
||||
nsChangeHint_UpdateCursor);
|
||||
|
||||
#define DO_STRUCT_DIFFERENCE(struct_) \
|
||||
PR_BEGIN_MACRO \
|
||||
|
||||
@@ -1693,13 +1693,12 @@ nsStyleUserInterface::nsStyleUserInterface(void)
|
||||
mCursor = NS_STYLE_CURSOR_AUTO; // fix for bugzilla bug 51113
|
||||
}
|
||||
|
||||
nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource)
|
||||
nsStyleUserInterface::nsStyleUserInterface(const nsStyleUserInterface& aSource) :
|
||||
mUserInput(aSource.mUserInput),
|
||||
mUserModify(aSource.mUserModify),
|
||||
mUserFocus(aSource.mUserFocus),
|
||||
mCursor(aSource.mCursor)
|
||||
{
|
||||
mUserInput = aSource.mUserInput;
|
||||
mUserModify = aSource.mUserModify;
|
||||
mUserFocus = aSource.mUserFocus;
|
||||
|
||||
mCursor = aSource.mCursor;
|
||||
}
|
||||
|
||||
nsStyleUserInterface::~nsStyleUserInterface(void)
|
||||
@@ -1708,31 +1707,29 @@ nsStyleUserInterface::~nsStyleUserInterface(void)
|
||||
|
||||
nsChangeHint nsStyleUserInterface::CalcDifference(const nsStyleUserInterface& aOther) const
|
||||
{
|
||||
nsChangeHint hint = nsChangeHint(0);
|
||||
if (mCursor != aOther.mCursor)
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
NS_UpdateHint(hint, nsChangeHint_UpdateCursor);
|
||||
|
||||
if (mUserInput == aOther.mUserInput) {
|
||||
if (mUserModify == aOther.mUserModify) {
|
||||
// ignore mUserFocus
|
||||
return NS_STYLE_HINT_NONE;
|
||||
}
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
}
|
||||
if (mUserModify != aOther.mUserModify)
|
||||
NS_UpdateHint(hint, NS_STYLE_HINT_VISUAL);
|
||||
|
||||
if ((mUserInput != aOther.mUserInput) &&
|
||||
((NS_STYLE_USER_INPUT_NONE == mUserInput) ||
|
||||
(NS_STYLE_USER_INPUT_NONE == aOther.mUserInput))) {
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
NS_UpdateHint(hint, NS_STYLE_HINT_FRAMECHANGE);
|
||||
}
|
||||
|
||||
return NS_STYLE_HINT_VISUAL;
|
||||
// ignore mUserFocus
|
||||
|
||||
return hint;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
/* static */
|
||||
nsChangeHint nsStyleUserInterface::MaxDifference()
|
||||
{
|
||||
return NS_STYLE_HINT_FRAMECHANGE;
|
||||
return nsChangeHint(nsChangeHint_UpdateCursor | NS_STYLE_HINT_FRAMECHANGE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user