зеркало из https://github.com/mozilla/gecko-dev.git
Bug 636564 - Make scroll frames deal correctly with scrollbars that overlay content. r=roc
This commit is contained in:
Родитель
b52ed5ef38
Коммит
7d099529c1
|
@ -1474,9 +1474,6 @@ nsGfxScrollFrameInner::nsGfxScrollFrameInner(nsContainerFrame* aOuter,
|
||||||
, mCollapsedResizer(false)
|
, mCollapsedResizer(false)
|
||||||
, mShouldBuildLayer(false)
|
, mShouldBuildLayer(false)
|
||||||
{
|
{
|
||||||
// lookup if we're allowed to overlap the content from the look&feel object
|
|
||||||
mScrollbarsCanOverlapContent =
|
|
||||||
LookAndFeel::GetInt(LookAndFeel::eIntID_ScrollbarsCanOverlapContent) != 0;
|
|
||||||
mScrollingActive = IsAlwaysActive();
|
mScrollingActive = IsAlwaysActive();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1879,32 +1876,35 @@ AppendToTop(nsDisplayListBuilder* aBuilder, nsDisplayList* aDest,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult
|
void
|
||||||
nsGfxScrollFrameInner::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
nsGfxScrollFrameInner::AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists,
|
const nsDisplayListSet& aLists,
|
||||||
const nsDisplayListCollection& aDest,
|
bool& aCreateLayer,
|
||||||
bool& aCreateLayer)
|
bool aPositioned)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
|
||||||
bool hasResizer = HasResizer();
|
|
||||||
for (nsIFrame* kid = mOuter->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
|
for (nsIFrame* kid = mOuter->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) {
|
||||||
if (kid != mScrolledFrame) {
|
if (kid == mScrolledFrame ||
|
||||||
if (kid == mResizerBox && hasResizer) {
|
(kid->GetStyleDisplay()->IsPositioned() != aPositioned))
|
||||||
// skip the resizer as this will be drawn later on top of the scrolled content
|
continue;
|
||||||
continue;
|
|
||||||
}
|
nsDisplayListCollection partList;
|
||||||
rv = mOuter->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, aDest,
|
mOuter->BuildDisplayListForChild(aBuilder, kid, aDirtyRect, partList,
|
||||||
nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
|
nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
// DISPLAY_CHILD_FORCE_STACKING_CONTEXT put everything into the
|
// Don't append textarea resizers to the positioned descendants because
|
||||||
// PositionedDescendants list.
|
// we don't want them to float on top of overlapping elements.
|
||||||
::AppendToTop(aBuilder, aLists.BorderBackground(),
|
bool appendToPositioned = aPositioned && !(kid == mResizerBox && !mIsRoot);
|
||||||
aDest.PositionedDescendants(), kid,
|
|
||||||
aCreateLayer);
|
nsDisplayList* dest = appendToPositioned ?
|
||||||
}
|
aLists.PositionedDescendants() : aLists.BorderBackground();
|
||||||
|
|
||||||
|
// DISPLAY_CHILD_FORCE_STACKING_CONTEXT put everything into
|
||||||
|
// partList.PositionedDescendants().
|
||||||
|
::AppendToTop(aBuilder, dest,
|
||||||
|
partList.PositionedDescendants(), kid,
|
||||||
|
aCreateLayer);
|
||||||
}
|
}
|
||||||
return rv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -1984,15 +1984,15 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
bool createLayersForScrollbars = mIsRoot &&
|
bool createLayersForScrollbars = mIsRoot &&
|
||||||
mOuter->PresContext()->IsRootContentDocument();
|
mOuter->PresContext()->IsRootContentDocument();
|
||||||
|
|
||||||
nsDisplayListCollection scrollParts;
|
// Now display the scrollbars and scrollcorner. These parts are drawn
|
||||||
if (!mScrollbarsCanOverlapContent) {
|
// in the border-background layer, on top of our own background and
|
||||||
// Now display the scrollbars and scrollcorner. These parts are drawn
|
// borders and underneath borders and backgrounds of later elements
|
||||||
// in the border-background layer, on top of our own background and
|
// in the tree.
|
||||||
// borders and underneath borders and backgrounds of later elements
|
// Note that this does not apply for overlay scrollbars; those are drawn
|
||||||
// in the tree.
|
// in the positioned-elements layer on top of everything else by the call
|
||||||
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists,
|
// to AppendScrollPartsTo(..., true) further down.
|
||||||
scrollParts, createLayersForScrollbars);
|
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists, createLayersForScrollbars,
|
||||||
}
|
false);
|
||||||
|
|
||||||
// Overflow clipping can never clip frames outside our subtree, so there
|
// Overflow clipping can never clip frames outside our subtree, so there
|
||||||
// is no need to worry about whether we are a moving frame that might clip
|
// is no need to worry about whether we are a moving frame that might clip
|
||||||
|
@ -2062,25 +2062,9 @@ nsGfxScrollFrameInner::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||||
true, mIsRoot);
|
true, mIsRoot);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (mScrollbarsCanOverlapContent) {
|
// Now display overlay scrollbars and the resizer, if we have one.
|
||||||
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists,
|
AppendScrollPartsTo(aBuilder, aDirtyRect, aLists, createLayersForScrollbars,
|
||||||
scrollParts, createLayersForScrollbars);
|
true);
|
||||||
}
|
|
||||||
|
|
||||||
if (HasResizer()) {
|
|
||||||
rv = mOuter->BuildDisplayListForChild(aBuilder, mResizerBox, aDirtyRect, scrollParts,
|
|
||||||
nsIFrame::DISPLAY_CHILD_FORCE_STACKING_CONTEXT);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
// DISPLAY_CHILD_FORCE_STACKING_CONTEXT puts everything into the
|
|
||||||
// PositionedDescendants list.
|
|
||||||
// The resizer is positioned and has maximum z-index; we put it in
|
|
||||||
// PositionedDescendants() for the root frame to ensure that it appears
|
|
||||||
// above all content, bug 631337.
|
|
||||||
::AppendToTop(aBuilder,
|
|
||||||
mIsRoot ? aLists.PositionedDescendants() : aLists.Content(),
|
|
||||||
scrollParts.PositionedDescendants(), mResizerBox,
|
|
||||||
createLayersForScrollbars);
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,11 @@ public:
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists);
|
const nsDisplayListSet& aLists);
|
||||||
|
|
||||||
nsresult AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
void AppendScrollPartsTo(nsDisplayListBuilder* aBuilder,
|
||||||
const nsRect& aDirtyRect,
|
const nsRect& aDirtyRect,
|
||||||
const nsDisplayListSet& aLists,
|
const nsDisplayListSet& aLists,
|
||||||
const nsDisplayListCollection& aDest,
|
bool& aCreateLayer,
|
||||||
bool& aCreateLayer);
|
bool aPositioned);
|
||||||
|
|
||||||
bool GetBorderRadii(nscoord aRadii[8]) const;
|
bool GetBorderRadii(nscoord aRadii[8]) const;
|
||||||
|
|
||||||
|
@ -324,9 +324,6 @@ public:
|
||||||
// If true, we should be prepared to scroll using this scrollframe
|
// If true, we should be prepared to scroll using this scrollframe
|
||||||
// by placing descendant content into its own layer(s)
|
// by placing descendant content into its own layer(s)
|
||||||
bool mScrollingActive:1;
|
bool mScrollingActive:1;
|
||||||
// If true, scrollbars are stacked on the top of the display list and can
|
|
||||||
// float above the content as a result
|
|
||||||
bool mScrollbarsCanOverlapContent:1;
|
|
||||||
// If true, the resizer is collapsed and not displayed
|
// If true, the resizer is collapsed and not displayed
|
||||||
bool mCollapsedResizer:1;
|
bool mCollapsedResizer:1;
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,6 @@ pref("layout.css.dpi", 160);
|
||||||
pref("layout.css.dpi", 240);
|
pref("layout.css.dpi", 240);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
/* allow scrollbars to float above chrome ui */
|
|
||||||
pref("ui.scrollbarsCanOverlapContent", 1);
|
|
||||||
|
|
||||||
/* use long press to display a context menu */
|
/* use long press to display a context menu */
|
||||||
pref("ui.click_hold_context_menus", true);
|
pref("ui.click_hold_context_menus", true);
|
||||||
|
|
|
@ -219,8 +219,6 @@ public:
|
||||||
eIntID_SubmenuDelay,
|
eIntID_SubmenuDelay,
|
||||||
// can popups overlap menu/task bar?
|
// can popups overlap menu/task bar?
|
||||||
eIntID_MenusCanOverlapOSBar,
|
eIntID_MenusCanOverlapOSBar,
|
||||||
// can scrollbars float above content?
|
|
||||||
eIntID_ScrollbarsCanOverlapContent,
|
|
||||||
// skip navigating to disabled menu item?
|
// skip navigating to disabled menu item?
|
||||||
eIntID_SkipNavigatingDisabledMenuItem,
|
eIntID_SkipNavigatingDisabledMenuItem,
|
||||||
// begin a drag if the mouse is moved further than the threshold while the
|
// begin a drag if the mouse is moved further than the threshold while the
|
||||||
|
|
|
@ -77,9 +77,6 @@ nsLookAndFeelIntPref nsXPLookAndFeel::sIntPrefs[] =
|
||||||
{ "ui.useAccessibilityTheme",
|
{ "ui.useAccessibilityTheme",
|
||||||
eIntID_UseAccessibilityTheme,
|
eIntID_UseAccessibilityTheme,
|
||||||
false, 0 },
|
false, 0 },
|
||||||
{ "ui.scrollbarsCanOverlapContent",
|
|
||||||
eIntID_ScrollbarsCanOverlapContent,
|
|
||||||
false, 0 },
|
|
||||||
{ "ui.menusCanOverlapOSBar",
|
{ "ui.menusCanOverlapOSBar",
|
||||||
eIntID_MenusCanOverlapOSBar,
|
eIntID_MenusCanOverlapOSBar,
|
||||||
false, 0 },
|
false, 0 },
|
||||||
|
|
Загрузка…
Ссылка в новой задаче