mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 777494 - Avoid using == with float. r=roc.
--HG-- extra : rebase_source : f17783c004de9d67576b1044f0180c1857fc499b
This commit is contained in:
parent
eeb7530185
commit
3a3dce5108
@ -182,6 +182,7 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
float GetFontSizeInflation() const;
|
float GetFontSizeInflation() const;
|
||||||
|
bool IsCurrentFontInflation(float aInflation) const;
|
||||||
bool HasFontSizeInflation() const {
|
bool HasFontSizeInflation() const {
|
||||||
return (GetStateBits() & TEXT_HAS_FONT_INFLATION) != 0;
|
return (GetStateBits() & TEXT_HAS_FONT_INFLATION) != 0;
|
||||||
}
|
}
|
||||||
|
@ -6710,6 +6710,10 @@ nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool nsTextFrame::IsCurrentFontInflation(float aInflation) const {
|
||||||
|
return fabsf(aInflation - GetFontSizeInflation()) < 1e-6;
|
||||||
|
}
|
||||||
|
|
||||||
// XXX Need to do something here to avoid incremental reflow bugs due to
|
// XXX Need to do something here to avoid incremental reflow bugs due to
|
||||||
// first-line and first-letter changing min-width
|
// first-line and first-letter changing min-width
|
||||||
/* virtual */ void
|
/* virtual */ void
|
||||||
@ -6719,7 +6723,7 @@ nsTextFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
|
|||||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||||
TextRunType trtype = (inflation == 1.0f) ? eNotInflated : eInflated;
|
TextRunType trtype = (inflation == 1.0f) ? eNotInflated : eInflated;
|
||||||
|
|
||||||
if (trtype == eInflated && inflation != GetFontSizeInflation()) {
|
if (trtype == eInflated && !IsCurrentFontInflation(inflation)) {
|
||||||
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
||||||
// the uninflated text run.
|
// the uninflated text run.
|
||||||
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
||||||
@ -6855,7 +6859,7 @@ nsTextFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
|
|||||||
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
float inflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||||
TextRunType trtype = (inflation == 1.0f) ? eNotInflated : eInflated;
|
TextRunType trtype = (inflation == 1.0f) ? eNotInflated : eInflated;
|
||||||
|
|
||||||
if (trtype == eInflated && inflation != GetFontSizeInflation()) {
|
if (trtype == eInflated && !IsCurrentFontInflation(inflation)) {
|
||||||
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
||||||
// the uninflated text run.
|
// the uninflated text run.
|
||||||
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
||||||
@ -7395,7 +7399,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||||||
|
|
||||||
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
float fontSizeInflation = nsLayoutUtils::FontSizeInflationFor(this);
|
||||||
|
|
||||||
if (fontSizeInflation != GetFontSizeInflation()) {
|
if (!IsCurrentFontInflation(fontSizeInflation)) {
|
||||||
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
// FIXME: Ideally, if we already have a text run, we'd move it to be
|
||||||
// the uninflated text run.
|
// the uninflated text run.
|
||||||
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
ClearTextRun(nsnull, nsTextFrame::eInflated);
|
||||||
@ -7405,7 +7409,7 @@ nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
|
|||||||
EnsureTextRun(nsTextFrame::eInflated, ctx,
|
EnsureTextRun(nsTextFrame::eInflated, ctx,
|
||||||
lineContainer, aLineLayout.GetLine(), &flowEndInTextRun);
|
lineContainer, aLineLayout.GetLine(), &flowEndInTextRun);
|
||||||
|
|
||||||
NS_ABORT_IF_FALSE(GetFontSizeInflation() == fontSizeInflation,
|
NS_ABORT_IF_FALSE(IsCurrentFontInflation(fontSizeInflation),
|
||||||
"EnsureTextRun should have set font size inflation");
|
"EnsureTextRun should have set font size inflation");
|
||||||
|
|
||||||
if (mTextRun && iter.GetOriginalEnd() < offset + length) {
|
if (mTextRun && iter.GetOriginalEnd() < offset + length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user