зеркало из https://github.com/mozilla/pjs.git
Make 'bolder' and 'lighter' values of 'font-weight' be computed in the style system, per recent edits to CSS 2.1. (Bug 93725) r=jdaggett a2.0=joedrew
This commit is contained in:
Родитель
6060ca1c06
Коммит
2be68ed209
|
@ -90,8 +90,6 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntry *aFontEntry,
|
|||
// DWrite simulation.
|
||||
mNeedsOblique = PR_TRUE;
|
||||
}
|
||||
PRInt8 baseWeight, weightDistance;
|
||||
GetStyle()->ComputeWeightAndOffset(&baseWeight, &weightDistance);
|
||||
if (aNeedsBold) {
|
||||
sims |= DWRITE_FONT_SIMULATIONS_BOLD;
|
||||
}
|
||||
|
|
|
@ -312,12 +312,8 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
|
|||
|
||||
aNeedsSyntheticBold = PR_FALSE;
|
||||
|
||||
PRInt8 baseWeight, weightDistance;
|
||||
aFontStyle.ComputeWeightAndOffset(&baseWeight, &weightDistance);
|
||||
PRInt8 baseWeight = aFontStyle.ComputeWeight();
|
||||
PRBool wantBold = baseWeight >= 6;
|
||||
if ((wantBold && weightDistance < 0) || (!wantBold && weightDistance > 0)) {
|
||||
wantBold = !wantBold;
|
||||
}
|
||||
|
||||
// If the family has only one face, we simply return it; no further checking needed
|
||||
if (mAvailableFonts.Length() == 1) {
|
||||
|
@ -422,47 +418,11 @@ gfxFontFamily::FindFontForStyle(const gfxFontStyle& aFontStyle,
|
|||
"weight mapping should always find at least one font in a family");
|
||||
|
||||
gfxFontEntry *matchFE = weightList[matchBaseWeight];
|
||||
const PRInt8 absDistance = abs(weightDistance);
|
||||
PRInt8 wghtSteps;
|
||||
|
||||
if (weightDistance != 0) {
|
||||
direction = (weightDistance > 0) ? 1 : -1;
|
||||
PRInt8 j;
|
||||
|
||||
// Synthetic bolding occurs when font itself is not a bold-face and
|
||||
// either the absolute weight is at least 600 or the relative weight
|
||||
// (e.g. 402) implies a darker face than the ones available.
|
||||
// note: this means that (1) lighter styles *never* synthetic bold and
|
||||
// (2) synthetic bolding always occurs at the first bolder step beyond
|
||||
// available faces, no matter how light the boldest face
|
||||
|
||||
// Account for synthetic bold in lighter case
|
||||
// if lighter is applied with an inherited bold weight,
|
||||
// and no actual bold faces exist, synthetic bold is used
|
||||
// so the matched weight above is actually one step down already
|
||||
|
||||
wghtSteps = 1; // account for initial mapped weight
|
||||
|
||||
if (weightDistance < 0 && baseWeight > 5 && matchBaseWeight < 6) {
|
||||
wghtSteps++; // if no faces [600, 900] then synthetic bold at 700
|
||||
}
|
||||
|
||||
for (j = matchBaseWeight + direction;
|
||||
j < 10 && j > 0 && wghtSteps <= absDistance;
|
||||
j += direction) {
|
||||
if (weightList[j]) {
|
||||
matchFE = weightList[j];
|
||||
wghtSteps++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(matchFE,
|
||||
"weight mapping should always find at least one font in a family");
|
||||
|
||||
if (!matchFE->IsBold() &&
|
||||
((weightDistance == 0 && baseWeight >= 6) ||
|
||||
(weightDistance > 0 && wghtSteps <= absDistance)))
|
||||
if (!matchFE->IsBold() && baseWeight >= 6)
|
||||
{
|
||||
aNeedsSyntheticBold = PR_TRUE;
|
||||
}
|
||||
|
@ -628,12 +588,7 @@ gfxFontFamily::FindFontForChar(FontSearch *aMatchData)
|
|||
}
|
||||
|
||||
// weight
|
||||
PRInt8 baseWeight, weightDistance;
|
||||
style->ComputeWeightAndOffset(&baseWeight, &weightDistance);
|
||||
|
||||
// xxx - not entirely correct, the one unit of weight distance reflects
|
||||
// the "next bolder/lighter face"
|
||||
PRInt32 targetWeight = (baseWeight * 100) + (weightDistance * 100);
|
||||
PRInt32 targetWeight = style->ComputeWeight() * 100;
|
||||
|
||||
PRInt32 entryWeight = fe->Weight();
|
||||
if (entryWeight == targetWeight) {
|
||||
|
@ -2730,21 +2685,17 @@ gfxFontStyle::gfxFontStyle(const gfxFontStyle& aStyle) :
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gfxFontStyle::ComputeWeightAndOffset(PRInt8 *outBaseWeight, PRInt8 *outOffset) const
|
||||
PRInt8
|
||||
gfxFontStyle::ComputeWeight() const
|
||||
{
|
||||
PRInt8 baseWeight = (weight + 50) / 100;
|
||||
PRInt8 offset = weight - baseWeight * 100;
|
||||
|
||||
if (baseWeight < 0)
|
||||
baseWeight = 0;
|
||||
if (baseWeight > 9)
|
||||
baseWeight = 9;
|
||||
|
||||
if (outBaseWeight)
|
||||
*outBaseWeight = baseWeight;
|
||||
if (outOffset)
|
||||
*outOffset = offset;
|
||||
return baseWeight;
|
||||
}
|
||||
|
||||
PRBool
|
||||
|
|
|
@ -137,11 +137,7 @@ struct THEBES_API gfxFontStyle {
|
|||
// "Wingdings", etc.) should be applied.
|
||||
PRPackedBool familyNameQuirks : 1;
|
||||
|
||||
// The weight of the font. 100, 200, ... 900 are the weights, and
|
||||
// single integer offsets request the next bolder/lighter font
|
||||
// available. For example, for a font available in weights 200,
|
||||
// 400, 700, and 900, a weight of 898 should lead to the weight 400
|
||||
// font being used, since it is two weights lighter than 900.
|
||||
// The weight of the font: 100, 200, ... 900.
|
||||
PRUint16 weight;
|
||||
|
||||
// The stretch of the font (the sum of various NS_FONT_STRETCH_*
|
||||
|
@ -191,8 +187,7 @@ struct THEBES_API gfxFontStyle {
|
|||
nsISupportsHashKey::HashKey(language);
|
||||
}
|
||||
|
||||
void ComputeWeightAndOffset(PRInt8 *outBaseWeight,
|
||||
PRInt8 *outOffset) const;
|
||||
PRInt8 ComputeWeight() const;
|
||||
|
||||
PRBool Equals(const gfxFontStyle& other) const {
|
||||
return (size == other.size) &&
|
||||
|
|
|
@ -50,8 +50,6 @@
|
|||
|
||||
#define NS_FONT_WEIGHT_NORMAL 400
|
||||
#define NS_FONT_WEIGHT_BOLD 700
|
||||
#define NS_FONT_WEIGHT_BOLDER 1
|
||||
#define NS_FONT_WEIGHT_LIGHTER (-1)
|
||||
|
||||
#define NS_FONT_STRETCH_ULTRA_CONDENSED (-4)
|
||||
#define NS_FONT_STRETCH_EXTRA_CONDENSED (-3)
|
||||
|
|
|
@ -189,34 +189,12 @@ GuessFcWeight(const gfxFontStyle& aFontStyle)
|
|||
* the weight in the list of supported font weights,
|
||||
* this value can be negative or positive.
|
||||
*/
|
||||
PRInt8 weight;
|
||||
PRInt8 offset;
|
||||
aFontStyle.ComputeWeightAndOffset(&weight, &offset);
|
||||
PRInt8 weight = aFontStyle.ComputeWeight();
|
||||
|
||||
// ComputeWeightAndOffset trimmed the range of weights for us
|
||||
// ComputeWeight trimmed the range of weights for us
|
||||
NS_ASSERTION(weight >= 0 && weight <= 10,
|
||||
"base weight out of range");
|
||||
|
||||
// Most font families do not support every weight. The tables here are
|
||||
// chosen such that a normal (4) base weight and an offset of +1 will
|
||||
// guess bold.
|
||||
|
||||
// Mapping from weight to a guess of the nearest available lighter weight
|
||||
static const int lighterGuess[11] =
|
||||
{ 0, 0, 1, 1, 2, 3, 4, 4, 6, 7, 8 };
|
||||
// Mapping from weight to a guess of the nearest available bolder weight
|
||||
static const int bolderGuess[11] =
|
||||
{ 2, 3, 4, 6, 7, 7, 8, 9, 10, 10, 10 };
|
||||
|
||||
while (offset < 0) {
|
||||
weight = lighterGuess[weight];
|
||||
offset++;
|
||||
}
|
||||
while (offset > 0) {
|
||||
weight = bolderGuess[weight];
|
||||
offset--;
|
||||
}
|
||||
|
||||
return gfxFontconfigUtils::FcWeightForBaseWeight(weight);
|
||||
}
|
||||
|
||||
|
|
|
@ -346,12 +346,10 @@ cairo_font_face_t *gfxOS2Font::CairoFontFace()
|
|||
FcPatternAddString(fcPattern, FC_FAMILY,
|
||||
(FcChar8 *)NS_ConvertUTF16toUTF8(GetName()).get());
|
||||
|
||||
// adjust font weight using the offset
|
||||
// The requirements outlined in gfxFont.h are difficult to meet without
|
||||
// having a table of available font weights, so we map the gfxFont
|
||||
// weight to possible FontConfig weights.
|
||||
PRInt8 weight, offset;
|
||||
GetStyle()->ComputeWeightAndOffset(&weight, &offset);
|
||||
PRInt8 weight = GetStyle()->ComputeWeight();
|
||||
// gfxFont weight FC weight
|
||||
// 400 80
|
||||
// 700 200
|
||||
|
@ -361,8 +359,6 @@ cairo_font_face_t *gfxOS2Font::CairoFontFace()
|
|||
while (i < nFcWeight && fcWeight[i] < fcW) {
|
||||
i++;
|
||||
}
|
||||
// add the offset, but observe the available number of weights
|
||||
i += offset;
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
} else if (i >= nFcWeight) {
|
||||
|
|
|
@ -422,8 +422,9 @@ static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
|
|||
// We should eventually stop using the NS_STYLE_* variants here.
|
||||
#define NS_STYLE_FONT_WEIGHT_NORMAL NS_FONT_WEIGHT_NORMAL
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLD NS_FONT_WEIGHT_BOLD
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLDER NS_FONT_WEIGHT_BOLDER
|
||||
#define NS_STYLE_FONT_WEIGHT_LIGHTER NS_FONT_WEIGHT_LIGHTER
|
||||
// The constants below appear only in style sheets and not computed style.
|
||||
#define NS_STYLE_FONT_WEIGHT_BOLDER (-1)
|
||||
#define NS_STYLE_FONT_WEIGHT_LIGHTER (-2)
|
||||
|
||||
// See nsStyleFont
|
||||
#define NS_STYLE_FONT_SIZE_XXSMALL 0
|
||||
|
|
|
@ -87,7 +87,7 @@ HTTP(..) == ex-unit-1-dynamic.html ex-unit-1-ref.html
|
|||
|
||||
== local-1.html local-1-ref.html
|
||||
HTTP(..) == synthetic-weight-style.html synthetic-weight-style-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == synthetic-variations.html synthetic-variations-ref.html # bug 419962
|
||||
HTTP(..) == synthetic-variations.html synthetic-variations-ref.html
|
||||
|
||||
# Leak test
|
||||
HTTP(..) load 486974-1.html
|
||||
|
|
|
@ -64,35 +64,35 @@ th, td {
|
|||
|
||||
em { font-style: italic; }
|
||||
|
||||
#test1 .w1 td { font-weight: bolder; }
|
||||
#test1 .w2 td { font-weight: bolder; }
|
||||
#test1 .w3 td { font-weight: bolder; }
|
||||
#test1 .w1 td, #test1 .w1 td span { font-weight: bolder; }
|
||||
#test1 .w2 td, #test1 .w2 td span { font-weight: bolder; }
|
||||
#test1 .w3 td, #test1 .w3 td span { font-weight: bolder; }
|
||||
#test1 .w4 td { font-weight: bolder; }
|
||||
#test1 .w5 td { font-weight: bolder; }
|
||||
#test1 .w6 th { font-weight: lighter; }
|
||||
#test1 .w7 th { font-weight: lighter; }
|
||||
#test1 .w8 th { font-weight: lighter; }
|
||||
#test1 .w9 th { font-weight: lighter; }
|
||||
#test1 .w8 th, #test1 .w8 th span { font-weight: lighter; }
|
||||
#test1 .w9 th, #test1 .w9 th span { font-weight: lighter; }
|
||||
|
||||
#test2 .w1 td { font-weight: bolder; }
|
||||
#test2 .w2 td { font-weight: bolder; }
|
||||
#test2 .w3 td { font-weight: bolder; }
|
||||
#test2 .w1 td, #test2 .w1 td span { font-weight: bolder; }
|
||||
#test2 .w2 td, #test2 .w2 td span { font-weight: bolder; }
|
||||
#test2 .w3 td, #test2 .w3 td span { font-weight: bolder; }
|
||||
#test2 .w4 td { font-weight: bolder; }
|
||||
#test2 .w5 td { font-weight: bolder; }
|
||||
#test2 .w6 th { font-weight: lighter; }
|
||||
#test2 .w7 th { font-weight: lighter; }
|
||||
#test2 .w8 th { font-weight: lighter; }
|
||||
#test2 .w9 th { font-weight: lighter; }
|
||||
#test2 .w8 th, #test2 .w8 th span { font-weight: lighter; }
|
||||
#test2 .w9 th, #test2 .w9 th span { font-weight: lighter; }
|
||||
|
||||
#test3 .w1 th, #test3 .w1 td, #test3 .w1 td span { font-weight: bolder; }
|
||||
#test3 .w2 th, #test3 .w2 td, #test3 .w2 td span { font-weight: bolder; }
|
||||
#test3 .w3 td { font-weight: bolder; }
|
||||
#test3 .w3 th, #test3 .w3 td, #test3 .w3 td span { font-weight: bolder; }
|
||||
#test3 .w4 td { font-weight: bolder; }
|
||||
#test3 .w5 td { font-weight: bolder; }
|
||||
#test3 .w6 th { font-weight: lighter; }
|
||||
#test3 .w7 th { font-weight: lighter; }
|
||||
#test3 .w8 th { font-weight: lighter; }
|
||||
#test3 .w9 th { font-weight: lighter; }
|
||||
#test3 .w8 td, #test3 .w8 th, #test3 .w8 th span { font-weight: lighter; }
|
||||
#test3 .w9 td, #test3 .w9 th, #test3 .w9 th span { font-weight: lighter; }
|
||||
|
||||
</style>
|
||||
|
||||
|
@ -102,27 +102,27 @@ em { font-style: italic; }
|
|||
<p>All lines should appear in a sans-serif face with proper bolding</p>
|
||||
|
||||
<table id="test1">
|
||||
<tr class="w1"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w2"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w3"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w4"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w5"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w6"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w7"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w8"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w9"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w1"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w2"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w3"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w4"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w5"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w6"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w7"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w8"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w9"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
</table>
|
||||
|
||||
<table id="test2">
|
||||
<tr class="w9"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w8"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w7"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w6"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w5"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w4"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w3"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w2"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w1"><th>normal</th><th><em>italic</em></th><td>bold</td><td><em>bolditalic</em></td></tr>
|
||||
<tr class="w9"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w8"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w7"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w6"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w5"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w4"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w3"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w2"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
<tr class="w1"><th><span>normal</span></th><th><em><span>italic</span></em></th><td><span>bold</span></td><td><em><span>bolditalic</span></em></td></tr>
|
||||
</table>
|
||||
|
||||
<table id="test3">
|
||||
|
@ -137,4 +137,4 @@ em { font-style: italic; }
|
|||
<tr class="w9"><th><span>normal</span></th><th><span><em>italic</em></span></th><td><span>bold</span></td><td><span><em>bolditalic</em></span></td></tr>
|
||||
</table>
|
||||
|
||||
</body></html>
|
||||
</body></html>
|
||||
|
|
|
@ -47,12 +47,12 @@ random-if(cocoaWidget) != impact-bold.html impact.html # bug 539418
|
|||
HTTP(..) == normalmedium.html normalmedium-ref.html
|
||||
HTTP(..) != normalmedium.html normalmedium-notref.html
|
||||
|
||||
# Linux fails due to bolder bug
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-12.html weightmapping-12-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-25.html weightmapping-25-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-45.html weightmapping-45-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-458.html weightmapping-458-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-478.html weightmapping-478-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-7.html weightmapping-7-ref.html
|
||||
random-if(gtk2Widget) HTTP(..) == weightmapping-12579.html weightmapping-12579-ref.html
|
||||
# Linux fails due to bug 604815
|
||||
HTTP(..) == weightmapping-12.html weightmapping-12-ref.html
|
||||
HTTP(..) == weightmapping-25.html weightmapping-25-ref.html
|
||||
HTTP(..) == weightmapping-45.html weightmapping-45-ref.html
|
||||
HTTP(..) == weightmapping-458.html weightmapping-458-ref.html
|
||||
HTTP(..) == weightmapping-478.html weightmapping-478-ref.html
|
||||
HTTP(..) == weightmapping-7.html weightmapping-7-ref.html
|
||||
HTTP(..) == weightmapping-12579.html weightmapping-12579-ref.html
|
||||
|
||||
|
|
|
@ -72,13 +72,13 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w2 .clili { font-family: test100; }
|
||||
.w2 .cli { font-family: test100; }
|
||||
.w2 .cnor { font-family: test200; }
|
||||
.w2 .cbo { font-family: test200; font-weight: bold; }
|
||||
.w2 .cbo { font-family: test200; }
|
||||
.w2 .cbobo { font-family: test200; font-weight: bold; }
|
||||
|
||||
.w3 .clili { font-family: test100; }
|
||||
.w3 .cli { font-family: test100; }
|
||||
.w3 .cnor { font-family: test200; }
|
||||
.w3 .cbo { font-family: test200; font-weight: bold; }
|
||||
.w3 .cbo { font-family: test200; }
|
||||
.w3 .cbobo { font-family: test200; font-weight: bold; }
|
||||
|
||||
.w4 .clili { font-family: test100; }
|
||||
|
@ -105,14 +105,14 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w7 .cbo { font-family: test200; font-weight: bold; }
|
||||
.w7 .cbobo { font-family: test200; font-weight: bold; }
|
||||
|
||||
.w8 .clili { font-family: test100; }
|
||||
.w8 .cli { font-family: test200; }
|
||||
.w8 .clili { font-family: test200; }
|
||||
.w8 .cli { font-family: test200; font-weight: bold; }
|
||||
.w8 .cnor { font-family: test200; font-weight: bold; }
|
||||
.w8 .cbo { font-family: test200; font-weight: bold; }
|
||||
.w8 .cbobo { font-family: test200; font-weight: bold; }
|
||||
|
||||
.w9 .clili { font-family: test100; }
|
||||
.w9 .cli { font-family: test200; }
|
||||
.w9 .clili { font-family: test200; }
|
||||
.w9 .cli { font-family: test200; font-weight: bold; }
|
||||
.w9 .cnor { font-family: test200; font-weight: bold; }
|
||||
.w9 .cbo { font-family: test200; font-weight: bold; }
|
||||
.w9 .cbobo { font-family: test200; font-weight: bold; }
|
||||
|
@ -219,4 +219,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -99,8 +99,8 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w1 .clili { font-family: test100; }
|
||||
.w1 .cli { font-family: test100; }
|
||||
.w1 .cnor { font-family: test100; }
|
||||
.w1 .cbo { font-family: test200; }
|
||||
.w1 .cbobo { font-family: test500; }
|
||||
.w1 .cbo { font-family: test500; }
|
||||
.w1 .cbobo { font-family: test700; }
|
||||
|
||||
.w2 .clili { font-family: test100; }
|
||||
.w2 .cli { font-family: test100; }
|
||||
|
@ -115,24 +115,24 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w3 .cbobo { font-family: test700; }
|
||||
|
||||
.w4 .clili { font-family: test100; }
|
||||
.w4 .cli { font-family: test200; }
|
||||
.w4 .cli { font-family: test100; }
|
||||
.w4 .cnor { font-family: test500; }
|
||||
.w4 .cbo { font-family: test700; }
|
||||
.w4 .cbobo { font-family: test900; }
|
||||
|
||||
.w5 .clili { font-family: test100; }
|
||||
.w5 .cli { font-family: test200; }
|
||||
.w5 .cli { font-family: test100; }
|
||||
.w5 .cnor { font-family: test500; }
|
||||
.w5 .cbo { font-family: test700; }
|
||||
.w5 .cbobo { font-family: test900; }
|
||||
|
||||
.w6 .clili { font-family: test200; }
|
||||
.w6 .clili { font-family: test100; }
|
||||
.w6 .cli { font-family: test500; }
|
||||
.w6 .cnor { font-family: test700; }
|
||||
.w6 .cbo { font-family: test900; }
|
||||
.w6 .cbobo { font-family: test900; }
|
||||
|
||||
.w7 .clili { font-family: test200; }
|
||||
.w7 .clili { font-family: test100; }
|
||||
.w7 .cli { font-family: test500; }
|
||||
.w7 .cnor { font-family: test700; }
|
||||
.w7 .cbo { font-family: test900; }
|
||||
|
@ -252,4 +252,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -105,14 +105,14 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w7 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w7 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w8 .clili { font-family: test200; }
|
||||
.w8 .cli { font-family: test500; }
|
||||
.w8 .clili { font-family: test500; }
|
||||
.w8 .cli { font-family: test500; font-weight: bold; }
|
||||
.w8 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w8 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w8 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w9 .clili { font-family: test200; }
|
||||
.w9 .cli { font-family: test500; }
|
||||
.w9 .clili { font-family: test500; }
|
||||
.w9 .cli { font-family: test500; font-weight: bold; }
|
||||
.w9 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w9 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w9 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
@ -219,4 +219,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -66,25 +66,25 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w1 .clili { font-family: test400; }
|
||||
.w1 .cli { font-family: test400; }
|
||||
.w1 .cnor { font-family: test400; }
|
||||
.w1 .cbo { font-family: test500; }
|
||||
.w1 .cbo { font-family: test400; }
|
||||
.w1 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w2 .clili { font-family: test400; }
|
||||
.w2 .cli { font-family: test400; }
|
||||
.w2 .cnor { font-family: test400; }
|
||||
.w2 .cbo { font-family: test500; }
|
||||
.w2 .cbo { font-family: test400; }
|
||||
.w2 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w3 .clili { font-family: test400; }
|
||||
.w3 .cli { font-family: test400; }
|
||||
.w3 .cnor { font-family: test400; }
|
||||
.w3 .cbo { font-family: test500; }
|
||||
.w3 .cbo { font-family: test400; }
|
||||
.w3 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w4 .clili { font-family: test400; }
|
||||
.w4 .cli { font-family: test400; }
|
||||
.w4 .cnor { font-family: test400; }
|
||||
.w4 .cbo { font-family: test500; }
|
||||
.w4 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w4 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w5 .clili { font-family: test400; }
|
||||
|
@ -94,25 +94,25 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w5 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w6 .clili { font-family: test400; }
|
||||
.w6 .cli { font-family: test500; }
|
||||
.w6 .cli { font-family: test400; }
|
||||
.w6 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w6 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w6 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w7 .clili { font-family: test400; }
|
||||
.w7 .cli { font-family: test500; }
|
||||
.w7 .cli { font-family: test400; }
|
||||
.w7 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w7 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w7 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w8 .clili { font-family: test400; }
|
||||
.w8 .cli { font-family: test500; }
|
||||
.w8 .cli { font-family: test500; font-weight: bold; }
|
||||
.w8 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w8 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w8 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
||||
.w9 .clili { font-family: test400; }
|
||||
.w9 .cli { font-family: test500; }
|
||||
.w9 .cli { font-family: test500; font-weight: bold; }
|
||||
.w9 .cnor { font-family: test500; font-weight: bold; }
|
||||
.w9 .cbo { font-family: test500; font-weight: bold; }
|
||||
.w9 .cbobo { font-family: test500; font-weight: bold; }
|
||||
|
@ -219,4 +219,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -77,25 +77,25 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w1 .clili { font-family: test400; }
|
||||
.w1 .cli { font-family: test400; }
|
||||
.w1 .cnor { font-family: test400; }
|
||||
.w1 .cbo { font-family: test500; }
|
||||
.w1 .cbo { font-family: test400; }
|
||||
.w1 .cbobo { font-family: test800; }
|
||||
|
||||
.w2 .clili { font-family: test400; }
|
||||
.w2 .cli { font-family: test400; }
|
||||
.w2 .cnor { font-family: test400; }
|
||||
.w2 .cbo { font-family: test500; }
|
||||
.w2 .cbo { font-family: test400; }
|
||||
.w2 .cbobo { font-family: test800; }
|
||||
|
||||
.w3 .clili { font-family: test400; }
|
||||
.w3 .cli { font-family: test400; }
|
||||
.w3 .cnor { font-family: test400; }
|
||||
.w3 .cbo { font-family: test500; }
|
||||
.w3 .cbo { font-family: test400; }
|
||||
.w3 .cbobo { font-family: test800; }
|
||||
|
||||
.w4 .clili { font-family: test400; }
|
||||
.w4 .cli { font-family: test400; }
|
||||
.w4 .cnor { font-family: test400; }
|
||||
.w4 .cbo { font-family: test500; }
|
||||
.w4 .cbo { font-family: test800; }
|
||||
.w4 .cbobo { font-family: test800; }
|
||||
|
||||
.w5 .clili { font-family: test400; }
|
||||
|
@ -105,25 +105,25 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w5 .cbobo { font-family: test800; }
|
||||
|
||||
.w6 .clili { font-family: test400; }
|
||||
.w6 .cli { font-family: test500; }
|
||||
.w6 .cli { font-family: test400; }
|
||||
.w6 .cnor { font-family: test800; }
|
||||
.w6 .cbo { font-family: test800; }
|
||||
.w6 .cbobo { font-family: test800; }
|
||||
|
||||
.w7 .clili { font-family: test400; }
|
||||
.w7 .cli { font-family: test500; }
|
||||
.w7 .cli { font-family: test400; }
|
||||
.w7 .cnor { font-family: test800; }
|
||||
.w7 .cbo { font-family: test800; }
|
||||
.w7 .cbobo { font-family: test800; }
|
||||
|
||||
.w8 .clili { font-family: test400; }
|
||||
.w8 .cli { font-family: test500; }
|
||||
.w8 .cli { font-family: test800; }
|
||||
.w8 .cnor { font-family: test800; }
|
||||
.w8 .cbo { font-family: test800; }
|
||||
.w8 .cbobo { font-family: test800; }
|
||||
|
||||
.w9 .clili { font-family: test400; }
|
||||
.w9 .cli { font-family: test500; }
|
||||
.w9 .cli { font-family: test800; }
|
||||
.w9 .cnor { font-family: test800; }
|
||||
.w9 .cbo { font-family: test800; }
|
||||
.w9 .cbobo { font-family: test800; }
|
||||
|
@ -230,4 +230,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -77,20 +77,20 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
.w1 .clili { font-family: test400; }
|
||||
.w1 .cli { font-family: test400; }
|
||||
.w1 .cnor { font-family: test400; }
|
||||
.w1 .cbo { font-family: test700; }
|
||||
.w1 .cbobo { font-family: test800; }
|
||||
.w1 .cbo { font-family: test400; }
|
||||
.w1 .cbobo { font-family: test700; }
|
||||
|
||||
.w2 .clili { font-family: test400; }
|
||||
.w2 .cli { font-family: test400; }
|
||||
.w2 .cnor { font-family: test400; }
|
||||
.w2 .cbo { font-family: test700; }
|
||||
.w2 .cbobo { font-family: test800; }
|
||||
.w2 .cbo { font-family: test400; }
|
||||
.w2 .cbobo { font-family: test700; }
|
||||
|
||||
.w3 .clili { font-family: test400; }
|
||||
.w3 .cli { font-family: test400; }
|
||||
.w3 .cnor { font-family: test400; }
|
||||
.w3 .cbo { font-family: test700; }
|
||||
.w3 .cbobo { font-family: test800; }
|
||||
.w3 .cbo { font-family: test400; }
|
||||
.w3 .cbobo { font-family: test700; }
|
||||
|
||||
.w4 .clili { font-family: test400; }
|
||||
.w4 .cli { font-family: test400; }
|
||||
|
@ -230,4 +230,4 @@ thead { font-weight: 400; font-size: 75%; }
|
|||
<p>tokyotokkyokyokakyoku</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
@ -3005,11 +3005,30 @@ nsRuleNode::SetFont(nsPresContext* aPresContext, nsStyleContext* aContext,
|
|||
case NS_STYLE_FONT_WEIGHT_BOLD:
|
||||
aFont->mFont.weight = value;
|
||||
break;
|
||||
case NS_STYLE_FONT_WEIGHT_BOLDER:
|
||||
case NS_STYLE_FONT_WEIGHT_LIGHTER:
|
||||
case NS_STYLE_FONT_WEIGHT_BOLDER: {
|
||||
aCanStoreInRuleTree = PR_FALSE;
|
||||
aFont->mFont.weight = nsStyleUtil::ConstrainFontWeight(aParentFont->mFont.weight + value);
|
||||
PRInt32 inheritedValue = aParentFont->mFont.weight;
|
||||
if (inheritedValue <= 300) {
|
||||
aFont->mFont.weight = 400;
|
||||
} else if (inheritedValue <= 500) {
|
||||
aFont->mFont.weight = 700;
|
||||
} else {
|
||||
aFont->mFont.weight = 900;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NS_STYLE_FONT_WEIGHT_LIGHTER: {
|
||||
aCanStoreInRuleTree = PR_FALSE;
|
||||
PRInt32 inheritedValue = aParentFont->mFont.weight;
|
||||
if (inheritedValue < 600) {
|
||||
aFont->mFont.weight = 100;
|
||||
} else if (inheritedValue < 800) {
|
||||
aFont->mFont.weight = 400;
|
||||
} else {
|
||||
aFont->mFont.weight = 700;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else
|
||||
SetDiscrete(aFontData.mWeight, aFont->mFont.weight, aCanStoreInRuleTree,
|
||||
|
|
|
@ -670,12 +670,12 @@ function test_font_weight(prop) {
|
|||
is(cs.getPropertyValue(prop), "500",
|
||||
"font-weight property " + prop + ": interpolation of font-weights");
|
||||
check_distance(prop, "400", "500", "800");
|
||||
div.style.setProperty(prop, "lighter", "");
|
||||
is(cs.getPropertyValue(prop), "lighter",
|
||||
"font-weight property " + prop + ": can't interpolate bolder/lighter");
|
||||
|
||||
div.style.setProperty("-moz-transition-property", "none", "");
|
||||
div.style.setProperty(prop, "900", "");
|
||||
is(cs.getPropertyValue(prop), "900",
|
||||
"font-weight property " + prop + ": computed value before transition");
|
||||
div.style.setProperty("-moz-transition-property", prop, "");
|
||||
div.style.setProperty(prop, "100", "");
|
||||
is(cs.getPropertyValue(prop), "700",
|
||||
"font-weight property " + prop + ": interpolation of font-weights");
|
||||
|
|
Загрузка…
Ссылка в новой задаче