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:
Boris Zbarsky 2010-03-08 19:30:02 -05:00
Родитель 1dd50deefa
Коммит ca700d3e0d
7 изменённых файлов: 52 добавлений и 20 удалений

Просмотреть файл

@ -2175,27 +2175,25 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsTArray<nsIContent*>& aElements)
nsIScrollableFrame *scrollable = do_QueryFrame(mOuter); nsIScrollableFrame *scrollable = do_QueryFrame(mOuter);
// At this stage in frame construction, the document element and/or // If we're the scrollframe for the root, then we want to construct
// BODY overflow styles have not yet been propagated to the // our scrollbar frames no matter what. That way later dynamic
// viewport. So GetScrollbarStylesFromFrame called here will only // changes to propagated overflow styles will show or hide
// take into account the scrollbar preferences set on the docshell. // scrollbars on the viewport without requiring frame reconstruction
// Thus if no scrollbar preferences are set on the docshell, we will // of the viewport (good!).
// always create scrollbars, which means later dynamic changes to PRBool canHaveHorizontal;
// propagated overflow styles will show or hide scrollbars on the PRBool canHaveVertical;
// viewport without requiring frame reconstruction of the viewport if (!mIsRoot) {
// (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.
ScrollbarStyles styles = scrollable->GetScrollbarStyles(); ScrollbarStyles styles = scrollable->GetScrollbarStyles();
PRBool canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN; canHaveHorizontal = styles.mHorizontal != NS_STYLE_OVERFLOW_HIDDEN;
PRBool canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN; canHaveVertical = styles.mVertical != NS_STYLE_OVERFLOW_HIDDEN;
if (!canHaveHorizontal && !canHaveVertical) { if (!canHaveHorizontal && !canHaveVertical) {
// Nothing to do. // Nothing to do.
return NS_OK; return NS_OK;
} }
} else {
canHaveHorizontal = PR_TRUE;
canHaveVertical = PR_TRUE;
}
// The anonymous <div> used by <inputs> never gets scrollbars. // The anonymous <div> used by <inputs> never gets scrollbars.
nsITextControlFrame* textFrame = do_QueryFrame(parent); 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=&quot;hidden&quot;'>
<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=&quot;&quot;'>
<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=&quot;hidden&quot;'>
<div style='width: 200%; height: 200%'></div>
</body>
</html>"></iframe>