mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Merge mozilla-central and mozilla-inbound
This commit is contained in:
commit
539e6ce545
12
configure.in
12
configure.in
@ -7593,6 +7593,18 @@ if test -n "$JS_GC_ZEAL"; then
|
||||
AC_DEFINE(JS_GC_ZEAL)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl JS opt-mode assertions and minidump instrumentation
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(js-diagnostics,
|
||||
[ --enable-js-diagnostics
|
||||
Enable JS diagnostic assertions and breakpad data],
|
||||
JS_CRASH_DIAGNOSTICS=1,
|
||||
JS_CRASH_DIAGNOSTICS= )
|
||||
if test -n "$JS_CRASH_DIAGNOSTICS"; then
|
||||
AC_DEFINE(JS_CRASH_DIAGNOSTICS)
|
||||
fi
|
||||
|
||||
dnl ======================================================
|
||||
dnl = Enable compiling with ccache
|
||||
dnl ======================================================
|
||||
|
@ -44,7 +44,7 @@ struct {
|
||||
{ HB_TAG('c','u','r','s'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('k','e','r','n'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('l','i','g','a'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('l','o','c','l'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('l','o','c','l'), FIRST_PRIORITY },
|
||||
{ HB_TAG('m','a','r','k'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('m','k','m','k'), DEFAULT_PRIORITY },
|
||||
{ HB_TAG('r','l','i','g'), DEFAULT_PRIORITY }
|
||||
|
@ -94,7 +94,7 @@ inline nscoord NSToCoordRound(float aValue)
|
||||
#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
|
||||
return NS_lroundup30(aValue);
|
||||
#else
|
||||
return nscoord(NS_floorf(aValue + 0.5f));
|
||||
return nscoord(floorf(aValue + 0.5f));
|
||||
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
|
||||
}
|
||||
|
||||
@ -103,7 +103,7 @@ inline nscoord NSToCoordRound(double aValue)
|
||||
#if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
|
||||
return NS_lroundup30((float)aValue);
|
||||
#else
|
||||
return nscoord(NS_floor(aValue + 0.5f));
|
||||
return nscoord(floor(aValue + 0.5f));
|
||||
#endif /* XP_WIN32 && _M_IX86 && !__GNUC__ */
|
||||
}
|
||||
|
||||
@ -360,12 +360,12 @@ inline float NSCoordToFloat(nscoord aCoord) {
|
||||
*/
|
||||
inline nscoord NSToCoordFloor(float aValue)
|
||||
{
|
||||
return nscoord(NS_floorf(aValue));
|
||||
return nscoord(floorf(aValue));
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordFloor(double aValue)
|
||||
{
|
||||
return nscoord(NS_floor(aValue));
|
||||
return nscoord(floor(aValue));
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordFloorClamped(float aValue)
|
||||
@ -388,12 +388,12 @@ inline nscoord NSToCoordFloorClamped(float aValue)
|
||||
|
||||
inline nscoord NSToCoordCeil(float aValue)
|
||||
{
|
||||
return nscoord(NS_ceilf(aValue));
|
||||
return nscoord(ceilf(aValue));
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordCeil(double aValue)
|
||||
{
|
||||
return nscoord(NS_ceil(aValue));
|
||||
return nscoord(ceil(aValue));
|
||||
}
|
||||
|
||||
inline nscoord NSToCoordCeilClamped(float aValue)
|
||||
@ -437,12 +437,12 @@ inline nscoord NSToCoordCeilClamped(double aValue)
|
||||
*/
|
||||
inline PRInt32 NSToIntFloor(float aValue)
|
||||
{
|
||||
return PRInt32(NS_floorf(aValue));
|
||||
return PRInt32(floorf(aValue));
|
||||
}
|
||||
|
||||
inline PRInt32 NSToIntCeil(float aValue)
|
||||
{
|
||||
return PRInt32(NS_ceilf(aValue));
|
||||
return PRInt32(ceilf(aValue));
|
||||
}
|
||||
|
||||
inline PRInt32 NSToIntRound(float aValue)
|
||||
@ -457,12 +457,12 @@ inline PRInt32 NSToIntRound(double aValue)
|
||||
|
||||
inline PRInt32 NSToIntRoundUp(float aValue)
|
||||
{
|
||||
return PRInt32(NS_floorf(aValue + 0.5f));
|
||||
return PRInt32(floorf(aValue + 0.5f));
|
||||
}
|
||||
|
||||
inline PRInt32 NSToIntRoundUp(double aValue)
|
||||
{
|
||||
return PRInt32(NS_floor(aValue + 0.5));
|
||||
return PRInt32(floor(aValue + 0.5));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -147,7 +147,7 @@ nsFontMetrics::Destroy()
|
||||
|
||||
// XXXTODO get rid of this macro
|
||||
#define ROUND_TO_TWIPS(x) (nscoord)floor(((x) * mP2A) + 0.5)
|
||||
#define CEIL_TO_TWIPS(x) (nscoord)NS_ceil((x) * mP2A)
|
||||
#define CEIL_TO_TWIPS(x) (nscoord)ceil((x) * mP2A)
|
||||
|
||||
const gfxFont::Metrics& nsFontMetrics::GetMetrics() const
|
||||
{
|
||||
@ -194,15 +194,15 @@ nsFontMetrics::GetUnderline(nscoord& aOffset, nscoord& aSize)
|
||||
static gfxFloat ComputeMaxDescent(const gfxFont::Metrics& aMetrics,
|
||||
gfxFontGroup* aFontGroup)
|
||||
{
|
||||
gfxFloat offset = NS_floor(-aFontGroup->GetUnderlineOffset() + 0.5);
|
||||
gfxFloat offset = floor(-aFontGroup->GetUnderlineOffset() + 0.5);
|
||||
gfxFloat size = NS_round(aMetrics.underlineSize);
|
||||
gfxFloat minDescent = NS_floor(offset + size + 0.5);
|
||||
gfxFloat minDescent = floor(offset + size + 0.5);
|
||||
return NS_MAX(minDescent, aMetrics.maxDescent);
|
||||
}
|
||||
|
||||
static gfxFloat ComputeMaxAscent(const gfxFont::Metrics& aMetrics)
|
||||
{
|
||||
return NS_floor(aMetrics.maxAscent + 0.5);
|
||||
return floor(aMetrics.maxAscent + 0.5);
|
||||
}
|
||||
|
||||
nscoord
|
||||
|
@ -114,7 +114,7 @@ gfxCachedTempSurface::Get(gfxASurface::gfxContentType aContentType,
|
||||
|
||||
PRBool cleared = PR_FALSE;
|
||||
if (!mSurface) {
|
||||
mSize = gfxIntSize(PRInt32(NS_ceil(aRect.width)), PRInt32(NS_ceil(aRect.height)));
|
||||
mSize = gfxIntSize(PRInt32(ceil(aRect.width)), PRInt32(ceil(aRect.height)));
|
||||
mSurface = aSimilarTo->CreateSimilarSurface(aContentType, mSize);
|
||||
if (!mSurface)
|
||||
return nsnull;
|
||||
|
@ -70,11 +70,11 @@ ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
|
||||
static void
|
||||
SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
|
||||
{
|
||||
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
gfxFloat snappedSize = NS_MAX(floor(aSize + 0.5), 1.0);
|
||||
// Correct offset for change in size
|
||||
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
|
||||
// Snap offset
|
||||
aOffset = NS_floor(offset + 0.5);
|
||||
aOffset = floor(offset + 0.5);
|
||||
aSize = snappedSize;
|
||||
}
|
||||
|
||||
@ -281,16 +281,16 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
|
||||
// internalLeading + externalLeading, but first each of these is rounded
|
||||
// to layout units. To ensure that the result is an integer number of
|
||||
// pixels, round each of the components to pixels.
|
||||
aMetrics->emHeight = NS_floor(emHeight + 0.5);
|
||||
aMetrics->emHeight = floor(emHeight + 0.5);
|
||||
|
||||
// maxHeight will normally be an integer, but round anyway in case
|
||||
// FreeType is configured differently.
|
||||
aMetrics->internalLeading =
|
||||
NS_floor(aMetrics->maxHeight - aMetrics->emHeight + 0.5);
|
||||
floor(aMetrics->maxHeight - aMetrics->emHeight + 0.5);
|
||||
|
||||
// Text input boxes currently don't work well with lineHeight
|
||||
// significantly less than maxHeight (with Verdana, for example).
|
||||
lineHeight = NS_floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
|
||||
lineHeight = floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
|
||||
aMetrics->externalLeading =
|
||||
lineHeight - aMetrics->internalLeading - aMetrics->emHeight;
|
||||
|
||||
|
@ -1594,7 +1594,7 @@ gfxFont::SetupGlyphExtents(gfxContext *aContext, PRUint32 aGlyphID, PRBool aNeed
|
||||
extents.y_bearing >= -fontMetrics.maxAscent &&
|
||||
extents.height + extents.y_bearing <= fontMetrics.maxDescent) {
|
||||
PRUint32 appUnitsWidth =
|
||||
PRUint32(NS_ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
|
||||
PRUint32(ceil((extents.x_bearing + extents.width)*appUnitsPerDevUnit));
|
||||
if (appUnitsWidth < gfxGlyphExtents::INVALID_WIDTH) {
|
||||
aExtents->SetContainedGlyphWidthAppUnits(aGlyphID, PRUint16(appUnitsWidth));
|
||||
return;
|
||||
@ -1713,9 +1713,9 @@ RoundToNearestMultiple(double aValue, double aFraction)
|
||||
void gfxFont::CalculateDerivedMetrics(Metrics& aMetrics)
|
||||
{
|
||||
aMetrics.maxAscent =
|
||||
NS_ceil(RoundToNearestMultiple(aMetrics.maxAscent, 1/1024.0));
|
||||
ceil(RoundToNearestMultiple(aMetrics.maxAscent, 1/1024.0));
|
||||
aMetrics.maxDescent =
|
||||
NS_ceil(RoundToNearestMultiple(aMetrics.maxDescent, 1/1024.0));
|
||||
ceil(RoundToNearestMultiple(aMetrics.maxDescent, 1/1024.0));
|
||||
|
||||
if (aMetrics.xHeight <= 0) {
|
||||
// only happens if we couldn't find either font metrics
|
||||
@ -1828,13 +1828,13 @@ gfxFont::SanitizeMetrics(gfxFont::Metrics *aMetrics, PRBool aIsBadUnderlineFont)
|
||||
// If strikeout line is overflowed from the ascent, the line should be resized and moved for
|
||||
// that being in the ascent space.
|
||||
// Note that the strikeoutOffset is *middle* of the strikeout line position.
|
||||
gfxFloat halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
gfxFloat halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
if (halfOfStrikeoutSize + aMetrics->strikeoutOffset > aMetrics->maxAscent) {
|
||||
if (aMetrics->strikeoutSize > aMetrics->maxAscent) {
|
||||
aMetrics->strikeoutSize = NS_MAX(aMetrics->maxAscent, 1.0);
|
||||
halfOfStrikeoutSize = NS_floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
halfOfStrikeoutSize = floor(aMetrics->strikeoutSize / 2.0 + 0.5);
|
||||
}
|
||||
gfxFloat ascent = NS_floor(aMetrics->maxAscent + 0.5);
|
||||
gfxFloat ascent = floor(aMetrics->maxAscent + 0.5);
|
||||
aMetrics->strikeoutOffset = NS_MAX(halfOfStrikeoutSize, ascent / 2.0);
|
||||
}
|
||||
|
||||
@ -2544,7 +2544,7 @@ gfxFontGroup::InitScriptRun(gfxContext *aContext,
|
||||
gfxFloat wid = mainFont->SynthesizeSpaceWidth(ch);
|
||||
if (wid >= 0.0) {
|
||||
nscoord advance =
|
||||
aTextRun->GetAppUnitsPerDevUnit() * NS_floor(wid + 0.5);
|
||||
aTextRun->GetAppUnitsPerDevUnit() * floor(wid + 0.5);
|
||||
gfxTextRun::CompressedGlyph g;
|
||||
if (gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance)) {
|
||||
aTextRun->SetSimpleGlyph(index,
|
||||
|
@ -1128,7 +1128,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
|
||||
hb_position_t x_advance = posInfo[glyphStart].x_advance;
|
||||
nscoord advance =
|
||||
roundX ? dev2appUnits * FixedToIntRound(x_advance)
|
||||
: NS_floor(hb2appUnits * x_advance + 0.5);
|
||||
: floor(hb2appUnits * x_advance + 0.5);
|
||||
|
||||
if (glyphsInClump == 1 &&
|
||||
gfxTextRun::CompressedGlyph::IsSimpleGlyphID(ginfo[glyphStart].codepoint) &&
|
||||
@ -1158,18 +1158,18 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
|
||||
hb_position_t x_offset = posInfo[glyphStart].x_offset;
|
||||
details->mXOffset =
|
||||
roundX ? dev2appUnits * FixedToIntRound(x_offset)
|
||||
: NS_floor(hb2appUnits * x_offset + 0.5);
|
||||
: floor(hb2appUnits * x_offset + 0.5);
|
||||
hb_position_t y_offset = posInfo[glyphStart].y_offset;
|
||||
details->mYOffset = yPos -
|
||||
(roundY ? dev2appUnits * FixedToIntRound(y_offset)
|
||||
: NS_floor(hb2appUnits * y_offset + 0.5));
|
||||
: floor(hb2appUnits * y_offset + 0.5));
|
||||
|
||||
details->mAdvance = advance;
|
||||
hb_position_t y_advance = posInfo[glyphStart].y_advance;
|
||||
if (y_advance != 0) {
|
||||
yPos -=
|
||||
roundY ? dev2appUnits * FixedToIntRound(y_advance)
|
||||
: NS_floor(hb2appUnits * y_advance + 0.5);
|
||||
: floor(hb2appUnits * y_advance + 0.5);
|
||||
}
|
||||
if (++glyphStart >= glyphEnd) {
|
||||
break;
|
||||
@ -1177,7 +1177,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
|
||||
x_advance = posInfo[glyphStart].x_advance;
|
||||
advance =
|
||||
roundX ? dev2appUnits * FixedToIntRound(x_advance)
|
||||
: NS_floor(hb2appUnits * x_advance + 0.5);
|
||||
: floor(hb2appUnits * x_advance + 0.5);
|
||||
}
|
||||
|
||||
gfxTextRun::CompressedGlyph g;
|
||||
|
@ -194,8 +194,8 @@ public:
|
||||
*/
|
||||
PRBool HasNonIntegerTranslation() const {
|
||||
return HasNonTranslation() ||
|
||||
!FuzzyEqual(x0, NS_floor(x0 + 0.5)) ||
|
||||
!FuzzyEqual(y0, NS_floor(y0 + 0.5));
|
||||
!FuzzyEqual(x0, floor(x0 + 0.5)) ||
|
||||
!FuzzyEqual(y0, floor(y0 + 0.5));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -291,8 +291,8 @@ public:
|
||||
* Returns true if the matrix has non-integer scale
|
||||
*/
|
||||
PRBool HasNonIntegerScale() const {
|
||||
return !FuzzyEqual(xx, NS_floor(xx + 0.5)) ||
|
||||
!FuzzyEqual(yy, NS_floor(yy + 0.5));
|
||||
return !FuzzyEqual(xx, floor(xx + 0.5)) ||
|
||||
!FuzzyEqual(yy, floor(yy + 0.5));
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -127,11 +127,11 @@ static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
|
||||
// line as close to the original position as possible.
|
||||
static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
|
||||
{
|
||||
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
|
||||
gfxFloat snappedSize = NS_MAX(floor(aSize + 0.5), 1.0);
|
||||
// Correct offset for change in size
|
||||
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
|
||||
// Snap offset
|
||||
aOffset = NS_floor(offset + 0.5);
|
||||
aOffset = floor(offset + 0.5);
|
||||
aSize = snappedSize;
|
||||
}
|
||||
|
||||
@ -155,7 +155,7 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
||||
|
||||
// round size to integer pixels, this is to get full pixels for layout
|
||||
// together with internal/external leading (see below)
|
||||
mMetrics->emHeight = NS_floor(GetStyle()->size + 0.5);
|
||||
mMetrics->emHeight = floor(GetStyle()->size + 0.5);
|
||||
|
||||
cairo_scaled_font_t* scaledFont = CairoScaledFont();
|
||||
if (!scaledFont) {
|
||||
@ -274,9 +274,9 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
||||
// leadings are not available directly (only for WinFNTs);
|
||||
// better compute them on our own, to get integer values and make
|
||||
// layout happy (see // LockedFTFace::GetMetrics in gfxPangoFonts.cpp)
|
||||
mMetrics->internalLeading = NS_floor(mMetrics->maxHeight
|
||||
mMetrics->internalLeading = floor(mMetrics->maxHeight
|
||||
- mMetrics->emHeight + 0.5);
|
||||
gfxFloat lineHeight = NS_floor(mMetrics->maxHeight + 0.5);
|
||||
gfxFloat lineHeight = floor(mMetrics->maxHeight + 0.5);
|
||||
mMetrics->externalLeading = lineHeight
|
||||
- mMetrics->internalLeading - mMetrics->emHeight;
|
||||
|
||||
|
@ -69,8 +69,8 @@ struct THEBES_API gfxPoint : public mozilla::gfx::BasePoint<gfxFloat, gfxPoint>
|
||||
// And if you need similar method which is using NS_round(), you should
|
||||
// create new |RoundAwayFromZero()| method.
|
||||
gfxPoint& Round() {
|
||||
x = NS_floor(x + 0.5);
|
||||
y = NS_floor(y + 0.5);
|
||||
x = floor(x + 0.5);
|
||||
y = floor(y + 0.5);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
@ -59,10 +59,10 @@ void
|
||||
gfxRect::Round()
|
||||
{
|
||||
// Note that don't use NS_round here. See the comment for this method in gfxRect.h
|
||||
gfxFloat x0 = NS_floor(X() + 0.5);
|
||||
gfxFloat y0 = NS_floor(Y() + 0.5);
|
||||
gfxFloat x1 = NS_floor(XMost() + 0.5);
|
||||
gfxFloat y1 = NS_floor(YMost() + 0.5);
|
||||
gfxFloat x0 = floor(X() + 0.5);
|
||||
gfxFloat y0 = floor(Y() + 0.5);
|
||||
gfxFloat x1 = floor(XMost() + 0.5);
|
||||
gfxFloat y1 = floor(YMost() + 0.5);
|
||||
|
||||
x = x0;
|
||||
y = y0;
|
||||
@ -74,10 +74,10 @@ gfxRect::Round()
|
||||
void
|
||||
gfxRect::RoundIn()
|
||||
{
|
||||
gfxFloat x0 = NS_ceil(X());
|
||||
gfxFloat y0 = NS_ceil(Y());
|
||||
gfxFloat x1 = NS_floor(XMost());
|
||||
gfxFloat y1 = NS_floor(YMost());
|
||||
gfxFloat x0 = ceil(X());
|
||||
gfxFloat y0 = ceil(Y());
|
||||
gfxFloat x1 = floor(XMost());
|
||||
gfxFloat y1 = floor(YMost());
|
||||
|
||||
x = x0;
|
||||
y = y0;
|
||||
@ -89,10 +89,10 @@ gfxRect::RoundIn()
|
||||
void
|
||||
gfxRect::RoundOut()
|
||||
{
|
||||
gfxFloat x0 = NS_floor(X());
|
||||
gfxFloat y0 = NS_floor(Y());
|
||||
gfxFloat x1 = NS_ceil(XMost());
|
||||
gfxFloat y1 = NS_ceil(YMost());
|
||||
gfxFloat x0 = floor(X());
|
||||
gfxFloat y0 = floor(Y());
|
||||
gfxFloat x1 = ceil(XMost());
|
||||
gfxFloat y1 = ceil(YMost());
|
||||
|
||||
x = x0;
|
||||
y = y0;
|
||||
|
@ -489,7 +489,7 @@ gfxUtils::ClampToScaleFactor(gfxFloat aVal)
|
||||
if (fabs(power - NS_round(power)) < 1e-6) {
|
||||
power = NS_round(power);
|
||||
} else {
|
||||
power = NS_ceil(power);
|
||||
power = ceil(power);
|
||||
}
|
||||
|
||||
return pow(kScaleResolution, power);
|
||||
|
@ -138,8 +138,8 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
||||
// There's probably a better fix, but I haven't figured out
|
||||
// the root cause of the problem.
|
||||
mTempSurfaceSize =
|
||||
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() + 1),
|
||||
(PRInt32) NS_ceil(mNativeRect.Height() + 1));
|
||||
gfxIntSize((PRInt32) ceil(mNativeRect.Width() + 1),
|
||||
(PRInt32) ceil(mNativeRect.Height() + 1));
|
||||
} else {
|
||||
// figure out the scale factors
|
||||
mScale = m.ScaleFactors(PR_TRUE);
|
||||
@ -153,8 +153,8 @@ gfxWindowsNativeDrawing::BeginNativeDrawing()
|
||||
|
||||
// See comment above about "+1"
|
||||
mTempSurfaceSize =
|
||||
gfxIntSize((PRInt32) NS_ceil(mNativeRect.Width() * mScale.width + 1),
|
||||
(PRInt32) NS_ceil(mNativeRect.Height() * mScale.height + 1));
|
||||
gfxIntSize((PRInt32) ceil(mNativeRect.Width() * mScale.width + 1),
|
||||
(PRInt32) ceil(mNativeRect.Height() * mScale.height + 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5022,6 +5022,18 @@ if test -n "$JS_GC_ZEAL"; then
|
||||
AC_DEFINE(JS_GC_ZEAL)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl JS opt-mode assertions and minidump instrumentation
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(js-diagnostics,
|
||||
[ --enable-js-diagnostics
|
||||
Enable JS diagnostic assertions and breakpad data],
|
||||
JS_CRASH_DIAGNOSTICS=1,
|
||||
JS_CRASH_DIAGNOSTICS= )
|
||||
if test -n "$JS_CRASH_DIAGNOSTICS"; then
|
||||
AC_DEFINE(JS_CRASH_DIAGNOSTICS)
|
||||
fi
|
||||
|
||||
dnl ======================================================
|
||||
dnl = Enable compiling with ccache
|
||||
dnl ======================================================
|
||||
|
3
js/src/jit-test/tests/basic/bug678211.js
Normal file
3
js/src/jit-test/tests/basic/bug678211.js
Normal file
@ -0,0 +1,3 @@
|
||||
var g = newGlobal('new-compartment');
|
||||
g.eval("function f(n) { for (var i = 0; i < n; i++) f(0); }");
|
||||
g.f(RUNLOOP + 1);
|
@ -562,8 +562,6 @@ JSCompartment::purge(JSContext *cx)
|
||||
#endif
|
||||
|
||||
#ifdef JS_METHODJIT
|
||||
js::CheckCompartmentScripts(this);
|
||||
|
||||
for (JSScript *script = (JSScript *)scripts.next;
|
||||
&script->links != &scripts;
|
||||
script = (JSScript *)script->links.next) {
|
||||
|
@ -245,37 +245,37 @@ static Stack gGCStack(JS_CRASH_STACK_GC);
|
||||
static Stack gErrorStack(JS_CRASH_STACK_ERROR);
|
||||
static Ring gRingBuffer(JS_CRASH_RING);
|
||||
|
||||
void
|
||||
SnapshotGCStack()
|
||||
{
|
||||
if (gInitialized)
|
||||
gGCStack.snapshot();
|
||||
}
|
||||
|
||||
void
|
||||
SnapshotErrorStack()
|
||||
{
|
||||
if (gInitialized)
|
||||
gErrorStack.snapshot();
|
||||
}
|
||||
|
||||
void
|
||||
SaveCrashData(uint64 tag, void *ptr, size_t size)
|
||||
{
|
||||
if (gInitialized)
|
||||
gRingBuffer.push(tag, ptr, size);
|
||||
}
|
||||
|
||||
} /* namespace crash */
|
||||
} /* namespace js */
|
||||
|
||||
using namespace js;
|
||||
using namespace js::crash;
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SnapshotGCStack()
|
||||
{
|
||||
if (gInitialized)
|
||||
gGCStack.snapshot();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SnapshotErrorStack()
|
||||
{
|
||||
if (gInitialized)
|
||||
gErrorStack.snapshot();
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SaveCrashData(uint64 tag, void *ptr, size_t size)
|
||||
{
|
||||
if (gInitialized)
|
||||
gRingBuffer.push(tag, ptr, size);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
JS_EnumerateDiagnosticMemoryRegions(JSEnumerateDiagnosticMemoryCallback callback)
|
||||
{
|
||||
#if 1
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
if (!gInitialized) {
|
||||
gInitialized = true;
|
||||
(*callback)(&gGCStack, sizeof(gGCStack));
|
||||
|
@ -42,18 +42,46 @@
|
||||
#define jscrashreport_h___
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "jsutil.h"
|
||||
|
||||
JS_BEGIN_EXTERN_C
|
||||
namespace js {
|
||||
namespace crash {
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SnapshotGCStack();
|
||||
void
|
||||
SnapshotGCStack();
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SnapshotErrorStack();
|
||||
void
|
||||
SnapshotErrorStack();
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
js_SaveCrashData(uint64 tag, void *ptr, size_t size);
|
||||
void
|
||||
SaveCrashData(uint64 tag, void *ptr, size_t size);
|
||||
|
||||
JS_END_EXTERN_C
|
||||
template<size_t size, char marker>
|
||||
class StackBuffer {
|
||||
private:
|
||||
JS_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
volatile char buffer[size + 4];
|
||||
|
||||
public:
|
||||
StackBuffer(void *data JS_GUARD_OBJECT_NOTIFIER_PARAM) {
|
||||
JS_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
buffer[0] = marker;
|
||||
buffer[1] = '[';
|
||||
|
||||
for (size_t i = 0; i < size; i++) {
|
||||
if (data)
|
||||
buffer[i + 2] = ((char *)data)[i];
|
||||
else
|
||||
buffer[i + 2] = 0;
|
||||
}
|
||||
|
||||
buffer[size - 2] = ']';
|
||||
buffer[size - 1] = marker;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace crash */
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* jscrashreport_h___ */
|
||||
|
@ -241,7 +241,7 @@ Arena::finalize(JSContext *cx)
|
||||
if (!newFreeSpanStart)
|
||||
newFreeSpanStart = thing;
|
||||
t->finalize(cx);
|
||||
memset(t, JS_FREE_PATTERN, sizeof(T));
|
||||
JS_POISON(t, JS_FREE_PATTERN, sizeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2399,9 +2399,6 @@ MarkAndSweep(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind GCTIM
|
||||
printf("GC HEAP SIZE %lu\n", (unsigned long)rt->gcBytes);
|
||||
}
|
||||
#endif
|
||||
|
||||
for (JSCompartment **c = rt->compartments.begin(); c != rt->compartments.end(); c++)
|
||||
js::CheckCompartmentScripts(*c);
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
@ -2693,7 +2690,7 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind)
|
||||
GCCrashData crashData;
|
||||
crashData.isRegen = rt->shapeGen & SHAPE_OVERFLOW_BIT;
|
||||
crashData.isCompartment = !!comp;
|
||||
js_SaveCrashData(crash::JS_CRASH_TAG_GC, &crashData, sizeof(crashData));
|
||||
crash::SaveCrashData(crash::JS_CRASH_TAG_GC, &crashData, sizeof(crashData));
|
||||
|
||||
GCTIMER_BEGIN(rt, comp);
|
||||
|
||||
@ -2744,7 +2741,7 @@ js_GC(JSContext *cx, JSCompartment *comp, JSGCInvocationKind gckind)
|
||||
rt->gcChunkAllocationSinceLastGC = false;
|
||||
GCTIMER_END(gckind == GC_LAST_CONTEXT);
|
||||
|
||||
js_SnapshotGCStack();
|
||||
crash::SnapshotGCStack();
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
@ -100,13 +100,6 @@ PushMarkStack(GCMarker *gcmarker, JSShortString *thing);
|
||||
static inline void
|
||||
PushMarkStack(GCMarker *gcmarker, JSString *thing);
|
||||
|
||||
static void
|
||||
volatile_memcpy(volatile unsigned char *dst, const void *src, size_t n)
|
||||
{
|
||||
for (size_t i = 0; i < n; i++)
|
||||
dst[i] = ((char *)src)[i];
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void
|
||||
Mark(JSTracer *trc, T *thing)
|
||||
@ -122,15 +115,9 @@ Mark(JSTracer *trc, T *thing)
|
||||
JS_ASSERT(thing->compartment());
|
||||
JS_ASSERT(thing->compartment()->rt == rt);
|
||||
|
||||
if (rt->gcCheckCompartment && thing->compartment() != rt->gcCheckCompartment &&
|
||||
thing->compartment() != rt->atomsCompartment)
|
||||
{
|
||||
volatile unsigned char dbg[sizeof(T) + 2];
|
||||
dbg[0] = 0xab;
|
||||
dbg[1] = 0xcd;
|
||||
volatile_memcpy(dbg + 2, thing, sizeof(T));
|
||||
JS_Assert("compartment mismatch in GC", __FILE__, __LINE__);
|
||||
}
|
||||
JS_OPT_ASSERT_IF(rt->gcCheckCompartment,
|
||||
thing->compartment() == rt->gcCheckCompartment ||
|
||||
thing->compartment() == rt->atomsCompartment);
|
||||
|
||||
/*
|
||||
* Don't mark things outside a compartment if we are in a per-compartment
|
||||
|
@ -3417,24 +3417,6 @@ CopySlots(JSContext *cx, JSObject *from, JSObject *to)
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
CheckProxy(JSObject *obj)
|
||||
{
|
||||
if (!obj->isProxy())
|
||||
return;
|
||||
|
||||
JSProxyHandler *handler = obj->getProxyHandler();
|
||||
if (handler->isCrossCompartment())
|
||||
return;
|
||||
|
||||
Value priv = obj->getProxyPrivate();
|
||||
if (!priv.isObject())
|
||||
return;
|
||||
|
||||
if (priv.toObject().compartment() != obj->compartment())
|
||||
JS_Assert("compartment mismatch in proxy object", __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
JSObject *
|
||||
JSObject::clone(JSContext *cx, JSObject *proto, JSObject *parent)
|
||||
{
|
||||
@ -3472,8 +3454,6 @@ JSObject::clone(JSContext *cx, JSObject *proto, JSObject *parent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CheckProxy(clone);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
@ -3586,11 +3566,6 @@ JSObject::swap(JSContext *cx, JSObject *other)
|
||||
TradeGuts(this, otherClone);
|
||||
TradeGuts(other, thisClone);
|
||||
|
||||
CheckProxy(this);
|
||||
CheckProxy(other);
|
||||
CheckProxy(thisClone);
|
||||
CheckProxy(otherClone);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1184,11 +1184,6 @@ NewProxyObject(JSContext *cx, JSProxyHandler *handler, const Value &priv, JSObje
|
||||
else
|
||||
clasp = handler->isOuterWindow() ? &OuterWindowProxyClass : &ObjectProxyClass;
|
||||
|
||||
if (!handler->isCrossCompartment() && priv.isObject()) {
|
||||
if (priv.toObject().compartment() != cx->compartment)
|
||||
JS_Assert("compartment mismatch in proxy object", __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
JSObject *obj = NewNonFunction<WithProto::Given>(cx, clasp, proto, parent);
|
||||
if (!obj || !obj->ensureInstanceReservedSlots(cx, 0))
|
||||
return NULL;
|
||||
|
@ -92,10 +92,6 @@ class JS_FRIEND_API(JSProxyHandler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual bool isCrossCompartment() {
|
||||
return false;
|
||||
}
|
||||
|
||||
inline void *family() {
|
||||
return mFamily;
|
||||
}
|
||||
|
@ -46,6 +46,7 @@
|
||||
#include "jstypes.h"
|
||||
#include "jsstdint.h"
|
||||
#include "jsutil.h"
|
||||
#include "jscrashreport.h"
|
||||
#include "jsprf.h"
|
||||
#include "jsapi.h"
|
||||
#include "jsatom.h"
|
||||
@ -287,44 +288,26 @@ Bindings::trace(JSTracer *trc)
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
static void
|
||||
volatile_memcpy(volatile char *dst, void *src, size_t n)
|
||||
{
|
||||
for (size_t i = 0; i < n; i++)
|
||||
dst[i] = ((char *)src)[i];
|
||||
}
|
||||
|
||||
static void
|
||||
CheckScript(JSScript *script, JSScript *prev)
|
||||
{
|
||||
volatile char dbg1[sizeof(JSScript)], dbg2[sizeof(JSScript)];
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
if (script->cookie1 != JS_SCRIPT_COOKIE || script->cookie2 != JS_SCRIPT_COOKIE) {
|
||||
volatile_memcpy(dbg1, script, sizeof(JSScript));
|
||||
if (prev)
|
||||
volatile_memcpy(dbg2, prev, sizeof(JSScript));
|
||||
crash::StackBuffer<sizeof(JSScript), 0x87> buf1(script);
|
||||
crash::StackBuffer<sizeof(JSScript), 0x88> buf2(prev);
|
||||
JS_OPT_ASSERT(false);
|
||||
}
|
||||
JS_OPT_ASSERT(script->cookie1 == JS_SCRIPT_COOKIE && script->cookie2 == JS_SCRIPT_COOKIE);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
CheckScriptOwner(JSScript *script, JSObject *owner)
|
||||
{
|
||||
if (script->ownerObject != owner) {
|
||||
volatile char scriptData[sizeof(JSScript)];
|
||||
volatile char owner1Data[sizeof(JSObject)], owner2Data[sizeof(JSObject)];
|
||||
volatile char savedOwner[sizeof(JSObject *)];
|
||||
|
||||
volatile_memcpy(scriptData, script, sizeof(JSScript));
|
||||
volatile_memcpy(savedOwner, &owner, sizeof(JSObject *));
|
||||
if (script->ownerObject != JS_NEW_SCRIPT && script->ownerObject != JS_CACHED_SCRIPT)
|
||||
volatile_memcpy(owner1Data, script->ownerObject, sizeof(JSObject));
|
||||
if (owner != JS_NEW_SCRIPT && owner != JS_CACHED_SCRIPT)
|
||||
volatile_memcpy(owner2Data, owner, sizeof(JSObject));
|
||||
}
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
JS_OPT_ASSERT(script->ownerObject == owner);
|
||||
|
||||
if (owner != JS_NEW_SCRIPT && owner != JS_CACHED_SCRIPT)
|
||||
JS_OPT_ASSERT(script->compartment == owner->compartment());
|
||||
#endif
|
||||
}
|
||||
|
||||
#if JS_HAS_XDR
|
||||
@ -981,8 +964,10 @@ JSScript::NewScript(JSContext *cx, uint32 length, uint32 nsrcnotes, uint32 natom
|
||||
return NULL;
|
||||
|
||||
PodZero(script);
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
script->cookie1 = script->cookie2 = JS_SCRIPT_COOKIE;
|
||||
script->ownerObject = JS_NEW_SCRIPT;
|
||||
#endif
|
||||
script->length = length;
|
||||
script->version = version;
|
||||
new (&script->bindings) Bindings(cx, emptyCallShape);
|
||||
@ -1286,8 +1271,10 @@ JSScript::totalSize()
|
||||
void
|
||||
JSScript::setOwnerObject(JSObject *owner)
|
||||
{
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
CheckScriptOwner(this, JS_NEW_SCRIPT);
|
||||
ownerObject = owner;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1328,22 +1315,6 @@ js_CallDestroyScriptHook(JSContext *cx, JSScript *script)
|
||||
JS_ClearScriptTraps(cx, script);
|
||||
}
|
||||
|
||||
namespace js {
|
||||
|
||||
void
|
||||
CheckCompartmentScripts(JSCompartment *comp)
|
||||
{
|
||||
JSScript *prev = NULL;
|
||||
for (JSScript *script = (JSScript *)comp->scripts.next;
|
||||
&script->links != &comp->scripts;
|
||||
prev = script, script = (JSScript *)script->links.next)
|
||||
{
|
||||
CheckScript(script, prev);
|
||||
}
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
static void
|
||||
DestroyScript(JSContext *cx, JSScript *script, JSObject *owner, uint32 caller)
|
||||
{
|
||||
@ -1408,7 +1379,7 @@ DestroyScript(JSContext *cx, JSScript *script, JSObject *owner, uint32 caller)
|
||||
if (script->sourceMap)
|
||||
cx->free_(script->sourceMap);
|
||||
|
||||
memset(script, 0xdb, script->totalSize());
|
||||
JS_POISON(script, 0xdb, sizeof(JSScript));
|
||||
*(uint32 *)script = caller;
|
||||
cx->free_(script);
|
||||
}
|
||||
@ -1443,9 +1414,8 @@ js_TraceScript(JSTracer *trc, JSScript *script, JSObject *owner)
|
||||
if (owner)
|
||||
CheckScriptOwner(script, owner);
|
||||
|
||||
JSRuntime *rt = trc->context->runtime;
|
||||
if (rt->gcCheckCompartment && script->compartment != rt->gcCheckCompartment)
|
||||
JS_Assert("compartment mismatch in GC", __FILE__, __LINE__);
|
||||
DebugOnly<JSRuntime *> rt = trc->context->runtime;
|
||||
JS_OPT_ASSERT_IF(rt->gcCheckCompartment, script->compartment == rt->gcCheckCompartment);
|
||||
|
||||
JSAtomMap *map = &script->atomMap;
|
||||
MarkAtomRange(trc, map->length, map->vector, "atomMap");
|
||||
|
@ -449,7 +449,9 @@ struct JSScript {
|
||||
jsbytecode *code; /* bytecodes and their immediate operands */
|
||||
uint32 length; /* length of code vector */
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
uint32 cookie1;
|
||||
#endif
|
||||
|
||||
private:
|
||||
uint16 version; /* JS version under which script was compiled */
|
||||
@ -507,7 +509,9 @@ struct JSScript {
|
||||
JSPrincipals *principals;/* principals for this script */
|
||||
jschar *sourceMap; /* source map file or null */
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
JSObject *ownerObject;
|
||||
#endif
|
||||
|
||||
void setOwnerObject(JSObject *owner);
|
||||
|
||||
@ -541,7 +545,9 @@ struct JSScript {
|
||||
/* array of execution counters for every JSOp in the script, by runmode */
|
||||
JSPCCounters pcCounters;
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
uint32 cookie2;
|
||||
#endif
|
||||
|
||||
public:
|
||||
#ifdef JS_METHODJIT
|
||||
@ -747,19 +753,6 @@ js_DestroyScriptFromGC(JSContext *cx, JSScript *script, JSObject *owner);
|
||||
extern void
|
||||
js_DestroyCachedScript(JSContext *cx, JSScript *script);
|
||||
|
||||
namespace js {
|
||||
|
||||
/*
|
||||
* This diagnostic function checks that a compartment's list of scripts
|
||||
* contains only valid scripts. It also searches for the target script
|
||||
* in the list. If expected is true, it asserts that the target script
|
||||
* is found. If expected is false, it asserts that it's not found.
|
||||
*/
|
||||
void
|
||||
CheckCompartmentScripts(JSCompartment *comp);
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
extern void
|
||||
js_TraceScript(JSTracer *trc, JSScript *script, JSObject *owner);
|
||||
|
||||
|
@ -10467,7 +10467,10 @@ TraceRecorder::record_EnterFrame()
|
||||
|
||||
/* Try inlining one level in case this recursion doesn't go too deep. */
|
||||
if (fp->script() == fp->prev()->script() &&
|
||||
fp->prev()->prev() && fp->prev()->prev()->script() == fp->script()) {
|
||||
fp->prev()->prev() &&
|
||||
fp->prev()->prev()->isScriptFrame() &&
|
||||
fp->prev()->prev()->script() == fp->script())
|
||||
{
|
||||
RETURN_STOP_A("recursion started inlining");
|
||||
}
|
||||
|
||||
|
@ -45,7 +45,6 @@
|
||||
#define jsutil_h___
|
||||
|
||||
#include "jstypes.h"
|
||||
#include "jscrashreport.h"
|
||||
#include "mozilla/Util.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -62,12 +61,24 @@ JS_BEGIN_EXTERN_C
|
||||
|
||||
#define JS_FREE_PATTERN 0xDA
|
||||
|
||||
#ifdef JS_CRASH_DIAGNOSTICS
|
||||
|
||||
#define JS_POISON(p, val, size) memset((p), (val), (size))
|
||||
|
||||
#define JS_OPT_ASSERT(expr) \
|
||||
((expr) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
|
||||
|
||||
#define JS_OPT_ASSERT_IF(cond, expr) \
|
||||
((!(cond) || (expr)) ? (void)0 : JS_Assert(#expr, __FILE__, __LINE__))
|
||||
|
||||
#else
|
||||
|
||||
#define JS_POISON(p, val, size) ((void) 0)
|
||||
#define JS_OPT_ASSERT(expr) ((void) 0)
|
||||
#define JS_OPT_ASSERT_IF(cond, expr) ((void) 0)
|
||||
|
||||
#endif /* JS_CRASH_DIAGNOSTICS */
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define JS_ASSERT(expr) \
|
||||
@ -227,12 +238,6 @@ extern JS_PUBLIC_DATA(JSUint32) OOM_counter; /* data race, who cares. */
|
||||
#define JS_OOM_POSSIBLY_FAIL() do {} while(0)
|
||||
#endif
|
||||
|
||||
static JS_INLINE void *js_record_oom(void *p) {
|
||||
if (!p)
|
||||
js_SnapshotErrorStack();
|
||||
return p;
|
||||
}
|
||||
|
||||
/*
|
||||
* SpiderMonkey code should not be calling these allocation functions directly.
|
||||
* Instead, all calls should go through JSRuntime, JSContext or OffTheBooks.
|
||||
@ -240,17 +245,17 @@ static JS_INLINE void *js_record_oom(void *p) {
|
||||
*/
|
||||
static JS_INLINE void* js_malloc(size_t bytes) {
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return js_record_oom(malloc(bytes));
|
||||
return malloc(bytes);
|
||||
}
|
||||
|
||||
static JS_INLINE void* js_calloc(size_t bytes) {
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return js_record_oom(calloc(bytes, 1));
|
||||
return calloc(bytes, 1);
|
||||
}
|
||||
|
||||
static JS_INLINE void* js_realloc(void* p, size_t bytes) {
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return js_record_oom(realloc(p, bytes));
|
||||
return realloc(p, bytes);
|
||||
}
|
||||
|
||||
static JS_INLINE void js_free(void* p) {
|
||||
|
@ -155,10 +155,6 @@ class JS_FRIEND_API(JSCrossCompartmentWrapper) : public JSWrapper {
|
||||
|
||||
virtual void trace(JSTracer *trc, JSObject *wrapper);
|
||||
|
||||
virtual bool isCrossCompartment() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static JSCrossCompartmentWrapper singleton;
|
||||
};
|
||||
|
||||
|
@ -1943,7 +1943,7 @@ static nscoord
|
||||
FindTileStart(nscoord aDirtyCoord, nscoord aTilePos, nscoord aTileDim)
|
||||
{
|
||||
NS_ASSERTION(aTileDim > 0, "Non-positive tile dimension");
|
||||
double multiples = NS_floor(double(aDirtyCoord - aTilePos)/aTileDim);
|
||||
double multiples = floor(double(aDirtyCoord - aTilePos)/aTileDim);
|
||||
return NSToCoordRound(multiples*aTileDim + aTilePos);
|
||||
}
|
||||
|
||||
@ -2050,7 +2050,7 @@ nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
|
||||
// try to do anything in that case. We certainly need to avoid
|
||||
// dividing by zero.
|
||||
if (stopDelta >= 1e-6) {
|
||||
double instanceCount = NS_ceil(-firstStop/stopDelta);
|
||||
double instanceCount = ceil(-firstStop/stopDelta);
|
||||
// Advance stops by instanceCount multiples of the period of the
|
||||
// repeating gradient.
|
||||
double offset = instanceCount*stopDelta;
|
||||
@ -3607,15 +3607,15 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
||||
|
||||
PRBool canLiftUnderline = aDescentLimit >= 0.0;
|
||||
|
||||
const gfxFloat left = NS_floor(aPt.x + 0.5),
|
||||
right = NS_floor(aPt.x + aLineSize.width + 0.5);
|
||||
const gfxFloat left = floor(aPt.x + 0.5),
|
||||
right = floor(aPt.x + aLineSize.width + 0.5);
|
||||
gfxRect r(left, 0, right - left, 0);
|
||||
|
||||
gfxFloat lineHeight = NS_round(aLineSize.height);
|
||||
lineHeight = NS_MAX(lineHeight, 1.0);
|
||||
|
||||
gfxFloat ascent = NS_round(aAscent);
|
||||
gfxFloat descentLimit = NS_floor(aDescentLimit);
|
||||
gfxFloat descentLimit = floor(aDescentLimit);
|
||||
|
||||
gfxFloat suggestedMaxRectHeight = NS_MAX(NS_MIN(ascent, descentLimit), 1.0);
|
||||
r.height = lineHeight;
|
||||
@ -3671,7 +3671,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
||||
}
|
||||
}
|
||||
|
||||
gfxFloat baseline = NS_floor(aPt.y + aAscent + 0.5);
|
||||
gfxFloat baseline = floor(aPt.y + aAscent + 0.5);
|
||||
gfxFloat offset = 0.0;
|
||||
switch (aDecoration) {
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE:
|
||||
@ -3692,7 +3692,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
||||
offset = aOffset - lineHeight + r.Height();
|
||||
break;
|
||||
case NS_STYLE_TEXT_DECORATION_LINE_LINE_THROUGH: {
|
||||
gfxFloat extra = NS_floor(r.Height() / 2.0 + 0.5);
|
||||
gfxFloat extra = floor(r.Height() / 2.0 + 0.5);
|
||||
extra = NS_MAX(extra, lineHeight);
|
||||
offset = aOffset - lineHeight + extra;
|
||||
break;
|
||||
@ -3700,7 +3700,7 @@ nsCSSRendering::GetTextDecorationRectInternal(const gfxPoint& aPt,
|
||||
default:
|
||||
NS_ERROR("Invalid decoration value!");
|
||||
}
|
||||
r.y = baseline - NS_floor(offset + 0.5);
|
||||
r.y = baseline - floor(offset + 0.5);
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -2766,7 +2766,7 @@ AdvanceToNextTab(gfxFloat aX, nsIFrame* aFrame,
|
||||
// Advance aX to the next multiple of *aCachedTabWidth. We must advance
|
||||
// by at least 1 appunit.
|
||||
// XXX should we make this 1 CSS pixel?
|
||||
return NS_ceil((aX + 1)/(*aCachedTabWidth))*(*aCachedTabWidth);
|
||||
return ceil((aX + 1)/(*aCachedTabWidth))*(*aCachedTabWidth);
|
||||
}
|
||||
|
||||
void
|
||||
@ -4517,7 +4517,7 @@ ComputeSelectionUnderlineHeight(nsPresContext* aPresContext,
|
||||
gfxFloat fontSize = NS_MIN(gfxFloat(defaultFontSize),
|
||||
aFontMetrics.emHeight);
|
||||
fontSize = NS_MAX(fontSize, 1.0);
|
||||
return NS_ceil(fontSize / 20);
|
||||
return ceil(fontSize / 20);
|
||||
}
|
||||
default:
|
||||
NS_WARNING("Requested underline style is not valid");
|
||||
|
@ -319,8 +319,8 @@ static nscoord CalcLengthWith(const nsCSSValue& aValue,
|
||||
gfxFloat zeroWidth = (fm->GetThebesFontGroup()->GetFontAt(0)
|
||||
->GetMetrics().zeroOrAveCharWidth);
|
||||
|
||||
return ScaleCoord(aValue, NS_ceil(aPresContext->AppUnitsPerDevPixel() *
|
||||
zeroWidth));
|
||||
return ScaleCoord(aValue, ceil(aPresContext->AppUnitsPerDevPixel() *
|
||||
zeroWidth));
|
||||
}
|
||||
// For properties for which lengths are the *only* units accepted in
|
||||
// calc(), we can handle calc() here and just compute a final
|
||||
|
@ -1384,8 +1384,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
|
||||
switch (aProperty) {
|
||||
case eCSSProperty_font_stretch: {
|
||||
// Animate just like eUnit_Integer.
|
||||
PRInt32 result = NS_floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
||||
aCoeff2 * double(aValue2.GetIntValue()));
|
||||
PRInt32 result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
||||
aCoeff2 * double(aValue2.GetIntValue()));
|
||||
if (result < NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED) {
|
||||
result = NS_STYLE_FONT_STRETCH_ULTRA_CONDENSED;
|
||||
} else if (result > NS_STYLE_FONT_STRETCH_ULTRA_EXPANDED) {
|
||||
@ -1409,8 +1409,8 @@ nsStyleAnimation::AddWeighted(nsCSSProperty aProperty,
|
||||
case eUnit_Integer: {
|
||||
// http://dev.w3.org/csswg/css3-transitions/#animation-of-property-types-
|
||||
// says we should use floor
|
||||
PRInt32 result = NS_floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
||||
aCoeff2 * double(aValue2.GetIntValue()));
|
||||
PRInt32 result = floor(aCoeff1 * double(aValue1.GetIntValue()) +
|
||||
aCoeff2 * double(aValue2.GetIntValue()));
|
||||
if (aProperty == eCSSProperty_font_weight) {
|
||||
if (result < 100) {
|
||||
result = 100;
|
||||
|
@ -29,6 +29,13 @@ var ContextCommands = {
|
||||
}
|
||||
},
|
||||
|
||||
pasteAndGo: function cc_pasteAndGo() {
|
||||
let target = ContextHelper.popupState.target;
|
||||
target.editor.selectAll();
|
||||
target.editor.paste(Ci.nsIClipboard.kGlobalClipboard);
|
||||
BrowserUI.goToURI();
|
||||
},
|
||||
|
||||
selectAll: function cc_selectAll() {
|
||||
let target = ContextHelper.popupState.target;
|
||||
if (target.localName == "browser") {
|
||||
|
@ -1820,8 +1820,12 @@
|
||||
let flavors = ["text/unicode"];
|
||||
let hasData = clipboard.hasDataMatchingFlavors(flavors, flavors.length, Ci.nsIClipboard.kGlobalClipboard);
|
||||
|
||||
if (hasData && (!aTextbox.readOnly || aIgnoreReadOnly))
|
||||
if (hasData && (!aTextbox.readOnly || aIgnoreReadOnly)) {
|
||||
json.types.push("paste");
|
||||
if (aTextbox.type == "url") {
|
||||
json.types.push("paste-url");
|
||||
}
|
||||
}
|
||||
|
||||
ContextHelper.showPopup({ target: aTextbox, json: json });
|
||||
]]></body>
|
||||
|
@ -626,6 +626,9 @@
|
||||
<richlistitem class="context-command" id="context-paste" type="paste" onclick="ContextCommands.paste();">
|
||||
<label value="&paste.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-paste-n-go" type="paste-url" onclick="ContextCommands.pasteAndGo();">
|
||||
<label value="&pasteAndGo.label;"/>
|
||||
</richlistitem>
|
||||
<richlistitem class="context-command" id="context-select-all" type="select-all" onclick="ContextCommands.selectAll();">
|
||||
<label value="&selectAll.label;"/>
|
||||
</richlistitem>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<!ENTITY copyAll.label "Copy All">
|
||||
<!ENTITY copylink.label "Copy Link Location">
|
||||
<!ENTITY paste.label "Paste">
|
||||
<!ENTITY pasteAndGo.label "Paste & Go">
|
||||
<!ENTITY delete.label "Delete">
|
||||
<!ENTITY selectAll.label "Select All">
|
||||
<!ENTITY noSuggestions.label "(No suggestions)">
|
||||
|
@ -590,9 +590,9 @@ namespace places {
|
||||
}
|
||||
else {
|
||||
// Estimate frecency using the last few visits.
|
||||
// Use NS_ceilf() so that we don't round down to 0, which
|
||||
// Use ceilf() so that we don't round down to 0, which
|
||||
// would cause us to completely ignore the place during autocomplete.
|
||||
NS_ADDREF(*_result = new IntegerVariant((PRInt32) NS_ceilf(fullVisitCount * NS_ceilf(pointsForSampledVisits) / numSampledVisits)));
|
||||
NS_ADDREF(*_result = new IntegerVariant((PRInt32) ceilf(fullVisitCount * ceilf(pointsForSampledVisits) / numSampledVisits)));
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -625,9 +625,9 @@ namespace places {
|
||||
// Assume "now" as our ageInDays, so use the first bucket.
|
||||
pointsForSampledVisits = history->GetFrecencyBucketWeight(1) * (bonus / (float)100.0);
|
||||
|
||||
// use NS_ceilf() so that we don't round down to 0, which
|
||||
// use ceilf() so that we don't round down to 0, which
|
||||
// would cause us to completely ignore the place during autocomplete
|
||||
NS_ADDREF(*_result = new IntegerVariant((PRInt32) NS_ceilf(fullVisitCount * NS_ceilf(pointsForSampledVisits))));
|
||||
NS_ADDREF(*_result = new IntegerVariant((PRInt32) ceilf(fullVisitCount * ceilf(pointsForSampledVisits))));
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -177,7 +177,7 @@ static const PRInt64 USECS_PER_DAY = LL_INIT(20, 500654080);
|
||||
// long, but we split only the last 6 months.
|
||||
#define HISTORY_DATE_CONT_NUM(_daysFromOldestVisit) \
|
||||
(HISTORY_ADDITIONAL_DATE_CONT_NUM + \
|
||||
NS_MIN(6, (PRInt32)NS_ceilf((float)_daysFromOldestVisit/30)))
|
||||
NS_MIN(6, (PRInt32)ceilf((float)_daysFromOldestVisit/30)))
|
||||
// Max number of containers, used to initialize the params hash.
|
||||
#define HISTORY_DATE_CONT_MAX 10
|
||||
|
||||
|
@ -6359,7 +6359,7 @@ nsWindow::ResetRemainingWheelDelta()
|
||||
|
||||
static PRInt32 RoundDelta(double aDelta)
|
||||
{
|
||||
return aDelta >= 0 ? (PRInt32)NS_floor(aDelta) : (PRInt32)NS_ceil(aDelta);
|
||||
return aDelta >= 0 ? (PRInt32)floor(aDelta) : (PRInt32)ceil(aDelta);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,30 +105,6 @@ inline NS_HIDDEN_(PRInt32) NS_lroundf(float x)
|
||||
return x >= 0.0f ? PRInt32(x + 0.5f) : PRInt32(x - 0.5f);
|
||||
}
|
||||
|
||||
/*
|
||||
* ceil
|
||||
*/
|
||||
inline NS_HIDDEN_(double) NS_ceil(double x)
|
||||
{
|
||||
return ceil(x);
|
||||
}
|
||||
inline NS_HIDDEN_(float) NS_ceilf(float x)
|
||||
{
|
||||
return ceilf(x);
|
||||
}
|
||||
|
||||
/*
|
||||
* floor
|
||||
*/
|
||||
inline NS_HIDDEN_(double) NS_floor(double x)
|
||||
{
|
||||
return floor(x);
|
||||
}
|
||||
inline NS_HIDDEN_(float) NS_floorf(float x)
|
||||
{
|
||||
return floorf(x);
|
||||
}
|
||||
|
||||
/*
|
||||
* hypot. We don't need a super accurate version of this, if a platform
|
||||
* turns up with none of the possibilities below it would be okay to fall
|
||||
|
Loading…
Reference in New Issue
Block a user