mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-15 06:15:43 +00:00
Bug 946408 - Always layerize a scrollable element if it's focused. r=kats,tn
This commit is contained in:
parent
a1a0eea188
commit
7951bd2cf8
@ -2252,6 +2252,19 @@ ScrollFrameHelper::ExpandRect(const nsRect& aRect) const
|
|||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsFocused(nsIContent* aContent)
|
||||||
|
{
|
||||||
|
// Some content elements, like the GetContent() of a scroll frame
|
||||||
|
// for a text input field, are inside anonymous subtrees, but the focus
|
||||||
|
// manager always reports a non-anonymous element as the focused one, so
|
||||||
|
// walk up the tree until we reach a non-anonymous element.
|
||||||
|
while (aContent && aContent->IsInAnonymousSubtree()) {
|
||||||
|
aContent = aContent->GetParent();
|
||||||
|
}
|
||||||
|
|
||||||
|
return aContent ? nsContentUtils::IsFocusedContent(aContent) : false;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
@ -2394,12 +2407,16 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||||||
} else {
|
} else {
|
||||||
nsRect scrollRange = GetScrollRange();
|
nsRect scrollRange = GetScrollRange();
|
||||||
ScrollbarStyles styles = GetScrollbarStylesFromFrame();
|
ScrollbarStyles styles = GetScrollbarStylesFromFrame();
|
||||||
|
bool isFocused = IsFocused(mOuter->GetContent());
|
||||||
bool isVScrollable = (scrollRange.height > 0)
|
bool isVScrollable = (scrollRange.height > 0)
|
||||||
&& (styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
|
&& (styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN);
|
||||||
bool isHScrollable = (scrollRange.width > 0)
|
bool isHScrollable = (scrollRange.width > 0)
|
||||||
&& (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
|
&& (styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN);
|
||||||
bool wantLayerV = isVScrollable && mVScrollbarBox;
|
// The check for scroll bars was added in bug 825692 to prevent layerization
|
||||||
bool wantLayerH = isHScrollable && mHScrollbarBox;
|
// of text inputs for performance reasons. However, if a text input is
|
||||||
|
// focused we want to layerize it so we can async scroll it (bug 946408).
|
||||||
|
bool wantLayerV = isVScrollable && (mVScrollbarBox || isFocused);
|
||||||
|
bool wantLayerH = isHScrollable && (mHScrollbarBox || isFocused);
|
||||||
// TODO Turn this on for inprocess OMTC on all platforms
|
// TODO Turn this on for inprocess OMTC on all platforms
|
||||||
bool wantSubAPZC = (XRE_GetProcessType() == GeckoProcessType_Content);
|
bool wantSubAPZC = (XRE_GetProcessType() == GeckoProcessType_Content);
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
|
Loading…
Reference in New Issue
Block a user