Backout changesets c9abc8ef4626, d62512892555, 69f89ee5d08f, c511af7d8f58, 6a6a560a1492, ac0ec1183d19, 46669afabd15, 74f32abaa8c0, f197554cf989, 0a2405eb5b90, b48954598d7d, e0a82577259c, 0235d1541e58, 450f2557d3a2, e24d196602bf, 03c2ea0eeba3, 7aca4ef8e538, 11ec362e780b, 4b92a3b96446 (bug 627842) for Windows crashtest assertions and Android reftest failures

--HG--
extra : rebase_source : fc8946055314369bfba5038ded32afcb00bf134d
This commit is contained in:
Phil Ringnalda 2011-11-14 22:12:31 -08:00
parent 74f049f0da
commit fb732c5149
77 changed files with 273 additions and 1656 deletions

View File

@ -366,9 +366,6 @@ user_pref("app.update.enabled", false);
user_pref("browser.panorama.experienced_first_run", true); // Assume experienced
user_pref("dom.w3c_touch_events.enabled", true);
user_pref("toolkit.telemetry.prompted", 2);
// Existing tests assume there is no font size inflation.
user_pref("font.size.inflation.emPerLine", 0);
user_pref("font.size.inflation.minTwips", 0);
// Only load extensions from the application and user profile
// AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION

View File

@ -2167,9 +2167,9 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback,
continue;
// overlapping with the offset we want
f->EnsureTextRun(nsTextFrame::eInflated);
NS_ENSURE_TRUE(f->GetTextRun(nsTextFrame::eInflated), NS_ERROR_OUT_OF_MEMORY);
bool rtl = f->GetTextRun(nsTextFrame::eInflated)->IsRightToLeft();
f->EnsureTextRun();
NS_ENSURE_TRUE(f->GetTextRun(), NS_ERROR_OUT_OF_MEMORY);
bool rtl = f->GetTextRun()->IsRightToLeft();
nsRect r(f->GetOffsetTo(relativeTo), f->GetSize());
if (fstart < aStartOffset) {
// aStartOffset is within this frame

View File

@ -2547,8 +2547,7 @@ GetScrollableLineHeight(nsIFrame* aTargetFrame)
// Fall back to the font height of the target frame.
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aTargetFrame, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(aTargetFrame));
nsLayoutUtils::GetFontMetricsForFrame(aTargetFrame, getter_AddRefs(fm));
NS_ASSERTION(fm, "FontMetrics is null!");
if (fm)
return fm->MaxHeight();

View File

@ -51,7 +51,7 @@
* http://www.w3.org/TR/DOM-Level-2-Style
*/
[builtinclass, scriptable, uuid(0a6fc4c6-a62a-4f52-9ab6-3d398b958843)]
[builtinclass, scriptable, uuid(519ae4fa-0fee-4aaa-bcb9-34b503236801)]
interface nsIDOMCSS2Properties : nsISupports
{
attribute DOMString background;
@ -764,7 +764,4 @@ interface nsIDOMCSS2Properties : nsISupports
attribute DOMString MozAnimation;
// raises(DOMException) on setting
attribute DOMString MozTextSizeAdjust;
// raises(DOMException) on setting
};

View File

@ -350,8 +350,7 @@ nsCaret::GetGeometryForFrame(nsIFrame* aFrame,
nscoord baseline = frame->GetCaretBaseline();
nscoord ascent = 0, descent = 0;
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(aFrame));
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
NS_ASSERTION(fm, "We should be able to get the font metrics");
if (fm) {
ascent = fm->MaxAscent();

View File

@ -128,9 +128,6 @@ bool nsLayoutUtils::gPreventAssertInCompareTreePosition = false;
typedef gfxPattern::GraphicsFilter GraphicsFilter;
typedef FrameMetrics::ViewID ViewID;
static PRUint32 sFontSizeInflationEmPerLine;
static PRUint32 sFontSizeInflationMinTwips;
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
typedef nsDataHashtable<nsUint64HashKey, nsIContent*> ContentMap;
@ -1928,26 +1925,22 @@ nsLayoutUtils::GetTextShadowRectsUnion(const nsRect& aTextAndDecorationsRect,
nsresult
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame,
nsFontMetrics** aFontMetrics,
float aInflation)
nsFontMetrics** aFontMetrics)
{
return nsLayoutUtils::GetFontMetricsForStyleContext(aFrame->GetStyleContext(),
aFontMetrics,
aInflation);
aFontMetrics);
}
nsresult
nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
nsFontMetrics** aFontMetrics,
float aInflation)
nsFontMetrics** aFontMetrics)
{
// pass the user font set object into the device context to pass along to CreateFontGroup
gfxUserFontSet* fs = aStyleContext->PresContext()->GetUserFontSet();
nsFont font = aStyleContext->GetStyleFont()->mFont;
font.size = NSToCoordRound(font.size * aInflation);
return aStyleContext->PresContext()->DeviceContext()->GetMetricsFor(
font, aStyleContext->GetStyleVisibility()->mLanguage,
aStyleContext->GetStyleFont()->mFont,
aStyleContext->GetStyleVisibility()->mLanguage,
fs, *aFontMetrics);
}
@ -4275,8 +4268,8 @@ nsLayoutUtils::GetFontFacesForText(nsIFrame* aFrame,
}
// overlapping with the offset we want
gfxSkipCharsIterator iter = curr->EnsureTextRun(nsTextFrame::eInflated);
gfxTextRun* textRun = curr->GetTextRun(nsTextFrame::eInflated);
gfxSkipCharsIterator iter = curr->EnsureTextRun();
gfxTextRun* textRun = curr->GetTextRun();
NS_ENSURE_TRUE(textRun, NS_ERROR_OUT_OF_MEMORY);
PRUint32 skipStart = iter.ConvertOriginalToSkipped(fstart);
@ -4299,15 +4292,12 @@ nsLayoutUtils::GetTextRunMemoryForFrames(nsIFrame* aFrame, PRUint64* aTotal)
if (aFrame->GetType() == nsGkAtoms::textFrame) {
nsTextFrame* textFrame = static_cast<nsTextFrame*>(aFrame);
for (PRUint32 i = 0; i < 2; ++i) {
gfxTextRun *run = textFrame->GetTextRun(
(i != 0) ? nsTextFrame::eInflated : nsTextFrame::eNotInflated);
if (run) {
if (aTotal) {
run->AccountForSize(aTotal);
} else {
run->ClearSizeAccounted();
}
gfxTextRun *run = textFrame->GetTextRun();
if (run) {
if (aTotal) {
run->AccountForSize(aTotal);
} else {
run->ClearSizeAccounted();
}
}
return NS_OK;
@ -4327,16 +4317,6 @@ nsLayoutUtils::GetTextRunMemoryForFrames(nsIFrame* aFrame, PRUint64* aTotal)
return NS_OK;
}
/* static */
void
nsLayoutUtils::Initialize()
{
mozilla::Preferences::AddUintVarCache(&sFontSizeInflationEmPerLine,
"font.size.inflation.emPerLine");
mozilla::Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
"font.size.inflation.minTwips");
}
/* static */
void
nsLayoutUtils::Shutdown()
@ -4499,311 +4479,3 @@ nsReflowFrameRunnable::Run()
}
return NS_OK;
}
/**
* Compute the minimum font size inside of a container with the given
* width, such that **when the user zooms the container to fill the full
* width of the device**, the fonts satisfy our minima.
*/
static nscoord
MinimumFontSizeFor(nsPresContext* aPresContext, nscoord aContainerWidth)
{
if (sFontSizeInflationEmPerLine == 0 && sFontSizeInflationMinTwips == 0) {
return 0;
}
nscoord byLine = 0, byInch = 0;
if (sFontSizeInflationEmPerLine != 0) {
byLine = aContainerWidth / sFontSizeInflationEmPerLine;
}
if (sFontSizeInflationMinTwips != 0) {
// REVIEW: Is this giving us app units and sizes *not* counting
// viewport scaling?
nsDeviceContext *dx = aPresContext->DeviceContext();
nsRect clientRect;
dx->GetClientRect(clientRect); // FIXME: GetClientRect looks expensive
float deviceWidthInches =
float(clientRect.width) / float(dx->AppUnitsPerPhysicalInch());
byInch = NSToCoordRound(aContainerWidth /
(deviceWidthInches * 1440 /
sFontSizeInflationMinTwips ));
}
return NS_MAX(byLine, byInch);
}
/* static */ float
nsLayoutUtils::FontSizeInflationInner(const nsIFrame *aFrame,
nscoord aMinFontSize)
{
// Note that line heights should be inflated by the same ratio as the
// font size of the same text; thus we operate only on the font size
// even when we're scaling a line height.
nscoord styleFontSize = aFrame->GetStyleFont()->mFont.size;
if (styleFontSize <= 0) {
// Never scale zero font size.
return 1.0;
}
if (aMinFontSize <= 0) {
// No need to scale.
return 1.0;
}
// Scale everything from 0-1.5 times min to instead fit in the range
// 1-1.5 times min, so that we still show some distinction rather than
// just enforcing a minimum.
// FIXME: Fiddle with this algorithm; maybe have prefs to control it?
float ratio = float(styleFontSize) / float(aMinFontSize);
if (ratio >= 1.5f) {
// If we're already at 1.5 or more times the minimum, don't scale.
return 1.0;
}
// To scale 0-1.5 times min to instead be 1-1.5 times min, we want
// to the desired multiple of min to be 1 + (ratio/3) (where ratio
// is our input's multiple of min). The scaling needed to produce
// that is that divided by |ratio|, or:
return (1.0f / ratio) + (1.0f / 3.0f);
}
/* static */ bool
nsLayoutUtils::IsContainerForFontSizeInflation(const nsIFrame *aFrame)
{
/*
* Font size inflation is build around the idea that we're inflating
* the fonts for a pan-and-zoom UI so that when the user scales up a
* block or other container to fill the width of the device, the fonts
* will be readable. To do this, we need to pick what counts as a
* container.
*
* From a code perspective, the only hard requirement is that frames
* that are line participants
* (nsIFrame::IsFrameOfType(nsIFrame::eLineParticipant)) are never
* containers, since line layout assumes that the inflation is
* consistent within a line.
*
* This is not an imposition, since we obviously want a bunch of text
* (possibly with inline elements) flowing within a block to count the
* block (or higher) as its container.
*
* We also want form controls, including the text in the anonymous
* content inside of them, to match each other and the text next to
* them, so they and their anonymous content should also not be a
* container.
*
* There are contexts where it would be nice if some blocks didn't
* count as a container, so that, for example, an indented quotation
* didn't end up with a smaller font size. However, it's hard to
* distinguish these situations where we really do want the indented
* thing to count as a container, so we don't try, and blocks are
* always containers.
*/
bool isInline = aFrame->GetStyleDisplay()->mDisplay ==
NS_STYLE_DISPLAY_INLINE ||
aFrame->GetContent()->IsInNativeAnonymousSubtree();
NS_ASSERTION(!aFrame->IsFrameOfType(nsIFrame::eLineParticipant) || isInline,
"line participants must not be containers");
NS_ASSERTION(aFrame->GetType() != nsGkAtoms::bulletFrame || isInline,
"bullets should not be containers");
return !isInline;
}
static bool
ShouldInflateFontsForContainer(const nsIFrame *aFrame)
{
// We only want to inflate fonts for text that is in a place
// with room to expand. The question is what the best heuristic for
// that is...
// For now, we're going to use NS_FRAME_IN_CONSTRAINED_HEIGHT, which
// indicates whether the frame is inside something with a constrained
// height (propagating down the tree), but the propagation stops when
// we hit overflow-y: scroll or auto.
return aFrame->GetStyleText()->mTextSizeAdjust !=
NS_STYLE_TEXT_SIZE_ADJUST_NONE &&
!(aFrame->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT);
}
nscoord
nsLayoutUtils::InflationMinFontSizeFor(const nsHTMLReflowState &aReflowState)
{
#ifdef DEBUG
{
const nsHTMLReflowState *rs = &aReflowState;
const nsIFrame *f = aReflowState.frame;
for (; rs; rs = rs->parentReflowState, f = f->GetParent()) {
NS_ABORT_IF_FALSE(rs->frame == f,
"reflow state parentage must match frame parentage");
}
}
#endif
if (!FontSizeInflationEnabled(aReflowState.frame->PresContext())) {
return 0;
}
nsIFrame *reflowRoot = nsnull;
for (const nsHTMLReflowState *rs = &aReflowState; rs;
reflowRoot = rs->frame, rs = rs->parentReflowState) {
if (IsContainerForFontSizeInflation(rs->frame)) {
if (!ShouldInflateFontsForContainer(rs->frame)) {
return 0;
}
NS_ABORT_IF_FALSE(rs->ComputedWidth() != NS_INTRINSICSIZE,
"must have a computed width");
return MinimumFontSizeFor(aReflowState.frame->PresContext(),
rs->ComputedWidth());
}
}
// We've hit the end of the reflow state chain. There are two
// possibilities now: we're either at a reflow root or we're crossing
// into flexbox layout. (Note that sometimes we cross into and out of
// flexbox layout on the same frame, e.g., for nsTextControlFrame,
// which breaks the reflow state parentage chain.)
// This code depends on:
// * When we cross from HTML to XUL and then on the child jump back
// to HTML again, we link the reflow states correctly (see hack in
// nsFrame::BoxReflow setting reflowState.parentReflowState).
// * For any other cases, the XUL frame is a font size inflation
// container, so we won't cross back into HTML (see the conditions
// under which we test the assertion in
// InflationMinFontSizeFor(const nsIFrame *).
return InflationMinFontSizeFor(reflowRoot->GetParent());
}
nscoord
nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame)
{
#ifdef DEBUG
// Check that neither this frame nor any of its ancestors are
// currently being reflowed.
// It's ok for box frames (but not arbitrary ancestors of box frames)
// since they set their size before reflow.
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
"must call nsHTMLReflowState& version during reflow");
}
}
// It's ok if frames are dirty, or even if they've never been
// reflowed, since they will be eventually and then we'll get the
// right size.
#endif
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
return 0;
}
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
if (IsContainerForFontSizeInflation(f)) {
if (!ShouldInflateFontsForContainer(f)) {
return 0;
}
return MinimumFontSizeFor(aFrame->PresContext(),
f->GetContentRect().width);
}
}
NS_ABORT_IF_FALSE(false, "root should always be container");
return 0;
}
/* static */ nscoord
nsLayoutUtils::InflationMinFontSizeFor(const nsIFrame *aFrame,
nscoord aInflationContainerWidth)
{
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
return 0;
}
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
if (IsContainerForFontSizeInflation(f)) {
if (!ShouldInflateFontsForContainer(f)) {
return 0;
}
// The caller is (sketchily) asserting that it picked the right
// container when passing aInflationContainerWidth. We only do
// this for text inputs and a few other limited situations.
return MinimumFontSizeFor(aFrame->PresContext(),
aInflationContainerWidth);
}
}
NS_ABORT_IF_FALSE(false, "root should always be container");
return 0;
}
float
nsLayoutUtils::FontSizeInflationFor(const nsHTMLReflowState &aReflowState)
{
#ifdef DEBUG
{
const nsHTMLReflowState *rs = &aReflowState;
const nsIFrame *f = aReflowState.frame;
for (; rs; rs = rs->parentReflowState, f = f->GetParent()) {
NS_ABORT_IF_FALSE(rs->frame == f,
"reflow state parentage must match frame parentage");
}
}
#endif
if (!FontSizeInflationEnabled(aReflowState.frame->PresContext())) {
return 1.0;
}
return FontSizeInflationInner(aReflowState.frame,
InflationMinFontSizeFor(aReflowState));
}
float
nsLayoutUtils::FontSizeInflationFor(const nsIFrame *aFrame)
{
#ifdef DEBUG
// Check that neither this frame nor any of its ancestors are
// currently being reflowed.
// It's ok for box frames (but not arbitrary ancestors of box frames)
// since they set their size before reflow.
if (!(aFrame->IsBoxFrame() && IsContainerForFontSizeInflation(aFrame))) {
for (const nsIFrame *f = aFrame; f; f = f->GetParent()) {
NS_ABORT_IF_FALSE(!(f->GetStateBits() & NS_FRAME_IN_REFLOW),
"must call nsHTMLReflowState& version during reflow");
}
}
// It's ok if frames are dirty, or even if they've never been
// reflowed, since they will be eventually and then we'll get the
// right size.
#endif
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
return 1.0;
}
return FontSizeInflationInner(aFrame,
InflationMinFontSizeFor(aFrame));
}
/* static */ float
nsLayoutUtils::FontSizeInflationFor(const nsIFrame *aFrame,
nscoord aInflationContainerWidth)
{
if (!FontSizeInflationEnabled(aFrame->PresContext())) {
return 1.0;
}
return FontSizeInflationInner(aFrame,
InflationMinFontSizeFor(aFrame,
aInflationContainerWidth));
}
/* static */ bool
nsLayoutUtils::FontSizeInflationEnabled(nsPresContext *aPresContext)
{
return (sFontSizeInflationEmPerLine != 0 ||
sFontSizeInflationMinTwips != 0) &&
!aPresContext->IsChrome();
}

View File

@ -742,23 +742,19 @@ public:
* Get the font metrics corresponding to the frame's style data.
* @param aFrame the frame
* @param aFontMetrics the font metrics result
* @param aSizeInflation number to multiply font size by
* @return success or failure code
*/
static nsresult GetFontMetricsForFrame(const nsIFrame* aFrame,
nsFontMetrics** aFontMetrics,
float aSizeInflation = 1.0f);
nsFontMetrics** aFontMetrics);
/**
* Get the font metrics corresponding to the given style data.
* @param aStyleContext the style data
* @param aFontMetrics the font metrics result
* @param aSizeInflation number to multiply font size by
* @return success or failure code
*/
static nsresult GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
nsFontMetrics** aFontMetrics,
float aSizeInflation = 1.0f);
nsFontMetrics** aFontMetrics);
/**
* Find the immediate child of aParent whose frame subtree contains
@ -1456,59 +1452,6 @@ public:
*/
static bool Are3DTransformsEnabled();
/**
* Return whether this is a frame whose width is used when computing
* the font size inflation of its descendants.
*/
static bool IsContainerForFontSizeInflation(const nsIFrame *aFrame);
/**
* Return the font size inflation *ratio* for a given frame. This is
* the factor by which font sizes should be inflated; it is never
* smaller than 1.
*
* There are three variants: pass a reflow state if the frame or any
* of its ancestors are currently being reflowed and a frame
* otherwise, or, if you know the width of the inflation container (a
* somewhat sketchy assumption), its width.
*/
static float FontSizeInflationFor(const nsHTMLReflowState &aReflowState);
static float FontSizeInflationFor(const nsIFrame *aFrame);
static float FontSizeInflationFor(const nsIFrame *aFrame,
nscoord aInflationContainerWidth);
/**
* Perform the first half of the computation of FontSizeInflationFor
* (see above).
* This includes determining whether inflation should be performed
* within this container and returning 0 if it should not be.
*
* The result is guaranteed not to vary between line participants
* (inlines, text frames) within a line.
*
* The result should not be used directly since font sizes slightly
* above the minimum should always be adjusted as done by
* FontSizeInflationInner.
*/
static nscoord InflationMinFontSizeFor(const nsHTMLReflowState
&aReflowState);
static nscoord InflationMinFontSizeFor(const nsIFrame *aFrame);
static nscoord InflationMinFontSizeFor(const nsIFrame *aFrame,
nscoord aInflationContainerWidth);
/**
* Perform the second half of the computation done by
* FontSizeInflationFor (see above).
*
* aMinFontSize must be the result of one of the
* InflationMinFontSizeFor methods above.
*/
static float FontSizeInflationInner(const nsIFrame *aFrame,
nscoord aMinFontSize);
static bool FontSizeInflationEnabled(nsPresContext *aPresContext);
static void Initialize();
static void Shutdown();
/**

View File

@ -713,10 +713,6 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
#define NS_STYLE_HYPHENS_MANUAL 1
#define NS_STYLE_HYPHENS_AUTO 2
// See nsStyleText
#define NS_STYLE_TEXT_SIZE_ADJUST_NONE 0
#define NS_STYLE_TEXT_SIZE_ADJUST_AUTO 1
// See nsStyleText
#define NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT 0

View File

@ -180,7 +180,6 @@ _TEST_FILES = \
test_bug603550.html \
test_bug629838.html \
test_bug646757.html \
test_font_inflation_reftests.html \
$(NULL)
# Tests for bugs 441782, 467672 and 570378 don't pass reliably on Windows, because of bug 469208
@ -378,16 +377,10 @@ _BROWSER_FILES = \
browser_bug617076.js \
$(NULL)
_INFLATION_REFTEST_FILES = \
$(shell find $(srcdir)/font-inflation/ -name '*.html' -o -name '*.xhtml') \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_BROWSER_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
libs:: $(_INFLATION_REFTEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/font-inflation/
check::
@$(EXIT_ON_ERROR) \

View File

@ -1,9 +0,0 @@
<!DOCTYPE HTML>
<style>
ul, li { line-height: 1.0; font-size: 35px; }
ul { width: 500px; margin: 0; padding: 0 }
li { margin: 0 0 0 50px; padding: 0 }
</style>
<ul>
<li>item</li>
</ul>

View File

@ -1,9 +0,0 @@
<!DOCTYPE HTML>
<style>
ul, li { line-height: 1.0; font-size: 15px; }
ul { width: 500px; margin: 0; padding: 0 }
li { margin: 0 0 0 50px; padding: 0 }
</style>
<ul>
<li>item</li>
</ul>

View File

@ -1,9 +0,0 @@
<!DOCTYPE HTML>
<style>
ol, li { line-height: 1.0; font-size: 35px; }
ol { width: 500px; margin: 0; padding: 0 }
li { margin: 0 0 0 50px; padding: 0 }
</style>
<ol>
<li>item</li>
</ol>

View File

@ -1,9 +0,0 @@
<!DOCTYPE HTML>
<style>
ol, li { line-height: 1.0; font-size: 15px; }
ol { width: 500px; margin: 0; padding: 0 }
li { margin: 0 0 0 50px; padding: 0 }
</style>
<ol>
<li>item</li>
</ol>

View File

@ -1,6 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; width: 150px; line-height: 1.0; white-space: nowrap }
span { -moz-transform-origin: 0 0; -moz-transform: scale(1.2); }
</style>
<div><span>Hello world</span></div>

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; width: 450px; line-height: 1.0 }
span { -moz-transform-origin: 0 0; -moz-transform: scale(1.2); }
</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.
-->
<div><span>Hello world</span></div>

View File

@ -1,6 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; width: 150px; line-height: 1.0; white-space: nowrap }
p { -moz-transform-origin: 0 0; margin: 0; -moz-transform: scale(1.2); }
</style>
<div><p>Hello world</p></div>

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; width: 450px; line-height: 1.0 }
p { -moz-transform-origin: 0 0; margin: 0; -moz-transform: scale(1.2); }
</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.
-->
<div><p>Hello world</p></div>

View File

@ -1,8 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 34px; line-height: 1.0; width: 450px }
span { font-size: 36px }
div { text-decoration: underline overline line-through }
</style>
<div>Hello <span>world</span></div>

View File

@ -1,13 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 12px; line-height: 1.0; width: 450px }
span { font-size: 18px }
div { text-decoration: underline overline line-through }
</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
and 18px gets mapped to 36px.
-->
<div>Hello <span>world</span></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
input { font-size: 34px; width: 200px }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world"></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
input { font-size: 12px; width: 200px }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world"></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
input { font-size: 34px; }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world" size="15"></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
input { font-size: 12px; }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world" size="15"></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
input { font-size: 34px; }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world"></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
input { font-size: 12px; }
input { height: 50px }
</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.
-->
<div><input type="text" value="Hello world"></div>

View File

@ -1,6 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 34px; width: 450px }
</style>
<div>Hello world</div>

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 12px; width: 450px }
</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.
-->
<div>Hello world</div>

View File

@ -1,6 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 34px; line-height: 1.0; width: 450px }
</style>
<div>Hello world</div>

View File

@ -1,10 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
div { font-size: 12px; line-height: 1.0; width: 450px }
</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.
-->
<div>Hello world</div>

View File

@ -1,7 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
span { background: aqua }
div { font-size: 34px; width: 450px }
</style>
<div><span>Hello world</span></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
span { background: aqua }
div { font-size: 12px; width: 450px }
</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.
-->
<div><span>Hello world</span></div>

View File

@ -1,7 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
span { background: aqua }
div { font-size: 34px; line-height: 1.0; width: 450px }
</style>
<div><span>Hello world</span></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { background: yellow }
span { background: aqua }
div { font-size: 12px; line-height: 1.0; width: 450px }
</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.
-->
<div><span>Hello world</span></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
textarea { font-size: 34px; width: 200px; height: 50px }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea>Hello world</textarea></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
textarea { font-size: 12px; width: 200px; height: 50px }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea>Hello world</textarea></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
textarea { font-size: 34px; }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea rows="4" cols="25">Hello world</textarea></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
textarea { font-size: 12px; }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea rows="4" cols="25">Hello world</textarea></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 34px; line-height: 1.0; width: 450px }
textarea { font-size: 34px; }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea>Hello world</textarea></div>

View File

@ -1,11 +0,0 @@
<!DOCTYPE HTML>
<style>
div { font-size: 12px; line-height: 1.0; width: 450px }
textarea { font-size: 12px; }
textarea { line-height: 1.0 }
</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.
-->
<div><textarea>Hello world</textarea></div>

View File

@ -1,127 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=627842
-->
<head>
<title>Font size inflation reftests</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style type="text/css">
canvas { border: 1px solid green }
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=627842">Mozilla Bug 627842</a>
<pre id="test">
<script type="application/javascript; version=1.7">
/** Test for font size inflation **/
var gTests = [
// IMPORTANT NOTE: For these tests, the test and reference are not
// snapshotted in the same way. The REFERENCE (second file) is
// snapshotted with no unusual pref settings, whereas the TEST (first
// file) has font inflation set to 15 em per line.
// FIXME (maybe): Commented out due to rounding differences between
// inflating the 'normal' line height of a smaller font and using the
// normal line height of the inflated font.
//"== text-1.html text-1-ref.html",
"== text-2.html text-2-ref.html",
// FIXME (maybe): same as text-1.
//"== text-3.html text-3-ref.html",
"== text-4.html text-4-ref.html",
"== decoration-1.html decoration-1-ref.html",
"== bullet-1.html bullet-1-ref.html",
"== bullet-2.html bullet-2-ref.html",
"== input-text-1.html input-text-1-ref.html",
"== input-text-2.html input-text-2-ref.html",
"== input-text-3.html input-text-3-ref.html",
"== textarea-1.html textarea-1-ref.html",
"== textarea-2.html textarea-2-ref.html",
"== textarea-3.html textarea-3-ref.html",
"== css-transform-1.html css-transform-1-ref.html",
"== css-transform-2.html css-transform-2-ref.html",
];
// Maintain a reference count of how many things we're waiting for until
// we can say the tests are done.
var gDelayCount = 0;
function AddFinishDependency()
{ ++gDelayCount; }
function RemoveFinishDependency()
{ if (--gDelayCount == 0) nextPhase(); }
function takeSnapshot(iframe_element)
{
return snapshotWindow(iframe_element.contentWindow, false);
}
function startIframe(url)
{
AddFinishDependency();
var element = document.createElement("iframe");
element.addEventListener("load", handleLoad, false);
// smaller than normal reftests, but enough for these
element.setAttribute("style", "width: 600px; height: 100px");
element.src = "font-inflation/" + url;
document.body.appendChild(element);
function handleLoad(event)
{
RemoveFinishDependency();
}
return element;
}
SimpleTest.waitForExplicitFinish();
var gPhase = 0;
function nextPhase() {
switch (gPhase) {
case 0:
SpecialPowers.setIntPref("font.size.inflation.emPerLine", 15);
for (var i = 0; i < gTests.length; ++i) {
let splitData = gTests[i].split(" ");
let testData =
{ op: splitData[0], test: splitData[1], reference: splitData[2] };
gTests[i] = testData;
testData.testframe = startIframe(testData.test);
}
break;
case 1:
for (var i = 0; i < gTests.length; ++i) {
var testData = gTests[i];
testData.testshot = takeSnapshot(testData.testframe);
testData.testframe.parentNode.removeChild(testData.testframe);
}
SpecialPowers.setIntPref("font.size.inflation.emPerLine", 0);
for (var i = 0; i < gTests.length; ++i) {
var testData = gTests[i];
testData.refframe = startIframe(testData.reference);
}
break;
case 2:
for (var i = 0; i < gTests.length; ++i) {
var testData = gTests[i];
testData.refshot = takeSnapshot(testData.refframe);
testData.refframe.parentNode.removeChild(testData.refframe);
assertSnapshots(testData.testshot, testData.refshot,
testData.op == "==",
testData.test, testData.reference);
}
SimpleTest.finish();
return;
}
++gPhase;
}
nextPhase();
</script>
</pre>
</body>
</html>

View File

@ -258,7 +258,6 @@ nsLayoutStatics::Initialize()
nsContentSink::InitializeStatics();
nsHtml5Module::InitializeStatics();
nsLayoutUtils::Initialize();
nsIPresShell::InitializeStatics();
nsRefreshDriver::InitializeStatics();

View File

@ -257,10 +257,9 @@ void nsListControlFrame::PaintFocus(nsRenderingContext& aRC, nsPoint aPt)
// get it into our coordinates
fRect.MoveBy(childframe->GetParent()->GetOffsetTo(this));
} else {
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
fRect.x = fRect.y = 0;
fRect.width = GetScrollPortRect().width;
fRect.height = CalcFallbackRowHeight(inflation);
fRect.height = CalcFallbackRowHeight();
fRect.MoveBy(containerFrame->GetOffsetTo(this));
}
fRect += aPt;
@ -284,7 +283,7 @@ void nsListControlFrame::PaintFocus(nsRenderingContext& aRC, nsPoint aPt)
}
void
nsListControlFrame::InvalidateFocus(const nsHTMLReflowState *aReflowState)
nsListControlFrame::InvalidateFocus()
{
if (mFocused != this)
return;
@ -294,16 +293,8 @@ nsListControlFrame::InvalidateFocus(const nsHTMLReflowState *aReflowState)
// Invalidating from the containerFrame because that's where our focus
// is drawn.
// The origin of the scrollport is the origin of containerFrame.
float inflation;
if (aReflowState) {
NS_ABORT_IF_FALSE(aReflowState->frame == this, "wrong reflow state");
inflation = nsLayoutUtils::FontSizeInflationFor(*aReflowState);
} else {
inflation = nsLayoutUtils::FontSizeInflationFor(this);
}
nsRect invalidateArea = containerFrame->GetVisualOverflowRect();
nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width,
CalcFallbackRowHeight(inflation));
nsRect emptyFallbackArea(0, 0, GetScrollPortRect().width, CalcFallbackRowHeight());
invalidateArea.UnionRect(invalidateArea, emptyFallbackArea);
containerFrame->Invalidate(invalidateArea);
}
@ -374,11 +365,8 @@ GetNumberOfOptionsRecursive(nsIContent* aContent)
// Main Reflow for ListBox/Dropdown
//-----------------------------------------------------------------
// Note that it doesn't much matter *which* reflow state aReflowState
// is (as long as it's in the right block); we intentionally pass
// whatever reflow state is most convenient.
nscoord
nsListControlFrame::CalcHeightOfARow(const nsHTMLReflowState& aReflowState)
nsListControlFrame::CalcHeightOfARow()
{
// Calculate the height of a single row in the listbox or dropdown list by
// using the tallest thing in the subtree, since there may be option groups
@ -389,9 +377,7 @@ nsListControlFrame::CalcHeightOfARow(const nsHTMLReflowState& aReflowState)
// Check to see if we have zero items (and optimize by checking
// heightOfARow first)
if (heightOfARow == 0 && GetNumberOfOptions() == 0) {
nscoord minFontSize = nsLayoutUtils::InflationMinFontSizeFor(aReflowState);
float inflation = nsLayoutUtils::FontSizeInflationInner(this, minFontSize);
heightOfARow = CalcFallbackRowHeight(inflation);
heightOfARow = CalcFallbackRowHeight();
}
return heightOfARow;
@ -514,7 +500,7 @@ nsListControlFrame::Reflow(nsPresContext* aPresContext,
// already set mNumDisplayRows in CalcIntrinsicHeight. Also note that we
// can't use HeightOfARow() here because that just uses a cached value
// that we didn't compute.
nscoord rowHeight = CalcHeightOfARow(aReflowState);
nscoord rowHeight = CalcHeightOfARow();
if (rowHeight == 0) {
// Just pick something
mNumDisplayRows = 1;
@ -1181,8 +1167,7 @@ nsListControlFrame::OnContentReset()
}
void
nsListControlFrame::ResetList(bool aAllowScrolling,
const nsHTMLReflowState *aReflowState)
nsListControlFrame::ResetList(bool aAllowScrolling)
{
// if all the frames aren't here
// don't bother reseting
@ -1206,7 +1191,7 @@ nsListControlFrame::ResetList(bool aAllowScrolling,
mStartSelectionIndex = kNothingSelected;
mEndSelectionIndex = kNothingSelected;
InvalidateFocus(aReflowState);
InvalidateFocus();
// Combobox will redisplay itself with the OnOptionSelected event
}
@ -1759,7 +1744,7 @@ nsListControlFrame::DidReflow(nsPresContext* aPresContext,
// The idea is that we want scroll history restoration to trump ResetList
// scrolling to the selected element, when the ResetList was probably only
// caused by content loading normally.
ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset, aReflowState);
ResetList(!DidHistoryRestore() || mPostChildrenLoadedReset);
}
mHasPendingInterruptAtStartOfReflow = false;
@ -1828,13 +1813,12 @@ nsListControlFrame::IsLeftButton(nsIDOMEvent* aMouseEvent)
}
nscoord
nsListControlFrame::CalcFallbackRowHeight(float aFontSizeInflation)
nsListControlFrame::CalcFallbackRowHeight()
{
nscoord rowHeight = 0;
nsRefPtr<nsFontMetrics> fontMet;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
aFontSizeInflation);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
if (fontMet) {
rowHeight = fontMet->MaxHeight();
}

View File

@ -239,16 +239,14 @@ public:
* that PaintFocus will or could have painted --- basically the whole
* GetOptionsContainer, plus some extra stuff if there are no options. This
* must be called every time mEndSelectionIndex changes.
*
* Pass non-null aReflowState if during reflow.
*/
void InvalidateFocus(const nsHTMLReflowState* aReflowState = nsnull);
void InvalidateFocus();
/**
* Function to calculate the height a row, for use with the "size" attribute.
* Can't be const because GetNumberOfOptions() isn't const.
*/
nscoord CalcHeightOfARow(const nsHTMLReflowState& aReflowState);
nscoord CalcHeightOfARow();
/**
* Function to ask whether we're currently in what might be the
@ -334,11 +332,8 @@ protected:
/**
* Resets the select back to it's original default values;
* those values as determined by the original HTML
*
* Pass non-null aReflowState if during reflow.
*/
virtual void ResetList(bool aAllowScrolling,
const nsHTMLReflowState* aReflowState = nsnull);
virtual void ResetList(bool aAllowScrolling);
nsListControlFrame(nsIPresShell* aShell, nsIDocument* aDocument, nsStyleContext* aContext);
virtual ~nsListControlFrame();
@ -378,7 +373,7 @@ protected:
bool IsLeftButton(nsIDOMEvent* aMouseEvent);
// guess at a row height based on our own style.
nscoord CalcFallbackRowHeight(float aFontSizeInflation);
nscoord CalcFallbackRowHeight();
// CalcIntrinsicHeight computes our intrinsic height (taking the "size"
// attribute into account). This should only be called in non-dropdown mode.

View File

@ -262,12 +262,9 @@ nsProgressFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap)
{
float inflation =
nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width);
nsRefPtr<nsFontMetrics> fontMet;
NS_ENSURE_SUCCESS(nsLayoutUtils::GetFontMetricsForFrame(this,
getter_AddRefs(fontMet),
inflation),
getter_AddRefs(fontMet)),
nsSize(0, 0));
nsSize autoSize;

View File

@ -234,7 +234,7 @@ nsSelectsAreaFrame::Reflow(nsPresContext* aPresContext,
// Check whether we need to suppress scrolbar updates. We want to do that if
// we're in a possible first pass and our height of a row has changed.
if (list->MightNeedSecondPass()) {
nscoord newHeightOfARow = list->CalcHeightOfARow(aReflowState);
nscoord newHeightOfARow = list->CalcHeightOfARow();
// We'll need a second pass if our height of a row changed. For
// comboboxes, we'll also need it if our height changed. If we're going
// to do a second pass, suppress scrollbar updates for this pass.

View File

@ -217,8 +217,7 @@ nsTextControlFrame::GetType() const
nsresult
nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
nsSize& aIntrinsicSize,
float aFontSizeInflation)
nsSize& aIntrinsicSize)
{
// Get leading and the Average/MaxAdvance char width
nscoord lineHeight = 0;
@ -227,14 +226,12 @@ nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
nsRefPtr<nsFontMetrics> fontMet;
nsresult rv =
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
aFontSizeInflation);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
NS_ENSURE_SUCCESS(rv, rv);
aRenderingContext->SetFont(fontMet);
lineHeight =
nsHTMLReflowState::CalcLineHeight(GetStyleContext(), NS_AUTOHEIGHT,
aFontSizeInflation);
nsHTMLReflowState::CalcLineHeight(GetStyleContext(), NS_AUTOHEIGHT);
charWidth = fontMet->AveCharWidth();
charMaxAdvance = fontMet->MaxAdvance();
@ -501,16 +498,8 @@ nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aMargin, nsSize aBorder,
nsSize aPadding, bool aShrinkWrap)
{
float inflation;
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
// FIXME: This won't turn out so well for the height; maybe disable
// inflation entirely in this case?
inflation = 1.0f;
} else {
inflation = nsLayoutUtils::FontSizeInflationFor(this, aCBSize.width);
}
nsSize autoSize;
nsresult rv = CalcIntrinsicSize(aRenderingContext, autoSize, inflation);
nsresult rv = CalcIntrinsicSize(aRenderingContext, autoSize);
if (NS_FAILED(rv)) {
// What now?
autoSize.SizeTo(0, 0);
@ -523,8 +512,7 @@ nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
aCBSize, aAvailableWidth,
aMargin, aBorder,
aPadding, aShrinkWrap);
// Disabled when there's inflation; see comment in GetPrefSize.
NS_ASSERTION(inflation != 1.0f || ancestorAutoSize.width == autoSize.width,
NS_ASSERTION(ancestorAutoSize.width == autoSize.width,
"Incorrect size computed by ComputeAutoSize?");
}
#endif
@ -565,11 +553,7 @@ nsTextControlFrame::GetPrefSize(nsBoxLayoutState& aState)
nsSize pref(0,0);
// FIXME: This inflation parameter isn't correct; we should fix it if
// we want font size inflation to work well in XUL. If we do, we can
// also re-enable the assertion in ComputeAutoSize when inflation is
// enabled.
nsresult rv = CalcIntrinsicSize(aState.GetRenderingContext(), pref, 1.0f);
nsresult rv = CalcIntrinsicSize(aState.GetRenderingContext(), pref);
NS_ENSURE_SUCCESS(rv, pref);
AddBorderAndPadding(pref);
@ -615,37 +599,16 @@ nsTextControlFrame::GetBoxAscent(nsBoxLayoutState& aState)
// Return the baseline of the first (nominal) row, with centering for
// single-line controls.
float inflation;
if (nsLayoutUtils::IsContainerForFontSizeInflation(this)) {
inflation =
nsLayoutUtils::FontSizeInflationFor(this, GetContentRect().width);
} else {
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
NS_ASSERTION(outerReflowState || !mParent || mParent->IsBoxFrame() ||
!(mParent->GetStateBits() & NS_FRAME_IN_REFLOW),
"when a text control is reflowed by one of its ancestors "
"and its parent is non-XUL, we should have the outer "
"reflow state in the box layout state");
if (outerReflowState && outerReflowState->frame == this) {
inflation = nsLayoutUtils::FontSizeInflationFor(*outerReflowState);
} else {
inflation = nsLayoutUtils::FontSizeInflationInner(this,
nsLayoutUtils::InflationMinFontSizeFor(mParent));
}
}
// First calculate the ascent wrt the client rect
nsRect clientRect;
GetClientRect(clientRect);
nscoord lineHeight =
IsSingleLineTextControl() ? clientRect.height :
nsHTMLReflowState::CalcLineHeight(GetStyleContext(), NS_AUTOHEIGHT,
inflation);
nsHTMLReflowState::CalcLineHeight(GetStyleContext(), NS_AUTOHEIGHT);
nsRefPtr<nsFontMetrics> fontMet;
nsresult rv =
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet),
inflation);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fontMet));
NS_ENSURE_SUCCESS(rv, 0);
nscoord ascent = nsLayoutUtils::GetCenteredFontBaseline(fontMet, lineHeight);

View File

@ -392,8 +392,7 @@ protected:
// etc. Just the size of our actual area for the text (and the scrollbars,
// for <textarea>).
nsresult CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
nsSize& aIntrinsicSize,
float aFontSizeInflation);
nsSize& aIntrinsicSize);
nsresult ScrollSelectionIntoView();

View File

@ -61,10 +61,12 @@ static const PRUnichar kASCIIPeriodsChar[] = { '.', '.', '.', 0x0 };
// Return an ellipsis if the font supports it,
// otherwise use three ASCII periods as fallback.
static nsDependentString GetEllipsis(nsFontMetrics *aFontMetrics)
static nsDependentString GetEllipsis(nsIFrame* aFrame)
{
// Check if the first font supports Unicode ellipsis.
gfxFontGroup* fontGroup = aFontMetrics->GetThebesFontGroup();
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
gfxFont* firstFont = fontGroup->GetFontAt(0);
return firstFont && firstFont->HasCharacter(kEllipsisChar[0])
? nsDependentString(kEllipsisChar,
@ -103,8 +105,11 @@ IsFullyClipped(nsTextFrame* aFrame, nscoord aLeft, nscoord aRight,
if (aLeft <= 0 && aRight <= 0) {
return false;
}
return !aFrame->MeasureCharClippedText(aLeft, aRight,
aSnappedLeft, aSnappedRight);
nsRefPtr<nsRenderingContext> rc =
aFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
return rc &&
!aFrame->MeasureCharClippedText(rc->ThebesContext(), aLeft, aRight,
aSnappedLeft, aSnappedRight);
}
static bool
@ -244,8 +249,7 @@ nsDisplayTextOverflowMarker::PaintTextToContext(nsRenderingContext* aCtx,
nsPoint aOffsetFromRect)
{
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(mFrame));
nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
aCtx->SetFont(fm);
gfxFloat y = nsLayoutUtils::GetSnappedBaselineY(mFrame, aCtx->ThebesContext(),
mRect.y, mAscent);
@ -658,12 +662,11 @@ TextOverflow::Marker::SetupString(nsIFrame* aFrame)
nsRefPtr<nsRenderingContext> rc =
aFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(aFrame));
nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
rc->SetFont(fm);
mMarkerString = mStyle->mType == NS_STYLE_TEXT_OVERFLOW_ELLIPSIS ?
GetEllipsis(fm) : mStyle->mString;
GetEllipsis(aFrame) : mStyle->mString;
mWidth = nsLayoutUtils::GetStringWidth(aFrame, rc, mMarkerString.get(),
mMarkerString.Length());
mInitialized = true;

View File

@ -57,6 +57,8 @@
#include "nsFrameSelection.h"
//END INCLUDES FOR SELECTION
#define BR_USING_CENTERED_FONT_BASELINE NS_FRAME_STATE_BIT(63)
class BRFrame : public nsFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
@ -97,8 +99,6 @@ public:
protected:
BRFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
virtual ~BRFrame();
nscoord mAscent;
};
nsIFrame*
@ -126,6 +126,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
// However, it's not always 0. See below.
aMetrics.width = 0;
aMetrics.ascent = 0;
RemoveStateBits(BR_USING_CENTERED_FONT_BASELINE);
// Only when the BR is operating in a line-layout situation will it
// behave like a BR.
@ -150,14 +151,14 @@ BRFrame::Reflow(nsPresContext* aPresContext,
// normal inline frame. That line-height is used is important
// here for cases where the line-height is less than 1.
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(aReflowState));
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
aReflowState.rendContext->SetFont(fm); // FIXME: maybe not needed?
if (fm) {
nscoord logicalHeight = aReflowState.CalcLineHeight();
aMetrics.height = logicalHeight;
aMetrics.ascent =
nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight);
AddStateBits(BR_USING_CENTERED_FONT_BASELINE);
}
else {
aMetrics.ascent = aMetrics.height = 0;
@ -188,8 +189,6 @@ BRFrame::Reflow(nsPresContext* aPresContext,
aMetrics.SetOverflowAreasToDesiredBounds();
mAscent = aMetrics.ascent;
NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
return NS_OK;
}
@ -233,7 +232,18 @@ BRFrame::GetType() const
nscoord
BRFrame::GetBaseline() const
{
return mAscent;
nscoord ascent = 0;
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
if (fm) {
nscoord logicalHeight = GetRect().height;
if (GetStateBits() & BR_USING_CENTERED_FONT_BASELINE) {
ascent = nsLayoutUtils::GetCenteredFontBaseline(fm, logicalHeight);
} else {
ascent = fm->MaxAscent() + GetUsedBorderAndPadding().top;
}
}
return NS_MIN(mRect.height, ascent);
}
nsIFrame::ContentOffsets BRFrame::CalcContentOffsetsFromFramePoint(nsPoint aPoint)

View File

@ -563,11 +563,9 @@ nsBlockFrame::GetCaretBaseline() const
}
}
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(this));
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
return nsLayoutUtils::GetCenteredFontBaseline(fm, nsHTMLReflowState::
CalcLineHeight(GetStyleContext(), contentRect.height,
nsLayoutUtils::FontSizeInflationFor(this))) +
CalcLineHeight(GetStyleContext(), contentRect.height)) +
bp.top;
}
@ -2334,8 +2332,7 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
}
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(aState.mReflowState));
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
aState.mReflowState.rendContext->SetFont(fm); // FIXME: needed?
nscoord minAscent =

View File

@ -65,9 +65,7 @@
#include "nsAccessibilityService.h"
#endif
using namespace mozilla;
NS_DECLARE_FRAME_PROPERTY(FontSizeInflationProperty, nsnull)
#define BULLET_FRAME_IMAGE_LOADING NS_FRAME_STATE_BIT(63)
class nsBulletListener : public nsStubImageDecoderObserver
{
@ -398,8 +396,7 @@ nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_AM:
case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ER:
case NS_STYLE_LIST_STYLE_MOZ_ETHIOPIC_HALEHAME_TI_ET:
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
GetFontSizeInflation());
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
GetListItemText(*myList, text);
aRenderingContext.SetFont(fm);
nscoord ascent = fm->MaxAscent();
@ -1319,8 +1316,7 @@ nsBulletFrame::GetListItemText(const nsStyleList& aListStyle,
void
nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
nsRenderingContext *aRenderingContext,
nsHTMLReflowMetrics& aMetrics,
float aFontSizeInflation)
nsHTMLReflowMetrics& aMetrics)
{
// Reset our padding. If we need it, we'll set it below.
mPadding.SizeTo(0, 0, 0, 0);
@ -1357,8 +1353,7 @@ nsBulletFrame::GetDesiredSize(nsPresContext* aCX,
mIntrinsicSize.SizeTo(0, 0);
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
aFontSizeInflation);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
nscoord bulletSize;
nsAutoString text;
@ -1447,11 +1442,8 @@ nsBulletFrame::Reflow(nsPresContext* aPresContext,
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame");
DISPLAY_REFLOW(aPresContext, this, aReflowState, aMetrics, aStatus);
float inflation = nsLayoutUtils::FontSizeInflationFor(aReflowState);
SetFontSizeInflation(inflation);
// Get the base size
GetDesiredSize(aPresContext, aReflowState.rendContext, aMetrics, inflation);
GetDesiredSize(aPresContext, aReflowState.rendContext, aMetrics);
// Add in the border and padding; split the top/bottom between the
// ascent and descent to make things look nice
@ -1476,7 +1468,7 @@ nsBulletFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
{
nsHTMLReflowMetrics metrics;
DISPLAY_MIN_WIDTH(this, metrics.width);
GetDesiredSize(PresContext(), aRenderingContext, metrics, 1.0f);
GetDesiredSize(PresContext(), aRenderingContext, metrics);
return metrics.width;
}
@ -1485,7 +1477,7 @@ nsBulletFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
{
nsHTMLReflowMetrics metrics;
DISPLAY_PREF_WIDTH(this, metrics.width);
GetDesiredSize(PresContext(), aRenderingContext, metrics, 1.0f);
GetDesiredSize(PresContext(), aRenderingContext, metrics);
return metrics.width;
}
@ -1606,41 +1598,6 @@ nsBulletFrame::GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGro
*aLoadGroup = doc->GetDocumentLoadGroup().get(); // already_AddRefed
}
union VoidPtrOrFloat {
VoidPtrOrFloat() : p(nsnull) {}
void *p;
float f;
};
float
nsBulletFrame::GetFontSizeInflation() const
{
if (!HasFontSizeInflation()) {
return 1.0f;
}
VoidPtrOrFloat u;
u.p = Properties().Get(FontSizeInflationProperty());
return u.f;
}
void
nsBulletFrame::SetFontSizeInflation(float aInflation)
{
if (aInflation == 1.0f) {
if (HasFontSizeInflation()) {
RemoveStateBits(BULLET_FRAME_HAS_FONT_INFLATION);
Properties().Delete(FontSizeInflationProperty());
}
return;
}
AddStateBits(BULLET_FRAME_HAS_FONT_INFLATION);
VoidPtrOrFloat u;
u.f = aInflation;
Properties().Set(FontSizeInflationProperty(), u.p);
}
nscoord
nsBulletFrame::GetBaseline() const
{
@ -1649,8 +1606,7 @@ nsBulletFrame::GetBaseline() const
ascent = GetRect().height;
} else {
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
GetFontSizeInflation());
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
const nsStyleList* myList = GetStyleList();
switch (myList->mListStyleType) {
case NS_STYLE_LIST_STYLE_NONE:

View File

@ -46,9 +46,6 @@
#include "imgIRequest.h"
#include "imgIDecoderObserver.h"
#define BULLET_FRAME_IMAGE_LOADING NS_FRAME_STATE_BIT(63)
#define BULLET_FRAME_HAS_FONT_INFLATION NS_FRAME_STATE_BIT(62)
/**
* A simple class that manages the layout and rendering of html bullets.
* This class also supports the CSS list-style properties.
@ -57,10 +54,7 @@ class nsBulletFrame : public nsFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
nsBulletFrame(nsStyleContext* aContext)
: nsFrame(aContext)
{
}
nsBulletFrame(nsStyleContext* aContext) : nsFrame(aContext) {}
virtual ~nsBulletFrame();
// nsIFrame
@ -113,17 +107,10 @@ public:
virtual bool IsSelfEmpty();
virtual nscoord GetBaseline() const;
float GetFontSizeInflation() const;
bool HasFontSizeInflation() const {
return (GetStateBits() & BULLET_FRAME_HAS_FONT_INFLATION) != 0;
}
void SetFontSizeInflation(float aInflation);
protected:
void GetDesiredSize(nsPresContext* aPresContext,
nsRenderingContext *aRenderingContext,
nsHTMLReflowMetrics& aMetrics,
float aFontSizeInflation);
nsHTMLReflowMetrics& aMetrics);
void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);

View File

@ -7510,21 +7510,8 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
// Construct the parent chain manually since constructing it normally
// messes up dimensions.
const nsHTMLReflowState *outerReflowState = aState.OuterReflowState();
NS_ASSERTION(!outerReflowState || outerReflowState->frame != this,
"in and out of XUL on a single frame?");
if (outerReflowState && outerReflowState->frame == parentFrame) {
// We're a frame (such as a text control frame) that jumps into
// box reflow and then straight out of it on the child frame.
// This means we actually have a real parent reflow state.
// nsLayoutUtils::InflationMinFontSizeFor needs this to be linked
// up correctly for text control frames, so do so here).
reflowState.parentReflowState = outerReflowState;
reflowState.mCBReflowState = outerReflowState;
} else {
reflowState.parentReflowState = &parentReflowState;
reflowState.mCBReflowState = &parentReflowState;
}
reflowState.parentReflowState = &parentReflowState;
reflowState.mCBReflowState = &parentReflowState;
reflowState.mReflowDepth = aState.GetReflowDepth();
// mComputedWidth and mComputedHeight are content-box, not
@ -7569,16 +7556,8 @@ nsFrame::BoxReflow(nsBoxLayoutState& aState,
// mLastSize before calling Reflow and then switching it back, but
// However, mLastSize can also be the size passed to BoxReflow by
// RefreshSizeCache, so that doesn't really make sense.
if (metrics->mLastSize.width != aWidth) {
if (metrics->mLastSize.width != aWidth)
reflowState.mFlags.mHResize = true;
// When font size inflation is enabled, a horizontal resize
// requires a full reflow. See nsHTMLReflowState::InitResizeFlags
// for more details.
if (nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
AddStateBits(NS_FRAME_IS_DIRTY);
}
}
if (metrics->mLastSize.height != aHeight)
reflowState.mFlags.mVResize = true;

View File

@ -2199,8 +2199,7 @@ nsSize
nsGfxScrollFrameInner::GetLineScrollAmount() const
{
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(mOuter));
nsLayoutUtils::GetFontMetricsForFrame(mOuter, getter_AddRefs(fm));
NS_ASSERTION(fm, "FontMetrics is null, assuming fontHeight == 1 appunit");
nscoord fontHeight = 1;
if (fm) {

View File

@ -289,19 +289,6 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext,
InitResizeFlags(aPresContext, type);
nsIFrame *parent = frame->GetParent();
if (parent &&
(parent->GetStateBits() & NS_FRAME_IN_CONSTRAINED_HEIGHT) &&
!(parent->GetType() == nsGkAtoms::scrollFrame &&
parent->GetStyleDisplay()->mOverflowY != NS_STYLE_OVERFLOW_HIDDEN)) {
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
} else if (mStylePosition->mHeight.GetUnit() != eStyleUnit_Auto ||
mStylePosition->mMaxHeight.GetUnit() != eStyleUnit_None) {
frame->AddStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
} else {
frame->RemoveStateBits(NS_FRAME_IN_CONSTRAINED_HEIGHT);
}
NS_WARN_IF_FALSE((mFrameType == NS_CSS_FRAME_TYPE_INLINE &&
!frame->IsFrameOfType(nsIFrame::eReplaced)) ||
type == nsGkAtoms::textFrame ||
@ -365,31 +352,6 @@ nsHTMLReflowState::InitResizeFlags(nsPresContext* aPresContext, nsIAtom* aFrameT
mFlags.mHResize = !(frame->GetStateBits() & NS_FRAME_IS_DIRTY) &&
frame->GetSize().width !=
mComputedWidth + mComputedBorderPadding.LeftRight();
if (mFlags.mHResize &&
nsLayoutUtils::FontSizeInflationEnabled(aPresContext)) {
// When font size inflation is enabled, the change in the width of a
// block (or anything that returns true in
// IsContainerForFontSizeInflation) needs to cause a dirty reflow
// since it changes the size of text, line-heights, etc. This is
// relatively similar to a classic case of style change reflow,
// except that because inflation doesn't affect the intrinsic sizing
// codepath, there's no need to invalidate intrinsic sizes.
//
// Note that this makes horizontal resizing a good bit more
// expensive. However, font size inflation is targeted at a set of
// devices (zoom-and-pan devices) where the main use case for
// horizontal resizing needing to be efficient (window resizing) is
// not present. It does still increase the cost of dynamic changes
// caused by script where a style or content change in one place
// causes a resize in another (e.g., rebalancing a table).
// 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);
}
// XXX Should we really need to null check mCBReflowState? (We do for
// at least nsBoxFrame).
@ -2149,13 +2111,10 @@ GetNormalLineHeight(nsFontMetrics* aFontMetrics)
return normalLineHeight;
}
static inline nscoord
static nscoord
ComputeLineHeight(nsStyleContext* aStyleContext,
nscoord aBlockHeight,
bool* aIsBlockHeight)
nscoord aBlockHeight)
{
*aIsBlockHeight = false;
const nsStyleCoord& lhCoord = aStyleContext->GetStyleText()->mLineHeight;
if (lhCoord.GetUnit() == eStyleUnit_Coord)
@ -2175,10 +2134,8 @@ ComputeLineHeight(nsStyleContext* aStyleContext,
if (lhCoord.GetUnit() == eStyleUnit_Enumerated) {
NS_ASSERTION(lhCoord.GetIntValue() == NS_STYLE_LINE_HEIGHT_BLOCK_HEIGHT,
"bad line-height value");
if (aBlockHeight != NS_AUTOHEIGHT) {
*aIsBlockHeight = true;
if (aBlockHeight != NS_AUTOHEIGHT)
return aBlockHeight;
}
}
nsRefPtr<nsFontMetrics> fm;
@ -2194,27 +2151,19 @@ nsHTMLReflowState::CalcLineHeight() const
nsLayoutUtils::IsNonWrapperBlock(frame) ? mComputedHeight :
(mCBReflowState ? mCBReflowState->mComputedHeight : NS_AUTOHEIGHT);
return CalcLineHeight(frame->GetStyleContext(), blockHeight,
nsLayoutUtils::FontSizeInflationFor(*this));
return CalcLineHeight(frame->GetStyleContext(), blockHeight);
}
/* static */ nscoord
nsHTMLReflowState::CalcLineHeight(nsStyleContext* aStyleContext,
nscoord aBlockHeight,
float aFontSizeInflation)
nscoord aBlockHeight)
{
NS_PRECONDITION(aStyleContext, "Must have a style context");
bool isBlockHeight;
nscoord lineHeight =
ComputeLineHeight(aStyleContext, aBlockHeight, &isBlockHeight);
nscoord lineHeight = ComputeLineHeight(aStyleContext, aBlockHeight);
NS_ASSERTION(lineHeight >= 0, "ComputeLineHeight screwed up");
if (aFontSizeInflation != 1.0f && !isBlockHeight) {
lineHeight = NSToCoordRound(lineHeight * aFontSizeInflation);
}
return lineHeight;
}

View File

@ -419,14 +419,9 @@ public:
* Only used with line-height:-moz-block-height.
* NS_AUTOHEIGHT results in a normal line-height for
* line-height:-moz-block-height.
* @param aFontSizeInflation The result of the appropriate
* nsLayoutUtils::FontSizeInflationFor call,
* or 1.0 if during intrinsic size
* calculation.
*/
static nscoord CalcLineHeight(nsStyleContext* aStyleContext,
nscoord aBlockHeight,
float aFontSizeInflation);
nscoord aBlockHeight);
void ComputeContainingBlockRectangle(nsPresContext* aPresContext,

View File

@ -160,6 +160,9 @@ typedef PRUint64 nsFrameState;
#define NS_FRAME_IN_REFLOW NS_FRAME_STATE_BIT(0)
// This is only set during painting
#define NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO NS_FRAME_STATE_BIT(0)
// This bit is set when a frame is created. After it has been reflowed
// once (during the DidReflow with a finished state) the bit is
// cleared.
@ -290,14 +293,8 @@ typedef PRUint64 nsFrameState;
// A display item for this frame has been painted as part of a ThebesLayer.
#define NS_FRAME_PAINTED_THEBES NS_FRAME_STATE_BIT(38)
// Frame is or is a descendant of something with a fixed height, and
// has no closer ancestor that is overflow:auto or overflow:scroll.
#define NS_FRAME_IN_CONSTRAINED_HEIGHT NS_FRAME_STATE_BIT(39)
// This is only set during painting
#define NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO NS_FRAME_STATE_BIT(40)
// Bits 0-19 and bits 32-59 of the frame state are reserved by this API.
// The lower 20 bits and upper 32 bits of the frame state are reserved
// by this API.
#define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
// Box layout bits

View File

@ -986,8 +986,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
// Set font and color
aRenderingContext.SetColor(GetStyleColor()->mColor);
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm),
nsLayoutUtils::FontSizeInflationFor(this));
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
aRenderingContext.SetFont(fm);
// Format the text to display within the formatting rect

View File

@ -646,8 +646,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
}
nsRefPtr<nsFontMetrics> fm;
float inflation = nsLayoutUtils::FontSizeInflationFor(aReflowState);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm), inflation);
nsLayoutUtils::GetFontMetricsForFrame(this, getter_AddRefs(fm));
aReflowState.rendContext->SetFont(fm);
if (fm) {

View File

@ -120,9 +120,6 @@ nsLineLayout::nsLineLayout(nsPresContext* aPresContext,
mTopEdge = 0;
mTrimmableWidth = 0;
mInflationMinFontSize =
nsLayoutUtils::InflationMinFontSizeFor(*aOuterReflowState);
// Instead of always pre-initializing the free-lists for frames and
// spans, we do it on demand so that situations that only use a few
// frames and spans won't waste a lot of time in unneeded
@ -1592,10 +1589,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// Get the parent frame's font for all of the frames in this span
nsRefPtr<nsFontMetrics> fm;
float inflation =
nsLayoutUtils::FontSizeInflationInner(spanFrame, mInflationMinFontSize);
nsLayoutUtils::GetFontMetricsForFrame(spanFrame, getter_AddRefs(fm),
inflation);
nsLayoutUtils::GetFontMetricsForFrame(spanFrame, getter_AddRefs(fm));
mBlockReflowState->rendContext->SetFont(fm);
bool preMode = mStyleText->WhiteSpaceIsSignificant();
@ -1726,12 +1720,9 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
// Compute the logical height for this span. The logical height
// is based on the line-height value, not the font-size. Also
// compute the top leading.
float inflation =
nsLayoutUtils::FontSizeInflationInner(spanFrame, mInflationMinFontSize);
nscoord logicalHeight = nsHTMLReflowState::
CalcLineHeight(spanFrame->GetStyleContext(),
mBlockReflowState->ComputedHeight(),
inflation);
mBlockReflowState->ComputedHeight());
nscoord contentHeight = spanFramePFD->mBounds.height -
spanFramePFD->mBorderPadding.top - spanFramePFD->mBorderPadding.bottom;
@ -1968,11 +1959,8 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
if (verticalAlign.HasPercent()) {
// Percentages are like lengths, except treated as a percentage
// of the elements line-height value.
float inflation =
nsLayoutUtils::FontSizeInflationInner(frame, mInflationMinFontSize);
pctBasis = nsHTMLReflowState::CalcLineHeight(
frame->GetStyleContext(), mBlockReflowState->ComputedHeight(),
inflation);
frame->GetStyleContext(), mBlockReflowState->ComputedHeight());
}
nscoord offset =
nsRuleNode::ComputeCoordPercentCalc(verticalAlign, pctBasis);
@ -2631,7 +2619,7 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsOverflowAreas& aOverflo
if (pfd->GetFlag(PFD_RECOMPUTEOVERFLOW) ||
frame->GetStyleContext()->HasTextDecorationLines()) {
nsTextFrame* f = static_cast<nsTextFrame*>(frame);
r = f->RecomputeOverflow(*mBlockReflowState);
r = f->RecomputeOverflow();
}
frame->FinishAndStoreOverflow(r, frame->GetSize());
}

View File

@ -369,9 +369,6 @@ public:
* context (e.g. MathML or floating first-letter).
*/
nsIFrame* GetLineContainerFrame() const { return mBlockReflowState->frame; }
const nsHTMLReflowState* GetLineContainerRS() const {
return mBlockReflowState;
}
const nsLineList::iterator* GetLine() const {
return GetFlag(LL_GOTLINEBOX) ? &mLineBox : nsnull;
}
@ -550,8 +547,6 @@ protected:
nscoord mMaxTopBoxHeight;
nscoord mMaxBottomBoxHeight;
nscoord mInflationMinFontSize;
// Final computed line-height value after VerticalAlignFrames for
// the block has been called.
nscoord mFinalLineHeight;

View File

@ -65,16 +65,13 @@ class PropertyProvider;
// reflow
#define TEXT_HAS_NONCOLLAPSED_CHARACTERS NS_FRAME_STATE_BIT(31)
#define TEXT_HAS_FONT_INFLATION NS_FRAME_STATE_BIT(61)
class nsTextFrame : public nsFrame {
public:
NS_DECL_FRAMEARENA_HELPERS
friend class nsContinuingTextFrame;
nsTextFrame(nsStyleContext* aContext)
: nsFrame(aContext)
nsTextFrame(nsStyleContext* aContext) : nsFrame(aContext)
{
NS_ASSERTION(mContentOffset == 0, "Bogus content offset");
}
@ -228,13 +225,7 @@ public:
#ifdef ACCESSIBILITY
virtual already_AddRefed<nsAccessible> CreateAccessible();
#endif
float GetFontSizeInflation() const;
bool HasFontSizeInflation() const {
return (GetStateBits() & TEXT_HAS_FONT_INFLATION) != 0;
}
void SetFontSizeInflation(float aInflation);
virtual void MarkIntrinsicWidthsDirty();
virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
@ -273,8 +264,7 @@ public:
PRUint32 aSkippedStartOffset = 0,
PRUint32 aSkippedMaxLength = PR_UINT32_MAX);
nsOverflowAreas
RecomputeOverflow(const nsHTMLReflowState& aBlockReflowState);
nsOverflowAreas RecomputeOverflow();
void AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext,
nsIFrame::InlineMinWidthData *aData);
@ -289,7 +279,8 @@ public:
* the method returns false.
* @return true if at least one whole grapheme cluster fit between the edges
*/
bool MeasureCharClippedText(nscoord aLeftEdge, nscoord aRightEdge,
bool MeasureCharClippedText(gfxContext* aCtx,
nscoord aLeftEdge, nscoord aRightEdge,
nscoord* aSnappedLeftEdge,
nscoord* aSnappedRightEdge);
/**
@ -298,7 +289,8 @@ public:
* undefined when the method returns false.
* @return true if at least one whole grapheme cluster fit between the edges
*/
bool MeasureCharClippedText(PropertyProvider& aProvider,
bool MeasureCharClippedText(gfxContext* aCtx,
PropertyProvider& aProvider,
nscoord aLeftEdge, nscoord aRightEdge,
PRUint32* aStartOffset, PRUint32* aMaxLength,
nscoord* aSnappedLeftEdge,
@ -373,16 +365,6 @@ public:
// boundary.
PRInt32 GetInFlowContentLength();
enum TextRunType {
// Anything in reflow (but not intrinsic width calculation) or
// painting should use the inflated text run (i.e., with font size
// inflation applied).
eInflated,
// Intrinsic width calculation should use the non-inflated text run.
// When there is font size inflation, it will be different.
eNotInflated
};
/**
* Acquires the text run for this content, if necessary.
* @param aRC the rendering context to use as a reference for creating
@ -395,49 +377,19 @@ public:
* to offsets into the textrun; its initial offset is set to this frame's
* content offset
*/
gfxSkipCharsIterator EnsureTextRun(TextRunType aWhichTextRun,
float aInflation,
gfxContext* aReferenceContext = nsnull,
gfxSkipCharsIterator EnsureTextRun(gfxContext* aReferenceContext = nsnull,
nsIFrame* aLineContainer = nsnull,
const nsLineList::iterator* aLine = nsnull,
PRUint32* aFlowEndInTextRun = nsnull);
// Since we can't reference |this| in default arguments:
gfxSkipCharsIterator EnsureTextRun(TextRunType aWhichTextRun) {
return EnsureTextRun(aWhichTextRun,
(aWhichTextRun == eInflated)
? GetFontSizeInflation() : 1.0f);
}
gfxTextRun* GetTextRun(TextRunType aWhichTextRun) {
if (aWhichTextRun == eInflated || !HasFontSizeInflation())
return mTextRun;
return GetUninflatedTextRun();
}
gfxTextRun* GetUninflatedTextRun();
void SetTextRun(gfxTextRun* aTextRun, TextRunType aWhichTextRun,
float aInflation);
gfxTextRun* GetTextRun() { return mTextRun; }
void SetTextRun(gfxTextRun* aTextRun) { mTextRun = aTextRun; }
/**
* Notify the frame that it should drop its pointer to a text run.
* Returns whether the text run was removed (i.e., whether it was
* associated with this frame, either as its inflated or non-inflated
* text run.
* Clears out |mTextRun| from all frames that hold a reference to it,
* starting at |aStartContinuation|, or if it's nsnull, starting at |this|.
* Deletes |mTextRun| if all references were cleared and it's not cached.
*/
bool RemoveTextRun(gfxTextRun* aTextRun);
/**
* Clears out |mTextRun| (or the uninflated text run, when aInflated
* is nsTextFrame::eNotInflated and there is inflation) from all frames that hold a
* reference to it, starting at |aStartContinuation|, or if it's
* nsnull, starting at |this|. Deletes the text run if all references
* were cleared and it's not cached.
*/
void ClearTextRun(nsTextFrame* aStartContinuation,
TextRunType aWhichTextRun);
void ClearTextRuns() {
ClearTextRun(nsnull, nsTextFrame::eInflated);
ClearTextRun(nsnull, nsTextFrame::eNotInflated);
}
void ClearTextRun(nsTextFrame* aStartContinuation);
// Get the DOM content range mapped by this frame after excluding
// whitespace subject to start-of-line and end-of-line trimming.
@ -482,7 +434,6 @@ protected:
SelectionDetails* GetSelectionDetails();
void UnionAdditionalOverflow(nsPresContext* aPresContext,
const nsHTMLReflowState& aBlockReflowState,
PropertyProvider& aProvider,
nsRect* aVisualOverflowRect,
bool aIncludeTextDecorations);

File diff suppressed because it is too large Load Diff

View File

@ -2235,15 +2235,6 @@ CSS_PROP_TEXT(
nsnull,
offsetof(nsStyleText, mTextShadow),
eStyleAnimType_Shadow)
CSS_PROP_TEXT(
-moz-text-size-adjust,
text_size_adjust,
CSS_PROP_DOMPROP_PREFIXED(TextSizeAdjust),
CSS_PROPERTY_PARSE_VALUE,
VARIANT_AUTO | VARIANT_NONE | VARIANT_INHERIT,
nsnull,
CSS_PROP_NO_OFFSET,
eStyleAnimType_None)
CSS_PROP_TEXT(
text-transform,
text_transform,

View File

@ -2643,24 +2643,6 @@ nsComputedDOMStyle::DoGetHyphens()
return val;
}
nsIDOMCSSValue*
nsComputedDOMStyle::DoGetTextSizeAdjust()
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
switch (GetStyleText()->mTextSizeAdjust) {
default:
NS_NOTREACHED("unexpected value");
// fall through
case NS_STYLE_TEXT_SIZE_ADJUST_AUTO:
val->SetIdent(eCSSKeyword_auto);
break;
case NS_STYLE_TEXT_SIZE_ADJUST_NONE:
val->SetIdent(eCSSKeyword_none);
break;
}
return val;
}
nsIDOMCSSValue*
nsComputedDOMStyle::DoGetPointerEvents()
{
@ -3413,10 +3395,8 @@ nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord)
}
}
// lie about font size inflation since we lie about font size (since
// the inflation only applies to text)
aCoord = nsHTMLReflowState::CalcLineHeight(mStyleContextHolder,
blockHeight, 1.0f);
blockHeight);
// CalcLineHeight uses font->mFont.size, but we want to use
// font->mSize as the font size. Adjust for that. Also adjust for
@ -4599,7 +4579,6 @@ nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
COMPUTED_STYLE_MAP_ENTRY(text_decoration_color, MozTextDecorationColor),
COMPUTED_STYLE_MAP_ENTRY(text_decoration_line, MozTextDecorationLine),
COMPUTED_STYLE_MAP_ENTRY(text_decoration_style, MozTextDecorationStyle),
COMPUTED_STYLE_MAP_ENTRY(text_size_adjust, TextSizeAdjust),
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform, MozTransform),
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform_origin, MozTransformOrigin),
COMPUTED_STYLE_MAP_ENTRY(transform_style, MozTransformStyle),

View File

@ -322,7 +322,6 @@ private:
nsIDOMCSSValue* DoGetWordWrap();
nsIDOMCSSValue* DoGetHyphens();
nsIDOMCSSValue* DoGetMozTabSize();
nsIDOMCSSValue* DoGetTextSizeAdjust();
/* Visibility properties */
nsIDOMCSSValue* DoGetOpacity();

View File

@ -3398,15 +3398,6 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
SETDSC_ENUMERATED, parentText->mHyphens,
NS_STYLE_HYPHENS_MANUAL, 0, 0, 0, 0);
// text-size-adjust: none, auto, inherit, initial
SetDiscrete(*aRuleData->ValueForTextSizeAdjust(), text->mTextSizeAdjust,
canStoreInRuleTree, SETDSC_NONE | SETDSC_AUTO,
parentText->mTextSizeAdjust,
NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // initial value
NS_STYLE_TEXT_SIZE_ADJUST_AUTO, // auto value
NS_STYLE_TEXT_SIZE_ADJUST_NONE, // none value
0, 0);
COMPUTE_END_INHERITED(Text, text)
}

View File

@ -2800,7 +2800,6 @@ nsStyleText::nsStyleText(void)
mWhiteSpace = NS_STYLE_WHITESPACE_NORMAL;
mWordWrap = NS_STYLE_WORDWRAP_NORMAL;
mHyphens = NS_STYLE_HYPHENS_MANUAL;
mTextSizeAdjust = NS_STYLE_TEXT_SIZE_ADJUST_AUTO;
mLetterSpacing.SetNormalValue();
mLineHeight.SetNormalValue();
@ -2817,7 +2816,6 @@ nsStyleText::nsStyleText(const nsStyleText& aSource)
mWhiteSpace(aSource.mWhiteSpace),
mWordWrap(aSource.mWordWrap),
mHyphens(aSource.mHyphens),
mTextSizeAdjust(aSource.mTextSizeAdjust),
mTabSize(aSource.mTabSize),
mLetterSpacing(aSource.mLetterSpacing),
mLineHeight(aSource.mLineHeight),
@ -2845,7 +2843,6 @@ nsChangeHint nsStyleText::CalcDifference(const nsStyleText& aOther) const
(mWhiteSpace != aOther.mWhiteSpace) ||
(mWordWrap != aOther.mWordWrap) ||
(mHyphens != aOther.mHyphens) ||
(mTextSizeAdjust != aOther.mTextSizeAdjust) ||
(mLetterSpacing != aOther.mLetterSpacing) ||
(mLineHeight != aOther.mLineHeight) ||
(mTextIndent != aOther.mTextIndent) ||

View File

@ -1280,7 +1280,6 @@ struct nsStyleText {
PRUint8 mWhiteSpace; // [inherited] see nsStyleConsts.h
PRUint8 mWordWrap; // [inherited] see nsStyleConsts.h
PRUint8 mHyphens; // [inherited] see nsStyleConsts.h
PRUint8 mTextSizeAdjust; // [inherited] see nsStyleConsts.h
PRInt32 mTabSize; // [inherited] see nsStyleConsts.h
nsStyleCoord mLetterSpacing; // [inherited] coord, normal

View File

@ -925,14 +925,6 @@ var gCSSProperties = {
other_values: [ "0", "3", "99", "12000" ],
invalid_values: [ "-1", "-808", "3.0", "17.5" ]
},
"-moz-text-size-adjust": {
domProp: "MozTextSizeAdjust",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: [ "auto" ],
other_values: [ "none" ],
invalid_values: [ "-5%", "0", "100", "0%", "50%", "100%", "220.3%" ]
},
"-moz-transform": {
domProp: "MozTransform",
inherited: false,

View File

@ -951,8 +951,6 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
aFirstTruncatedRow = nsnull;
aDesiredHeight = 0;
bool borderCollapse =
static_cast<nsTableFrame*>(aTable.GetFirstInFlow())->IsBorderCollapse();
PRInt32 lastRowIndex = aLastRow.GetRowIndex();
bool wasLast = false;
// Iterate the rows between aFirstRow and aLastRow
@ -972,21 +970,7 @@ nsTableRowGroupFrame::SplitSpanningCells(nsPresContext& aPresContext,
nscoord cellAvailHeight = aSpanningRowBottom - rowPos.y;
NS_ASSERTION(cellAvailHeight >= 0, "No space for cell?");
bool isTopOfPage = (row == &aFirstRow) && aFirstRowIsTopOfPage;
nsRect rowRect = row->GetRect();
nsSize rowAvailSize(aReflowState.availableWidth,
NS_MAX(aReflowState.availableHeight - rowRect.y,
0));
// don't let the available height exceed what
// CalculateRowHeights set for it
rowAvailSize.height = NS_MIN(rowAvailSize.height, rowRect.height);
nsHTMLReflowState rowReflowState(&aPresContext, aReflowState,
row, rowAvailSize,
-1, -1, false);
InitChildReflowState(aPresContext, borderCollapse, rowReflowState);
rowReflowState.mFlags.mIsTopOfPage = isTopOfPage; // set top of page
nscoord cellHeight = row->ReflowCellFrame(&aPresContext, rowReflowState,
nscoord cellHeight = row->ReflowCellFrame(&aPresContext, aReflowState,
isTopOfPage, cell,
cellAvailHeight, status);
aDesiredHeight = NS_MAX(aDesiredHeight, rowPos.y + cellHeight);

View File

@ -676,7 +676,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
// create the layout state
nsBoxLayoutState state(aPresContext, aReflowState.rendContext,
&aReflowState, aReflowState.mReflowDepth);
aReflowState.mReflowDepth);
nsSize computedSize(aReflowState.ComputedWidth(),aReflowState.ComputedHeight());

View File

@ -46,11 +46,9 @@
nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
nsRenderingContext* aRenderingContext,
const nsHTMLReflowState* aOuterReflowState,
PRUint16 aReflowDepth)
: mPresContext(aPresContext)
, mRenderingContext(aRenderingContext)
, mOuterReflowState(aOuterReflowState)
, mLayoutFlags(0)
, mReflowDepth(aReflowDepth)
, mPaintingDisabled(false)
@ -61,7 +59,6 @@ nsBoxLayoutState::nsBoxLayoutState(nsPresContext* aPresContext,
nsBoxLayoutState::nsBoxLayoutState(const nsBoxLayoutState& aState)
: mPresContext(aState.mPresContext)
, mRenderingContext(aState.mRenderingContext)
, mOuterReflowState(aState.mOuterReflowState)
, mLayoutFlags(aState.mLayoutFlags)
, mReflowDepth(aState.mReflowDepth + 1)
, mPaintingDisabled(aState.mPaintingDisabled)

View File

@ -59,10 +59,7 @@ class nsHTMLReflowCommand;
class NS_STACK_CLASS nsBoxLayoutState
{
public:
nsBoxLayoutState(nsPresContext* aPresContext,
nsRenderingContext* aRenderingContext = nsnull,
// see OuterReflowState() below
const nsHTMLReflowState* aOuterReflowState = nsnull,
nsBoxLayoutState(nsPresContext* aPresContext, nsRenderingContext* aRenderingContext = nsnull,
PRUint16 aReflowDepth = 0) NS_HIDDEN;
nsBoxLayoutState(const nsBoxLayoutState& aState) NS_HIDDEN;
@ -87,16 +84,11 @@ public:
void* AllocateStackMemory(size_t aSize)
{ return PresShell()->AllocateStackMemory(aSize); }
// The HTML reflow state that lives outside the box-block boundary.
// May not be set reliably yet.
const nsHTMLReflowState* OuterReflowState() { return mOuterReflowState; }
PRUint16 GetReflowDepth() { return mReflowDepth; }
private:
nsRefPtr<nsPresContext> mPresContext;
nsRenderingContext *mRenderingContext;
const nsHTMLReflowState *mOuterReflowState;
PRUint32 mLayoutFlags;
PRUint16 mReflowDepth;
bool mPaintingDisabled;

View File

@ -419,8 +419,6 @@ pref("browser.ui.zoom.animationDuration", 200); // ms duration of double-tap zoo
pref("browser.ui.zoom.reflow", false); // Change text wrapping on double-tap
pref("browser.ui.zoom.reflow.fontSize", 720);
pref("font.size.inflation.minTwips", 160);
// pinch gesture
pref("browser.ui.pinch.maxGrowth", 150); // max pinch distance growth
pref("browser.ui.pinch.maxShrink", 200); // max pinch distance shrinkage

View File

@ -1538,29 +1538,6 @@ pref("font.minimum-size.x-western", 0);
pref("font.minimum-size.x-unicode", 0);
pref("font.minimum-size.x-user-def", 0);
/*
* A value greater than zero enables font size inflation for
* pan-and-zoom UIs, so that the fonts in a block are at least the size
* that, if a block's width is scaled to match the device's width, the
* fonts in the block are big enough that at most the pref value ems of
* text fit in *the width of the device*.
*
* When both this pref and the next are set, the larger inflation is
* used.
*/
pref("font.size.inflation.emPerLine", 0);
/*
* A value greater than zero enables font size inflation for
* pan-and-zoom UIs, so that if a block's width is scaled to match the
* device's width, the fonts in a block are at least the font size
* given. The value given is in twips, i.e., 1/20 of a point, or 1/1440
* of an inch.
*
* When both this pref and the previous are set, the larger inflation is
* used.
*/
pref("font.size.inflation.minTwips", 0);
#ifdef XP_WIN
pref("font.name.serif.ar", "Times New Roman");

View File

@ -45,19 +45,3 @@ function compareSnapshots(s1, s2, expected) {
return [correct, s1Str, s2Str];
}
function assertSnapshots(s1, s2, expected, s1name, s2name) {
var [correct, s1Str, s2Str] = compareSnapshots(s1, s2, expected);
var sym = expected ? "==" : "!=";
ok(correct, "reftest comparison: " + sym + " " + s1name + " " + s2name);
if (!correct) {
var report = "REFTEST TEST-UNEXPECTED-FAIL | " + s1name + " | image comparison (" + sym + ")\n";
if (expected) {
report += "REFTEST IMAGE 1 (TEST): " + s1Str + "\n";
report += "REFTEST IMAGE 2 (REFERENCE): " + s2Str + "\n";
} else {
report += "REFTEST IMAGE: " + s1Str + "\n";
}
dump(report);
}
}