зеркало из https://github.com/mozilla/gecko-dev.git
Bug 550882. Make sure to create scrollbars for the viewport even if it's currently overflow:hidden, since various changes to <body> and the like can change the propagated overflow. r=roc
This commit is contained in:
Родитель
984af21306
Коммит
5060537f28
|
@ -2194,27 +2194,28 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
|
|||
|
||||
nsIScrollableFrame *scrollable = do_QueryFrame(mOuter);
|
||||
|
||||
// At this stage in frame construction, the document element and/or
|
||||
// BODY overflow styles have not yet been propagated to the
|
||||
// viewport. So GetScrollbarStylesFromFrame called here will only
|
||||
// take into account the scrollbar preferences set on the docshell.
|
||||
// Thus if no scrollbar preferences are set on the docshell, we will
|
||||
// always create scrollbars, which means later dynamic changes to
|
||||
// propagated overflow styles will show or hide scrollbars on the
|
||||
// viewport without requiring frame reconstruction of the viewport
|
||||
// (good!).
|
||||
|
||||
// XXX On the other hand, if scrolling="no" is set on the container
|
||||
// we won't create scrollbars here so no scrollbars will ever be
|
||||
// created even if the container's scrolling attribute is later
|
||||
// changed. However, this has never been supported.
|
||||
// If we're the scrollframe for the root, then we want to construct
|
||||
// our scrollbar frames no matter what. That way later dynamic
|
||||
// changes to propagated overflow styles will show or hide
|
||||
// scrollbars on the viewport without requiring frame reconstruction
|
||||
// of the viewport (good!).
|
||||
PRBool canHaveHorizontal;
|
||||
PRBool canHaveVertical;
|
||||
// Hack to try to avoid Tsspider regression: always call
|
||||
// GetScrollbarStyles here, even if we plan to ignore the return
|
||||
// value.
|
||||
ScrollbarStyles styles = scrollable->GetScrollbarStyles();
|
||||
PRBool canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
PRBool canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
if (!mIsRoot) {
|
||||
canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
|
||||
if (!canHaveHorizontal && !canHaveVertical && !isResizable) {
|
||||
// Nothing to do.
|
||||
return NS_OK;
|
||||
}
|
||||
} else {
|
||||
canHaveHorizontal = PR_TRUE;
|
||||
canHaveVertical = PR_TRUE;
|
||||
}
|
||||
|
||||
// The anonymous <div> used by <inputs> never gets scrollbars.
|
||||
nsITextControlFrame* textFrame = do_QueryFrame(parent);
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html></html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%; overflow: visible'>
|
||||
<body style='margin: 0; padding: 0; height: 100%'
|
||||
onload='document.body.offsetWidth;
|
||||
document.documentElement.style.overflow="hidden"'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,6 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%; overflow: hidden'
|
||||
onload='document.body.offsetWidth;
|
||||
document.body.style.overflow=""'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
|
@ -0,0 +1,2 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html></html>"></iframe>
|
|
@ -0,0 +1,8 @@
|
|||
<!DOCTYPE html>
|
||||
<iframe src="data:text/html,<html style='height: 100%'>
|
||||
<body style='margin: 0; padding: 0; height: 100%; overflow: visible'
|
||||
onload='document.body.offsetWidth;
|
||||
document.body.style.overflow="hidden"'>
|
||||
<div style='width: 200%; height: 200%'></div>
|
||||
</body>
|
||||
</html>"></iframe>
|
Загрузка…
Ссылка в новой задаче