Merging cedar with mozilla-central.

This commit is contained in:
Mounir Lamouri 2011-06-03 12:06:08 +02:00
Родитель b856b7b398 22b9771448
Коммит 8d38f1695a
190 изменённых файлов: 1783 добавлений и 900 удалений

Просмотреть файл

@ -341,16 +341,13 @@ static PRInt32
GetAccessModifierMask(nsIContent* aContent)
{
// use ui.key.generalAccessKey (unless it is -1)
PRInt32 accessKey = -1;
nsresult rv = Preferences::GetInt("ui.key.generalAccessKey", accessKey);
if (NS_SUCCEEDED(rv) && accessKey != -1) {
switch (accessKey) {
case nsIDOMKeyEvent::DOM_VK_SHIFT: return NS_MODIFIER_SHIFT;
case nsIDOMKeyEvent::DOM_VK_CONTROL: return NS_MODIFIER_CONTROL;
case nsIDOMKeyEvent::DOM_VK_ALT: return NS_MODIFIER_ALT;
case nsIDOMKeyEvent::DOM_VK_META: return NS_MODIFIER_META;
default: return 0;
}
switch (Preferences::GetInt("ui.key.generalAccessKey", -1)) {
case -1: break;
case nsIDOMKeyEvent::DOM_VK_SHIFT: return NS_MODIFIER_SHIFT;
case nsIDOMKeyEvent::DOM_VK_CONTROL: return NS_MODIFIER_CONTROL;
case nsIDOMKeyEvent::DOM_VK_ALT: return NS_MODIFIER_ALT;
case nsIDOMKeyEvent::DOM_VK_META: return NS_MODIFIER_META;
default: return 0;
}
// get the docShell to this DOMNode, return 0 on failure
@ -365,6 +362,7 @@ GetAccessModifierMask(nsIContent* aContent)
return 0;
// determine the access modifier used in this context
nsresult rv = NS_ERROR_FAILURE;
PRInt32 itemType, accessModifierMask = 0;
treeItem->GetItemType(&itemType);
switch (itemType) {

Просмотреть файл

@ -2873,7 +2873,7 @@ var PrintPreviewListener = {
this._printPreviewTab = null;
},
_toggleAffectedChrome: function () {
gNavToolbox.hidden = gInPrintPreviewMode;
gNavToolbox.collapsed = gInPrintPreviewMode;
if (gInPrintPreviewMode)
this._hideChrome();

Просмотреть файл

@ -463,11 +463,13 @@ let AboutPermissions = {
gSitesStmt.params.limit = this.PLACES_SITES_LIMIT;
gSitesStmt.executeAsync({
handleResult: function(aResults) {
AboutPermissions.startSitesListBatch();
let row;
while (row = aResults.getNextRow()) {
let host = row.getResultByName("host");
AboutPermissions.addHost(host);
}
AboutPermissions.endSitesListBatch();
},
handleError: function(aError) {
Cu.reportError("AboutPermissions: " + aError);
@ -484,6 +486,8 @@ let AboutPermissions = {
* them if they are not already stored in _sites.
*/
enumerateServices: function() {
this.startSitesListBatch();
let logins = Services.logins.getAllLogins();
logins.forEach(function(aLogin) {
try {
@ -515,6 +519,8 @@ let AboutPermissions = {
}
}
}
this.endSitesListBatch();
},
/**
@ -548,7 +554,19 @@ let AboutPermissions = {
});
aSite.listitem = item;
this.sitesList.appendChild(item);
(this._listFragment || this.sitesList).appendChild(item);
},
startSitesListBatch: function () {
if (!this._listFragment)
this._listFragment = document.createDocumentFragment();
},
endSitesListBatch: function () {
if (this._listFragment) {
this.sitesList.appendChild(this._listFragment);
this._listFragment = null;
}
},
/**

Просмотреть файл

@ -41,7 +41,7 @@
#include "elfxx.h"
template <class endian, typename R, typename T>
inline void Elf_Ehdr_Traits::swap(T &t, R &r)
void Elf_Ehdr_Traits::swap(T &t, R &r)
{
memcpy(r.e_ident, t.e_ident, sizeof(r.e_ident));
r.e_type = endian::swap(t.e_type);
@ -60,7 +60,7 @@ inline void Elf_Ehdr_Traits::swap(T &t, R &r)
}
template <class endian, typename R, typename T>
inline void Elf_Phdr_Traits::swap(T &t, R &r)
void Elf_Phdr_Traits::swap(T &t, R &r)
{
r.p_type = endian::swap(t.p_type);
r.p_offset = endian::swap(t.p_offset);
@ -73,7 +73,7 @@ inline void Elf_Phdr_Traits::swap(T &t, R &r)
}
template <class endian, typename R, typename T>
inline void Elf_Shdr_Traits::swap(T &t, R &r)
void Elf_Shdr_Traits::swap(T &t, R &r)
{
r.sh_name = endian::swap(t.sh_name);
r.sh_type = endian::swap(t.sh_type);
@ -88,14 +88,14 @@ inline void Elf_Shdr_Traits::swap(T &t, R &r)
}
template <class endian, typename R, typename T>
inline void Elf_Dyn_Traits::swap(T &t, R &r)
void Elf_Dyn_Traits::swap(T &t, R &r)
{
r.d_tag = endian::swap(t.d_tag);
r.d_un.d_val = endian::swap(t.d_un.d_val);
}
template <class endian, typename R, typename T>
inline void Elf_Sym_Traits::swap(T &t, R &r)
void Elf_Sym_Traits::swap(T &t, R &r)
{
r.st_name = endian::swap(t.st_name);
r.st_value = endian::swap(t.st_value);
@ -118,14 +118,14 @@ struct _Rel_info {
};
template <class endian, typename R, typename T>
inline void Elf_Rel_Traits::swap(T &t, R &r)
void Elf_Rel_Traits::swap(T &t, R &r)
{
r.r_offset = endian::swap(t.r_offset);
_Rel_info<endian>::swap(t.r_info, r.r_info);
}
template <class endian, typename R, typename T>
inline void Elf_Rela_Traits::swap(T &t, R &r)
void Elf_Rela_Traits::swap(T &t, R &r)
{
r.r_offset = endian::swap(t.r_offset);
_Rel_info<endian>::swap(t.r_info, r.r_info);

Просмотреть файл

@ -2209,8 +2209,6 @@ ia64*-hpux*)
else
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fno-omit-frame-pointer"
fi
# The Maemo builders don't know about this flag
MOZ_ARM_VFP_FLAGS="-mfpu=vfp"
;;
*-*linux*)
@ -3444,41 +3442,6 @@ AC_SUBST(XEXT_LIBS)
AC_SUBST(XT_LIBS)
AC_SUBST(XSS_LIBS)
if test "$CPU_ARCH" = "arm"; then
AC_MSG_CHECKING(for ARM SIMD support in compiler)
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm("uqadd8 r1, r1, r2");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_SIMD)
HAVE_ARM_SIMD=1
fi
AC_MSG_CHECKING(for ARM NEON support in compiler)
_SAVE_CFLAGS="$CFLAGS"
if test "$GNU_CC"; then
# gcc needs -mfpu=neon to recognize NEON instructions
CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
fi
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm("vadd.i8 d0, d0, d0");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_NEON)
HAVE_ARM_NEON=1
fi
CFLAGS="$_SAVE_CFLAGS"
fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl = pthread support
dnl = Start by checking whether the system support pthreads
@ -4841,7 +4804,6 @@ MOZ_SPELLCHECK=1
MOZ_SPLASHSCREEN=
MOZ_STORAGE=1
MOZ_SVG_DLISTS=
MOZ_THUMB2=
MOZ_TIMELINE=
MOZ_TOOLKIT_SEARCH=1
MOZ_UI_LOCALE=en-US
@ -4893,7 +4855,6 @@ case "${target}" in
USE_ARM_KUSER=1
MOZ_INSTALLER=
NECKO_WIFI=
MOZ_THUMB2=1
MOZ_THEME_FASTSTRIPE=1
MOZ_TREE_FREETYPE=1
MOZ_MEMORY=1
@ -6964,8 +6925,6 @@ if test $MOZ_PLATFORM_MAEMO; then
AC_SUBST(MOZ_ENABLE_CONTENTACTION)
fi
fi
MOZ_THUMB2=1
fi
PKG_CHECK_MODULES(LIBLOCATION,liblocation, _LIB_FOUND=1, _LIB_FOUND=)
@ -6994,80 +6953,204 @@ if test $MOZ_PLATFORM_MAEMO; then
AC_SUBST(MOZ_PLATFORM_MAEMO_CFLAGS)
fi
dnl Setup default CPU arch for arm target
case "$target_cpu" in
arm*)
MOZ_ARM_ARCH=armv7
;;
dnl ========================================================
dnl = ARM toolchain tweaks
dnl ========================================================
dnl Defaults
case "${target}" in
arm-android-eabi)
MOZ_THUMB=yes
MOZ_ARCH=armv7-a
MOZ_FPU=vfp
MOZ_FLOAT_ABI=softfp
;;
arm*-*)
if test -n "$MOZ_PLATFORM_MAEMO"; then
MOZ_THUMB=no
MOZ_ARCH=armv7-a
MOZ_FLOAT_ABI=softfp
fi
if test "$MOZ_PLATFORM_MAEMO" = 6; then
MOZ_THUMB=yes
fi
;;
esac
dnl ========================================================
dnl = Enable building the Thumb2 instruction set
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(thumb2,
[ --enable-thumb2 Enable Thumb2 instruction set (implies ARMv7)],
MOZ_THUMB2=1,
MOZ_THUMB2=)
if test -n "$MOZ_THUMB2"; then
MOZ_ARM_ARCH=armv7
dnl Kept for compatibility with some buildbot mozconfig
MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
MOZ_ARG_WITH_STRING(thumb,
[ --with-thumb[[=yes|no|toolchain-default]]]
[ Use Thumb instruction set (-mthumb)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchains])
fi
MOZ_THUMB=$withval)
MOZ_ARG_WITH_STRING(thumb-interwork,
[ --with-thumb-interwork[[=yes|no|toolchain-default]]
Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchains])
fi
MOZ_THUMB_INTERWORK=$withval)
MOZ_ARG_WITH_STRING(arch,
[ --with-arch=[[type|toolchain-default]]
Use specific CPU features (-march=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchains])
fi
MOZ_ARCH=$withval)
MOZ_ARG_WITH_STRING(fpu,
[ --with-fpu=[[type|toolchain-default]]
Use specific FPU type (-mfpu=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchains])
fi
MOZ_FPU=$withval)
MOZ_ARG_WITH_STRING(float-abi,
[ --with-float-abi=[[type|toolchain-default]]
Use specific arm float ABI (-mfloat-abi=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchains])
fi
MOZ_FLOAT_ABI=$withval)
MOZ_ARG_WITH_STRING(soft-float,
[ --with-soft-float[[=yes|no|toolchain-default]]
Use soft float library (-msoft-float)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchains])
fi
MOZ_SOFT_FLOAT=$withval)
case "$MOZ_ARCH" in
toolchain-default|"")
arch_flag=""
;;
*)
arch_flag="-march=$MOZ_ARCH"
;;
esac
case "$MOZ_THUMB" in
yes)
MOZ_THUMB2=1
thumb_flag="-mthumb"
;;
no)
MOZ_THUMB2=
thumb_flag="-marm"
;;
*)
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$arch_flag"
AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
MOZ_THUMB2=1,
MOZ_THUMB2=)
CFLAGS="$_SAVE_CFLAGS"
thumb_flag=""
;;
esac
if test "$MOZ_THUMB2" = 1; then
AC_DEFINE(MOZ_THUMB2)
fi
dnl ========================================================
dnl = Enable building for ARM specific CPU features
dnl ========================================================
MOZ_ARG_WITH_STRING(cpu-arch,
[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
MOZ_ARM_ARCH=$withval)
case "$MOZ_THUMB_INTERWORK" in
yes)
thumb_interwork_flag="-mthumb-interwork"
;;
no)
thumb_interwork_flag="-mno-thumb-interwork"
;;
*) # toolchain-default
thumb_interwork_flag=""
;;
esac
if test -n "$MOZ_THUMB2"; then
case "$target_cpu" in
arm*)
if test "$MOZ_ARM_ARCH" != "armv7"; then
AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
fi
if test "$GNU_CC"; then
AC_DEFINE(MOZ_THUMB2)
AC_DEFINE(MOZ_ARM_ARCH)
CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
else
AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
fi
case "$MOZ_FPU" in
toolchain-default|"")
fpu_flag=""
;;
*)
AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
*)
fpu_flag="-mfpu=$MOZ_FPU"
;;
esac
elif test "$MOZ_ARM_ARCH" = "armv7"; then
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
AC_DEFINE(MOZ_ARM_ARCH)
CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
else
AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
fi
esac
case "$MOZ_FLOAT_ABI" in
toolchain-default|"")
float_abi_flag=""
;;
*)
AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
*)
float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
;;
esac
else
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
fi
;;
esac
esac
case "$MOZ_SOFT_FLOAT" in
yes)
soft_float_flag="-msoft-float"
;;
no)
soft_float_flag="-mno-soft-float"
;;
*) # toolchain-default
soft_float_flag=""
;;
esac
dnl Use echo to avoid accumulating space characters
all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
if test -n "$all_flags"; then
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$all_flags"
AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
AC_TRY_COMPILE([],[return 0;],
AC_MSG_RESULT([yes]),
AC_MSG_ERROR([no]))
CFLAGS="$_SAVE_CFLAGS $all_flags"
CXXFLAGS="$CXXFLAGS $all_flags"
ASFLAGS="$ASFLAGS $all_flags"
if test -n "$thumb_flag"; then
LDFLAGS="$LDFLAGS $thumb_flag"
fi
fi
AC_SUBST(MOZ_THUMB2)
AC_SUBST(MOZ_ARM_ARCH)
if test "$CPU_ARCH" = "arm"; then
AC_MSG_CHECKING(for ARM SIMD support in compiler)
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm("uqadd8 r1, r1, r2");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_SIMD)
HAVE_ARM_SIMD=1
fi
AC_MSG_CHECKING(for ARM NEON support in compiler)
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm(".fpu neon\n vadd.i8 d0, d0, d0");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_NEON)
HAVE_ARM_NEON=1
fi
fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl = faststripe theme
@ -7417,8 +7500,8 @@ MOZ_ARG_ENABLE_BOOL(wrap-malloc,
if test -n "$_WRAP_MALLOC"; then
if test "$GNU_CC"; then
WRAP_MALLOC_CFLAGS="${LDFLAGS} ${WRAP_MALLOC_CFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
MKCSHLIB='$(CC) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
MKSHLIB="$MKSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
MKCSHLIB="$MKCSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
fi
fi
@ -9281,12 +9364,6 @@ unset CONFIG_FILES
# No need to run subconfigures when building with LIBXUL_SDK_DIR
if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
if test -n "$MOZ_THUMB2"; then
_SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-thumb2"
fi
if test -n "$MOZ_ARM_ARCH"; then
_SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --with-cpu-arch=$MOZ_ARM_ARCH"
fi
if test -n "$_WRAP_MALLOC"; then
_SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
fi

Просмотреть файл

@ -151,16 +151,16 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aStart, PRInt64 aEnd,
aEnd = (PRInt64)thisLength;
}
// Modifies aStart and aEnd.
ParseSize((PRInt64)thisLength, aStart, aEnd);
// If we clamped to nothing we create an empty blob
nsTArray<nsCOMPtr<nsIDOMBlob> > blobs;
PRInt64 length = aEnd - aStart;
PRUint64 finalLength = length;
PRUint64 length = aEnd - aStart;
PRUint64 skipStart = aStart;
NS_ABORT_IF_FALSE(aStart + length <= thisLength, "Er, what?");
NS_ABORT_IF_FALSE(PRUint64(aStart) + length <= thisLength, "Er, what?");
// Prune the list of blobs if we can
PRUint32 i;
@ -172,7 +172,7 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aStart, PRInt64 aEnd,
NS_ENSURE_SUCCESS(rv, rv);
if (skipStart < l) {
PRInt64 upperBound = NS_MIN<PRInt64>(l - skipStart, length);
PRUint64 upperBound = NS_MIN<PRUint64>(l - skipStart, length);
nsCOMPtr<nsIDOMBlob> firstBlob;
rv = mBlobs.ElementAt(i)->MozSlice(skipStart, skipStart + upperBound,
@ -212,7 +212,7 @@ nsDOMMultipartBlob::MozSlice(PRInt64 aStart, PRInt64 aEnd,
} else {
blobs.AppendElement(blob);
}
length -= NS_MIN<PRInt64>(l, length);
length -= NS_MIN<PRUint64>(l, length);
}
// we can create our blob now

Просмотреть файл

@ -949,7 +949,7 @@ protected:
FakeBlackStatus mFakeBlackStatus;
void EnsureMaxLevelWithCustomImagesAtLeast(size_t aMaxLevelWithCustomImages) {
mMaxLevelWithCustomImages = PR_MAX(mMaxLevelWithCustomImages, aMaxLevelWithCustomImages);
mMaxLevelWithCustomImages = NS_MAX(mMaxLevelWithCustomImages, aMaxLevelWithCustomImages);
mImageInfos.EnsureLengthAtLeast((mMaxLevelWithCustomImages + 1) * mFacesCount);
}
@ -979,8 +979,8 @@ protected:
const ImageInfo& actual = ImageInfoAt(level, face);
if (actual != expected)
return PR_FALSE;
expected.mWidth = PR_MAX(1, expected.mWidth >> 1);
expected.mHeight = PR_MAX(1, expected.mHeight >> 1);
expected.mWidth = NS_MAX(1, expected.mWidth >> 1);
expected.mHeight = NS_MAX(1, expected.mHeight >> 1);
// if the current level has size 1x1, we can stop here: the spec doesn't seem to forbid the existence
// of extra useless levels.
@ -1091,7 +1091,7 @@ public:
ImageInfo imageInfo = ImageInfoAt(0, 0);
NS_ASSERTION(imageInfo.IsPowerOfTwo(), "this texture is NPOT, so how could GenerateMipmap() ever accept it?");
WebGLsizei size = PR_MAX(imageInfo.mWidth, imageInfo.mHeight);
WebGLsizei size = NS_MAX(imageInfo.mWidth, imageInfo.mHeight);
// so, the size is a power of two, let's find its log in base 2.
size_t maxLevel = 0;

Просмотреть файл

@ -744,13 +744,13 @@ WebGLContext::CopyTexSubImage2D_base(WebGLenum target,
return NS_OK;
}
GLint actual_x = PR_MIN(framebufferWidth, PR_MAX(0, x));
GLint actual_x_plus_width = PR_MIN(framebufferWidth, PR_MAX(0, x + width));
GLint actual_x = NS_MIN(framebufferWidth, NS_MAX(0, x));
GLint actual_x_plus_width = NS_MIN(framebufferWidth, NS_MAX(0, x + width));
GLsizei actual_width = actual_x_plus_width - actual_x;
GLint actual_xoffset = xoffset + actual_x - x;
GLint actual_y = PR_MIN(framebufferHeight, PR_MAX(0, y));
GLint actual_y_plus_height = PR_MIN(framebufferHeight, PR_MAX(0, y + height));
GLint actual_y = NS_MIN(framebufferHeight, NS_MAX(0, y));
GLint actual_y_plus_height = NS_MIN(framebufferHeight, NS_MAX(0, y + height));
GLsizei actual_height = actual_y_plus_height - actual_y;
GLint actual_yoffset = yoffset + actual_y - y;
@ -2987,12 +2987,12 @@ WebGLContext::ReadPixels_base(WebGLint x, WebGLint y, WebGLsizei width, WebGLsiz
}
// compute the parameters of the subrect we're actually going to call glReadPixels on
GLint subrect_x = PR_MAX(x, 0);
GLint subrect_end_x = PR_MIN(x+width, boundWidth);
GLint subrect_x = NS_MAX(x, 0);
GLint subrect_end_x = NS_MIN(x+width, boundWidth);
GLsizei subrect_width = subrect_end_x - subrect_x;
GLint subrect_y = PR_MAX(y, 0);
GLint subrect_end_y = PR_MIN(y+height, boundHeight);
GLint subrect_y = NS_MAX(y, 0);
GLint subrect_end_y = NS_MIN(y+height, boundHeight);
GLsizei subrect_height = subrect_end_y - subrect_y;
if (subrect_width < 0 || subrect_height < 0 ||

Просмотреть файл

@ -538,7 +538,7 @@ WebGLContext::InitAndValidateGL()
error = gl->fGetError();
switch (error) {
case LOCAL_GL_NO_ERROR:
mGLMaxVaryingVectors = PR_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
mGLMaxVaryingVectors = NS_MIN(maxVertexOutputComponents, minFragmentInputComponents) / 4;
break;
case LOCAL_GL_INVALID_ENUM:
mGLMaxVaryingVectors = 16; // = 64/4, 64 is the min value for maxVertexOutputComponents in OpenGL 3.2 spec

Просмотреть файл

@ -3233,7 +3233,8 @@ nsCanvasRenderingContext2D::IsPointInPath(float x, float y, PRBool *retVal)
return NS_OK;
}
*retVal = mThebes->PointInFill(gfxPoint(x,y));
gfxPoint pt(x, y);
*retVal = mThebes->PointInFill(mThebes->DeviceToUser(pt));
return NS_OK;
}
@ -3457,8 +3458,7 @@ nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
if (op.EqualsLiteral(cvsop)) \
thebes_op = gfxContext::OPERATOR_##thebesop;
CANVAS_OP_TO_THEBES_OP("clear", CLEAR)
else CANVAS_OP_TO_THEBES_OP("copy", SOURCE)
CANVAS_OP_TO_THEBES_OP("copy", SOURCE)
else CANVAS_OP_TO_THEBES_OP("destination-atop", DEST_ATOP)
else CANVAS_OP_TO_THEBES_OP("destination-in", DEST_IN)
else CANVAS_OP_TO_THEBES_OP("destination-out", DEST_OUT)
@ -3469,8 +3469,6 @@ nsCanvasRenderingContext2D::SetGlobalCompositeOperation(const nsAString& op)
else CANVAS_OP_TO_THEBES_OP("source-out", OUT)
else CANVAS_OP_TO_THEBES_OP("source-over", OVER)
else CANVAS_OP_TO_THEBES_OP("xor", XOR)
// not part of spec, kept here for compat
else CANVAS_OP_TO_THEBES_OP("over", OVER)
// XXX ERRMSG we need to report an error to developers here! (bug 329026)
else return NS_OK;
@ -3489,10 +3487,7 @@ nsCanvasRenderingContext2D::GetGlobalCompositeOperation(nsAString& op)
if (thebes_op == gfxContext::OPERATOR_##thebesop) \
op.AssignLiteral(cvsop);
// XXX "darker" isn't really correct
CANVAS_OP_TO_THEBES_OP("clear", CLEAR)
else CANVAS_OP_TO_THEBES_OP("copy", SOURCE)
else CANVAS_OP_TO_THEBES_OP("darker", SATURATE) // XXX
CANVAS_OP_TO_THEBES_OP("copy", SOURCE)
else CANVAS_OP_TO_THEBES_OP("destination-atop", DEST_ATOP)
else CANVAS_OP_TO_THEBES_OP("destination-in", DEST_IN)
else CANVAS_OP_TO_THEBES_OP("destination-out", DEST_OUT)

Просмотреть файл

@ -1486,7 +1486,7 @@ var ctx = canvas.getContext('2d');
ctx.globalCompositeOperation = 'xor';
ctx.globalCompositeOperation = 'clear';
todo(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
}
@ -1619,7 +1619,7 @@ var ctx = canvas.getContext('2d');
ctx.globalCompositeOperation = 'xor';
ctx.globalCompositeOperation = 'over';
todo(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
ok(ctx.globalCompositeOperation == 'xor', "ctx.globalCompositeOperation == 'xor'");
}
@ -13276,10 +13276,10 @@ var ctx = canvas.getContext('2d');
ctx.translate(50, 0);
ctx.rect(0, 0, 20, 20);
ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
todo(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
todo(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
todo(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");
@ -13301,10 +13301,10 @@ var ctx = canvas.getContext('2d');
ctx.rect(50, 0, 20, 20);
ctx.translate(50, 0);
ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
todo(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
todo(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
todo(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");
@ -13328,8 +13328,8 @@ ctx.rect(-70, 0, 20, 20);
ok(ctx.isPointInPath(-40, 10) === false, "ctx.isPointInPath(-40, 10) === false");
ok(ctx.isPointInPath(10, 10) === false, "ctx.isPointInPath(10, 10) === false");
ok(ctx.isPointInPath(49, 10) === false, "ctx.isPointInPath(49, 10) === false");
todo(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
todo(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(51, 10) === true, "ctx.isPointInPath(51, 10) === true");
ok(ctx.isPointInPath(69, 10) === true, "ctx.isPointInPath(69, 10) === true");
ok(ctx.isPointInPath(71, 10) === false, "ctx.isPointInPath(71, 10) === false");

Просмотреть файл

@ -770,7 +770,7 @@ nsMouseWheelTransaction::LimitToOnePageScroll(PRInt32 aScrollLines,
nsSize pageAmount = sf->GetPageScrollAmount();
nscoord pageScroll = aIsHorizontal ? pageAmount.width : pageAmount.height;
if (PR_ABS(aScrollLines) * lineScroll < pageScroll)
if (NS_ABS(aScrollLines) * lineScroll < pageScroll)
return aScrollLines;
nscoord maxLines = (pageScroll / lineScroll);
@ -1272,7 +1272,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (!gPixelScrollDeltaX || !pixelHeight)
break;
if (PR_ABS(gPixelScrollDeltaX) >= pixelHeight) {
if (NS_ABS(gPixelScrollDeltaX) >= pixelHeight) {
PRInt32 numLines = (PRInt32)ceil((float)gPixelScrollDeltaX/(float)pixelHeight);
gPixelScrollDeltaX -= numLines*pixelHeight;
@ -1287,7 +1287,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
if (!gPixelScrollDeltaY || !pixelHeight)
break;
if (PR_ABS(gPixelScrollDeltaY) >= pixelHeight) {
if (NS_ABS(gPixelScrollDeltaY) >= pixelHeight) {
PRInt32 numLines = (PRInt32)ceil((float)gPixelScrollDeltaY/(float)pixelHeight);
gPixelScrollDeltaY -= numLines*pixelHeight;
@ -1990,8 +1990,8 @@ nsEventStateManager::GenerateDragGesture(nsPresContext* aPresContext,
// fire drag gesture if mouse has moved enough
nsIntPoint pt = aEvent->refPoint + aEvent->widget->WidgetToScreenOffset();
if (PR_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX ||
PR_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) {
if (NS_ABS(pt.x - mGestureDownPoint.x) > pixelThresholdX ||
NS_ABS(pt.y - mGestureDownPoint.y) > pixelThresholdY) {
if (mClickHoldContextMenu) {
// stop the click-hold before we fire off the drag gesture, in case
// it takes a long time

Просмотреть файл

@ -2367,12 +2367,6 @@ nsHTMLDocument::ResolveName(const nsAString& aName,
//----------------------------
/* virtual */ nsIContent*
nsHTMLDocument::GetBodyContentExternal()
{
return GetBodyElement();
}
// forms related stuff
NS_IMETHODIMP

Просмотреть файл

@ -174,8 +174,6 @@ public:
mDisableCookieAccess = PR_TRUE;
}
virtual nsIContent* GetBodyContentExternal();
class nsAutoEditingState {
public:
nsAutoEditingState(nsHTMLDocument* aDoc, EditingState aState)

Просмотреть файл

@ -49,8 +49,8 @@ class nsContentList;
class nsWrapperCache;
#define NS_IHTMLDOCUMENT_IID \
{ 0x30001b0c, 0xdb25, 0x4318, \
{ 0x85, 0xb8, 0x48, 0xb4, 0xea, 0x54, 0x8f, 0x23 } }
{ 0x51a360fa, 0xd659, 0x4d85, \
{ 0xa5, 0xc5, 0x4a, 0xbb, 0x0d, 0x97, 0x0f, 0x7a } }
/**
@ -164,12 +164,6 @@ public:
*/
virtual void DisableCookieAccess() = 0;
/**
* Get the first <body> child of the root <html>, but don't do
* anything <frameset>-related (like nsIDOMHTMLDocument::GetBody).
*/
virtual nsIContent* GetBodyContentExternal() = 0;
/**
* Called when this nsIHTMLDocument's editor is destroyed.
*/

Просмотреть файл

@ -254,7 +254,7 @@ VideoData* nsBuiltinDecoderReader::FindStartTime(PRInt64& aOutStartTime)
}
}
PRInt64 startTime = PR_MIN(videoStartTime, audioStartTime);
PRInt64 startTime = NS_MIN(videoStartTime, audioStartTime);
if (startTime != PR_INT64_MAX) {
aOutStartTime = startTime;
}

Просмотреть файл

@ -818,14 +818,14 @@ nsMediaCache::FindReusableBlock(TimeStamp aNow,
{
mReentrantMonitor.AssertCurrentThreadIn();
PRUint32 length = PR_MIN(PRUint32(aMaxSearchBlockIndex), mIndex.Length());
PRUint32 length = NS_MIN(PRUint32(aMaxSearchBlockIndex), mIndex.Length());
if (aForStream && aForStreamBlock > 0 &&
PRUint32(aForStreamBlock) <= aForStream->mBlocks.Length()) {
PRInt32 prevCacheBlock = aForStream->mBlocks[aForStreamBlock - 1];
if (prevCacheBlock >= 0) {
PRUint32 freeBlockScanEnd =
PR_MIN(length, prevCacheBlock + FREE_BLOCK_SCAN_LIMIT);
NS_MIN(length, prevCacheBlock + FREE_BLOCK_SCAN_LIMIT);
for (PRUint32 i = prevCacheBlock; i < freeBlockScanEnd; ++i) {
if (IsBlockFree(i))
return i;
@ -1046,7 +1046,7 @@ nsMediaCache::PredictNextUse(TimeStamp aNow, PRInt32 aBlock)
PRInt64 millisecondsAhead =
bytesAhead*1000/bo->mStream->mPlaybackBytesPerSecond;
prediction = TimeDuration::FromMilliseconds(
PR_MIN(millisecondsAhead, PR_INT32_MAX));
NS_MIN<PRInt64>(millisecondsAhead, PR_INT32_MAX));
break;
}
default:
@ -1074,7 +1074,7 @@ nsMediaCache::PredictNextUseForIncomingData(nsMediaCacheStream* aStream)
return TimeDuration(0);
PRInt64 millisecondsAhead = bytesAhead*1000/aStream->mPlaybackBytesPerSecond;
return TimeDuration::FromMilliseconds(
PR_MIN(millisecondsAhead, PR_INT32_MAX));
NS_MIN<PRInt64>(millisecondsAhead, PR_INT32_MAX));
}
enum StreamAction { NONE, SEEK, RESUME, SUSPEND };
@ -1124,7 +1124,7 @@ nsMediaCache::Update()
continue;
}
TimeDuration predictedUse = PredictNextUse(now, blockIndex);
latestPredictedUseForOverflow = PR_MAX(latestPredictedUseForOverflow, predictedUse);
latestPredictedUseForOverflow = NS_MAX(latestPredictedUseForOverflow, predictedUse);
}
// Now try to move overflowing blocks to the main part of the cache.
@ -1649,7 +1649,7 @@ nsMediaCache::NoteSeek(nsMediaCacheStream* aStream, PRInt64 aOldOffset)
// be converted.
PRInt32 blockIndex = aOldOffset/BLOCK_SIZE;
PRInt32 endIndex =
PR_MIN((aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
NS_MIN<PRInt64>((aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
aStream->mBlocks.Length());
TimeStamp now = TimeStamp::Now();
while (blockIndex < endIndex) {
@ -1669,7 +1669,7 @@ nsMediaCache::NoteSeek(nsMediaCacheStream* aStream, PRInt64 aOldOffset)
PRInt32 blockIndex =
(aStream->mStreamOffset + BLOCK_SIZE - 1)/BLOCK_SIZE;
PRInt32 endIndex =
PR_MIN((aOldOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
NS_MIN<PRInt64>((aOldOffset + BLOCK_SIZE - 1)/BLOCK_SIZE,
aStream->mBlocks.Length());
while (blockIndex < endIndex) {
PRInt32 cacheBlockIndex = aStream->mBlocks[endIndex - 1];
@ -1713,7 +1713,7 @@ nsMediaCacheStream::NotifyDataStarted(PRInt64 aOffset)
if (mStreamLength >= 0) {
// If we started reading at a certain offset, then for sure
// the stream is at least that long.
mStreamLength = PR_MAX(mStreamLength, mChannelOffset);
mStreamLength = NS_MAX(mStreamLength, mChannelOffset);
}
}
@ -1768,7 +1768,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
while (size > 0) {
PRUint32 blockIndex = mChannelOffset/BLOCK_SIZE;
PRInt32 blockOffset = PRInt32(mChannelOffset - blockIndex*BLOCK_SIZE);
PRInt32 chunkSize = PRInt32(PR_MIN(BLOCK_SIZE - blockOffset, size));
PRInt32 chunkSize = NS_MIN<PRInt64>(BLOCK_SIZE - blockOffset, size);
// This gets set to something non-null if we have a whole block
// of data to write to the cache
@ -1809,7 +1809,7 @@ nsMediaCacheStream::NotifyDataReceived(PRInt64 aSize, const char* aData,
while (nsMediaCacheStream* stream = iter.Next()) {
if (stream->mStreamLength >= 0) {
// The stream is at least as long as what we've read
stream->mStreamLength = PR_MAX(stream->mStreamLength, mChannelOffset);
stream->mStreamLength = NS_MAX(stream->mStreamLength, mChannelOffset);
}
stream->UpdatePrincipal(aPrincipal);
stream->mClient->CacheClientNotifyDataReceived();
@ -1975,9 +1975,9 @@ nsMediaCacheStream::GetCachedDataEndInternal(PRInt64 aOffset)
if (mStreamLength >= 0) {
// The last block in the cache may only be partially valid, so limit
// the cached range to the stream length
result = PR_MIN(result, mStreamLength);
result = NS_MIN(result, mStreamLength);
}
return PR_MAX(result, aOffset);
return NS_MAX(result, aOffset);
}
PRInt64
@ -2106,7 +2106,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
PRUint32 streamBlock = PRUint32(mStreamOffset/BLOCK_SIZE);
PRUint32 offsetInStreamBlock =
PRUint32(mStreamOffset - streamBlock*BLOCK_SIZE);
PRInt32 size = PR_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
PRInt32 size = NS_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
if (mStreamLength >= 0) {
// Don't try to read beyond the end of the stream
@ -2115,7 +2115,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
// Get out of here and return NS_OK
break;
}
size = PR_MIN(size, PRInt32(bytesRemaining));
size = NS_MIN(size, PRInt32(bytesRemaining));
}
PRInt32 bytes;
@ -2125,7 +2125,7 @@ nsMediaCacheStream::Read(char* aBuffer, PRUint32 aCount, PRUint32* aBytes)
// We can just use the data in mPartialBlockBuffer. In fact we should
// use it rather than waiting for the block to fill and land in
// the cache.
bytes = PR_MIN(size, mChannelOffset - mStreamOffset);
bytes = NS_MIN<PRInt64>(size, mChannelOffset - mStreamOffset);
memcpy(aBuffer + count,
reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
if (mCurrentMode == MODE_METADATA) {
@ -2192,7 +2192,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
PRUint32 streamBlock = PRUint32(streamOffset/BLOCK_SIZE);
PRUint32 offsetInStreamBlock =
PRUint32(streamOffset - streamBlock*BLOCK_SIZE);
PRInt32 size = PR_MIN(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
PRInt32 size = NS_MIN<PRInt64>(aCount - count, BLOCK_SIZE - offsetInStreamBlock);
if (mStreamLength >= 0) {
// Don't try to read beyond the end of the stream
@ -2200,7 +2200,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
if (bytesRemaining <= 0) {
return NS_ERROR_FAILURE;
}
size = PR_MIN(size, PRInt32(bytesRemaining));
size = NS_MIN(size, PRInt32(bytesRemaining));
}
PRInt32 bytes;
@ -2210,7 +2210,7 @@ nsMediaCacheStream::ReadFromCache(char* aBuffer,
// We can just use the data in mPartialBlockBuffer. In fact we should
// use it rather than waiting for the block to fill and land in
// the cache.
bytes = PR_MIN(size, mChannelOffset - streamOffset);
bytes = NS_MIN<PRInt64>(size, mChannelOffset - streamOffset);
memcpy(aBuffer + count,
reinterpret_cast<char*>(mPartialBlockBuffer) + offsetInStreamBlock, bytes);
} else {

Просмотреть файл

@ -938,7 +938,7 @@ public:
{
return (aOffset < mSize) ? aOffset : -1;
}
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset) { return PR_MAX(aOffset, mSize); }
virtual PRInt64 GetCachedDataEnd(PRInt64 aOffset) { return NS_MAX(aOffset, mSize); }
virtual PRBool IsDataCachedToEndOfStream(PRInt64 aOffset) { return PR_TRUE; }
virtual PRBool IsSuspendedByCache() { return PR_FALSE; }
virtual PRBool IsSuspended() { return PR_FALSE; }

Просмотреть файл

@ -579,7 +579,7 @@ nsSMILAnimationController::DoMilestoneSamples()
// Because we're only performing this clamping at the last moment, the
// animations will still all get sampled in the correct order and
// dependencies will be appropriately resolved.
sampleTime = PR_MAX(nextMilestone.mTime, sampleTime);
sampleTime = NS_MAX(nextMilestone.mTime, sampleTime);
for (PRUint32 i = 0; i < length; ++i) {
nsISMILAnimationElement* elem = params.mElements[i].get();
@ -596,7 +596,7 @@ nsSMILAnimationController::DoMilestoneSamples()
continue;
// Clamp the converted container time to non-negative values.
nsSMILTime containerTime = PR_MAX(0, containerTimeValue.GetMillis());
nsSMILTime containerTime = NS_MAX<nsSMILTime>(0, containerTimeValue.GetMillis());
if (nextMilestone.mIsEnd) {
elem->TimedElement().SampleEndAt(containerTime);

Просмотреть файл

@ -149,7 +149,7 @@ nsSMILTimeContainer::SetCurrentTime(nsSMILTime aSeekTo)
{
// SVG 1.1 doesn't specify what to do for negative times so we adopt SVGT1.2's
// behaviour of clamping negative times to 0.
aSeekTo = PR_MAX(0, aSeekTo);
aSeekTo = NS_MAX<nsSMILTime>(0, aSeekTo);
// The following behaviour is consistent with:
// http://www.w3.org/2003/01/REC-SVG11-20030114-errata

Просмотреть файл

@ -261,7 +261,7 @@ void Double::toString(double aValue, nsAString& aDest)
}
}
// mantissa
int firstlen = PR_MIN(intDigits, endp - buf);
int firstlen = NS_MIN<size_t>(intDigits, endp - buf);
for (i = 0; i < firstlen; i++) {
*dest = buf[i]; ++dest;
}

Просмотреть файл

@ -121,7 +121,7 @@ public:
void write(const PRUnichar* aSource, PRUint32 aSourceLength)
{
PRUint32 len = PR_MIN(PRUint32(mIter.size_forward()), aSourceLength);
PRUint32 len = NS_MIN(PRUint32(mIter.size_forward()), aSourceLength);
PRUnichar* cp = mIter.get();
const PRUnichar* end = aSource + len;
while (aSource != end) {

Просмотреть файл

@ -712,7 +712,7 @@ txXPathNodeUtils::comparePosition(const txXPathNode& aNode,
PRInt32 otherTotal = otherParents.Length() - 1;
NS_ASSERTION(total != otherTotal, "Can't have same number of parents");
PRInt32 lastIndex = PR_MIN(total, otherTotal);
PRInt32 lastIndex = NS_MIN(total, otherTotal);
PRInt32 i;
parent = nsnull;
for (i = 0; i <= lastIndex; ++i) {

Просмотреть файл

@ -552,7 +552,7 @@ PRBool txNodeSet::ensureGrowSize(PRInt32 aSize)
// This isn't 100% safe. But until someone manages to make a 1gig nodeset
// it should be ok.
PRInt32 newLength = PR_MAX(oldLength, kTxNodeSetMinSize);
PRInt32 newLength = NS_MAX(oldLength, kTxNodeSetMinSize);
while (newLength < ensureSize) {
newLength *= kTxNodeSetGrowFactor;

Просмотреть файл

@ -684,7 +684,7 @@ txMozillaXMLOutput::createTxWrapper()
// The new documentElement should go after the document type.
// This is needed for cases when there is no existing
// documentElement in the document.
rootLocation = PR_MAX(rootLocation, j + 1);
rootLocation = NS_MAX(rootLocation, j + 1);
#endif
++j;
}

Просмотреть файл

@ -1039,7 +1039,7 @@ nsXULElement::RemoveChildAt(PRUint32 aIndex, PRBool aNotify)
PRInt32 treeRows;
listBox->GetRowCount(&treeRows);
if (treeRows > 0) {
newCurrentIndex = PR_MIN((treeRows - 1), newCurrentIndex);
newCurrentIndex = NS_MIN((treeRows - 1), newCurrentIndex);
nsCOMPtr<nsIDOMElement> newCurrentItem;
listBox->GetItemAtIndex(newCurrentIndex, getter_AddRefs(newCurrentItem));
nsCOMPtr<nsIDOMXULSelectControlItemElement> xulCurItem = do_QueryInterface(newCurrentItem);

Просмотреть файл

@ -315,7 +315,7 @@ nsMorkReader::ParseMap(const nsCSubstring &aLine, StringMap *aMap)
}
++idx;
}
PRUint32 tokenEnd = PR_MIN(idx, len);
PRUint32 tokenEnd = NS_MIN(idx, len);
++idx;
nsCString value;
@ -463,7 +463,7 @@ nsMorkReader::ParseTable(const nsCSubstring &aLine, const IndexMap &aColumnMap)
++idx;
}
tokenEnd = PR_MIN(idx, len);
tokenEnd = NS_MIN(idx, len);
nsCAutoString column;
const nsCSubstring &colValue =
@ -496,7 +496,7 @@ nsMorkReader::ParseTable(const nsCSubstring &aLine, const IndexMap &aColumnMap)
}
++idx;
}
tokenEnd = PR_MIN(idx, len);
tokenEnd = NS_MIN(idx, len);
++idx;
const nsCSubstring &value =

Просмотреть файл

@ -1003,7 +1003,7 @@ nsSHistory::EvictGlobalContentViewer()
// This SHEntry has a ContentViewer, so check how far away it is from
// the currently used SHEntry within this SHistory object
if (viewer) {
PRInt32 distance = PR_ABS(shist->mIndex - i);
PRInt32 distance = NS_ABS(shist->mIndex - i);
#ifdef DEBUG_PAGE_CACHE
printf("Has a cached content viewer: %s\n", spec.get());
@ -1213,7 +1213,7 @@ PRBool IsSameTree(nsISHEntry* aEntry1, nsISHEntry* aEntry2)
container1->GetChildCount(&count1);
container2->GetChildCount(&count2);
// We allow null entries in the end of the child list.
PRInt32 count = PR_MAX(count1, count2);
PRInt32 count = NS_MAX(count1, count2);
for (PRInt32 i = 0; i < count; ++i) {
nsCOMPtr<nsISHEntry> child1, child2;
container1->GetChildAt(i, getter_AddRefs(child1));

Просмотреть файл

@ -627,7 +627,7 @@ IDBFactory::SetCurrentDatabase(IDBDatabase* aDatabase)
PRUint32
IDBFactory::GetIndexedDBQuota()
{
return PRUint32(PR_MAX(gIndexedDBQuota, 0));
return PRUint32(NS_MAX(gIndexedDBQuota, 0));
}
// static
@ -983,9 +983,9 @@ OpenDatabaseHelper::DoDatabaseWork(mozIStorageConnection* aConnection)
nsAutoPtr<ObjectStoreInfo>& objectStoreInfo = mObjectStores[i];
for (PRUint32 j = 0; j < objectStoreInfo->indexes.Length(); j++) {
IndexInfo& indexInfo = objectStoreInfo->indexes[j];
mLastIndexId = PR_MAX(indexInfo.id, mLastIndexId);
mLastIndexId = NS_MAX(indexInfo.id, mLastIndexId);
}
mLastObjectStoreId = PR_MAX(objectStoreInfo->id, mLastObjectStoreId);
mLastObjectStoreId = NS_MAX(objectStoreInfo->id, mLastObjectStoreId);
}
return NS_OK;

Просмотреть файл

@ -400,7 +400,7 @@ TabParent::HandleQueryContentEvent(nsQueryContentEvent& aEvent)
{
case NS_QUERY_SELECTED_TEXT:
{
aEvent.mReply.mOffset = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
aEvent.mReply.mOffset = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
if (mIMESelectionAnchor == mIMESelectionFocus) {
aEvent.mReply.mString.Truncate(0);
} else {
@ -446,7 +446,7 @@ bool
TabParent::SendCompositionEvent(nsCompositionEvent& event)
{
mIMEComposing = event.message == NS_COMPOSITION_START;
mIMECompositionStart = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
mIMECompositionStart = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
if (mIMECompositionEnding)
return true;
event.seqno = ++mIMESeqno;
@ -471,7 +471,7 @@ TabParent::SendTextEvent(nsTextEvent& event)
// We must be able to simulate the selection because
// we might not receive selection updates in time
if (!mIMEComposing) {
mIMECompositionStart = PR_MIN(mIMESelectionAnchor, mIMESelectionFocus);
mIMECompositionStart = NS_MIN(mIMESelectionAnchor, mIMESelectionFocus);
}
mIMESelectionAnchor = mIMESelectionFocus =
mIMECompositionStart + event.theText.Length();

Просмотреть файл

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.cs" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript"

Просмотреть файл

@ -2023,7 +2023,7 @@ nsHTMLEditRules::WillDeleteSelection(nsISelection *aSelection,
res = nsWSRunObject::PrepareToDeleteRange(mHTMLEditor, address_of(visNode), &so, address_of(visNode), &eo);
NS_ENSURE_SUCCESS(res, res);
nsCOMPtr<nsIDOMCharacterData> nodeAsText(do_QueryInterface(visNode));
res = mHTMLEditor->DeleteText(nodeAsText, NS_MIN(so, eo), PR_ABS(eo - so));
res = mHTMLEditor->DeleteText(nodeAsText, NS_MIN(so, eo), NS_ABS(eo - so));
*aHandled = PR_TRUE;
NS_ENSURE_SUCCESS(res, res);
res = InsertBRIfNeeded(aSelection);

Просмотреть файл

@ -927,8 +927,8 @@ nsHTMLEditor::MouseMove(nsIDOMEvent* aMouseEvent)
look->GetMetric(nsILookAndFeel::eMetric_DragThresholdX, xThreshold);
look->GetMetric(nsILookAndFeel::eMetric_DragThresholdY, yThreshold);
if (PR_ABS(clientX - mOriginalX ) * 2 >= xThreshold ||
PR_ABS(clientY - mOriginalY ) * 2 >= yThreshold) {
if (NS_ABS(clientX - mOriginalX ) * 2 >= xThreshold ||
NS_ABS(clientY - mOriginalY ) * 2 >= yThreshold) {
mGrabberClicked = PR_FALSE;
StartMoving(nsnull);
}

Просмотреть файл

@ -523,7 +523,7 @@ nsGnomeVFSInputStream::DoRead(char *aBuf, PRUint32 aCount, PRUint32 *aCountRead)
PRUint32 bufLen = mDirBuf.Length() - mDirBufCursor;
if (bufLen)
{
PRUint32 n = PR_MIN(bufLen, aCount);
PRUint32 n = NS_MIN(bufLen, aCount);
memcpy(aBuf, mDirBuf.get() + mDirBufCursor, n);
*aCountRead += n;
aBuf += n;

Просмотреть файл

@ -137,7 +137,7 @@ nsAutoConfig::OnDataAvailable(nsIRequest *request,
char buf[1024];
while (aLength) {
size = PR_MIN(aLength, sizeof(buf));
size = NS_MIN<size_t>(aLength, sizeof(buf));
rv = aIStream->Read(buf, size, &amt);
if (NS_FAILED(rv))
return rv;

Просмотреть файл

@ -78,7 +78,7 @@ typedef struct _cairo_d2d_device cairo_d2d_device_t;
struct _cairo_d2d_surface {
_cairo_d2d_surface() : d2d_clip(NULL), clipping(false), isDrawing(false),
textRenderingInit(false)
textRenderingState(TEXT_RENDERING_UNINITIALIZED)
{
_cairo_clip_init (&this->clip);
}
@ -128,7 +128,12 @@ struct _cairo_d2d_surface {
/** Indicates if our render target is currently in drawing mode */
bool isDrawing;
/** Indicates if text rendering is initialized */
bool textRenderingInit;
enum TextRenderingState {
TEXT_RENDERING_UNINITIALIZED,
TEXT_RENDERING_NORMAL,
TEXT_RENDERING_GDI_CLASSIC
};
TextRenderingState textRenderingState;
RefPtr<ID3D10RenderTargetView> buffer_rt_view;
RefPtr<ID3D10ShaderResourceView> buffer_sr_view;

Просмотреть файл

@ -4109,10 +4109,16 @@ _cairo_d2d_show_glyphs (void *surface,
return CAIRO_INT_STATUS_UNSUPPORTED;
}
cairo_d2d_surface_t *d2dsurf = static_cast<cairo_d2d_surface_t*>(surface);
if (!d2dsurf->textRenderingInit) {
RefPtr<IDWriteRenderingParams> params = DWriteFactory::RenderingParams();
cairo_bool_t forceGDIClassic =
scaled_font->backend->type == CAIRO_FONT_TYPE_DWRITE &&
reinterpret_cast<cairo_dwrite_scaled_font_t*>(scaled_font)->force_GDI_classic;
cairo_d2d_surface_t::TextRenderingState textRenderingState =
(forceGDIClassic ? cairo_d2d_surface_t::TEXT_RENDERING_GDI_CLASSIC : cairo_d2d_surface_t::TEXT_RENDERING_NORMAL);
if (d2dsurf->textRenderingState != textRenderingState) {
RefPtr<IDWriteRenderingParams> params =
DWriteFactory::RenderingParams(forceGDIClassic);
d2dsurf->rt->SetTextRenderingParams(params);
d2dsurf->textRenderingInit = true;
d2dsurf->textRenderingState = textRenderingState;
}
cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED;
if (scaled_font->backend->type == CAIRO_FONT_TYPE_DWRITE) {

Просмотреть файл

@ -66,6 +66,7 @@ _dwrite_draw_glyphs_to_gdi_surface_gdi(cairo_win32_surface_t *surface,
DWRITE_MATRIX *transform,
DWRITE_GLYPH_RUN *run,
COLORREF color,
cairo_dwrite_scaled_font_t *scaled_font,
const RECT &area);
class D2DFactory
@ -119,6 +120,7 @@ private:
IDWriteFactory *DWriteFactory::mFactoryInstance = NULL;
IDWriteFontCollection *DWriteFactory::mSystemCollection = NULL;
IDWriteRenderingParams *DWriteFactory::mRenderingParams = NULL;
IDWriteRenderingParams *DWriteFactory::mForceGDIClassicRenderingParams = NULL;
FLOAT DWriteFactory::mGamma = -1.0;
FLOAT DWriteFactory::mEnhancedContrast = -1.0;
FLOAT DWriteFactory::mClearTypeLevel = -1.0;
@ -494,6 +496,7 @@ _cairo_dwrite_font_face_scaled_font_create (void *abstract_face,
}
dwriteFont->manual_show_glyphs_allowed = TRUE;
dwriteFont->force_GDI_classic = FALSE;
return _cairo_scaled_font_set_metrics (*font, &extents);
}
@ -991,7 +994,8 @@ _cairo_dwrite_scaled_font_init_glyph_surface(cairo_dwrite_scaled_font_t *scaled_
DWRITE_MATRIX matrix = _cairo_dwrite_matrix_from_matrix(&scaled_font->mat);
status = _dwrite_draw_glyphs_to_gdi_surface_gdi (surface, &matrix, &run, RGB(0,0,0), area);
status = _dwrite_draw_glyphs_to_gdi_surface_gdi (surface, &matrix, &run,
RGB(0,0,0), scaled_font, area);
if (status)
goto FAIL;
@ -1069,12 +1073,26 @@ cairo_dwrite_font_face_create_for_dwrite_fontface(void* dwrite_font, void* dwrit
}
void
cairo_dwrite_scaled_font_allow_manual_show_glyphs(void* dwrite_scaled_font, cairo_bool_t allowed)
cairo_dwrite_scaled_font_allow_manual_show_glyphs(cairo_scaled_font_t *dwrite_scaled_font, cairo_bool_t allowed)
{
cairo_dwrite_scaled_font_t *font = static_cast<cairo_dwrite_scaled_font_t*>(dwrite_scaled_font);
cairo_dwrite_scaled_font_t *font = reinterpret_cast<cairo_dwrite_scaled_font_t*>(dwrite_scaled_font);
font->manual_show_glyphs_allowed = allowed;
}
void
cairo_dwrite_scaled_font_set_force_GDI_classic(cairo_scaled_font_t *dwrite_scaled_font, cairo_bool_t force)
{
cairo_dwrite_scaled_font_t *font = reinterpret_cast<cairo_dwrite_scaled_font_t*>(dwrite_scaled_font);
font->force_GDI_classic = force;
}
cairo_bool_t
cairo_dwrite_scaled_font_get_force_GDI_classic(cairo_scaled_font_t *dwrite_scaled_font)
{
cairo_dwrite_scaled_font_t *font = reinterpret_cast<cairo_dwrite_scaled_font_t*>(dwrite_scaled_font);
return font->force_GDI_classic;
}
void
cairo_dwrite_set_cleartype_params(FLOAT gamma, FLOAT contrast, FLOAT level,
int geometry, int mode)
@ -1087,13 +1105,15 @@ _dwrite_draw_glyphs_to_gdi_surface_gdi(cairo_win32_surface_t *surface,
DWRITE_MATRIX *transform,
DWRITE_GLYPH_RUN *run,
COLORREF color,
cairo_dwrite_scaled_font_t *scaled_font,
const RECT &area)
{
IDWriteGdiInterop *gdiInterop;
DWriteFactory::Instance()->GetGdiInterop(&gdiInterop);
IDWriteBitmapRenderTarget *rt;
IDWriteRenderingParams *params = DWriteFactory::RenderingParams();
IDWriteRenderingParams *params =
DWriteFactory::RenderingParams(scaled_font->force_GDI_classic);
gdiInterop->CreateBitmapRenderTarget(surface->dc,
area.right - area.left,
@ -1141,6 +1161,8 @@ _dwrite_draw_glyphs_to_gdi_surface_d2d(cairo_win32_surface_t *surface,
ID2D1DCRenderTarget *rt = D2DFactory::RenderTarget();
// XXX don't we need to set RenderingParams on this RenderTarget?
rv = rt->BindDC(surface->dc, &area);
printf("Rendering to surface: %p\n", surface->dc);
@ -1369,6 +1391,7 @@ _cairo_dwrite_show_glyphs_on_surface(void *surface,
mat,
&run,
color,
dwritesf,
fontArea);
#ifdef CAIRO_TRY_D2D_TO_GDI
}
@ -1413,15 +1436,22 @@ DWriteFactory::CreateRenderingParams()
// For parameters that have not been explicitly set via the SetRenderingParams API,
// we copy values from default params (or our overridden value for contrast)
Instance()->CreateCustomRenderingParams(
mGamma >= 1.0 && mGamma <= 2.2 ? mGamma : defaultParams->GetGamma(),
contrast,
mClearTypeLevel >= 0.0 && mClearTypeLevel <= 1.0 ? mClearTypeLevel : defaultParams->GetClearTypeLevel(),
mPixelGeometry >= DWRITE_PIXEL_GEOMETRY_FLAT && mPixelGeometry <= DWRITE_PIXEL_GEOMETRY_BGR ?
(DWRITE_PIXEL_GEOMETRY)mPixelGeometry : defaultParams->GetPixelGeometry(),
mRenderingMode >= DWRITE_RENDERING_MODE_DEFAULT && mRenderingMode <= DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC ?
(DWRITE_RENDERING_MODE)mRenderingMode : defaultParams->GetRenderingMode(),
FLOAT gamma =
mGamma >= 1.0 && mGamma <= 2.2 ? mGamma : defaultParams->GetGamma();
FLOAT clearTypeLevel =
mClearTypeLevel >= 0.0 && mClearTypeLevel <= 1.0 ? mClearTypeLevel : defaultParams->GetClearTypeLevel();
DWRITE_PIXEL_GEOMETRY pixelGeometry =
mPixelGeometry >= DWRITE_PIXEL_GEOMETRY_FLAT && mPixelGeometry <= DWRITE_PIXEL_GEOMETRY_BGR ?
(DWRITE_PIXEL_GEOMETRY)mPixelGeometry : defaultParams->GetPixelGeometry();
DWRITE_RENDERING_MODE renderingMode =
mRenderingMode >= DWRITE_RENDERING_MODE_DEFAULT && mRenderingMode <= DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC ?
(DWRITE_RENDERING_MODE)mRenderingMode : defaultParams->GetRenderingMode();
Instance()->CreateCustomRenderingParams(gamma, contrast, clearTypeLevel,
pixelGeometry, renderingMode,
&mRenderingParams);
Instance()->CreateCustomRenderingParams(gamma, contrast, clearTypeLevel,
pixelGeometry, DWRITE_RENDERING_MODE_CLEARTYPE_GDI_CLASSIC,
&mForceGDIClassicRenderingParams);
}
// Helper for _cairo_win32_printing_surface_show_glyphs to create a win32 equivalent

Просмотреть файл

@ -44,6 +44,17 @@ typedef HRESULT (WINAPI*DWriteCreateFactoryFunc)(
__out IUnknown **factory
);
/* cairo_scaled_font_t implementation */
struct _cairo_dwrite_scaled_font {
cairo_scaled_font_t base;
cairo_matrix_t mat;
cairo_matrix_t mat_inverse;
cairo_antialias_t antialias_mode;
DWRITE_MEASURING_MODE measuring_mode;
cairo_bool_t manual_show_glyphs_allowed;
cairo_bool_t force_GDI_classic;
};
typedef struct _cairo_dwrite_scaled_font cairo_dwrite_scaled_font_t;
class DWriteFactory
{
@ -92,15 +103,17 @@ public:
return family;
}
static IDWriteRenderingParams *RenderingParams()
static IDWriteRenderingParams *RenderingParams(cairo_bool_t forceGDIClassic)
{
if (!mRenderingParams) {
if (!mRenderingParams || !mForceGDIClassicRenderingParams) {
CreateRenderingParams();
}
if (mRenderingParams) {
mRenderingParams->AddRef();
IDWriteRenderingParams *params =
forceGDIClassic ? mForceGDIClassicRenderingParams : mRenderingParams;
if (params) {
params->AddRef();
}
return mRenderingParams;
return params;
}
static void SetRenderingParams(FLOAT aGamma,
@ -119,6 +132,10 @@ public:
mRenderingParams->Release();
mRenderingParams = NULL;
}
if (mForceGDIClassicRenderingParams) {
mForceGDIClassicRenderingParams->Release();
mForceGDIClassicRenderingParams = NULL;
}
}
private:
@ -127,6 +144,7 @@ private:
static IDWriteFactory *mFactoryInstance;
static IDWriteFontCollection *mSystemCollection;
static IDWriteRenderingParams *mRenderingParams;
static IDWriteRenderingParams *mForceGDIClassicRenderingParams;
static FLOAT mGamma;
static FLOAT mEnhancedContrast;
static FLOAT mClearTypeLevel;
@ -142,17 +160,6 @@ struct _cairo_dwrite_font_face {
};
typedef struct _cairo_dwrite_font_face cairo_dwrite_font_face_t;
/* cairo_scaled_font_t implementation */
struct _cairo_dwrite_scaled_font {
cairo_scaled_font_t base;
cairo_matrix_t mat;
cairo_matrix_t mat_inverse;
cairo_antialias_t antialias_mode;
DWRITE_MEASURING_MODE measuring_mode;
cairo_bool_t manual_show_glyphs_allowed;
};
typedef struct _cairo_dwrite_scaled_font cairo_dwrite_scaled_font_t;
DWRITE_MATRIX _cairo_dwrite_matrix_from_matrix(const cairo_matrix_t *matrix);
// This will create a DWrite glyph run from cairo glyphs and a scaled_font.

Просмотреть файл

@ -124,7 +124,13 @@ cairo_public cairo_font_face_t *
cairo_dwrite_font_face_create_for_dwrite_fontface(void *dwrite_font, void *dwrite_font_face);
void
cairo_dwrite_scaled_font_allow_manual_show_glyphs(void *dwrite_scaled_font, cairo_bool_t allowed);
cairo_dwrite_scaled_font_allow_manual_show_glyphs(cairo_scaled_font_t *dwrite_scaled_font, cairo_bool_t allowed);
void
cairo_dwrite_scaled_font_set_force_GDI_classic(cairo_scaled_font_t *dwrite_scaled_font, cairo_bool_t force);
cairo_bool_t
cairo_dwrite_scaled_font_get_force_GDI_classic(cairo_scaled_font_t *dwrite_scaled_font);
void
cairo_dwrite_set_cleartype_params(FLOAT gamma, FLOAT contrast, FLOAT level, int geometry, int mode);

Просмотреть файл

@ -348,11 +348,11 @@ SpreadHorizontal(unsigned char* aInput,
break;
}
PRInt32 sMin = PR_MAX(x - aRadius, 0);
PRInt32 sMax = PR_MIN(x + aRadius, aWidth - 1);
PRInt32 sMin = NS_MAX(x - aRadius, 0);
PRInt32 sMax = NS_MIN(x + aRadius, aWidth - 1);
PRInt32 v = 0;
for (PRInt32 s = sMin; s <= sMax; ++s) {
v = PR_MAX(v, aInput[aStride * y + s]);
v = NS_MAX<PRInt32>(v, aInput[aStride * y + s]);
}
aOutput[aStride * y + x] = v;
}
@ -393,11 +393,11 @@ SpreadVertical(unsigned char* aInput,
break;
}
PRInt32 sMin = PR_MAX(y - aRadius, 0);
PRInt32 sMax = PR_MIN(y + aRadius, aRows - 1);
PRInt32 sMin = NS_MAX(y - aRadius, 0);
PRInt32 sMax = NS_MIN(y + aRadius, aRows - 1);
PRInt32 v = 0;
for (PRInt32 s = sMin; s <= sMax; ++s) {
v = PR_MAX(v, aInput[aStride * s + x]);
v = NS_MAX<PRInt32>(v, aInput[aStride * s + x]);
}
aOutput[aStride * y + x] = v;
}

Просмотреть файл

@ -398,10 +398,10 @@ gfxContext::UserToDevice(const gfxRect& rect) const
ymax = ymin;
for (int i = 0; i < 3; i++) {
cairo_user_to_device(mCairo, &x[i], &y[i]);
xmin = PR_MIN(xmin, x[i]);
xmax = PR_MAX(xmax, x[i]);
ymin = PR_MIN(ymin, y[i]);
ymax = PR_MAX(ymax, y[i]);
xmin = NS_MIN(xmin, x[i]);
xmax = NS_MAX(xmax, x[i]);
ymin = NS_MIN(ymin, y[i]);
ymax = NS_MAX(ymax, y[i]);
}
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);

Просмотреть файл

@ -39,6 +39,7 @@
* ***** END LICENSE BLOCK ***** */
#include "prtypes.h"
#include "nsAlgorithm.h"
#include "prmem.h"
#include "nsString.h"
#include "nsBidiUtils.h"
@ -378,7 +379,7 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxTextRun *aTextRun,
// find the maximum glyph index covered by the clump so far
for (PRInt32 i = charStart; i != charEnd; i += direction) {
if (charToGlyph[i] != NO_GLYPH) {
glyphEnd = PR_MAX(glyphEnd, charToGlyph[i] + 1); // update extent of glyph range
glyphEnd = NS_MAX(glyphEnd, charToGlyph[i] + 1); // update extent of glyph range
}
}
@ -453,8 +454,8 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxTextRun *aTextRun,
continue;
}
// Ensure we won't try to go beyond the valid length of the textRun's text
baseCharIndex = PR_MAX(baseCharIndex, aRunStart);
endCharIndex = PR_MIN(endCharIndex, aRunStart + aRunLength);
baseCharIndex = NS_MAX(baseCharIndex, aRunStart);
endCharIndex = NS_MIN(endCharIndex, aRunStart + aRunLength);
// Now we're ready to set the glyph info in the textRun; measure the glyph width
// of the first (perhaps only) glyph, to see if it is "Simple"

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsIPrefService.h"
#include "nsIPrefBranch2.h"
#include "nsServiceManagerUtils.h"
#include "nsCharSeparatedTokenizer.h"
#include "gfxGDIFontList.h"
@ -156,6 +157,7 @@ gfxDWriteFontFamily::FindStyleVariations()
*/
gfxDWriteFontEntry *fe =
new gfxDWriteFontEntry(fullID, font);
fe->SetForceGDIClassic(mForceGDIClassic);
AddFontEntry(fe);
#ifdef PR_LOGGING
@ -497,7 +499,7 @@ gfxDWriteFontEntry::IsCJKFont()
// gfxDWriteFontList
gfxDWriteFontList::gfxDWriteFontList()
: mInitialized(PR_FALSE)
: mInitialized(PR_FALSE), mForceGDIClassicMaxFontSize(0.0)
{
mFontSubstitutes.Init();
}
@ -550,13 +552,14 @@ gfxDWriteFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
{
return nsnull;
}
gfxFontEntry *fe =
gfxDWriteFontEntry* dwriteLookup = static_cast<gfxDWriteFontEntry*>(lookup);
gfxDWriteFontEntry *fe =
new gfxDWriteFontEntry(lookup->Name(),
static_cast<gfxDWriteFontEntry*>(lookup)->mFont,
dwriteLookup->mFont,
aProxyEntry->Weight(),
aProxyEntry->Stretch(),
aProxyEntry->IsItalic());
fe->SetForceGDIClassic(dwriteLookup->GetForceGDIClassic());
return fe;
}
@ -950,6 +953,29 @@ gfxDWriteFontList::DelayedInitFontList()
}
}
nsCOMPtr<nsIPrefBranch2> pref = do_GetService(NS_PREFSERVICE_CONTRACTID);
nsXPIDLCString classicFamilies;
nsresult rv = pref->GetCharPref(
"gfx.font_rendering.cleartype_params.force_gdi_classic_for_families",
getter_Copies(classicFamilies));
if (NS_SUCCEEDED(rv)) {
nsCCharSeparatedTokenizer tokenizer(classicFamilies, ',');
while (tokenizer.hasMoreTokens()) {
NS_ConvertUTF8toUTF16 name(tokenizer.nextToken());
BuildKeyNameFromFontName(name);
gfxFontFamily *family = mFontFamilies.GetWeak(name);
if (family) {
static_cast<gfxDWriteFontFamily*>(family)->SetForceGDIClassic(true);
}
}
}
PRInt32 forceGDIClassicMaxFontSize = 0;
rv = pref->GetIntPref("gfx.font_rendering.cleartype_params.force_gdi_classic_max_size",
&forceGDIClassicMaxFontSize);
if (NS_SUCCEEDED(rv)) {
mForceGDIClassicMaxFontSize = forceGDIClassicMaxFontSize;
}
StartLoader(kDelayBeforeLoadingFonts, kIntervalBetweenLoadingFonts);
LOGREGISTRY(L"DelayedInitFontList end");

Просмотреть файл

@ -45,6 +45,7 @@
#include "cairo-win32.h"
#include "gfxPlatformFontList.h"
#include "gfxPlatform.h"
/**
@ -68,16 +69,20 @@ public:
* family object.
*/
gfxDWriteFontFamily(const nsAString& aName,
IDWriteFontFamily *aFamily)
: gfxFontFamily(aName), mDWFamily(aFamily) {}
IDWriteFontFamily *aFamily)
: gfxFontFamily(aName), mDWFamily(aFamily), mForceGDIClassic(false) {}
virtual ~gfxDWriteFontFamily();
virtual void FindStyleVariations();
virtual void LocalizedName(nsAString& aLocalizedName);
virtual void LocalizedName(nsAString& aLocalizedName);
void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; }
protected:
/** This font family's directwrite fontfamily object */
nsRefPtr<IDWriteFontFamily> mDWFamily;
bool mForceGDIClassic;
};
/**
@ -94,12 +99,13 @@ public:
*/
gfxDWriteFontEntry(const nsAString& aFaceName,
IDWriteFont *aFont)
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nsnull)
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nsnull),
mForceGDIClassic(false)
{
mItalic = (aFont->GetStyle() == DWRITE_FONT_STYLE_ITALIC ||
aFont->GetStyle() == DWRITE_FONT_STYLE_OBLIQUE);
mStretch = FontStretchFromDWriteStretch(aFont->GetStretch());
PRUint16 weight = PR_ROUNDUP(aFont->GetWeight() - 50, 100);
PRUint16 weight = NS_ROUNDUP(aFont->GetWeight() - 50, 100);
weight = NS_MAX<PRUint16>(100, weight);
weight = NS_MIN<PRUint16>(900, weight);
@ -124,7 +130,8 @@ public:
PRUint16 aWeight,
PRInt16 aStretch,
PRBool aItalic)
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nsnull)
: gfxFontEntry(aFaceName), mFont(aFont), mFontFile(nsnull),
mForceGDIClassic(false)
{
mWeight = aWeight;
mStretch = aStretch;
@ -148,7 +155,8 @@ public:
PRUint16 aWeight,
PRInt16 aStretch,
PRBool aItalic)
: gfxFontEntry(aFaceName), mFont(nsnull), mFontFile(aFontFile)
: gfxFontEntry(aFaceName), mFont(nsnull), mFontFile(aFontFile),
mForceGDIClassic(false)
{
mWeight = aWeight;
mStretch = aStretch;
@ -168,6 +176,9 @@ public:
PRBool IsCJKFont();
void SetForceGDIClassic(bool aForce) { mForceGDIClassic = aForce; }
bool GetForceGDIClassic() { return mForceGDIClassic; }
protected:
friend class gfxDWriteFont;
friend class gfxDWriteFontList;
@ -189,7 +200,8 @@ protected:
nsRefPtr<IDWriteFontFile> mFontFile;
DWRITE_FONT_FACE_TYPE mFaceType;
PRBool mIsCJK;
PRInt8 mIsCJK;
bool mForceGDIClassic;
};
@ -227,6 +239,8 @@ public:
virtual void GetFontFamilyList(nsTArray<nsRefPtr<gfxFontFamily> >& aFamilyArray);
gfxFloat GetForceGDIClassicMaxFontSize() { return mForceGDIClassicMaxFontSize; }
private:
friend class gfxDWriteFontFamily;
@ -251,6 +265,8 @@ private:
PRBool mInitialized;
virtual nsresult DelayedInitFontList();
gfxFloat mForceGDIClassicMaxFontSize;
// whether to use GDI font table access routines
PRBool mGDIFontTableAccess;
nsRefPtr<IDWriteGdiInterop> mGDIInterop;

Просмотреть файл

@ -149,18 +149,7 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntry *aFontEntry,
return;
}
if ((anAAOption == gfxFont::kAntialiasDefault &&
UsingClearType() &&
(gfxWindowsPlatform::GetPlatform()->DWriteMeasuringMode() ==
DWRITE_MEASURING_MODE_NATURAL)) ||
anAAOption == gfxFont::kAntialiasSubpixel)
{
mUseSubpixelPositions = PR_TRUE;
// note that this may be reset to FALSE if we determine that a bitmap
// strike is going to be used
}
ComputeMetrics();
ComputeMetrics(anAAOption);
if (FontCanSupportHarfBuzz()) {
mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
@ -216,7 +205,7 @@ gfxDWriteFont::GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics)
}
void
gfxDWriteFont::ComputeMetrics()
gfxDWriteFont::ComputeMetrics(AntialiasOption anAAOption)
{
DWRITE_FONT_METRICS fontMetrics;
if (!(mFontEntry->Weight() == 900 &&
@ -235,6 +224,17 @@ gfxDWriteFont::ComputeMetrics()
mAdjustedSize = mStyle.size;
}
// Note that GetMeasuringMode depends on mAdjustedSize
if ((anAAOption == gfxFont::kAntialiasDefault &&
UsingClearType() &&
GetMeasuringMode() == DWRITE_MEASURING_MODE_NATURAL) ||
anAAOption == gfxFont::kAntialiasSubpixel)
{
mUseSubpixelPositions = PR_TRUE;
// note that this may be reset to FALSE if we determine that a bitmap
// strike is going to be used
}
gfxDWriteFontEntry *fe =
static_cast<gfxDWriteFontEntry*>(mFontEntry.get());
if (fe->IsCJKFont() && HasBitmapStrikeForSize(NS_lround(mAdjustedSize))) {
@ -597,6 +597,11 @@ gfxDWriteFont::CairoScaledFont()
cairo_dwrite_scaled_font_allow_manual_show_glyphs(mCairoScaledFont,
mAllowManualShowGlyphs);
gfxDWriteFontEntry *fe =
static_cast<gfxDWriteFontEntry*>(mFontEntry.get());
cairo_dwrite_scaled_font_set_force_GDI_classic(mCairoScaledFont,
GetForceGDIClassic());
}
NS_ASSERTION(mAdjustedSize == 0.0 ||
@ -685,6 +690,22 @@ gfxDWriteFont::GetGlyphWidth(gfxContext *aCtx, PRUint16 aGID)
return width;
}
bool
gfxDWriteFont::GetForceGDIClassic()
{
return static_cast<gfxDWriteFontEntry*>(mFontEntry.get())->GetForceGDIClassic() &&
GetAdjustedSize() <=
gfxDWriteFontList::PlatformFontList()->GetForceGDIClassicMaxFontSize();
}
DWRITE_MEASURING_MODE
gfxDWriteFont::GetMeasuringMode()
{
return GetForceGDIClassic()
? DWRITE_MEASURING_MODE_GDI_CLASSIC
: gfxWindowsPlatform::GetPlatform()->DWriteMeasuringMode();
}
gfxFloat
gfxDWriteFont::MeasureGlyphWidth(PRUint16 aGlyph)
{
@ -698,8 +719,7 @@ gfxDWriteFont::MeasureGlyphWidth(PRUint16 aGlyph)
} else {
hr = mFontFace->GetGdiCompatibleGlyphMetrics(
FLOAT(mAdjustedSize), 1.0f, nsnull,
gfxWindowsPlatform::GetPlatform()->DWriteMeasuringMode() ==
DWRITE_MEASURING_MODE_GDI_NATURAL,
GetMeasuringMode() == DWRITE_MEASURING_MODE_GDI_NATURAL,
&aGlyph, 1, &metrics, FALSE);
if (SUCCEEDED(hr)) {
return NS_lround(metrics.advanceWidth * mFUnitsConvFactor);

Просмотреть файл

@ -90,7 +90,7 @@ protected:
PRBool GetFakeMetricsForArialBlack(DWRITE_FONT_METRICS *aFontMetrics);
void ComputeMetrics();
void ComputeMetrics(AntialiasOption anAAOption);
PRBool HasBitmapStrikeForSize(PRUint32 aSize);
@ -102,6 +102,9 @@ protected:
static void DestroyBlobFunc(void* userArg);
DWRITE_MEASURING_MODE GetMeasuringMode();
bool GetForceGDIClassic();
nsRefPtr<IDWriteFontFace> mFontFace;
cairo_font_face_t *mCairoFontFace;
cairo_scaled_font_t *mCairoScaledFont;

Просмотреть файл

@ -70,7 +70,7 @@ ScaleRoundDesignUnits(FT_Short aDesignMetric, FT_Fixed aScale)
static void
SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
{
gfxFloat snappedSize = PR_MAX(NS_floor(aSize + 0.5), 1.0);
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
// Correct offset for change in size
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
// Snap offset
@ -201,10 +201,10 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
gfxFloat avgCharWidth =
ScaleRoundDesignUnits(os2->xAvgCharWidth, ftMetrics.x_scale);
aMetrics->aveCharWidth =
PR_MAX(aMetrics->aveCharWidth, avgCharWidth);
NS_MAX(aMetrics->aveCharWidth, avgCharWidth);
}
aMetrics->aveCharWidth =
PR_MAX(aMetrics->aveCharWidth, aMetrics->zeroOrAveCharWidth);
NS_MAX(aMetrics->aveCharWidth, aMetrics->zeroOrAveCharWidth);
if (aMetrics->aveCharWidth == 0.0) {
aMetrics->aveCharWidth = aMetrics->spaceWidth;
}
@ -213,7 +213,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
}
// Apparently hinting can mean that max_advance is not always accurate.
aMetrics->maxAdvance =
PR_MAX(aMetrics->maxAdvance, aMetrics->aveCharWidth);
NS_MAX(aMetrics->maxAdvance, aMetrics->aveCharWidth);
// gfxFont::Metrics::underlineOffset is the position of the top of the
// underline.
@ -258,7 +258,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
if (os2 && os2->ySuperscriptYOffset) {
gfxFloat val = ScaleRoundDesignUnits(os2->ySuperscriptYOffset,
ftMetrics.y_scale);
aMetrics->superscriptOffset = PR_MAX(1.0, val);
aMetrics->superscriptOffset = NS_MAX(1.0, val);
} else {
aMetrics->superscriptOffset = aMetrics->xHeight;
}
@ -268,7 +268,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
ftMetrics.y_scale);
// some fonts have the incorrect sign.
val = fabs(val);
aMetrics->subscriptOffset = PR_MAX(1.0, val);
aMetrics->subscriptOffset = NS_MAX(1.0, val);
} else {
aMetrics->subscriptOffset = aMetrics->xHeight;
}
@ -290,7 +290,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
// Text input boxes currently don't work well with lineHeight
// significantly less than maxHeight (with Verdana, for example).
lineHeight = NS_floor(PR_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
lineHeight = NS_floor(NS_MAX(lineHeight, aMetrics->maxHeight) + 0.5);
aMetrics->externalLeading =
lineHeight - aMetrics->internalLeading - aMetrics->emHeight;

Просмотреть файл

@ -43,6 +43,7 @@
#include "gfxTypes.h"
#include "prtypes.h"
#include "nsAlgorithm.h"
#include "prcpucfg.h"
#include "nsDataHashtable.h"
@ -122,7 +123,7 @@ public:
// first block, check bits
if ((block = mBlocks[startBlock])) {
start = aStart;
end = PR_MIN(aEnd, ((startBlock+1) << BLOCK_INDEX_SHIFT) - 1);
end = NS_MIN(aEnd, ((startBlock+1) << BLOCK_INDEX_SHIFT) - 1);
for (i = start; i <= end; i++) {
if ((block->mBits[(i>>3) & (BLOCK_SIZE - 1)]) & (1 << (i & 0x7)))
return PR_TRUE;
@ -210,7 +211,7 @@ public:
}
const PRUint32 start = aStart > blockFirstBit ? aStart - blockFirstBit : 0;
const PRUint32 end = PR_MIN(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
const PRUint32 end = NS_MIN<PRUint32>(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
for (PRUint32 bit = start; bit <= end; ++bit) {
block->mBits[bit>>3] |= 1 << (bit & 0x7);
@ -254,7 +255,7 @@ public:
}
const PRUint32 start = aStart > blockFirstBit ? aStart - blockFirstBit : 0;
const PRUint32 end = PR_MIN(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
const PRUint32 end = NS_MIN<PRUint32>(aEnd - blockFirstBit, BLOCK_SIZE_BITS - 1);
for (PRUint32 bit = start; bit <= end; ++bit) {
block->mBits[bit>>3] &= ~(1 << (bit & 0x7));

Просмотреть файл

@ -374,7 +374,7 @@ gfxGDIFont::Initialize()
mMetrics->maxAscent = metrics.tmAscent;
mMetrics->maxDescent = metrics.tmDescent;
mMetrics->maxAdvance = metrics.tmMaxCharWidth;
mMetrics->aveCharWidth = PR_MAX(1, metrics.tmAveCharWidth);
mMetrics->aveCharWidth = NS_MAX<gfxFloat>(1, metrics.tmAveCharWidth);
// The font is monospace when TMPF_FIXED_PITCH is *not* set!
// See http://msdn2.microsoft.com/en-us/library/ms534202(VS.85).aspx
if (!(metrics.tmPitchAndFamily & TMPF_FIXED_PITCH)) {

Просмотреть файл

@ -434,7 +434,7 @@ GDIFontEntry::InitLogFont(const nsAString& aName,
mLogFont.lfItalic = mItalic;
mLogFont.lfWeight = mWeight;
int len = PR_MIN(aName.Length(), LF_FACESIZE - 1);
int len = NS_MIN<int>(aName.Length(), LF_FACESIZE - 1);
memcpy(&mLogFont.lfFaceName, nsPromiseFlatString(aName).get(), len * 2);
mLogFont.lfFaceName[len] = '\0';
}
@ -468,7 +468,7 @@ GDIFontFamily::FamilyAddStylesProc(const ENUMLOGFONTEXW *lpelfe,
GDIFontFamily *ff = reinterpret_cast<GDIFontFamily*>(data);
// Some fonts claim to support things > 900, but we don't so clamp the sizes
logFont.lfWeight = PR_MAX(PR_MIN(logFont.lfWeight, 900), 100);
logFont.lfWeight = NS_MAX<LONG>(NS_MIN<LONG>(logFont.lfWeight, 900), 100);
gfxWindowsFontType feType = GDIFontEntry::DetermineFontType(metrics, fontType);
@ -551,7 +551,7 @@ GDIFontFamily::FindStyleVariations()
memset(&logFont, 0, sizeof(LOGFONTW));
logFont.lfCharSet = DEFAULT_CHARSET;
logFont.lfPitchAndFamily = 0;
PRUint32 l = PR_MIN(mName.Length(), LF_FACESIZE - 1);
PRUint32 l = NS_MIN<PRUint32>(mName.Length(), LF_FACESIZE - 1);
memcpy(logFont.lfFaceName,
nsPromiseFlatString(mName).get(),
l * sizeof(PRUnichar));
@ -820,7 +820,7 @@ public:
while (mCurrentChunk < mNumChunks && bytesLeft) {
FontDataChunk& currentChunk = mDataChunks[mCurrentChunk];
PRUint32 bytesToCopy = PR_MIN(bytesLeft,
PRUint32 bytesToCopy = NS_MIN(bytesLeft,
currentChunk.mLength - mChunkOffset);
memcpy(out, currentChunk.mData + mChunkOffset, bytesToCopy);
bytesLeft -= bytesToCopy;
@ -888,7 +888,7 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
PRUint32 eotlen;
isEmbedded = PR_TRUE;
PRUint32 nameLen = PR_MIN(uniqueName.Length(), LF_FACESIZE - 1);
PRUint32 nameLen = NS_MIN<PRUint32>(uniqueName.Length(), LF_FACESIZE - 1);
nsPromiseFlatString fontName(Substring(uniqueName, 0, nameLen));
FontDataOverlay overlayNameData = {0, 0, 0};

Просмотреть файл

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "prtypes.h"
#include "nsAlgorithm.h"
#include "prmem.h"
#include "nsString.h"
#include "nsBidiUtils.h"
@ -335,7 +336,7 @@ GetKernValueFmt0(const void* aSubtable,
if (aIsOverride) {
aValue = PRInt16(lo->value);
} else if (aIsMinimum) {
aValue = PR_MAX(aValue, PRInt16(lo->value));
aValue = NS_MAX(aValue, PRInt32(lo->value));
} else {
aValue += PRInt16(lo->value);
}
@ -952,8 +953,9 @@ GetRoundOffsetsToPixels(gfxContext *aContext,
// show_glyphs is implemented on the font and so is used for
// all surface types; however, it may pixel-snap depending on
// the dwrite rendering mode
if (gfxWindowsPlatform::GetPlatform()->DWriteMeasuringMode() ==
DWRITE_MEASURING_MODE_NATURAL) {
if (!cairo_dwrite_scaled_font_get_force_GDI_classic(scaled_font) &&
gfxWindowsPlatform::GetPlatform()->DWriteMeasuringMode() ==
DWRITE_MEASURING_MODE_NATURAL) {
return;
}
#endif
@ -1047,7 +1049,7 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxContext *aContext,
// find the maximum glyph index covered by the clump so far
for (PRInt32 i = charStart; i < charEnd; ++i) {
if (charToGlyph[i] != NO_GLYPH) {
glyphEnd = PR_MAX(glyphEnd, charToGlyph[i] + 1);
glyphEnd = NS_MAX(glyphEnd, charToGlyph[i] + 1);
// update extent of glyph range
}
}

Просмотреть файл

@ -212,7 +212,7 @@ gfxImageSurface::CopyFrom(gfxImageSurface *other)
if (other->mStride == mStride) {
memcpy (mData, other->mData, mStride * mSize.height);
} else {
int lineSize = PR_MIN(other->mStride, mStride);
int lineSize = NS_MIN(other->mStride, mStride);
for (int i = 0; i < mSize.height; i++) {
unsigned char *src = other->mData + other->mStride * i;
unsigned char *dst = mData + mStride * i;

Просмотреть файл

@ -228,7 +228,7 @@ gfxMacFont::InitMetrics()
return;
}
mAdjustedSize = PR_MAX(mStyle.size, 1.0f);
mAdjustedSize = NS_MAX(mStyle.size, 1.0);
mFUnitsConvFactor = mAdjustedSize / upem;
// For CFF fonts, when scaling values read from CGFont* APIs, we need to

Просмотреть файл

@ -130,7 +130,7 @@ static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
// line as close to the original position as possible.
static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
{
gfxFloat snappedSize = PR_MAX(NS_floor(aSize + 0.5), 1.0);
gfxFloat snappedSize = NS_MAX(NS_floor(aSize + 0.5), 1.0);
// Correct offset for change in size
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
// Snap offset
@ -240,12 +240,12 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
if (os2 && os2->version != 0xFFFF) { // should be there if not old Mac font
// if we are here we can improve the avgCharWidth
mMetrics->aveCharWidth = PR_MAX(mMetrics->aveCharWidth,
mMetrics->aveCharWidth = NS_MAX(mMetrics->aveCharWidth,
os2->xAvgCharWidth * xScale);
mMetrics->superscriptOffset = PR_MAX(os2->ySuperscriptYOffset * yScale, 1.0);
mMetrics->superscriptOffset = NS_MAX(os2->ySuperscriptYOffset * yScale, 1.0);
// some fonts have the incorrect sign (from gfxPangoFonts)
mMetrics->subscriptOffset = PR_MAX(fabs(os2->ySubscriptYOffset * yScale),
mMetrics->subscriptOffset = NS_MAX(fabs(os2->ySubscriptYOffset * yScale),
1.0);
mMetrics->strikeoutOffset = os2->yStrikeoutPosition * yScale;
mMetrics->strikeoutSize = os2->yStrikeoutSize * yScale;
@ -267,11 +267,11 @@ const gfxFont::Metrics& gfxOS2Font::GetMetrics()
mMetrics->emDescent = -face->descender * yScale;
mMetrics->maxHeight = face->height * yScale;
// the max units determine frame heights, better be generous
mMetrics->maxAscent = PR_MAX(face->bbox.yMax * yScale,
mMetrics->maxAscent = NS_MAX(face->bbox.yMax * yScale,
mMetrics->emAscent);
mMetrics->maxDescent = PR_MAX(-face->bbox.yMin * yScale,
mMetrics->maxDescent = NS_MAX(-face->bbox.yMin * yScale,
mMetrics->emDescent);
mMetrics->maxAdvance = PR_MAX(face->max_advance_width * xScale,
mMetrics->maxAdvance = NS_MAX(face->max_advance_width * xScale,
mMetrics->aveCharWidth);
// leadings are not available directly (only for WinFNTs);

Просмотреть файл

@ -38,6 +38,7 @@
#ifndef GFX_RECT_H
#define GFX_RECT_H
#include "nsAlgorithm.h"
#include "gfxTypes.h"
#include "gfxPoint.h"
#include "gfxCore.h"

Просмотреть файл

@ -240,7 +240,7 @@ gfxSkipCharsBuilder::FlushRun()
// Fill in buffer entries starting at mBufferLength, as many as necessary
PRUint32 charCount = mRunCharCount;
for (;;) {
PRUint32 chars = PR_MIN(255, charCount);
PRUint32 chars = NS_MIN<PRUint32>(255, charCount);
if (!mBuffer.AppendElement(chars)) {
mInErrorState = PR_TRUE;
return;

Просмотреть файл

@ -248,7 +248,7 @@ nsConverterInputStream::Fill(nsresult * aErrorCode)
++srcConsumed;
// XXX this is needed to make sure we don't underrun our buffer;
// bug 160784 again
srcConsumed = PR_MAX(srcConsumed, 0);
srcConsumed = NS_MAX<PRUint32>(srcConsumed, 0);
mConverter->Reset();
}
NS_ASSERTION(srcConsumed <= mByteData->GetLength(),

Просмотреть файл

@ -35,6 +35,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAlgorithm.h"
#include "nsUCSupport.h"
#include "nsUTF8ToUnicode.h"
#include "mozilla/SSE.h"
@ -249,7 +250,7 @@ NS_IMETHODIMP nsUTF8ToUnicode::Convert(const char * aSrc,
// When mState is zero we expect either a US-ASCII character or a
// multi-octet sequence.
if (0 == (0x80 & (*in))) {
PRInt32 max_loops = PR_MIN(inend - in, outend - out);
PRInt32 max_loops = NS_MIN(inend - in, outend - out);
Convert_ascii_run(in, out, max_loops);
--in; // match the rest of the cases
mBytes = 1;

Просмотреть файл

@ -37,6 +37,7 @@
* ***** END LICENSE BLOCK ***** */
#include "pratom.h"
#include "nsAlgorithm.h"
#include "nsIComponentManager.h"
#include "nsUCSupport.h"
#include "nsUnicodeDecodeHelper.h"
@ -106,7 +107,7 @@ nsBufferDecoderSupport::~nsBufferDecoderSupport()
void nsBufferDecoderSupport::FillBuffer(const char ** aSrc, PRInt32 aSrcLength)
{
PRInt32 bcr = PR_MIN(mBufferCapacity - mBufferLength, aSrcLength);
PRInt32 bcr = NS_MIN(mBufferCapacity - mBufferLength, aSrcLength);
memcpy(mBuffer + mBufferLength, *aSrc, bcr);
mBufferLength += bcr;
(*aSrc) += bcr;

Просмотреть файл

@ -3351,37 +3351,6 @@ case $target in
AC_CHECK_LIB(socket, socket)
esac
if test "$CPU_ARCH" = "arm"; then
AC_MSG_CHECKING(for ARM SIMD support in compiler)
AC_TRY_COMPILE([],
[asm("uqadd8 r1, r1, r2");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_SIMD)
HAVE_ARM_SIMD=1
fi
AC_MSG_CHECKING(for ARM NEON support in compiler)
_SAVE_CFLAGS="$CFLAGS"
if test "$GNU_CC"; then
# gcc needs -mfpu=neon to recognize NEON instructions
CFLAGS="$CFLAGS -mfpu=neon -mfloat-abi=softfp"
fi
AC_TRY_COMPILE([],
[asm("vadd.i8 d0, d0, d0");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_NEON)
HAVE_ARM_NEON=1
fi
CFLAGS="$_SAVE_CFLAGS"
fi
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl = pthread support
dnl = Start by checking whether the system support pthreads
@ -4419,13 +4388,11 @@ MOZ_ARG_HEADER(Application)
ENABLE_TESTS=1
MOZ_THUMB2=
USE_ARM_KUSER=
case "${target}" in
*-android*|*-linuxandroid*)
USE_ARM_KUSER=1
MOZ_THUMB2=1
;;
esac
@ -4471,80 +4438,204 @@ dnl =
dnl ========================================================
MOZ_ARG_HEADER(Individual module options)
dnl Setup default CPU arch for arm target
case "$target_cpu" in
arm*)
MOZ_ARM_ARCH=armv7
;;
dnl ========================================================
dnl = ARM toolchain tweaks
dnl ========================================================
dnl Defaults
case "${target}" in
arm-android-eabi)
MOZ_THUMB=yes
MOZ_ARCH=armv7-a
MOZ_FPU=vfp
MOZ_FLOAT_ABI=softfp
;;
arm*-*)
if test -n "$MOZ_PLATFORM_MAEMO"; then
MOZ_THUMB=no
MOZ_ARCH=armv7-a
MOZ_FLOAT_ABI=softfp
fi
if test "$MOZ_PLATFORM_MAEMO" = 6; then
MOZ_THUMB=yes
fi
;;
esac
dnl ========================================================
dnl = Enable building the Thumb2 instruction set
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(thumb2,
[ --enable-thumb2 Enable Thumb2 instruction set (implies ARMv7)],
MOZ_THUMB2=1,
MOZ_THUMB2=)
if test -n "$MOZ_THUMB2"; then
MOZ_ARM_ARCH=armv7
dnl Kept for compatibility with some buildbot mozconfig
MOZ_ARG_DISABLE_BOOL(thumb2, [], MOZ_THUMB=no, MOZ_THUMB=yes)
MOZ_ARG_WITH_STRING(thumb,
[ --with-thumb[[=yes|no|toolchain-default]]]
[ Use Thumb instruction set (-mthumb)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-thumb is not supported on non-GNU toolchain-defaults])
fi
MOZ_THUMB=$withval)
MOZ_ARG_WITH_STRING(thumb-interwork,
[ --with-thumb-interwork[[=yes|no|toolchain-default]]
Use Thumb/ARM instuctions interwork (-mthumb-interwork)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-thumb-interwork is not supported on non-GNU toolchain-defaults])
fi
MOZ_THUMB_INTERWORK=$withval)
MOZ_ARG_WITH_STRING(arch,
[ --with-arch=[[type|toolchain-default]]
Use specific CPU features (-march=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-arch is not supported on non-GNU toolchain-defaults])
fi
MOZ_ARCH=$withval)
MOZ_ARG_WITH_STRING(fpu,
[ --with-fpu=[[type|toolchain-default]]
Use specific FPU type (-mfpu=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-fpu is not supported on non-GNU toolchain-defaults])
fi
MOZ_FPU=$withval)
MOZ_ARG_WITH_STRING(float-abi,
[ --with-float-abi=[[type|toolchain-default]]
Use specific arm float ABI (-mfloat-abi=type)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-float-abi is not supported on non-GNU toolchain-defaults])
fi
MOZ_FLOAT_ABI=$withval)
MOZ_ARG_WITH_STRING(soft-float,
[ --with-soft-float[[=yes|no|toolchain-default]]
Use soft float library (-msoft-float)],
if test -z "$GNU_CC"; then
AC_MSG_ERROR([--with-soft-float is not supported on non-GNU toolchain-defaults])
fi
MOZ_SOFT_FLOAT=$withval)
case "$MOZ_ARCH" in
toolchain-default|"")
arch_flag=""
;;
*)
arch_flag="-march=$MOZ_ARCH"
;;
esac
case "$MOZ_THUMB" in
yes)
MOZ_THUMB2=1
thumb_flag="-mthumb"
;;
no)
MOZ_THUMB2=
thumb_flag="-marm"
;;
*)
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$arch_flag"
AC_TRY_COMPILE([],[return sizeof(__thumb2__);],
MOZ_THUMB2=1,
MOZ_THUMB2=)
CFLAGS="$_SAVE_CFLAGS"
thumb_flag=""
;;
esac
if test "$MOZ_THUMB2" = 1; then
AC_DEFINE(MOZ_THUMB2)
fi
dnl ========================================================
dnl = Enable building for ARM specific CPU features
dnl ========================================================
MOZ_ARG_WITH_STRING(cpu-arch,
[ --with-cpu-arch=arch Use specific arm architecture CPU features, default armv7],
MOZ_ARM_ARCH=$withval)
case "$MOZ_THUMB_INTERWORK" in
yes)
thumb_interwork_flag="-mthumb-interwork"
;;
no)
thumb_interwork_flag="-mno-thumb-interwork"
;;
*) # toolchain-default
thumb_interwork_flag=""
;;
esac
if test -n "$MOZ_THUMB2"; then
case "$target_cpu" in
arm*)
if test "$MOZ_ARM_ARCH" != "armv7"; then
AC_MSG_ERROR([--enable-thumb2 is not compatible with cpu-arch=$MOZ_ARM_ARCH])
fi
if test "$GNU_CC"; then
AC_DEFINE(MOZ_THUMB2)
AC_DEFINE(MOZ_ARM_ARCH)
CFLAGS="$CFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
CXXFLAGS="$CXXFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
ASFLAGS="$ASFLAGS -march=armv7-a -mthumb -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
else
AC_MSG_ERROR([--enable-thumb2 is not supported for non-GNU toolchains])
fi
case "$MOZ_FPU" in
toolchain-default|"")
fpu_flag=""
;;
*)
AC_MSG_ERROR([--enable-thumb2 is not supported for non-ARM CPU architectures])
*)
fpu_flag="-mfpu=$MOZ_FPU"
;;
esac
elif test "$MOZ_ARM_ARCH" = "armv7"; then
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
AC_DEFINE(MOZ_ARM_ARCH)
CFLAGS="$CFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
CXXFLAGS="$CXXFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
ASFLAGS="$ASFLAGS -march=armv7-a -marm -mfloat-abi=softfp $MOZ_ARM_VFP_FLAGS"
else
AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-GNU toolchains])
fi
esac
case "$MOZ_FLOAT_ABI" in
toolchain-default|"")
float_abi_flag=""
;;
*)
AC_MSG_ERROR([--with-cpu-arch=armv7 is not supported for non-ARM CPU architectures])
*)
float_abi_flag="-mfloat-abi=$MOZ_FLOAT_ABI"
;;
esac
else
case "$target_cpu" in
arm*)
if test "$GNU_CC"; then
CFLAGS="$CFLAGS -march=armv5te -mthumb-interwork -msoft-float"
CXXFLAGS="$CXXFLAGS -march=armv5te -mthumb-interwork -msoft-float"
ASFLAGS="$ASFLAGS -march=armv5te -mthumb-interwork -msoft-float"
fi
;;
esac
esac
case "$MOZ_SOFT_FLOAT" in
yes)
soft_float_flag="-msoft-float"
;;
no)
soft_float_flag="-mno-soft-float"
;;
*) # toolchain-default
soft_float_flag=""
;;
esac
dnl Use echo to avoid accumulating space characters
all_flags=`echo $arch_flag $thumb_flag $thumb_interwork_flag $fpu_flag $float_abi_flag $soft_float_flag`
if test -n "$all_flags"; then
_SAVE_CFLAGS="$CFLAGS"
CFLAGS="$all_flags"
AC_MSG_CHECKING(whether the chosen combination of compiler flags ($all_flags) works)
AC_TRY_COMPILE([],[return 0;],
AC_MSG_RESULT([yes]),
AC_MSG_ERROR([no]))
CFLAGS="$_SAVE_CFLAGS $all_flags"
CXXFLAGS="$CXXFLAGS $all_flags"
ASFLAGS="$ASFLAGS $all_flags"
if test -n "$thumb_flag"; then
LDFLAGS="$LDFLAGS $thumb_flag"
fi
fi
AC_SUBST(MOZ_THUMB2)
AC_SUBST(MOZ_ARM_ARCH)
if test "$CPU_ARCH" = "arm"; then
AC_MSG_CHECKING(for ARM SIMD support in compiler)
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm("uqadd8 r1, r1, r2");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_SIMD)
HAVE_ARM_SIMD=1
fi
AC_MSG_CHECKING(for ARM NEON support in compiler)
# We try to link so that this also fails when
# building with LTO.
AC_TRY_LINK([],
[asm(".fpu neon\n vadd.i8 d0, d0, d0");],
result="yes", result="no")
AC_MSG_RESULT("$result")
if test "$result" = "yes"; then
AC_DEFINE(HAVE_ARM_NEON)
HAVE_ARM_NEON=1
fi
fi # CPU_ARCH = arm
AC_SUBST(HAVE_ARM_SIMD)
AC_SUBST(HAVE_ARM_NEON)
dnl ========================================================
dnl =
@ -4798,7 +4889,7 @@ MOZ_ARG_ENABLE_BOOL(wrap-malloc,
if test -n "$_WRAP_MALLOC"; then
if test "$GNU_CC"; then
WRAP_MALLOC_CFLAGS="${LDFLAGS} -Wl,--wrap -Wl,malloc -Wl,--wrap -Wl,calloc -Wl,--wrap -Wl,valloc -Wl,--wrap -Wl,free -Wl,--wrap -Wl,realloc -Wl,--wrap -Wl,memalign -Wl,--wrap -Wl,__builtin_new -Wl,--wrap -Wl,__builtin_vec_new -Wl,--wrap -Wl,__builtin_delete -Wl,--wrap -Wl,__builtin_vec_delete -Wl,--wrap -Wl,PR_Free -Wl,--wrap -Wl,PR_Malloc -Wl,--wrap -Wl,PR_Calloc -Wl,--wrap -Wl,PR_Realloc -Wl,--wrap -Wl,strdup -Wl,--wrap -Wl,strndup -Wl,--wrap -Wl,posix_memalign"
MKSHLIB='$(CXX) $(DSO_LDOPTS) $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB) -o $@'
MKSHLIB="$MKSHLIB"' $(WRAP_MALLOC_CFLAGS) $(WRAP_MALLOC_LIB)'
fi
fi
@ -5923,12 +6014,6 @@ if test "$JS_HAS_CTYPES"; then
if test "$OS_ARCH" = "OS2"; then
ac_configure_args="$ac_configure_args CFLAGS=-Zomf AR=emxomfar"
fi
if test -n "$MOZ_THUMB2"; then
ac_configure_args="$ac_configure_args --enable-thumb2"
fi
if test -n "$MOZ_ARM_ARCH"; then
ac_configure_args="$ac_configure_args --with-cpu-arch=$MOZ_ARM_ARCH"
fi
# Use a separate cache file for libffi, since it does things differently
# from our configure.

Просмотреть файл

@ -47,7 +47,7 @@
// See http://www.w3.org/TR/AERT#color-contrast
#define NS_SUFFICIENT_LUMINOSITY_DIFFERENCE 125000
#define NS_LUMINOSITY_DIFFERENCE(a, b) \
PR_ABS(NS_GetLuminosity(a) - NS_GetLuminosity(b))
NS_ABS(NS_GetLuminosity(a) - NS_GetLuminosity(b))
// To determine colors based on the background brightness and border color
void NS_GetSpecial3DColors(nscolor aResult[2],

Просмотреть файл

@ -67,7 +67,6 @@
#include "nsITheme.h"
#include "nsThemeConstants.h"
#include "nsIServiceManager.h"
#include "nsIHTMLDocument.h"
#include "nsLayoutUtils.h"
#include "nsINameSpaceManager.h"
#include "nsBlockFrame.h"
@ -85,6 +84,8 @@
#include "nsCSSRenderingBorders.h"
using namespace mozilla;
/**
* This is a small wrapper class to encapsulate image drawing that can draw an
* nsStyleImage image, which may internally be a real image, a sub image, or a
@ -378,14 +379,10 @@ static nscolor MakeBevelColor(mozilla::css::Side whichSide, PRUint8 style,
static InlineBackgroundData* gInlineBGData = nsnull;
// Initialize any static variables used by nsCSSRendering.
nsresult nsCSSRendering::Init()
void nsCSSRendering::Init()
{
NS_ASSERTION(!gInlineBGData, "Init called twice");
gInlineBGData = new InlineBackgroundData();
if (!gInlineBGData)
return NS_ERROR_OUT_OF_MEMORY;
return NS_OK;
}
// Clean up any global variables used by nsCSSRendering.
@ -937,36 +934,43 @@ nsCSSRendering::FindBackgroundStyleFrame(nsIFrame* aForFrame)
const nsStyleBackground* result = aForFrame->GetStyleBackground();
// Check if we need to do propagation from BODY rather than HTML.
if (result->IsTransparent()) {
nsIContent* content = aForFrame->GetContent();
// The root element content can't be null. We wouldn't know what
// frame to create for aFrame.
// Use |GetOwnerDoc| so it works during destruction.
if (content) {
nsIDocument* document = content->GetOwnerDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
if (htmlDoc) {
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
// We need to null check the body node (bug 118829) since
// there are cases, thanks to the fix for bug 5569, where we
// will reflow a document with no body. In particular, if a
// SCRIPT element in the head blocks the parser and then has a
// SCRIPT that does "document.location.href = 'foo'", then
// nsParser::Terminate will call |DidBuildModel| methods
// through to the content sink, which will call |StartLayout|
// and thus |InitialReflow| on the pres shell. See bug 119351
// for the ugly details.
if (bodyContent) {
nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
if (bodyFrame) {
return nsLayoutUtils::GetStyleFrame(bodyFrame);
}
}
}
}
if (!result->IsTransparent()) {
return aForFrame;
}
return aForFrame;
nsIContent* content = aForFrame->GetContent();
// The root element content can't be null. We wouldn't know what
// frame to create for aFrame.
// Use |GetOwnerDoc| so it works during destruction.
if (!content) {
return aForFrame;
}
nsIDocument* document = content->GetOwnerDoc();
if (!document) {
return aForFrame;
}
dom::Element* bodyContent = document->GetBodyElement();
// We need to null check the body node (bug 118829) since
// there are cases, thanks to the fix for bug 5569, where we
// will reflow a document with no body. In particular, if a
// SCRIPT element in the head blocks the parser and then has a
// SCRIPT that does "document.location.href = 'foo'", then
// nsParser::Terminate will call |DidBuildModel| methods
// through to the content sink, which will call |StartLayout|
// and thus |InitialReflow| on the pres shell. See bug 119351
// for the ugly details.
if (!bodyContent) {
return aForFrame;
}
nsIFrame *bodyFrame = bodyContent->GetPrimaryFrame();
if (!bodyFrame) {
return aForFrame;
}
return nsLayoutUtils::GetStyleFrame(bodyFrame);
}
/**
@ -1027,11 +1031,10 @@ FindElementBackground(nsIFrame* aForFrame, nsIFrame* aRootElementFrame,
// We should only look at the <html> background if we're in an HTML document
nsIDocument* document = content->GetOwnerDoc();
nsCOMPtr<nsIHTMLDocument> htmlDoc = do_QueryInterface(document);
if (!htmlDoc)
if (!document)
return PR_TRUE;
nsIContent* bodyContent = htmlDoc->GetBodyContentExternal();
dom::Element* bodyContent = document->GetBodyElement();
if (bodyContent != content)
return PR_TRUE; // this wasn't the background that was propagated
@ -1822,10 +1825,10 @@ ComputeRadialGradientLine(nsPresContext* aPresContext,
// Compute gradient shape: the x and y radii of an ellipse.
double radiusX, radiusY;
double leftDistance = PR_ABS(aLineStart->x);
double rightDistance = PR_ABS(aBoxSize.width - aLineStart->x);
double topDistance = PR_ABS(aLineStart->y);
double bottomDistance = PR_ABS(aBoxSize.height - aLineStart->y);
double leftDistance = NS_ABS(aLineStart->x);
double rightDistance = NS_ABS(aBoxSize.width - aLineStart->x);
double topDistance = NS_ABS(aLineStart->y);
double bottomDistance = NS_ABS(aBoxSize.height - aLineStart->y);
switch (aGradient->mSize) {
case NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE:
radiusX = NS_MIN(leftDistance, rightDistance);

Просмотреть файл

@ -54,7 +54,7 @@ struct nsCSSRendering {
/**
* Initialize any static variables used by nsCSSRendering.
*/
static nsresult Init();
static void Init();
/**
* Clean up any static variables used by nsCSSRendering.

Просмотреть файл

@ -183,11 +183,7 @@ nsLayoutStatics::Initialize()
return rv;
}
rv = nsCSSRendering::Init();
if (NS_FAILED(rv)) {
NS_ERROR("Could not initialize nsCSSRendering");
return rv;
}
nsCSSRendering::Init();
rv = nsTextFrameTextRunCache::Init();
if (NS_FAILED(rv)) {

Просмотреть файл

@ -43,6 +43,6 @@ load 538062-1.xhtml
load 570624-1.html
load 498698-1.html
asserts(1) load 578604-1.html # bug 584564
asserts(5) load 590302-1.xhtml # bug 584564
asserts(3-5) load 590302-1.xhtml # bug 584564
load 626014.xhtml
load 639733.xhtml

Просмотреть файл

@ -1892,6 +1892,20 @@ nsImageFrame::IconLoad::IconLoad()
GetPrefs();
}
void
nsImageFrame::IconLoad::Shutdown()
{
Preferences::RemoveObservers(this, kIconLoadPrefs);
// in case the pref service releases us later
if (mLoadingImage) {
mLoadingImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mLoadingImage = nsnull;
}
if (mBrokenImage) {
mBrokenImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mBrokenImage = nsnull;
}
}
NS_IMETHODIMP
nsImageFrame::IconLoad::Observe(nsISupports *aSubject, const char* aTopic,

Просмотреть файл

@ -328,18 +328,7 @@ private:
public:
IconLoad();
void Shutdown()
{
// in case the pref service releases us later
if (mLoadingImage) {
mLoadingImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mLoadingImage = nsnull;
}
if (mBrokenImage) {
mBrokenImage->CancelAndForgetObserver(NS_ERROR_FAILURE);
mBrokenImage = nsnull;
}
}
void Shutdown();
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER

Просмотреть файл

@ -888,7 +888,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, PRUint32 aHint)
// or in sloppy markups without protective <mrow></mrow>
PRBool isNormal =
(aHint & NS_STRETCH_NORMAL)
&& PRBool(float(PR_ABS(a - b))
&& PRBool(float(NS_ABS(a - b))
< (1.0f - NS_MATHML_DELIMITER_FACTOR) * float(b));
// Nearer: True if 'a' is around max{ +/-10% of 'b' , 'b' - 5pt },
// as documented in The TeXbook, Ch.17, p.152.
@ -897,7 +897,7 @@ IsSizeOK(nsPresContext* aPresContext, nscoord a, nscoord b, PRUint32 aHint)
if (aHint & (NS_STRETCH_NEARER | NS_STRETCH_LARGEOP)) {
float c = NS_MAX(float(b) * NS_MATHML_DELIMITER_FACTOR,
float(b) - nsPresContext::CSSPointsToAppUnits(NS_MATHML_DELIMITER_SHORTFALL_POINTS));
isNearer = PRBool(float(PR_ABS(b - a)) <= (float(b) - c));
isNearer = PRBool(float(NS_ABS(b - a)) <= (float(b) - c));
}
// Smaller: Mainly for transitory use, to compare two candidate
// choices
@ -924,7 +924,7 @@ IsSizeBetter(nscoord a, nscoord olda, nscoord b, PRUint32 aHint)
return (a <= olda) ? (olda > b) : (a <= b);
// XXXkt prob want log scale here i.e. 1.5 is closer to 1 than 0.5
return PR_ABS(a - b) < PR_ABS(olda - b);
return NS_ABS(a - b) < NS_ABS(olda - b);
}
// We want to place the glyphs even when they don't fit at their

Просмотреть файл

@ -675,7 +675,7 @@ fails-if(Android) != 376532-3.html 376532-3-ref.html
== 379178-html.html 379178-html-ref.html
== 379178-svg.svg 379178-svg-ref.svg
== 379316-1.html 379316-1-ref.html
fails-if(Android) random-if(cocoaWidget) fails-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 379316-2.html 379316-2-ref.html # bug 379786
fails-if(Android) random-if(cocoaWidget) random-if(/^Windows\x20NT\x206\.1/.test(http.oscpu)) == 379316-2.html 379316-2-ref.html # bug 379786
== 379328-1.html 379328-1-ref.html
== 379349-1a.xhtml 379349-1-ref.xhtml
== 379349-1b.xhtml 379349-1-ref.xhtml
@ -1538,7 +1538,8 @@ needs-focus == 568441.html 568441-ref.html
# 574907 is a windows-only issue, result on other platforms depends on details of font support
random-if(!winWidget) == 574907-1.html 574907-1-ref.html
random-if(!winWidget) == 574907-2.html 574907-2-ref.html
random-if(!winWidget) fails-if(winWidget&&!d2d) != 574907-3.html 574907-3-notref.html
# 574907-3 only worked under directwrite, and even there it now depends on the rendering mode; marking as random for now
random-if(!winWidget) fails-if(winWidget&&!d2d) random-if(winWidget&&d2d) != 574907-3.html 574907-3-notref.html
== 577838-1.html 577838-1-ref.html
== 577838-2.html 577838-2-ref.html
fails-if(Android) random-if(layersGPUAccelerated) fails-if(/^Windows\x20NT\x205\.1/.test(http.oscpu)) fails-if(/Mac\x20OS\x20X\x2010\.5/.test(http.oscpu)) == 579323-1.html 579323-1-ref.html # bug 623450 for WinXP and bug 627560 for OSX 10.5

Просмотреть файл

@ -2,6 +2,9 @@
<html class="reftest-wait">
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#ib1 {
display: inline-block;
margin-right: 20px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
span {
display: inline-block;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
span {
display: inline-block;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#ib1 {
display: inline-block;
margin-right: 20px;

Просмотреть файл

@ -2,6 +2,9 @@
<html class="reftest-wait">
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#ib1 {
display: inline-block;
margin-right: 10px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
span {
display: inline-block;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
span {
display: inline-block;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#ib1 {
display: inline-block;
margin-right: 10px;

Просмотреть файл

@ -2,6 +2,9 @@
<html class="reftest-wait">
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 10px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 20px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 30px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 10px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html class="reftest-wait">
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 10px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline2 {
margin-left: 10px;
margin-right: 40px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline2 {
margin-left: 10px;
margin-right: 70px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#inline1 {
margin-right: 10px;
}

Просмотреть файл

@ -2,6 +2,9 @@
<html class="reftest-wait">
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#it1 {
display: inline-table;
margin-right: 20px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#it1 {
display: inline-table;
margin-right: 20px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#it1 {
display: inline-table;
margin-right: 30px;

Просмотреть файл

@ -2,6 +2,9 @@
<html>
<head>
<style type="text/css">
body {
font-family: sans-serif;
}
#it1 {
display: inline-table;
margin-right: 20px;

Просмотреть файл

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body lang="en-us">
<div style="width: 5em;">
<div style="width: 5em; font-family:sans-serif;">
supercalifragilisticexpialidocious
</div>
</body>

Просмотреть файл

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body lang="en-us">
<div style="width: 5em; -moz-hyphens: manual;">
<div style="width: 5em; -moz-hyphens: manual; font-family:sans-serif;">
su&shy;per&shy;cal&shy;ifrag&shy;ilis&shy;tic&shy;ex&shy;pi&shy;ali&shy;do&shy;cious
</div>
</body>

Просмотреть файл

@ -2,7 +2,7 @@
<html>
<!-- simple test for automatic hyphenation -->
<body lang="en-us">
<div style="width: 5em; -moz-hyphens: auto;">
<div style="width: 5em; -moz-hyphens: auto; font-family:sans-serif;">
supercalifragilisticexpialidocious
</div>
</body>

Просмотреть файл

@ -2,7 +2,7 @@
<html>
<!-- adding random <span>s should not affect hyphenation -->
<body lang="en-us">
<div style="width: 5em; -moz-hyphens: auto;">
<div style="width: 5em; -moz-hyphens: auto; font-family:sans-serif;">
super<span>cali</span>frag<span>ili</span>sti<span>cex</span>pialidoc<span>i</span>ous
</div>
</body>

Просмотреть файл

@ -1,7 +1,7 @@
<!DOCTYPE html>
<html>
<body lang="en-us">
<div style="width: 5em; -moz-hyphens: auto;">
<div style="width: 5em; -moz-hyphens: auto; font-family:sans-serif;">
supercalifragilisticexpialidocious
<span style="-moz-hyphens:none">supercalifragilisticexpialidocious</span>
supercalifragilisticexpialidocious

Просмотреть файл

@ -2,7 +2,7 @@
<html>
<!-- mixed languages in a word should inhibit automatic hyphenation -->
<body lang="en-us">
<div style="width: 5em; -moz-hyphens: auto;">
<div style="width: 5em; -moz-hyphens: auto; font-family:sans-serif;">
supercalifragilisticexpialidocious
super<span lang="foo">cali</span>fragilisticexpialidocious
supercalifragilisticexpialidocious

Просмотреть файл

@ -42,7 +42,8 @@ fails-if(Android) skip-if(d2d||cocoaWidget) == subpixel-glyphs-x-1a.html subpixe
# design, but that is considered more tolerable because they are subpixel
# inconsistencies. On those platforms we just test that glyph positions are
# subpixel.
skip-if(!(d2d||cocoaWidget)) != subpixel-glyphs-x-2a.html subpixel-glyphs-x-2b.html
# D2D/DirectWrite results depend on the rendering mode chosen, so considering this as random for now.
skip-if(!(d2d||cocoaWidget)) random-if(d2d) != subpixel-glyphs-x-2a.html subpixel-glyphs-x-2b.html
# No platforms do subpixel positioning vertically
== subpixel-glyphs-y-1a.html subpixel-glyphs-y-1b.html
== subpixel-lineheight-1a.html subpixel-lineheight-1b.html

Просмотреть файл

@ -63,8 +63,6 @@
#include "nsIDocument.h"
#include "nsIPresShell.h"
#include "nsStyleConsts.h"
#include "nsIHTMLDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsCSSAnonBoxes.h"
#include "nsRuleWalker.h"
#include "nsRuleData.h"

Просмотреть файл

@ -282,7 +282,7 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
// just like eUnit_Integer.
PRInt32 startInt = aStartValue.GetIntValue();
PRInt32 endInt = aEndValue.GetIntValue();
aDistance = PR_ABS(endInt - startInt);
aDistance = NS_ABS(endInt - startInt);
return PR_TRUE;
}
default:
@ -293,13 +293,13 @@ nsStyleAnimation::ComputeDistance(nsCSSProperty aProperty,
aStartValue.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE;
PRInt32 endVal =
aEndValue.GetIntValue() == NS_STYLE_VISIBILITY_VISIBLE;
aDistance = PR_ABS(startVal - endVal);
aDistance = NS_ABS(startVal - endVal);
return PR_TRUE;
}
case eUnit_Integer: {
PRInt32 startInt = aStartValue.GetIntValue();
PRInt32 endInt = aEndValue.GetIntValue();
aDistance = PR_ABS(endInt - startInt);
aDistance = NS_ABS(endInt - startInt);
return PR_TRUE;
}
case eUnit_Coord: {
@ -1110,7 +1110,7 @@ DecomposeMatrix(const nsStyleTransformMatrix &aMatrix,
XYshear /= scaleY;
// A*D - B*C should now be 1 or -1
NS_ASSERTION(0.99 < PR_ABS(A*D - B*C) && PR_ABS(A*D - B*C) < 1.01,
NS_ASSERTION(0.99 < NS_ABS(A*D - B*C) && NS_ABS(A*D - B*C) < 1.01,
"determinant should now be 1 or -1");
if (A * D < B * C) {
A = -A;

Просмотреть файл

@ -6272,7 +6272,7 @@ BCPaintBorderIterator::SetDamageArea(nsRect aDirtyRect)
if (!haveIntersect)
return PR_FALSE;
mDamageArea = nsRect(startColIndex, startRowIndex,
1 + PR_ABS(PRInt32(endColIndex - startColIndex)),
1 + NS_ABS(PRInt32(endColIndex - startColIndex)),
1 + endRowIndex - startRowIndex);
Reset();
@ -6611,7 +6611,7 @@ BCVerticalSeg::Start(BCPaintBorderIterator& aIter,
aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
PRBool topBevel = (aVerSegWidth > 0) ? bevel : PR_FALSE;
BCPixelSize maxHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
BCPixelSize maxHorSegHeight = NS_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
nscoord offset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
maxHorSegHeight, PR_TRUE,
topBevel);
@ -6673,7 +6673,7 @@ BCVerticalSeg::GetBottomCorner(BCPaintBorderIterator& aIter,
cornerSubWidth = aIter.mBCData->GetCorner(ownerSide, bevel);
}
mIsBottomBevel = (mWidth > 0) ? bevel : PR_FALSE;
mBottomHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
mBottomHorSegHeight = NS_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
mBottomOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
mBottomHorSegHeight,
PR_FALSE, mIsBottomBevel);
@ -6815,7 +6815,7 @@ BCHorizontalSeg::Start(BCPaintBorderIterator& aIter,
PRBool leftBevel = (aHorSegHeight > 0) ? bevel : PR_FALSE;
PRInt32 relColIndex = aIter.GetRelativeColIndex();
nscoord maxVerSegWidth = PR_MAX(aIter.mVerInfo[relColIndex].mWidth,
nscoord maxVerSegWidth = NS_MAX(aIter.mVerInfo[relColIndex].mWidth,
aBottomVerSegWidth);
nscoord offset = CalcHorCornerOffset(cornerOwnerSide, cornerSubWidth,
maxVerSegWidth, PR_TRUE, leftBevel,
@ -6855,7 +6855,7 @@ BCHorizontalSeg::GetRightCorner(BCPaintBorderIterator& aIter,
mIsRightBevel = (mWidth > 0) ? bevel : 0;
PRInt32 relColIndex = aIter.GetRelativeColIndex();
nscoord verWidth = PR_MAX(aIter.mVerInfo[relColIndex].mWidth, aLeftSegWidth);
nscoord verWidth = NS_MAX(aIter.mVerInfo[relColIndex].mWidth, aLeftSegWidth);
mEndOffset = CalcHorCornerOffset(ownerSide, cornerSubWidth, verWidth,
PR_FALSE, mIsRightBevel, aIter.mTableIsLTR);
mLength += mEndOffset;

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше