Make scroll frames (i.e., overflow != visible) be font size inflation flow roots again, to fix www.youtube.com. Except for the test changes, this reverts 9620f50be9fa8be44931decf1e57ce25f51da812 (Bug 747720, patch 7) which in turn reverted part of 9499f6b28addcbcd9c480eb80cfe6c4c63a4a3a1 (Bug 706193, patch 2). (Bug 760098) r=roc

This commit is contained in:
L. David Baron 2012-06-06 22:11:42 -07:00
parent 88011f8d12
commit 311a0652e5
4 changed files with 46 additions and 10 deletions

View File

@ -94,6 +94,16 @@ nsHTMLScrollFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsContainerFrame::DestroyFrom(aDestructRoot);
}
NS_IMETHODIMP
nsHTMLScrollFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsresult rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
mInner.Init();
return rv;
}
NS_IMETHODIMP
nsHTMLScrollFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
@ -1029,6 +1039,16 @@ nsXULScrollFrame::DestroyFrom(nsIFrame* aDestructRoot)
nsBoxFrame::DestroyFrom(aDestructRoot);
}
NS_IMETHODIMP
nsXULScrollFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);
mInner.Init();
return rv;
}
NS_IMETHODIMP
nsXULScrollFrame::SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList)
@ -1623,6 +1643,14 @@ nsGfxScrollFrameInner::~nsGfxScrollFrameInner()
}
}
void
nsGfxScrollFrameInner::Init()
{
if (mOuter->GetStateBits() & NS_FRAME_FONT_INFLATION_CONTAINER) {
mOuter->AddStateBits(NS_FRAME_FONT_INFLATION_FLOW_ROOT);
}
}
/*
* Callback function from AsyncScroll, used in nsGfxScrollFrameInner::ScrollTo
*/

View File

@ -45,6 +45,8 @@ public:
nsGfxScrollFrameInner(nsContainerFrame* aOuter, bool aIsRoot);
~nsGfxScrollFrameInner();
void Init();
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
ScrollbarStyles GetScrollbarStylesFromFrame() const;
@ -350,6 +352,9 @@ public:
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
NS_IMETHOD SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList);
@ -582,6 +587,9 @@ public:
// Called to set the child frames. We typically have three: the scroll area,
// the vertical scrollbar, and the horizontal scrollbar.
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
NS_IMETHOD SetInitialChildList(ChildListID aListID,
nsFrameList& aChildList);

View File

@ -1,9 +1,9 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; width: 450px }
div.inner { width: 300px; overflow: hidden; }
div { font-size: 44px; width: 600px }
div.inner { font-size: 34px; width: 450px; overflow: hidden; }
</style>
<div class="middle">
Text in middle.
<div class="outer">
Text in outer.
<div class="inner">Text in inner.</div>
</div>

View File

@ -1,16 +1,16 @@
<!DOCTYPE HTML>
<style>
div.outer { font-size: 12px; width: 600px }
div.middle { width: 450px; }
div.inner { width: 300px; overflow: hidden; }
div.inner { width: 450px; overflow: hidden; }
</style>
<!--
In a 450px container, the minimum font size at 15em per line is 30px.
This means we map 0px-45px into 30px-45px, so 12px gets mapped to 34px.
In a 600px container, the minimum font size at 15em per line is 40px.
This means we map 0px-60px into 40px-60px, so 12px gets mapped to 44px.
-->
<div class="outer">
<div class="middle">
Text in middle.
<div class="inner">Text in inner.</div>
</div>
Text in outer.
<div class="inner">Text in inner.</div>
</div>