From 3479e2b4fdb03028b8a9993fe8c1d9cfff6d3ed0 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Wed, 6 Jun 2012 22:11:42 -0700 Subject: [PATCH] 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 --- layout/generic/nsGfxScrollFrame.cpp | 28 +++++++++++++++++++ layout/generic/nsGfxScrollFrame.h | 8 ++++++ .../relevant-width-overflow-1-ref.html | 8 +++--- .../relevant-width-overflow-1.html | 12 ++++---- 4 files changed, 46 insertions(+), 10 deletions(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index fc0630647803..c173c797df73 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -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 */ diff --git a/layout/generic/nsGfxScrollFrame.h b/layout/generic/nsGfxScrollFrame.h index 3718513a857a..f54a49d73dd4 100644 --- a/layout/generic/nsGfxScrollFrame.h +++ b/layout/generic/nsGfxScrollFrame.h @@ -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); diff --git a/layout/reftests/font-inflation/relevant-width-overflow-1-ref.html b/layout/reftests/font-inflation/relevant-width-overflow-1-ref.html index 96f555569cd9..a3028e694066 100644 --- a/layout/reftests/font-inflation/relevant-width-overflow-1-ref.html +++ b/layout/reftests/font-inflation/relevant-width-overflow-1-ref.html @@ -1,9 +1,9 @@ -
- Text in middle. +
+ Text in outer.
Text in inner.
diff --git a/layout/reftests/font-inflation/relevant-width-overflow-1.html b/layout/reftests/font-inflation/relevant-width-overflow-1.html index ca6bf57c7183..26f4f9a0d859 100644 --- a/layout/reftests/font-inflation/relevant-width-overflow-1.html +++ b/layout/reftests/font-inflation/relevant-width-overflow-1.html @@ -1,16 +1,16 @@
-
- Text in middle. -
Text in inner.
-
+ Text in outer. +
Text in inner.