Back out 30e441f7ad9d (bug 759755) and 08286f4e696b (bug 760098) for orange

This commit is contained in:
Phil Ringnalda 2012-06-06 22:51:58 -07:00
parent 1f41d4e3c0
commit 353d289c8c
7 changed files with 19 additions and 75 deletions

View File

@ -38,7 +38,7 @@ nsFontInflationData::FindFontInflationDataFor(const nsIFrame *aFrame)
bfc->Properties().Get(FontInflationDataProperty()));
}
/* static */ bool
/* static */ void
nsFontInflationData::UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState)
{
nsIFrame *bfc = aReflowState.frame;
@ -47,22 +47,12 @@ nsFontInflationData::UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aR
FrameProperties bfcProps(bfc->Properties());
nsFontInflationData *data = static_cast<nsFontInflationData*>(
bfcProps.Get(FontInflationDataProperty()));
bool oldInflationEnabled;
nscoord oldNCAWidth;
if (data) {
oldNCAWidth = data->mNCAWidth;
oldInflationEnabled = data->mInflationEnabled;
} else {
if (!data) {
data = new nsFontInflationData(bfc);
bfcProps.Set(FontInflationDataProperty(), data);
oldNCAWidth = -1;
oldInflationEnabled = true; /* not relevant */
}
data->UpdateWidth(aReflowState);
return oldNCAWidth != data->mNCAWidth ||
oldInflationEnabled != data->mInflationEnabled;
}
/* static */ void

View File

@ -20,9 +20,7 @@ public:
static nsFontInflationData* FindFontInflationDataFor(const nsIFrame *aFrame);
// Returns whether the effective width changed (which requires the
// caller to mark its descendants dirty
static bool
static void
UpdateFontInflationDataWidthFor(const nsHTMLReflowState& aReflowState);
static void MarkFontInflationDataTextDirty(nsIFrame *aFrame);

View File

@ -94,16 +94,6 @@ 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)
@ -1039,16 +1029,6 @@ 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)
@ -1643,14 +1623,6 @@ 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,8 +45,6 @@ public:
nsGfxScrollFrameInner(nsContainerFrame* aOuter, bool aIsRoot);
~nsGfxScrollFrameInner();
void Init();
typedef nsIScrollableFrame::ScrollbarStyles ScrollbarStyles;
ScrollbarStyles GetScrollbarStylesFromFrame() const;
@ -352,9 +350,6 @@ 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);
@ -587,9 +582,6 @@ 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

@ -305,6 +305,12 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
"have unconstrained width; this should only result from "
"very large sizes, not attempts at intrinsic width "
"calculation");
if (frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) {
// Create our font inflation data if we don't have it already, and
// give it our current width information.
nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
}
}
void nsHTMLReflowState::InitCBReflowState()
@ -358,20 +364,6 @@ IsQuirkContainingBlockHeight(const nsHTMLReflowState* rs, nsIAtom* aFrameType)
void
nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameType)
{
if (frame->GetStateBits() & NS_FRAME_FONT_INFLATION_FLOW_ROOT) {
// Create our font inflation data if we don't have it already, and
// give it our current width information.
bool dirty = nsFontInflationData::UpdateFontInflationDataWidthFor(*this);
if (dirty) {
// FIXME: This isn't so great for the cases where
// nsHTMLReflowState::SetComputedWith is called, if the first time
// we go through InitResizeFlags we set mHResize to true, and then
// the second time we'd set it to false even without the
// NS_FRAME_IS_DIRTY bit already set.
frame->AddStateBits(NS_FRAME_IS_DIRTY);
}
}
mFlags.mHResize = !(frame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
frame->GetSize().width !=
mComputedWidth + mComputedBorderPadding.LeftRight();

View File

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