mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out 6 changesets (bug 1038663) for Android opt R2 bustage
Backed out changeset 97e3492d6080 (bug 1038663) Backed out changeset d176322f2d36 (bug 1038663) Backed out changeset f69af9161252 (bug 1038663) Backed out changeset 8bb77e5fad8c (bug 1038663) Backed out changeset 954e57438f51 (bug 1038663) Backed out changeset 16c0919101cd (bug 1038663)
This commit is contained in:
parent
d8ce8959ff
commit
b5f9a51ba9
@ -1,5 +1,4 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
@ -1580,6 +1579,15 @@ void BuildTextRunsScanner::AccumulateRunInfo(nsTextFrame* aFrame)
|
||||
}
|
||||
}
|
||||
|
||||
static nscoord StyleToCoord(const nsStyleCoord& aCoord)
|
||||
{
|
||||
if (eStyleUnit_Coord == aCoord.GetUnit()) {
|
||||
return aCoord.GetCoordValue();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
HasTerminalNewline(const nsTextFrame* aFrame)
|
||||
{
|
||||
@ -1589,29 +1597,6 @@ HasTerminalNewline(const nsTextFrame* aFrame)
|
||||
return frag->CharAt(aFrame->GetContentEnd() - 1) == '\n';
|
||||
}
|
||||
|
||||
static gfxFont::Metrics
|
||||
GetFirstFontMetrics(gfxFontGroup* aFontGroup, bool aVerticalMetrics)
|
||||
{
|
||||
if (!aFontGroup)
|
||||
return gfxFont::Metrics();
|
||||
gfxFont* font = aFontGroup->GetFirstValidFont();
|
||||
return font->GetMetrics(aVerticalMetrics ? gfxFont::eVertical
|
||||
: gfxFont::eHorizontal);
|
||||
}
|
||||
|
||||
static gfxFloat
|
||||
GetSpaceWidthAppUnits(gfxTextRun* aTextRun)
|
||||
{
|
||||
// Round the space width when converting to appunits the same way textruns
|
||||
// do.
|
||||
gfxFloat spaceWidthAppUnits =
|
||||
NS_round(GetFirstFontMetrics(aTextRun->GetFontGroup(),
|
||||
aTextRun->UseCenterBaseline()).spaceWidth *
|
||||
aTextRun->GetAppUnitsPerDevUnit());
|
||||
|
||||
return spaceWidthAppUnits;
|
||||
}
|
||||
|
||||
static nscoord
|
||||
LetterSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
|
||||
{
|
||||
@ -1621,18 +1606,11 @@ LetterSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
|
||||
if (!aStyleText) {
|
||||
aStyleText = aFrame->StyleText();
|
||||
}
|
||||
|
||||
const nsStyleCoord& coord = aStyleText->mLetterSpacing;
|
||||
if (eStyleUnit_Coord == coord.GetUnit()) {
|
||||
return coord.GetCoordValue();
|
||||
}
|
||||
return 0;
|
||||
return StyleToCoord(aStyleText->mLetterSpacing);
|
||||
}
|
||||
|
||||
// This function converts non-coord values (e.g. percentages) to nscoord.
|
||||
static nscoord
|
||||
WordSpacing(nsIFrame* aFrame, gfxTextRun* aTextRun,
|
||||
const nsStyleText* aStyleText = nullptr)
|
||||
WordSpacing(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
|
||||
{
|
||||
if (aFrame->IsSVGText()) {
|
||||
return 0;
|
||||
@ -1640,43 +1618,7 @@ WordSpacing(nsIFrame* aFrame, gfxTextRun* aTextRun,
|
||||
if (!aStyleText) {
|
||||
aStyleText = aFrame->StyleText();
|
||||
}
|
||||
|
||||
const nsStyleCoord& coord = aStyleText->mWordSpacing;
|
||||
if (eStyleUnit_Coord == coord.GetUnit()) {
|
||||
return coord.GetCoordValue();
|
||||
}
|
||||
if (eStyleUnit_Percent == coord.GetUnit() ||
|
||||
eStyleUnit_Calc == coord.GetUnit()) {
|
||||
return nsRuleNode::ComputeCoordPercentCalc(coord,
|
||||
GetSpaceWidthAppUnits(aTextRun));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Returns gfxTextRunFactory::TEXT_ENABLE_SPACING if non-standard
|
||||
// letter-spacing or word-spacing is present.
|
||||
static uint32_t
|
||||
GetSpacingFlags(nsIFrame* aFrame, const nsStyleText* aStyleText = nullptr)
|
||||
{
|
||||
if (aFrame->IsSVGText()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const nsStyleText* styleText = aFrame->StyleText();
|
||||
const nsStyleCoord& ls = styleText->mLetterSpacing;
|
||||
const nsStyleCoord& ws = styleText->mWordSpacing;
|
||||
|
||||
// It's possible to have a calc() value that computes to zero but for which
|
||||
// IsDefinitelyZero() is false, in which case we'll return
|
||||
// TEXT_ENABLE_SPACING unnecessarily. That's ok because such cases are likely
|
||||
// to be rare, and avoiding TEXT_ENABLE_SPACING is just an optimization.
|
||||
bool nonStandardSpacing =
|
||||
(eStyleUnit_Coord == ls.GetUnit() && ls.GetCoordValue() != 0) ||
|
||||
(eStyleUnit_Coord == ws.GetUnit() && ws.GetCoordValue() != 0) ||
|
||||
(eStyleUnit_Percent == ws.GetUnit() && ws.GetPercentValue() != 0) ||
|
||||
(eStyleUnit_Calc == ws.GetUnit() && !ws.GetCalcValue()->IsDefinitelyZero());
|
||||
|
||||
return nonStandardSpacing ? gfxTextRunFactory::TEXT_ENABLE_SPACING : 0;
|
||||
return StyleToCoord(aStyleText->mWordSpacing);
|
||||
}
|
||||
|
||||
bool
|
||||
@ -1830,6 +1772,12 @@ BuildTextRunsScanner::GetNextBreakBeforeFrame(uint32_t* aIndex)
|
||||
return static_cast<nsTextFrame*>(mLineBreakBeforeFrames.ElementAt(index));
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
GetSpacingFlags(nscoord spacing)
|
||||
{
|
||||
return spacing ? gfxTextRunFactory::TEXT_ENABLE_SPACING : 0;
|
||||
}
|
||||
|
||||
static gfxFontGroup*
|
||||
GetFontGroupForFrame(nsIFrame* aFrame, float aFontSizeInflation,
|
||||
nsFontMetrics** aOutFontMetrics = nullptr)
|
||||
@ -1878,6 +1826,16 @@ GetHyphenTextRun(gfxTextRun* aTextRun, gfxContext* aContext, nsTextFrame* aTextF
|
||||
MakeHyphenTextRun(ctx, aTextRun->GetAppUnitsPerDevUnit());
|
||||
}
|
||||
|
||||
static gfxFont::Metrics
|
||||
GetFirstFontMetrics(gfxFontGroup* aFontGroup, bool aVerticalMetrics)
|
||||
{
|
||||
if (!aFontGroup)
|
||||
return gfxFont::Metrics();
|
||||
gfxFont* font = aFontGroup->GetFirstValidFont();
|
||||
return font->GetMetrics(aVerticalMetrics ? gfxFont::eVertical
|
||||
: gfxFont::eHorizontal);
|
||||
}
|
||||
|
||||
PR_STATIC_ASSERT(NS_STYLE_WHITESPACE_NORMAL == 0);
|
||||
PR_STATIC_ASSERT(NS_STYLE_WHITESPACE_PRE == 1);
|
||||
PR_STATIC_ASSERT(NS_STYLE_WHITESPACE_NOWRAP == 2);
|
||||
@ -1985,7 +1943,8 @@ BuildTextRunsScanner::BuildTextRunForFrames(void* aTextBuffer)
|
||||
if (NS_STYLE_TEXT_TRANSFORM_NONE != textStyle->mTextTransform) {
|
||||
anyTextTransformStyle = true;
|
||||
}
|
||||
textFlags |= GetSpacingFlags(f);
|
||||
textFlags |= GetSpacingFlags(LetterSpacing(f));
|
||||
textFlags |= GetSpacingFlags(WordSpacing(f));
|
||||
nsTextFrameUtils::CompressionMode compression =
|
||||
GetCSSWhitespaceToCompressionMode(f, textStyle);
|
||||
if ((enabledJustification || f->ShouldSuppressLineBreak()) &&
|
||||
@ -2916,7 +2875,7 @@ public:
|
||||
mFrame(aFrame), mStart(aStart), mTempIterator(aStart),
|
||||
mTabWidths(nullptr), mTabWidthsAnalyzedLimit(0),
|
||||
mLength(aLength),
|
||||
mWordSpacing(WordSpacing(aFrame, mTextRun, aTextStyle)),
|
||||
mWordSpacing(WordSpacing(aFrame, aTextStyle)),
|
||||
mLetterSpacing(LetterSpacing(aFrame, aTextStyle)),
|
||||
mHyphenWidth(-1),
|
||||
mOffsetFromBlockOriginForTabs(aOffsetFromBlockOriginForTabs),
|
||||
@ -2941,7 +2900,7 @@ public:
|
||||
mFrame(aFrame), mStart(aStart), mTempIterator(aStart),
|
||||
mTabWidths(nullptr), mTabWidthsAnalyzedLimit(0),
|
||||
mLength(aFrame->GetContentLength()),
|
||||
mWordSpacing(WordSpacing(aFrame, mTextRun)),
|
||||
mWordSpacing(WordSpacing(aFrame)),
|
||||
mLetterSpacing(LetterSpacing(aFrame)),
|
||||
mHyphenWidth(-1),
|
||||
mOffsetFromBlockOriginForTabs(0),
|
||||
@ -3266,8 +3225,14 @@ ComputeTabWidthAppUnits(nsIFrame* aFrame, gfxTextRun* aTextRun)
|
||||
{
|
||||
// Get the number of spaces from CSS -moz-tab-size
|
||||
const nsStyleText* textStyle = aFrame->StyleText();
|
||||
|
||||
return textStyle->mTabSize * GetSpaceWidthAppUnits(aTextRun);
|
||||
|
||||
// Round the space width when converting to appunits the same way
|
||||
// textruns do
|
||||
gfxFloat spaceWidthAppUnits =
|
||||
NS_round(GetFirstFontMetrics(aTextRun->GetFontGroup(),
|
||||
aTextRun->UseCenterBaseline()).spaceWidth *
|
||||
aTextRun->GetAppUnitsPerDevUnit());
|
||||
return textStyle->mTabSize * spaceWidthAppUnits;
|
||||
}
|
||||
|
||||
// aX and the result are in whole appunits.
|
||||
|
@ -4,5 +4,3 @@
|
||||
== text-align-match-parent-04.html text-align-match-parent-ref.html
|
||||
== text-align-match-parent-root-ltr.html text-align-match-parent-root-ltr-ref.html
|
||||
== text-align-match-parent-root-rtl.html text-align-match-parent-root-rtl-ref.html
|
||||
|
||||
== text-word-spacing-001.html text-word-spacing-ref.html
|
||||
|
@ -1,26 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<title>CSS Text Test: Word Spacing</title>
|
||||
<link rel="author" title="Nicholas Nethercote" href="mailto:nnethercote@mozilla.com">
|
||||
<link rel="help" href="http://www.w3.org/TR/css-text-3/#word-spacing">
|
||||
<meta name="flags" content="">
|
||||
<meta name="assert" content="Test checks that word-spacing works with percentages.">
|
||||
<style>
|
||||
div.wsn100 { word-spacing: -100%; }
|
||||
div.wsn40 { word-spacing: -40%; }
|
||||
div.ws0 { word-spacing: 0%; }
|
||||
div.ws25 { word-spacing: calc(25% + 0px); }
|
||||
div.ws100 { word-spacing: 100%; }
|
||||
div.ws300 { word-spacing: calc(100% + 6em + 50%*4 - 12em/2); }
|
||||
div.ws400p1 { word-spacing: calc(400% + 0.5em); }
|
||||
</style>
|
||||
<body>
|
||||
<p>Test passes if the space between the words starts at zero and increases
|
||||
on each subsequent line.</p>
|
||||
<div class="wsn100" >A Bc Def Ghij</div>
|
||||
<div class="ws0" >A Bc Def Ghij</div>
|
||||
<div class="ws100" >A Bc Def Ghij</div>
|
||||
<div class="wsn40" > A Bc Def Ghij</div>
|
||||
<div class="ws300" >A Bc Def Ghij</div>
|
||||
<div class="ws25" >A Bc Def Ghij</div>
|
||||
<div class="ws400p1">A Bc Def Ghij</div>
|
||||
</body>
|
@ -1,20 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<title>CSS Text Test: Word Spacing</title>
|
||||
<link rel="author" title="Nicholas Nethercote" href="mailto:nnethercote@mozilla.com">
|
||||
<link rel="help" href="http://www.w3.org/TR/css-text-3/#word-spacing">
|
||||
<meta name="flags" content="">
|
||||
<meta name="assert" content="Test checks that word-spacing works with percentages.">
|
||||
<style>
|
||||
span.padhalfem { padding-left: 0.5em; }
|
||||
</style>
|
||||
<body>
|
||||
<p>Test passes if the space between the words starts at zero and increases on
|
||||
each subsequent line.</p>
|
||||
<div>ABcDefGhij</div>
|
||||
<div>A Bc Def Ghij</div>
|
||||
<div>A Bc Def Ghij</div>
|
||||
<div>A Bc Def Ghij</div>
|
||||
<div>A Bc Def Ghij</div>
|
||||
<div>A Bc Def Ghij</div>
|
||||
<div>A <span class="padhalfem">Bc <span class="padhalfem">Def <span class="padhalfem">Ghij <span class="padhalfem"></div>
|
||||
</body>
|
@ -3623,10 +3623,9 @@ CSS_PROP_TEXT(
|
||||
CSS_PROPERTY_PARSE_VALUE |
|
||||
CSS_PROPERTY_APPLIES_TO_FIRST_LETTER_AND_FIRST_LINE |
|
||||
CSS_PROPERTY_APPLIES_TO_PLACEHOLDER |
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK |
|
||||
CSS_PROPERTY_STORES_CALC,
|
||||
CSS_PROPERTY_UNITLESS_LENGTH_QUIRK,
|
||||
"",
|
||||
VARIANT_HLP | VARIANT_NORMAL | VARIANT_CALC,
|
||||
VARIANT_HL | VARIANT_NORMAL | VARIANT_CALC,
|
||||
nullptr,
|
||||
offsetof(nsStyleText, mWordSpacing),
|
||||
eStyleAnimType_Coord)
|
||||
|
@ -4408,7 +4408,7 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||
parentText->mWordBreak,
|
||||
NS_STYLE_WORDBREAK_NORMAL, 0, 0, 0, 0);
|
||||
|
||||
// word-spacing: normal, length, percent, inherit
|
||||
// word-spacing: normal, length, inherit
|
||||
const nsCSSValue* wordSpacingValue = aRuleData->ValueForWordSpacing();
|
||||
if (wordSpacingValue->GetUnit() == eCSSUnit_Normal) {
|
||||
// Do this so that "normal" computes to 0px, as the CSS 2.1 spec requires.
|
||||
@ -4416,8 +4416,8 @@ nsRuleNode::ComputeTextData(void* aStartStruct,
|
||||
} else {
|
||||
SetCoord(*aRuleData->ValueForWordSpacing(),
|
||||
text->mWordSpacing, parentText->mWordSpacing,
|
||||
SETCOORD_LPH | SETCOORD_INITIAL_ZERO |
|
||||
SETCOORD_STORE_CALC | SETCOORD_UNSET_INHERIT,
|
||||
SETCOORD_LH | SETCOORD_INITIAL_ZERO |
|
||||
SETCOORD_CALC_LENGTH_ONLY | SETCOORD_UNSET_INHERIT,
|
||||
aContext, mPresContext, conditions);
|
||||
}
|
||||
|
||||
|
@ -90,10 +90,6 @@ public:
|
||||
bool operator!=(const CalcValue& aOther) const {
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
// If this returns true the value is definitely zero. It it returns false
|
||||
// it might be zero. So it's best used for conservative optimization.
|
||||
bool IsDefinitelyZero() const { return mLength == 0 && mPercent == 0; }
|
||||
};
|
||||
|
||||
// Reference counted calc() value. This is the type that is used to store
|
||||
|
@ -1736,7 +1736,7 @@ struct nsStyleText {
|
||||
uint8_t mControlCharacterVisibility; // [inherited] see nsStyleConsts.h
|
||||
int32_t mTabSize; // [inherited] see nsStyleConsts.h
|
||||
|
||||
nsStyleCoord mWordSpacing; // [inherited] coord, percent, calc
|
||||
nsStyleCoord mWordSpacing; // [inherited] coord
|
||||
nsStyleCoord mLetterSpacing; // [inherited] coord, normal
|
||||
nsStyleCoord mLineHeight; // [inherited] coord, factor, normal
|
||||
nsStyleCoord mTextIndent; // [inherited] coord, percent, calc
|
||||
|
@ -3737,11 +3737,10 @@ var gCSSProperties = {
|
||||
initial_values: [ "normal", "0", "0px", "-0em",
|
||||
"calc(-0px)", "calc(0em)"
|
||||
],
|
||||
other_values: [ "1em", "2px", "-3px", "0%", "50%", "-120%",
|
||||
other_values: [ "1em", "2px", "-3px",
|
||||
"calc(1em)", "calc(1em + 3px)",
|
||||
"calc(15px / 2)", "calc(15px/2)",
|
||||
"calc(-2em)", "calc(0% + 0px)",
|
||||
"calc(-10%/2 - 1em)"
|
||||
"calc(-2em)"
|
||||
],
|
||||
invalid_values: [],
|
||||
quirks_values: { "5": "5px" },
|
||||
|
Loading…
Reference in New Issue
Block a user