зеркало из https://github.com/mozilla/gecko-dev.git
Bug 301149 :hover is processed in Print Preview mode r+sr=roc
This commit is contained in:
Родитель
77f69277a4
Коммит
d42d69a82c
|
@ -4059,7 +4059,21 @@ nsEventStateManager::SetContentState(nsIContent *aContent, PRInt32 aState)
|
|||
nsCOMPtr<nsIContent> commonHoverAncestor, oldHover, newHover;
|
||||
if ((aState & NS_EVENT_STATE_HOVER) && (aContent != mHoverContent)) {
|
||||
oldHover = mHoverContent;
|
||||
newHover = aContent;
|
||||
|
||||
if (!mPresContext || mPresContext->IsDynamic()) {
|
||||
newHover = aContent;
|
||||
} else {
|
||||
nsIFrame *frame = mPresContext->PresShell()->GetPrimaryFrameFor(aContent);
|
||||
if (nsLayoutUtils::IsViewportScrollbarFrame(frame)) {
|
||||
// The scrollbars of viewport should not ignore the hover state.
|
||||
// Because they are *not* the content of the web page.
|
||||
newHover = aContent;
|
||||
} else {
|
||||
// All contents of the web page should ignore the hover state.
|
||||
newHover = nsnull;
|
||||
}
|
||||
}
|
||||
|
||||
commonHoverAncestor = FindCommonAncestor(mHoverContent, aContent);
|
||||
mHoverContent = aContent;
|
||||
}
|
||||
|
|
|
@ -1062,3 +1062,26 @@ nsLayoutUtils::GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1,
|
|||
}
|
||||
return lastCommonFrame;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsLayoutUtils::IsViewportScrollbarFrame(nsIFrame* aFrame)
|
||||
{
|
||||
if (!aFrame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame* rootScrollFrame =
|
||||
aFrame->GetPresContext()->PresShell()->GetRootScrollFrame();
|
||||
if (!rootScrollFrame)
|
||||
return PR_FALSE;
|
||||
|
||||
nsIScrollableFrame* rootScrollableFrame = nsnull;
|
||||
CallQueryInterface(rootScrollFrame, &rootScrollableFrame);
|
||||
NS_ASSERTION(rootScrollableFrame, "The root scorollable frame is null");
|
||||
|
||||
if (!IsProperAncestorFrame(rootScrollFrame, aFrame))
|
||||
return PR_FALSE;
|
||||
|
||||
nsIFrame* rootScrolledFrame = rootScrollableFrame->GetScrolledFrame();
|
||||
return !(rootScrolledFrame == aFrame ||
|
||||
IsProperAncestorFrame(rootScrolledFrame, aFrame));
|
||||
}
|
||||
|
|
|
@ -452,6 +452,15 @@ public:
|
|||
static nsIFrame*
|
||||
GetClosestCommonAncestorViaPlaceholders(nsIFrame* aFrame1, nsIFrame* aFrame2,
|
||||
nsIFrame* aKnownCommonAncestorHint);
|
||||
|
||||
/**
|
||||
* Check whether aFrame is a part of the scrollbar or scrollcorner of
|
||||
* the root content.
|
||||
* @param aFrame the checking frame
|
||||
* @return if TRUE, the frame is a part of the scrollbar or scrollcorner of
|
||||
* the root content.
|
||||
*/
|
||||
static PRBool IsViewportScrollbarFrame(nsIFrame* aFrame);
|
||||
};
|
||||
|
||||
#endif // nsLayoutUtils_h__
|
||||
|
|
Загрузка…
Ссылка в новой задаче