зеркало из https://github.com/mozilla/pjs.git
Add a preference for the threshold at which we have enough text within a BFC to use font size inflation. (Bug 706193, patch 1) r=roc
The basic principle behind this preference is that we don't want to use font size inflation when all the text that we would have inflated would fit within a line or two. We're better off preserving the layout than inflating a small amount of text. However, we don't want the inflation decision to vary between adjacent paragraphs, so this decision needs to be made once for each block formatting context. Once the later patches for this bug cause this preference to be honored, this will be a change in behavior. The old behavior can be obtained by setting the preference to 0.
This commit is contained in:
Родитель
ef930ef773
Коммит
7d84450b95
|
@ -133,6 +133,7 @@ typedef FrameMetrics::ViewID ViewID;
|
|||
|
||||
static PRUint32 sFontSizeInflationEmPerLine;
|
||||
static PRUint32 sFontSizeInflationMinTwips;
|
||||
/* static */ PRUint32 nsLayoutUtils::sFontSizeInflationLineThreshold;
|
||||
|
||||
static ViewID sScrollIdCounter = FrameMetrics::START_SCROLL_ID;
|
||||
|
||||
|
@ -4452,6 +4453,8 @@ nsLayoutUtils::Initialize()
|
|||
"font.size.inflation.emPerLine");
|
||||
mozilla::Preferences::AddUintVarCache(&sFontSizeInflationMinTwips,
|
||||
"font.size.inflation.minTwips");
|
||||
mozilla::Preferences::AddUintVarCache(&sFontSizeInflationLineThreshold,
|
||||
"font.size.inflation.lineThreshold");
|
||||
}
|
||||
|
||||
/* static */
|
||||
|
|
|
@ -1555,6 +1555,14 @@ public:
|
|||
|
||||
static bool FontSizeInflationEnabled(nsPresContext *aPresContext);
|
||||
|
||||
/**
|
||||
* See comment above "font.size.inflation.lineThreshold" in
|
||||
* modules/libpref/src/init/all.js .
|
||||
*/
|
||||
static PRUint32 FontSizeInflationLineThreshold() {
|
||||
return sFontSizeInflationLineThreshold;
|
||||
}
|
||||
|
||||
static void Initialize();
|
||||
static void Shutdown();
|
||||
|
||||
|
@ -1633,6 +1641,9 @@ public:
|
|||
static void
|
||||
AssertTreeOnlyEmptyNextInFlows(nsIFrame *aSubtreeRoot);
|
||||
#endif
|
||||
|
||||
private:
|
||||
static PRUint32 sFontSizeInflationLineThreshold;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
|
|
@ -1,47 +1,47 @@
|
|||
test-pref(font.size.inflation.emPerLine,15) == text-1.html text-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == text-2.html text-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == text-3.html text-3-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == text-4.html text-4-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == decoration-1.html decoration-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == bullet-1.html bullet-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == bullet-2.html bullet-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == input-text-1-height.html input-text-1-height-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == input-text-1-noheight.html input-text-1-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == input-text-2-height.html input-text-2-height-ref.html
|
||||
# test-pref(font.size.inflation.emPerLine,15) == input-text-2-noheight.html input-text-2-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == input-text-3-height.html input-text-3-height-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == input-text-3-noheight.html input-text-3-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == textarea-1.html textarea-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == textarea-2.html textarea-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == textarea-3.html textarea-3-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == css-transform-1.html css-transform-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == css-transform-2.html css-transform-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == container-with-clamping.html container-with-clamping-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) load video-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-min-1.html intrinsic-min-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-max-1.html intrinsic-max-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-1a.html intrinsic-fit-1a-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-1b.html intrinsic-fit-1b-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-1c.html intrinsic-fit-1c-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-2a.html intrinsic-fit-1a-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-2b.html intrinsic-fit-1b-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) HTTP(..) == intrinsic-fit-2c.html intrinsic-fit-1c-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == select-listbox-1.html select-listbox-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) != select-listbox-1.html select-listbox-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == select-combobox-1.html select-combobox-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) != select-combobox-1.html select-combobox-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == select-listbox-2.html select-listbox-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) != select-listbox-2.html select-listbox-2.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == select-combobox-2.html select-combobox-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) != select-combobox-2.html select-combobox-2.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == select-combobox-3.html select-combobox-3-ref.html
|
||||
asserts-if(gtk2Widget,0-2) test-pref(font.size.inflation.emPerLine,15) != input-checkbox.html input-checkbox.html
|
||||
asserts-if(gtk2Widget,0-2) test-pref(font.size.inflation.emPerLine,15) != input-radio.html input-radio.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == disable-fontinfl-on-mobile.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == disable-fontinfl-on-mobile-2.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == disable-fontinfl-on-mobile-3.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == disable-fontinfl-on-mobile-4.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == preformatted-text.html preformatted-text-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == fixed-height-body.html fixed-height-body-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == fixed-height-body-child.html fixed-height-body-child-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) == consecutive-inline.html consecutive-inline-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-1.html text-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-2.html text-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-3.html text-3-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == text-4.html text-4-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == decoration-1.html decoration-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == bullet-1.html bullet-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == bullet-2.html bullet-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-1-height.html input-text-1-height-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-1-noheight.html input-text-1-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-2-height.html input-text-2-height-ref.html
|
||||
# test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-2-noheight.html input-text-2-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-3-height.html input-text-3-height-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == input-text-3-noheight.html input-text-3-noheight-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == textarea-1.html textarea-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == textarea-2.html textarea-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == textarea-3.html textarea-3-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == css-transform-1.html css-transform-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == css-transform-2.html css-transform-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == container-with-clamping.html container-with-clamping-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) load video-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-min-1.html intrinsic-min-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-max-1.html intrinsic-max-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-1a.html intrinsic-fit-1a-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-1b.html intrinsic-fit-1b-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-1c.html intrinsic-fit-1c-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-2a.html intrinsic-fit-1a-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-2b.html intrinsic-fit-1b-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) HTTP(..) == intrinsic-fit-2c.html intrinsic-fit-1c-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == select-listbox-1.html select-listbox-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != select-listbox-1.html select-listbox-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == select-combobox-1.html select-combobox-1-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != select-combobox-1.html select-combobox-1.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == select-listbox-2.html select-listbox-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != select-listbox-2.html select-listbox-2.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == select-combobox-2.html select-combobox-2-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != select-combobox-2.html select-combobox-2.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == select-combobox-3.html select-combobox-3-ref.html
|
||||
asserts-if(gtk2Widget,0-2) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != input-checkbox.html input-checkbox.html
|
||||
asserts-if(gtk2Widget,0-2) test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) != input-radio.html input-radio.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == disable-fontinfl-on-mobile.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == disable-fontinfl-on-mobile-2.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == disable-fontinfl-on-mobile-3.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == disable-fontinfl-on-mobile-4.html disable-fontinfl-on-mobile-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == preformatted-text.html preformatted-text-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == fixed-height-body.html fixed-height-body-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == fixed-height-body-child.html fixed-height-body-child-ref.html
|
||||
test-pref(font.size.inflation.emPerLine,15) test-pref(font.size.inflation.lineThreshold,0) == consecutive-inline.html consecutive-inline-ref.html
|
||||
|
|
|
@ -1672,6 +1672,28 @@ pref("font.size.inflation.emPerLine", 0);
|
|||
* used.
|
||||
*/
|
||||
pref("font.size.inflation.minTwips", 0);
|
||||
/*
|
||||
* Since the goal of font size inflation is to avoid having to
|
||||
* repeatedly scroll side to side to read a block of text, and there are
|
||||
* a number of page layouts where a relatively small chunk of text is
|
||||
* better of not being inflated according to the same algorithm we use
|
||||
* for larger chunks of text, we want a threshold for an amount of text
|
||||
* that triggers font size inflation. This preference controls that
|
||||
* threshold.
|
||||
*
|
||||
* It controls the threshold used within an *approximation* of the
|
||||
* number of lines of text we use. In particular, if we assume that
|
||||
* each character (collapsing collapsible whitespace) has a width the
|
||||
* same as the em-size of the font (when, normally, it's actually quite
|
||||
* a bit smaller on average), this preference gives the percentage of a
|
||||
* number of lines of text we'd need to trigger inflation. This means
|
||||
* that a percentage of 100 means that we'd need a number of characters
|
||||
* (we know the font size and the width) equivalent to one line of
|
||||
* square text (which is actually a lot less than a real line of text).
|
||||
*
|
||||
* A value of 0 means there's no character length threshold.
|
||||
*/
|
||||
pref("font.size.inflation.lineThreshold", 400);
|
||||
|
||||
#ifdef XP_WIN
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче