Merge mozilla-central to tracemonkey.

This commit is contained in:
Robert Sayre 2010-06-06 11:28:04 -04:00
commit cecd0f18ee
411 changed files with 6992 additions and 6246 deletions

View File

@ -22,9 +22,13 @@
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false">
</ms_asmv3:requestedExecutionLevel>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
</assembly>

View File

@ -467,10 +467,7 @@
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
title="&locationItem.title;" class="chromeclass-location" removable="true">
<textbox id="urlbar" flex="1"
bookmarkhistoryplaceholder="&urlbar.bookmarkhistory.emptyText;"
bookmarkplaceholder="&urlbar.bookmark.emptyText;"
historyplaceholder="&urlbar.history.emptyText;"
noneplaceholder="&urlbar.none.emptyText;"
placeholder="&urlbar.placeholder;"
type="autocomplete"
autocompletesearch="history"
autocompletesearchparam="enable-actions"

View File

@ -53,7 +53,6 @@
this.doubleClickSelectsAll = this._prefs.getBoolPref("doubleClickSelectsAll");
this.completeDefaultIndex = this._prefs.getBoolPref("autoFill");
this.timeout = this._prefs.getIntPref("delay");
this._setPlaceholder();
this._urlTooltip = document.getElementById("urlTooltip");
@ -407,10 +406,6 @@
case "delay":
this.timeout = this._prefs.getIntPref(aData);
break;
case "autocomplete.enabled":
case "default.behavior":
this._setPlaceholder();
break;
}
}
]]></body>
@ -466,27 +461,6 @@
</setter>
</property>
<method name="_setPlaceholder">
<body><![CDATA[
var type = "none";
if (this._prefs.getBoolPref("autocomplete.enabled")) {
// Bottom 2 bits of default.behavior specify history/bookmark
switch (this._prefs.getIntPref("default.behavior") & 3) {
case 0:
type = "bookmarkhistory";
break;
case 1:
type = "history";
break;
case 2:
type = "bookmark";
break;
}
}
this.placeholder = this.getAttribute(type + "placeholder");
]]></body>
</method>
<method name="_parseActionUrl">
<parameter name="aUrl"/>
<body><![CDATA[

View File

@ -41,7 +41,6 @@ function test() {
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
run_test_subset([
test_locbar_placeholder,
test_pane_visibility,
test_dependent_elements,
test_dependent_cookie_elements,

View File

@ -65,20 +65,6 @@ function controlChanged(element) {
element.doCommand();
}
function test_locbar_placeholder(win) {
let texts = ["none", "bookmarkhistory", "history", "bookmark"];
let locbarlist = win.document.getElementById("locationBarSuggestion");
ok(locbarlist, "location bar suggestion menulist should exist");
for (let level = -1; level <= 2; ++level) {
locbarlist.value = level;
controlChanged(locbarlist);
is(gURLBar.placeholder, gURLBar.getAttribute(texts[level + 1] + "placeholder"),
"location bar placeholder for for level " + level + " is correctly set");
}
}
function test_pane_visibility(win) {
let modes = {
"remember": "historyRememberPane",

View File

@ -229,10 +229,7 @@
<!ENTITY showAllHistoryCmd.commandkey "H">
<!ENTITY openCmd.commandkey "l">
<!ENTITY urlbar.bookmarkhistory.emptyText "Search Bookmarks and History">
<!ENTITY urlbar.bookmark.emptyText "Search Bookmarks">
<!ENTITY urlbar.history.emptyText "Search History">
<!ENTITY urlbar.none.emptyText "Type a Web address">
<!ENTITY urlbar.placeholder "Go to a Web Site">
<!ENTITY urlbar.accesskey "d">
<!ENTITY urlbar.switchToTab.label "Switch to tab:">

View File

@ -18,14 +18,14 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r
if test x$libIDL_config_exec_prefix != x ; then
libIDL_config_args="$libIDL_config_args --exec-prefix=$libIDL_config_exec_prefix"
if test x${LIBIDL_CONFIG+set} != xset ; then
LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config
if test x${HOST_LIBIDL_CONFIG+set} != xset ; then
HOST_LIBIDL_CONFIG=$libIDL_config_exec_prefix/bin/libIDL-config
fi
fi
if test x$libIDL_config_prefix != x ; then
libIDL_config_args="$libIDL_config_args --prefix=$libIDL_config_prefix"
if test x${LIBIDL_CONFIG+set} != xset ; then
LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config
if test x${HOST_LIBIDL_CONFIG+set} != xset ; then
HOST_LIBIDL_CONFIG=$libIDL_config_prefix/bin/libIDL-config
fi
fi
@ -34,30 +34,26 @@ AC_ARG_ENABLE(libIDLtest, [ --disable-libIDLtest Do not try to compile and r
dnl Force a version check to keep upgraded versions from being overridden by the cached value.
unset ac_cv_path_LIBIDL_CONFIG
AC_PATH_PROG(LIBIDL_CONFIG, libIDL-config, no)
AC_PATH_PROG(HOST_LIBIDL_CONFIG, libIDL-config, no)
min_libIDL_version=ifelse([$1], ,0.6.0,$1)
AC_MSG_CHECKING(for libIDL - version >= $min_libIDL_version)
no_libIDL=""
if test "$LIBIDL_CONFIG" = "no" ; then
if test "$HOST_LIBIDL_CONFIG" = "no" ; then
no_libIDL=yes
else
LIBIDL_CFLAGS=`$LIBIDL_CONFIG $libIDL_config_args --cflags`
LIBIDL_LIBS=`$LIBIDL_CONFIG $libIDL_config_args --libs`
# hack to allow us to keep using libIDL 0.6.3-0.6.7. Anyone may remove
# this after we start requiring libIDL 0.6.8 or anything higher
LIBIDL_CFLAGS="$GLIB_CFLAGS $LIBIDL_CFLAGS"
LIBIDL_LIBS="$GLIB_LIBS $LIBIDL_LIBS"
libIDL_config_major_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
HOST_LIBIDL_CFLAGS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --cflags`
HOST_LIBIDL_LIBS=`$HOST_LIBIDL_CONFIG $libIDL_config_args --libs`
libIDL_config_major_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
libIDL_config_minor_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
libIDL_config_minor_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
libIDL_config_micro_version=`$LIBIDL_CONFIG $libIDL_config_args --version | \
libIDL_config_micro_version=`$HOST_LIBIDL_CONFIG $libIDL_config_args --version | \
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
if test "x$enable_libIDLtest" = "xyes" ; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $LIBIDL_CFLAGS"
LIBS="$LIBIDL_LIBS $LIBS"
CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS"
LIBS="$HOST_LIBIDL_LIBS $LIBS"
dnl
dnl Now check if the installed LIBIDL is sufficiently new.
dnl
@ -154,7 +150,7 @@ main ()
ifelse([$2], , :, [$2])
else
AC_MSG_RESULT(no)
if test "$LIBIDL_CONFIG" = "no" ; then
if test "$HOST_LIBIDL_CONFIG" = "no" ; then
echo "*** The libIDL-config script installed by libIDL could not be found"
echo "*** If libIDL was installed in PREFIX, make sure PREFIX/bin is in"
echo "*** your path, or set the LIBIDL_CONFIG environment variable to the"
@ -164,8 +160,8 @@ main ()
:
else
echo "*** Could not run libIDL test program, checking why..."
CFLAGS="$CFLAGS $LIBIDL_CFLAGS"
LIBS="$LIBS $LIBIDL_LIBS"
CFLAGS="$CFLAGS $HOST_LIBIDL_CFLAGS"
LIBS="$LIBS $HOST_LIBIDL_LIBS"
AC_TRY_LINK([
#include <stdio.h>
#include <stdlib.h>
@ -188,11 +184,11 @@ main ()
LIBS="$ac_save_LIBS"
fi
fi
LIBIDL_CFLAGS=""
LIBIDL_LIBS=""
HOST_LIBIDL_CFLAGS=""
HOST_LIBIDL_LIBS=""
ifelse([$3], , :, [$3])
fi
AC_SUBST(LIBIDL_CFLAGS)
AC_SUBST(LIBIDL_LIBS)
AC_SUBST(HOST_LIBIDL_CFLAGS)
AC_SUBST(HOST_LIBIDL_LIBS)
rm -f conf.libIDLtest
])

View File

@ -512,6 +512,7 @@ MOZ_ENABLE_PHOTON = @MOZ_ENABLE_PHOTON@
MOZ_ENABLE_XREMOTE = @MOZ_ENABLE_XREMOTE@
MOZ_ENABLE_DWRITE_FONT = @MOZ_ENABLE_DWRITE_FONT@
MOZ_ENABLE_D2D_SURFACE = @MOZ_ENABLE_D2D_SURFACE@
MOZ_ENABLE_D3D9_LAYER = @MOZ_ENABLE_D3D9_LAYER@
MOZ_GTK2_CFLAGS = @MOZ_GTK2_CFLAGS@
MOZ_GTK2_LIBS = @MOZ_GTK2_LIBS@

View File

@ -10,8 +10,13 @@
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false"></ms_asmv3:requestedExecutionLevel>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
</assembly>

View File

@ -2293,9 +2293,6 @@ ia64*-hpux*)
XARGS=xargs
XPCOM_FROZEN_LDOPTS='$(LIBXUL_DIST)/lib/xpcom.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
ZIP=zip
LIBIDL_CFLAGS="-I$MOZ_TOOLS_DIR/include ${GLIB_CFLAGS}"
LIBIDL_LIBS="$MOZ_TOOLS_DIR/lib/libidl-0.6_s.lib $MOZ_TOOLS_DIR/lib/glib-1.2_s.lib"
STATIC_LIBIDL=1
MOZ_TREE_FREETYPE=1
AC_DEFINE(HAVE_SNPRINTF)
@ -2474,84 +2471,7 @@ ia64*-hpux*)
AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
fi
MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
if test -n "$GLIB_PREFIX"; then
_GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
if test "$?" = "0"; then
if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
fi
_GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
else
AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
fi
else
_GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
fi
if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
fi
GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
else
AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
fi
if test -n "$LIBIDL_PREFIX"; then
_LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
if test "$?" = "0"; then
if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
fi
_LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
else
AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
fi
else
_LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
fi
if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
fi
LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
STATIC_LIBIDL=1
elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
else
AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
fi
LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
;;
*) # else cross-compiling
if test -n "$GLIB_PREFIX"; then
GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
else
AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
fi
fi
if test -n "$LIBIDL_PREFIX"; then
LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
STATIC_LIBIDL=1
elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
else
AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
fi
fi
LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
;;
esac
@ -2901,8 +2821,6 @@ alpha*-*-osf*)
MOZ_GFX_OPTIMIZE_MOBILE=1
MOZ_OPTIMIZE_FLAGS="-Os -freorder-blocks -fno-reorder-functions -fomit-frame-pointer"
dnl MOZ_MEMORY=1
;;
esac
@ -4960,18 +4878,6 @@ MOZ_ARG_WITH_STRING(java-bin-path,
Location of Java binaries (java, javac, jar)],
JAVA_BIN_PATH=$withval)
dnl ========================================================
dnl Use ARM userspace kernel helpers; tell NSPR to enable
dnl their usage and use them in spidermonkey.
dnl ========================================================
MOZ_ARG_WITH_BOOL(arm-kuser,
[ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
USE_ARM_KUSER=1,
USE_ARM_KUSER=)
if test -n "$USE_ARM_KUSER"; then
AC_DEFINE(USE_ARM_KUSER)
fi
dnl ========================================================
dnl =
dnl = Application
@ -4988,6 +4894,7 @@ MOZ_OFFICIAL_BRANDING=
MOZ_FEEDS=1
MOZ_IMG_DECODERS_DEFAULT="png gif jpeg bmp icon"
MOZ_IMG_ENCODERS_DEFAULT="png jpeg"
MOZ_INSTALLER=1
MOZ_IPC=1
MOZ_JAVAXPCOM=
MOZ_JSDEBUGGER=1
@ -5033,10 +4940,12 @@ MOZ_XTF=1
MOZ_XUL=1
MOZ_ZIPWRITER=1
NS_PRINTING=1
NSS_DISABLE_DBM=
NECKO_WIFI=1
NECKO_COOKIES=1
NECKO_DISK_CACHE=1
NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource"
USE_ARM_KUSER=
BUILD_CTYPES=1
XPC_IDISPATCH_SUPPORT=
@ -5066,6 +4975,22 @@ case "$target_os" in
;;
esac
case "${target}" in
arm-android-eabi)
NSS_DISABLE_DBM=1
USE_ARM_KUSER=1
MOZ_INSTALLER=
MOZ_CRASHREPORTER=
NS_PRINTING=
NECKO_WIFI=
MOZ_PLUGINS=
MOZ_THUMB2=1
MOZ_THEME_FASTSTRIPE=1
MOZ_TREE_FREETYPE=1
MOZ_MEMORY=1
;;
esac
MOZ_ARG_ENABLE_STRING(application,
[ --enable-application=APP
Options include:
@ -5323,6 +5248,17 @@ fi # COMPILE_ENVIRONMENT
AC_SUBST(MOZ_FS_LAYOUT)
dnl ========================================================
dnl Use ARM userspace kernel helpers; tell NSPR to enable
dnl their usage and use them in spidermonkey.
dnl ========================================================
MOZ_ARG_WITH_BOOL(arm-kuser,
[ --with-arm-kuser Use kuser helpers (Linux/ARM only -- requires kernel 2.6.13 or later)],
USE_ARM_KUSER=1,)
if test -n "$USE_ARM_KUSER"; then
AC_DEFINE(USE_ARM_KUSER)
fi
dnl ========================================================
dnl = startup-notification support module
dnl ========================================================
@ -5803,16 +5739,14 @@ dnl = Disable plugin support
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(plugins,
[ --disable-plugins Disable plugins support],
MOZ_PLUGINS=,
MOZ_PLUGINS=1)
MOZ_PLUGINS=,)
dnl ========================================================
dnl = Disable building dbm
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(dbm,
[ --disable-dbm Disable building dbm],
NSS_DISABLE_DBM=1,
NSS_DISABLE_DBM=)
[ --disable-dbm Disable building dbm],
NSS_DISABLE_DBM=1,)
dnl bi-directional support always on
IBMBIDI=1
@ -5862,8 +5796,7 @@ dnl Disable printing
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(printing,
[ --disable-printing Disable printing support],
NS_PRINTING=,
NS_PRINTING=1 )
NS_PRINTING=,)
if test "$MOZ_WIDGET_TOOLKIT" = "qt"; then
AC_MSG_WARN([Printing does not work with Qt at this time. Omitting printing support.])
@ -5874,7 +5807,6 @@ if test "$NS_PRINTING"; then
AC_DEFINE(NS_PRINTING)
AC_DEFINE(NS_PRINT_PREVIEW)
fi
dnl ========================================================
dnl use native unicode converters
dnl ========================================================
@ -5923,8 +5855,7 @@ dnl = Disable Ogg Codecs
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(ogg,
[ --disable-ogg Disable Ogg Codec support],
MOZ_OGG=,
MOZ_OGG=1)
MOZ_OGG=,)
AC_SUBST(MOZ_OGG)
@ -5960,8 +5891,7 @@ dnl = Disable Wave decoder support
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(wave,
[ --disable-wave Disable Wave decoder support],
MOZ_WAVE=,
MOZ_WAVE=1)
MOZ_WAVE=,)
AC_SUBST(MOZ_WAVE)
@ -6074,8 +6004,7 @@ esac
MOZ_ARG_ENABLE_BOOL(javaxpcom,
[ --enable-javaxpcom
Enable Java-XPCOM bridge],
MOZ_JAVAXPCOM=1,
MOZ_JAVAXPCOM= )
MOZ_JAVAXPCOM=1,)
case "$host_os" in
cygwin*|msvc*|mks*)
@ -6152,8 +6081,7 @@ esac
MOZ_ARG_DISABLE_BOOL(crashreporter,
[ --disable-crashreporter Disable breakpad crash reporting],
MOZ_CRASHREPORTER=,
MOZ_CRASHREPORTER=1)
MOZ_CRASHREPORTER=,)
if test -n "$MOZ_CRASHREPORTER"; then
AC_DEFINE(MOZ_CRASHREPORTER)
@ -6430,8 +6358,7 @@ esac
MOZ_ARG_DISABLE_BOOL(installer,
[ --disable-installer Disable building of installer],
MOZ_INSTALLER=,
MOZ_INSTALLER=1 )
MOZ_INSTALLER=,)
if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
# Disable installer for Windows builds that use the new toolkit if NSIS
# isn't in the path.
@ -6969,7 +6896,7 @@ MOZ_ARG_ENABLE_STRING(debug,
fi ],
MOZ_DEBUG=)
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG"
MOZ_DEBUG_ENABLE_DEFS="-DDEBUG -D_DEBUG -DTRACING"
MOZ_ARG_WITH_STRING(debug-label,
[ --with-debug-label=LABELS
Define DEBUG_<value> for each comma-separated
@ -6978,19 +6905,6 @@ MOZ_ARG_WITH_STRING(debug-label,
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${option}"
done])
case "${target_os}" in
beos*)
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_${USER}"
;;
msvc*|mks*|cygwin*|mingw*|os2*|wince*|winmo*)
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`echo ${USERNAME} | sed -e 's| |_|g'`"
;;
*)
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DDEBUG_`$WHOAMI`"
;;
esac
MOZ_DEBUG_ENABLE_DEFS="$MOZ_DEBUG_ENABLE_DEFS -DTRACING"
MOZ_DEBUG_DISABLE_DEFS="-DNDEBUG -DTRIMMED"
if test -n "$MOZ_DEBUG"; then
@ -7264,6 +7178,8 @@ if test "$MOZ_MEMORY"; then
*-android*)
AC_DEFINE(MOZ_MEMORY_LINUX)
AC_DEFINE(MOZ_MEMORY_ANDROID)
_WRAP_MALLOC=1
export WRAP_MALLOC_LIB="-L$_objdir/dist/lib -lmozalloc"
;;
*)
AC_MSG_ERROR([--enable-jemalloc not supported on ${target}])
@ -7293,7 +7209,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"
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 $@'
fi
fi
@ -8000,14 +7916,7 @@ MOZ_ARG_HEADER(Standalone module options (Not for building Mozilla))
dnl Check for GLib and libIDL.
dnl ========================================================
case "$target_os" in
msvc*|mks*|cygwin*|mingw*|wince*|winmo*)
SKIP_IDL_CHECK="yes"
;;
*)
SKIP_IDL_CHECK="no"
;;
esac
SKIP_IDL_CHECK="no"
if test -z "$COMPILE_ENVIRONMENT"; then
SKIP_IDL_CHECK="yes"
@ -8018,33 +7927,100 @@ MOZ_ARG_WITHOUT_BOOL(libIDL,
[ --without-libIDL Skip check for libIDL (standalone modules only)],
SKIP_IDL_CHECK="yes")
if test -z "$CROSS_COMPILE"; then
if test -z "$HOST_LIBIDL_CONFIG"; then
HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
fi
if test -z "$HOST_LIBIDL_PREFIX"; then
HOST_LIBIDL_PREFIX="$LIBIDL_PREFIX"
fi
fi
if test "$SKIP_IDL_CHECK" = "no"
then
_LIBIDL_FOUND=
if test "$MACOS_SDK_DIR"; then
dnl xpidl, and therefore libIDL, is only needed on the build host.
dnl Don't build it against the SDK, as that causes problems.
_MACSAVE_CFLAGS="$CFLAGS"
_MACSAVE_LIBS="$LIBS"
_MACSAVE_LDFLAGS="$LDFLAGS"
_MACSAVE_NEXT_ROOT="$NEXT_ROOT"
changequote(,)
CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
changequote([,])
unset NEXT_ROOT
case "$host" in
*-mingw*|*-cygwin*|*-msvc*|*-mks*)
if test -n "$GLIB_PREFIX"; then
_GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
if test "$?" = "0"; then
if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
fi
_GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
else
AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
fi
else
_GLIB_PREFIX_DIR=$MOZ_TOOLS_DIR
fi
if test ! -f "${_GLIB_PREFIX_DIR}/include/glib.h"; then
AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/include/glib.h .])
fi
GLIB_CFLAGS="-I${_GLIB_PREFIX_DIR}/include"
if test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"; then
GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
else
AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
fi
if test -n "$HOST_LIBIDL_PREFIX"; then
_LIBIDL_PREFIX_DIR=`cd $HOST_LIBIDL_PREFIX && pwd -W`
if test "$?" = "0"; then
if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
fi
_LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
else
AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
fi
else
_LIBIDL_PREFIX_DIR=$MOZ_TOOLS_DIR
fi
if test ! -f "${_LIBIDL_PREFIX_DIR}/include/libIDL/IDL.h"; then
AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/include/libIDL/IDL.h .])
fi
HOST_LIBIDL_CFLAGS="-I${_LIBIDL_PREFIX_DIR}/include ${GLIB_CFLAGS}"
if test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"; then
HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6_s.lib"
STATIC_LIBIDL=1
elif test -f "${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"; then
HOST_LIBIDL_LIBS="${_LIBIDL_PREFIX_DIR}/lib/libidl-0.6.lib"
else
AC_MSG_ERROR([Cannot find $_LIBIDL_PREFIX_DIR/lib/libidl-0.6.lib or $_LIBIDL_PREFIX_DIR/lib/libidl-0.6_s.lib])
fi
HOST_LIBIDL_LIBS="${HOST_LIBIDL_LIBS} ${GLIB_LIBS}"
_LIBIDL_FOUND=1
;;
esac
if test -z "$_LIBIDL_FOUND"; then
if test "$MACOS_SDK_DIR"; then
dnl xpidl, and therefore libIDL, is only needed on the build host.
dnl Don't build it against the SDK, as that causes problems.
_MACSAVE_CFLAGS="$CFLAGS"
_MACSAVE_LIBS="$LIBS"
_MACSAVE_LDFLAGS="$LDFLAGS"
_MACSAVE_NEXT_ROOT="$NEXT_ROOT"
changequote(,)
CFLAGS=`echo $CFLAGS|sed -E -e "s%((-I|-isystem )${MACOS_SDK_DIR}/usr/(include|lib/gcc)[^ ]*)|-F${MACOS_SDK_DIR}(/System)?/Library/Frameworks[^ ]*|-nostdinc[^ ]*|-isysroot ${MACOS_SDK_DIR}%%g"`
LIBS=`echo $LIBS|sed -e "s?-L${MACOS_SDK_DIR}/usr/lib[^ ]*??g"`
LDFLAGS=`echo $LDFLAGS|sed -e "s?-Wl,-syslibroot,${MACOS_SDK_DIR}??g"`
changequote([,])
unset NEXT_ROOT
fi
PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
fi
if test "$MOZ_ENABLE_GTK2"; then
PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0 glib-2.0 gobject-2.0, _LIBIDL_FOUND=1,_LIBIDL_FOUND=)
fi
dnl if no gtk/libIDL1 or gtk2/libIDL2 combination was found, fall back
dnl to either libIDL1 or libIDL2.
if test -z "$_LIBIDL_FOUND"; then
AM_PATH_LIBIDL($LIBIDL_VERSION,_LIBIDL_FOUND=1)
if test -z "$_LIBIDL_FOUND"; then
PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
PKG_CHECK_MODULES(HOST_LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
fi
fi
dnl
@ -8059,13 +8035,13 @@ then
_ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
_ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
_ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
LIBIDL_CONFIG=
HOST_LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
HOST_LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
HOST_LIBIDL_CONFIG=
_SAVE_CFLAGS="$CFLAGS"
_SAVE_LIBS="$LIBS"
CFLAGS="$LIBIDL_CFLAGS $CFLAGS"
LIBS="$LIBIDL_LIBS $LIBS"
CFLAGS="$HOST_LIBIDL_CFLAGS $CFLAGS"
LIBS="$HOST_LIBIDL_LIBS $LIBS"
AC_TRY_RUN([
#include <stdlib.h>
#include <libIDL/IDL.h>
@ -8079,8 +8055,8 @@ int main() {
}
], [_LIBIDL_FOUND=1
result="yes"],
[LIBIDL_CFLAGS=
LIBIDL_LIBS=
[HOST_LIBIDL_CFLAGS=
HOST_LIBIDL_LIBS=
result="no"],
[_LIBIDL_FOUND=1
result="maybe"] )
@ -8104,16 +8080,42 @@ int main() {
fi
if test -n "$CROSS_COMPILE"; then
if test -z "$HOST_LIBIDL_CONFIG"; then
HOST_LIBIDL_CONFIG="$LIBIDL_CONFIG"
fi
if test -n "$HOST_LIBIDL_CONFIG" && test "$HOST_LIBIDL_CONFIG" != "no"; then
HOST_LIBIDL_CFLAGS=`${HOST_LIBIDL_CONFIG} --cflags`
HOST_LIBIDL_LIBS=`${HOST_LIBIDL_CONFIG} --libs`
else
HOST_LIBIDL_CFLAGS="$LIBIDL_CFLAGS"
HOST_LIBIDL_LIBS="$LIBIDL_LIBS"
fi
case "$target" in
*-mingw*|*-cygwin*|*-msvc*|*-mks*)
if test -n "$GLIB_PREFIX"; then
GLIB_CFLAGS="-I${GLIB_PREFIX}/include"
if test -f "${GLIB_PREFIX}/lib/glib-1.2_s.lib"; then
GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2_s.lib"
elif test -f "${GLIB_PREFIX}/lib/glib-1.2.lib"; then
GLIB_LIBS="${GLIB_PREFIX}/lib/glib-1.2.lib"
else
AC_MSG_ERROR([Cannot find $GLIB_PREFIX/lib/glib-1.2.lib or $GLIB_PREFIX/lib/glib-1.2_s.lib])
fi
fi
if test -n "$LIBIDL_PREFIX"; then
LIBIDL_CFLAGS="-I${LIBIDL_PREFIX}/include ${GLIB_CFLAGS}"
if test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"; then
LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6_s.lib"
STATIC_LIBIDL=1
elif test -f "${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"; then
LIBIDL_LIBS="${LIBIDL_PREFIX}/lib/libIDL-0.6.lib"
else
AC_MSG_ERROR([Cannot find $LIBIDL_PREFIX/lib/libIDL-0.6.lib or $LIBIDL_PREFIX/lib/libIDL-0.6_s.lib])
fi
fi
LIBIDL_LIBS="${LIBIDL_LIBS} ${GLIB_LIBS}"
;;
*)
if test -n "LIBIDL_CONFIG" && test "LIBIDL_CONFIG" != "no"; then
LIBIDL_CFLAGS=`${LIBIDL_CONFIG} --cflags`
LIBIDL_LIBS=`${LIBIDL_CONFIG} --libs`
fi
;;
esac
else
LIBIDL_CFLAGS="$HOST_LIBIDL_CFLAGS"
LIBIDL_LIBS="$HOST_LIBIDL_LIBS"
fi
if test -z "$SKIP_PATH_CHECKS"; then
@ -8198,6 +8200,8 @@ if test "$MOZ_TREE_CAIRO"; then
WIN32_D2D_SURFACE_FEATURE=
fi
AC_CHECK_HEADER(d3d9.h, MOZ_ENABLE_D3D9_LAYER=1)
AC_TRY_COMPILE([#include <ddraw.h>], [int foo = DDLOCK_WAITNOTBUSY;], HAS_DDRAW=1, HAS_DDRAW=)
if test -z "$HAS_DDRAW"; then
AC_MSG_WARN([DirectDraw ddraw.h header not found or it's missing DDLOCK_WAITNOTBUSY, disabling DirectDraw surface. If you have an older SDK (such as the CE5 SDK), try copying in ddraw.lib and ddraw.h from the WM6 SDK.])
@ -8245,6 +8249,7 @@ if test "$MOZ_TREE_CAIRO"; then
AC_SUBST(MOZ_ENABLE_CAIRO_FT)
AC_SUBST(MOZ_ENABLE_DWRITE_FONT)
AC_SUBST(MOZ_ENABLE_D2D_SURFACE)
AC_SUBST(MOZ_ENABLE_D3D9_LAYER)
AC_SUBST(CAIRO_FT_CFLAGS)
AC_SUBST(HAS_OGLES)
@ -8404,9 +8409,7 @@ dnl option to disable necko's wifi scanner
dnl
MOZ_ARG_DISABLE_BOOL(necko-wifi,
[ --disable-necko-wifi Disable necko wifi scanner],
NECKO_WIFI=,
NECKO_WIFI=1
)
NECKO_WIFI=,)
if test "$OS_ARCH" = "OS2"; then
dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566
@ -9014,6 +9017,13 @@ 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 "$_WRAP_MALLOC"; then
_SUBDIR_CONFIG_ARGS="$_SUBDIR_CONFIG_ARGS --enable-wrap-malloc"
fi
if test -z "$MOZ_NATIVE_NSPR"; then
ac_configure_args="$_SUBDIR_CONFIG_ARGS --with-dist-prefix=$MOZ_BUILD_ROOT/dist --with-mozilla"
if test -z "$MOZ_DEBUG"; then
@ -9031,9 +9041,6 @@ if test -z "$MOZ_NATIVE_NSPR"; then
if test -n "$USE_ARM_KUSER"; then
ac_configure_args="$ac_configure_args --with-arm-kuser"
fi
if test -n "$MOZ_THUMB2"; then
ac_configure_args="$ac_configure_args --enable-thumb2"
fi
AC_OUTPUT_SUBDIRS(nsprpub)
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
fi

View File

@ -1,15 +1,18 @@
<Html>
<Html class="reftest-wait">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf8">
</head>
<body>
<body onload="boom()">
<iframe src="#" id="data"></iframe>
<script>
function boom() {
var d=document.getElementById('data').contentDocument;
d.clear()
var text='Тест';
d.write(text);
d.close()
d.close();
document.documentElement.removeAttribute("class");
}
</script>
</body>
</html>

View File

@ -1615,6 +1615,14 @@ public:
static already_AddRefed<mozilla::layers::LayerManager>
LayerManagerForDocument(nsIDocument *aDoc);
/**
* Determine whether a content node is focused or not,
*
* @param aContent the content node to check
* @return true if the content node is focused, false otherwise.
*/
static PRBool IsFocusedContent(nsIContent *aContent);
private:
static PRBool InitializeEventTable();

View File

@ -458,7 +458,6 @@ DragDataProducer::Produce(nsDOMDataTransfer* aDataTransfer,
nsCOMPtr<nsIFormControl> form(do_QueryInterface(findFormParent));
if (form && form->GetType() != NS_FORM_OBJECT &&
form->GetType() != NS_FORM_FIELDSET &&
form->GetType() != NS_FORM_LEGEND &&
form->GetType() != NS_FORM_LABEL &&
form->GetType() != NS_FORM_OUTPUT)
return NS_OK;

View File

@ -178,6 +178,8 @@ static NS_DEFINE_CID(kXTFServiceCID, NS_XTFSERVICE_CID);
#include "nsLayoutUtils.h"
#include "nsFrameManager.h"
#include "BasicLayers.h"
#include "nsFocusManager.h"
#include "nsTextEditorState.h"
#ifdef IBMBIDI
#include "nsIBidiKeyboard.h"
@ -1047,6 +1049,8 @@ nsContentUtils::Shutdown()
NS_IF_RELEASE(sSameOriginChecker);
nsAutoGCRoot::Shutdown();
nsTextEditorState::ShutDown();
}
// static
@ -5953,6 +5957,15 @@ mozAutoRemovableBlockerRemover::~mozAutoRemovableBlockerRemover()
}
}
// static
PRBool
nsContentUtils::IsFocusedContent(nsIContent* aContent)
{
nsFocusManager* fm = nsFocusManager::GetFocusManager();
return fm && fm->GetFocusedContent() == aContent;
}
void nsContentUtils::RemoveNewlines(nsString &aString)
{
// strip CR/LF and null

View File

@ -195,17 +195,16 @@ nsMappedAttributes::SetStyleSheet(nsHTMLStyleSheet* aSheet)
mSheet = aSheet; // not ref counted
}
NS_IMETHODIMP
/* virtual */ void
nsMappedAttributes::MapRuleInfoInto(nsRuleData* aRuleData)
{
if (mRuleMapper) {
(*mRuleMapper)(this, aRuleData);
}
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
/* virtual */ void
nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const
{
nsAutoString buffer;
@ -228,8 +227,6 @@ nsMappedAttributes::List(FILE* out, PRInt32 aIndent) const
fputs(NS_LossyConvertUTF16toASCII(buffer).get(), out);
fputs("\n", out);
}
return NS_OK;
}
#endif

View File

@ -103,9 +103,9 @@ public:
// nsIStyleRule
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
NS_METHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
private:

View File

@ -48,10 +48,7 @@ class nsFormSubmission;
enum FormControlsTypes {
NS_FORM_FIELDSET = 1,
NS_FORM_LABEL,
NS_FORM_OPTION,
NS_FORM_OPTGROUP,
NS_FORM_OUTPUT,
NS_FORM_LEGEND,
NS_FORM_SELECT,
NS_FORM_TEXTAREA,
NS_FORM_OBJECT,

View File

@ -40,32 +40,174 @@
#define nsITextControlElement_h___
#include "nsISupports.h"
class nsIContent;
class nsAString;
class nsITextControlFrame;
class nsIEditor;
class nsISelectionController;
class nsFrameSelection;
class nsTextControlFrame;
// IID for the nsITextControl interface
#define NS_ITEXTCONTROLELEMENT_IID \
{ 0x8c22af1e, 0x1dd2, 0x11b2, \
{ 0x9d, 0x72, 0xb4, 0xc1, 0x53, 0x68, 0xdc, 0xa1 } }
{ 0x66545dde, 0x3f4a, 0x49fd, \
{ 0x82, 0x73, 0x69, 0x7e, 0xab, 0x54, 0x06, 0x0a } }
/**
* This interface is used for the text control frame to store its value away
* into the content.
* This interface is used for the text control frame to get the editor and
* selection controller objects, and some helper properties.
*/
class nsITextControlElement : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ITEXTCONTROLELEMENT_IID)
/**
* Set the control's value without security checks
*/
NS_IMETHOD TakeTextFrameValue(const nsAString& aValue) = 0;
/**
* Tell the control that value has been deliberately changed (or not).
*/
NS_IMETHOD SetValueChanged(PRBool changed) = 0;
/**
* Find out whether this is a single line text control. (text or password)
* @return whether this is a single line text control
*/
NS_IMETHOD_(PRBool) IsSingleLineTextControl() const = 0;
/**
* Find out whether this control is a textarea.
* @return whether this is a textarea text control
*/
NS_IMETHOD_(PRBool) IsTextArea() const = 0;
/**
* Find out whether this control edits plain text. (Currently always true.)
* @return whether this is a plain text control
*/
NS_IMETHOD_(PRBool) IsPlainTextControl() const = 0;
/**
* Find out whether this is a password control (input type=password)
* @return whether this is a password ontrol
*/
NS_IMETHOD_(PRBool) IsPasswordTextControl() const = 0;
/**
* Get the cols attribute (if textarea) or a default
* @return the number of columns to use
*/
NS_IMETHOD_(PRInt32) GetCols() = 0;
/**
* Get the column index to wrap at, or -1 if we shouldn't wrap
*/
NS_IMETHOD_(PRInt32) GetWrapCols() = 0;
/**
* Get the rows attribute (if textarea) or a default
* @return the number of rows to use
*/
NS_IMETHOD_(PRInt32) GetRows() = 0;
/**
* Get the default value of the text control
*/
NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue) = 0;
/**
* Return true if the value of the control has been changed.
*/
NS_IMETHOD_(PRBool) ValueChanged() const = 0;
/**
* Get the current value of the text editor.
*
* @param aValue the buffer to retrieve the value in
* @param aIgnoreWrap whether to ignore the text wrapping behavior specified
* for the element.
*/
NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const = 0;
/**
* Set the current value of the text editor.
*
* @param aValue the new value for the text control.
* @param aUserInput whether this value is coming from user input.
*/
NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput) = 0;
/**
* Get the editor object associated with the text editor.
* The return value is null if the control does not support an editor
* (for example, if it is a checkbox.)
*/
NS_IMETHOD_(nsIEditor*) GetTextEditor() = 0;
/**
* Get the selection controller object associated with the text editor.
* The return value is null if the control does not support an editor
* (for example, if it is a checkbox.)
*/
NS_IMETHOD_(nsISelectionController*) GetSelectionController() = 0;
NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection() = 0;
/**
* Binds a frame to the text control. This is performed when a frame
* is created for the content node.
*/
NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame) = 0;
/**
* Unbinds a frame from the text control. This is performed when a frame
* belonging to a content node is destroyed.
*/
NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame) = 0;
/**
* Creates an editor for the text control. This should happen when
* a frame has been created for the text control element, but the created
* editor may outlive the frame itself.
*/
NS_IMETHOD CreateEditor() = 0;
/**
* Get the anonymous root node for the text control.
*/
NS_IMETHOD_(nsIContent*) GetRootEditorNode() = 0;
/**
* Get the placeholder anonymous node for the text control.
*/
NS_IMETHOD_(nsIContent*) GetPlaceholderNode() = 0;
/**
* Initialize the keyboard event listeners.
*/
NS_IMETHOD_(void) InitializeKeyboardEventListeners() = 0;
/**
* Notify the text control that the placeholder text needs to be updated.
*/
NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify) = 0;
/**
* Show/hide the placeholder for the control.
*/
NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify) = 0;
static const PRInt32 DEFAULT_COLS = 20;
static const PRInt32 DEFAULT_ROWS = 1;
static const PRInt32 DEFAULT_ROWS_TEXTAREA = 2;
static const PRInt32 DEFAULT_UNDO_CAP = 1000;
// wrap can be one of these three values.
typedef enum {
eHTMLTextWrap_Off = 1, // "off"
eHTMLTextWrap_Hard = 2, // "hard"
eHTMLTextWrap_Soft = 3 // the default
} nsHTMLTextWrap;
static PRBool
GetWrapPropertyEnum(nsIContent* aContent, nsHTMLTextWrap& aWrapProp);
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsITextControlElement,

View File

@ -58,6 +58,7 @@ CPPSRCS = \
nsGenericHTMLElement.cpp \
nsFormSubmission.cpp \
nsImageMapUtils.cpp \
nsTextEditorState.cpp \
nsHTMLAnchorElement.cpp \
nsHTMLAreaElement.cpp \
nsHTMLBRElement.cpp \
@ -124,6 +125,7 @@ INCLUDES += \
-I$(srcdir)/../../../base/src \
-I$(srcdir)/../../../events/src \
-I$(srcdir)/../../../xbl/src \
-I$(srcdir)/../../../../layout/forms \
-I$(srcdir)/../../../../layout/style \
-I$(srcdir)/../../../../layout/tables \
-I$(srcdir)/../../../../layout/xul/base/src \

View File

@ -110,6 +110,7 @@
#include "nsContentCreatorFunctions.h"
#include "mozAutoDocUpdate.h"
#include "nsHtml5Module.h"
#include "nsITextControlElement.h"
#include "nsThreadUtils.h"
@ -2685,7 +2686,6 @@ nsGenericHTMLFormElement::CanBeDisabled() const
// It's easier to test the types that _cannot_ be disabled
return
type != NS_FORM_LABEL &&
type != NS_FORM_LEGEND &&
type != NS_FORM_FIELDSET &&
type != NS_FORM_OBJECT &&
type != NS_FORM_OUTPUT;
@ -2708,14 +2708,20 @@ nsGenericHTMLFormElement::IsTextControl(PRBool aExcludePassword) const
type == NS_FORM_TEXTAREA;
}
PRBool
nsGenericHTMLFormElement::IsSingleLineTextControlInternal(PRBool aExcludePassword,
PRInt32 aType) const
{
return aType == NS_FORM_INPUT_TEXT ||
aType == NS_FORM_INPUT_SEARCH ||
aType == NS_FORM_INPUT_TEL ||
(!aExcludePassword && aType == NS_FORM_INPUT_PASSWORD);
}
PRBool
nsGenericHTMLFormElement::IsSingleLineTextControl(PRBool aExcludePassword) const
{
PRInt32 type = GetType();
return type == NS_FORM_INPUT_TEXT ||
type == NS_FORM_INPUT_SEARCH ||
type == NS_FORM_INPUT_TEL ||
(!aExcludePassword && type == NS_FORM_INPUT_PASSWORD);
return IsSingleLineTextControlInternal(aExcludePassword, GetType());
}
PRBool
@ -2726,10 +2732,7 @@ nsGenericHTMLFormElement::IsLabelableControl() const
PRInt32 type = GetType();
return type != NS_FORM_FIELDSET &&
type != NS_FORM_LABEL &&
type != NS_FORM_OPTION &&
type != NS_FORM_OPTGROUP &&
type != NS_FORM_OBJECT &&
type != NS_FORM_LEGEND;
type != NS_FORM_OBJECT;
}
PRInt32
@ -3170,12 +3173,10 @@ nsGenericHTMLElement::GetEditorInternal(nsIEditor** aEditor)
{
*aEditor = nsnull;
nsIFormControlFrame *fcFrame = GetFormControlFrame(PR_FALSE);
if (fcFrame) {
nsITextControlFrame *textFrame = do_QueryFrame(fcFrame);
if (textFrame) {
return textFrame->GetEditor(aEditor);
}
nsCOMPtr<nsITextControlElement> textCtrl = do_QueryInterface(this);
if (textCtrl) {
*aEditor = textCtrl->GetTextEditor();
NS_IF_ADDREF(*aEditor);
}
return NS_OK;

View File

@ -863,6 +863,8 @@ protected:
void UpdateEditableFormControlState();
PRBool IsSingleLineTextControlInternal(PRBool aExcludePassword, PRInt32 mType) const;
// The focusability state of this form control. eUnfocusable means that it
// shouldn't be focused at all, eInactiveWindow means it's in an inactive
// window, eActiveWindow means it's in an active window.

View File

@ -69,9 +69,9 @@ public:
NS_DECL_ISUPPORTS
// nsIStyleRule interface
NS_IMETHOD MapRuleInfoInto(nsRuleData* aRuleData);
virtual void MapRuleInfoInto(nsRuleData* aRuleData);
#ifdef DEBUG
NS_IMETHOD List(FILE* out = stdout, PRInt32 aIndent = 0) const;
virtual void List(FILE* out = stdout, PRInt32 aIndent = 0) const;
#endif
nsHTMLBodyElement* mPart; // not ref-counted, cleared by content
@ -132,11 +132,11 @@ BodyRule::~BodyRule()
NS_IMPL_ISUPPORTS1(BodyRule, nsIStyleRule)
NS_IMETHODIMP
/* virtual */ void
BodyRule::MapRuleInfoInto(nsRuleData* aData)
{
if (!aData || !(aData->mSIDs & NS_STYLE_INHERIT_BIT(Margin)) || !aData->mMarginData || !mPart)
return NS_OK; // We only care about margins.
return; // We only care about margins.
PRInt32 bodyMarginWidth = -1;
PRInt32 bodyMarginHeight = -1;
@ -261,14 +261,12 @@ BodyRule::MapRuleInfoInto(nsRuleData* aData)
}
}
}
return NS_OK;
}
#ifdef DEBUG
NS_IMETHODIMP
/* virtual */ void
BodyRule::List(FILE* out, PRInt32 aIndent) const
{
return NS_OK;
}
#endif

View File

@ -202,9 +202,6 @@ ShouldBeInElements(nsIFormControl* aFormControl)
//
// NS_FORM_INPUT_IMAGE
// NS_FORM_LABEL
// NS_FORM_OPTION
// NS_FORM_OPTGROUP
// NS_FORM_LEGEND
return PR_FALSE;
}

View File

@ -112,6 +112,8 @@
#include "nsTextEditRules.h"
#include "nsTextEditorState.h"
// XXX align=left, hspace, vspace, border? other nav4 attrs
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
@ -308,9 +310,30 @@ public:
virtual PRInt32 IntrinsicState() const;
// nsITextControlElement
NS_IMETHOD TakeTextFrameValue(const nsAString& aValue);
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
NS_IMETHOD_(PRBool) IsSingleLineTextControl() const;
NS_IMETHOD_(PRBool) IsTextArea() const;
NS_IMETHOD_(PRBool) IsPlainTextControl() const;
NS_IMETHOD_(PRBool) IsPasswordTextControl() const;
NS_IMETHOD_(PRInt32) GetCols();
NS_IMETHOD_(PRInt32) GetWrapCols();
NS_IMETHOD_(PRInt32) GetRows();
NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue);
NS_IMETHOD_(PRBool) ValueChanged() const;
NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const;
NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput);
NS_IMETHOD_(nsIEditor*) GetTextEditor();
NS_IMETHOD_(nsISelectionController*) GetSelectionController();
NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection();
NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame);
NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame);
NS_IMETHOD CreateEditor();
NS_IMETHOD_(nsIContent*) GetRootEditorNode();
NS_IMETHOD_(nsIContent*) GetPlaceholderNode();
NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify);
NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify);
NS_IMETHOD_(void) InitializeKeyboardEventListeners();
// nsIFileControlElement
virtual void GetDisplayFileName(nsAString& aFileName);
virtual void GetFileArray(nsCOMArray<nsIFile> &aFile);
@ -341,9 +364,12 @@ public:
void MaybeLoadImage();
protected:
// Pull IsSingleLineTextControl into our scope, otherwise it'd be hidden
// by the nsITextControlElement version.
using nsGenericHTMLFormElement::IsSingleLineTextControl;
// Helper method
nsresult SetValueInternal(const nsAString& aValue,
nsITextControlFrame* aFrame,
PRBool aUserInput);
void ClearFileNames() {
@ -455,6 +481,9 @@ protected:
*/
PRBool NeedToInitializeEditorForEvent(nsEventChainPreVisitor& aVisitor) const;
void FreeData();
nsTextEditorState *GetEditorState() const;
nsCOMPtr<nsIControllers> mControllers;
/**
@ -467,10 +496,24 @@ protected:
* @see GET_BOOLBIT / SET_BOOLBIT macros and BF_* field identifiers
*/
PRInt16 mBitField;
/**
* The current value of the input if it has been changed from the default
/*
* In mInputData, the mState field is used if IsSingleLineTextControl returns
* true and mValue is used otherwise. We have to be careful when handling it
* on a type change.
*
* Accessing the mState member should be done using the GetEditorState function,
* which returns null if the state is not present.
*/
char* mValue;
union InputData {
/**
* The current value of the input if it has been changed from the default
*/
char* mValue;
/**
* The state of the text editor associated with the text/password input
*/
nsTextEditorState* mState;
} mInputData;
/**
* The value of the input if it is a file input. This is the list of filenames
* used when uploading a file. It is vital that this is kept separate from
@ -503,20 +546,43 @@ nsHTMLInputElement::nsHTMLInputElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mType(kInputDefaultType->value),
mBitField(0),
mValue(nsnull)
mBitField(0)
{
SET_BOOLBIT(mBitField, BF_PARSER_CREATING, aFromParser);
mInputData.mState = new nsTextEditorState(this);
NS_ADDREF(mInputData.mState);
}
nsHTMLInputElement::~nsHTMLInputElement()
{
DestroyImageLoadingContent();
if (mValue) {
nsMemory::Free(mValue);
FreeData();
}
void
nsHTMLInputElement::FreeData()
{
if (!IsSingleLineTextControl(PR_FALSE)) {
nsMemory::Free(mInputData.mValue);
mInputData.mValue = nsnull;
} else {
NS_IF_RELEASE(mInputData.mState);
}
}
nsTextEditorState*
nsHTMLInputElement::GetEditorState() const
{
if (!IsSingleLineTextControl(PR_FALSE)) {
return nsnull;
}
NS_ASSERTION(mInputData.mState,
"Single line text controls need to have a state associated with them");
return mInputData.mState;
}
// nsISupports
@ -524,6 +590,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLInputElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLInputElement,
nsGenericHTMLFormElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mControllers)
if (tmp->IsSingleLineTextControl(PR_FALSE)) {
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mInputData.mState, nsTextEditorState)
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsHTMLInputElement, nsGenericElement)
@ -578,7 +647,7 @@ nsHTMLInputElement::Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const
nsAutoString value;
const_cast<nsHTMLInputElement*>(this)->GetValue(value);
// SetValueInternal handles setting the VALUE_CHANGED bit for us
it->SetValueInternal(value, nsnull, PR_FALSE);
it->SetValueInternal(value, PR_FALSE);
}
break;
case NS_FORM_INPUT_FILE:
@ -707,20 +776,17 @@ nsHTMLInputElement::AfterSetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
mType = kInputDefaultType->value;
}
// If we are changing type from File/Text/Tel/Passwd
// to other input types we need save the mValue into value attribute
if (mValue &&
// If we are changing type from File/Text/Tel/Passwd to other input types
// we need save the mValue into value attribute
if (mInputData.mValue &&
mType != NS_FORM_INPUT_TEXT &&
mType != NS_FORM_INPUT_SEARCH &&
mType != NS_FORM_INPUT_PASSWORD &&
mType != NS_FORM_INPUT_TEL &&
mType != NS_FORM_INPUT_FILE) {
SetAttr(kNameSpaceID_None, nsGkAtoms::value,
NS_ConvertUTF8toUTF16(mValue), PR_FALSE);
if (mValue) {
nsMemory::Free(mValue);
mValue = nsnull;
}
NS_ConvertUTF8toUTF16(mInputData.mValue), PR_FALSE);
FreeData();
}
if (mType != NS_FORM_INPUT_IMAGE) {
@ -889,40 +955,9 @@ nsHTMLInputElement::SetSize(PRUint32 aValue)
NS_IMETHODIMP
nsHTMLInputElement::GetValue(nsAString& aValue)
{
if (IsSingleLineTextControl(PR_FALSE)) {
// No need to flush here, if there's no frame created for this
// input yet, there won't be a value in it (that we don't already
// have) even if we force it to be created
nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
PRBool frameOwnsValue = PR_FALSE;
if (formControlFrame) {
nsITextControlFrame* textControlFrame = do_QueryFrame(formControlFrame);
if (textControlFrame) {
textControlFrame->OwnsValue(&frameOwnsValue);
} else {
// We assume if it's not a text control frame that it owns the value
frameOwnsValue = PR_TRUE;
}
}
if (frameOwnsValue) {
formControlFrame->GetFormProperty(nsGkAtoms::value, aValue);
} else {
if (!GET_BOOLBIT(mBitField, BF_VALUE_CHANGED) || !mValue) {
GetDefaultValue(aValue);
} else {
CopyUTF8toUTF16(mValue, aValue);
}
// If the value is not owned by the frame, then we should handle any
// exiting newline characters inside it, instead of relying on the
// editor to do it for us.
nsString value(aValue);
nsTextEditRules::HandleNewLines(value, -1);
aValue.Assign(value);
}
nsTextEditorState* state = GetEditorState();
if (state) {
state->GetValue(aValue, PR_TRUE);
return NS_OK;
}
@ -979,7 +1014,7 @@ nsHTMLInputElement::SetValue(const nsAString& aValue)
}
}
else {
SetValueInternal(aValue, nsnull, PR_FALSE);
SetValueInternal(aValue, PR_FALSE);
}
return NS_OK;
@ -1045,21 +1080,106 @@ nsHTMLInputElement::SetUserInput(const nsAString& aValue)
{
SetSingleFileName(aValue);
} else {
SetValueInternal(aValue, nsnull, PR_TRUE);
SetValueInternal(aValue, PR_TRUE);
}
return NS_OK;
}
NS_IMETHODIMP
nsHTMLInputElement::TakeTextFrameValue(const nsAString& aValue)
NS_IMETHODIMP_(nsIEditor*)
nsHTMLInputElement::GetTextEditor()
{
if (mValue) {
nsMemory::Free(mValue);
nsTextEditorState *state = GetEditorState();
if (state) {
return state->GetEditor();
}
return nsnull;
}
NS_IMETHODIMP_(nsISelectionController*)
nsHTMLInputElement::GetSelectionController()
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->GetSelectionController();
}
return nsnull;
}
nsFrameSelection*
nsHTMLInputElement::GetConstFrameSelection()
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->GetConstFrameSelection();
}
return nsnull;
}
NS_IMETHODIMP
nsHTMLInputElement::BindToFrame(nsTextControlFrame* aFrame)
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->BindToFrame(aFrame);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::UnbindFromFrame(nsTextControlFrame* aFrame)
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->UnbindFromFrame(aFrame);
}
}
NS_IMETHODIMP
nsHTMLInputElement::CreateEditor()
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->PrepareEditor();
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP_(nsIContent*)
nsHTMLInputElement::GetRootEditorNode()
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->GetRootNode();
}
return nsnull;
}
NS_IMETHODIMP_(nsIContent*)
nsHTMLInputElement::GetPlaceholderNode()
{
nsTextEditorState *state = GetEditorState();
if (state) {
return state->GetPlaceholderNode();
}
return nsnull;
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::UpdatePlaceholderText(PRBool aNotify)
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->UpdatePlaceholderText(aNotify);
}
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::SetPlaceholderClass(PRBool aVisible, PRBool aNotify)
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->SetPlaceholderClass(aVisible, aNotify);
}
nsString value(aValue);
nsContentUtils::PlatformToDOMLineBreaks(value);
mValue = ToNewUTF8String(value);
return NS_OK;
}
void
@ -1158,32 +1278,19 @@ nsHTMLInputElement::UpdateFileList()
nsresult
nsHTMLInputElement::SetValueInternal(const nsAString& aValue,
nsITextControlFrame* aFrame,
PRBool aUserInput)
{
NS_PRECONDITION(mType != NS_FORM_INPUT_FILE,
"Don't call SetValueInternal for file inputs");
if (IsSingleLineTextControl(PR_FALSE)) {
nsIFormControlFrame* formControlFrame = aFrame;
if (!formControlFrame) {
// No need to flush here, if there's no frame at this point we
// don't need to force creation of one just to tell it about this
// new value.
formControlFrame = GetFormControlFrame(PR_FALSE);
}
if (formControlFrame) {
// Always set the value in the frame. If the frame does not own the
// value yet (per OwnsValue()), it will turn around and call
// TakeTextFrameValue() on us, but will update its display with the new
// value if needed.
return formControlFrame->SetFormProperty(
aUserInput ? nsGkAtoms::userInput : nsGkAtoms::value, aValue);
}
// Need to set the value changed flag here, so that
// nsTextControlFrame::UpdateValueDisplay retrieves the correct value
// if needed.
SetValueChanged(PR_TRUE);
return TakeTextFrameValue(aValue);
mInputData.mState->SetValue(aValue, aUserInput);
return NS_OK;
}
if (mType == NS_FORM_INPUT_FILE) {
@ -1210,9 +1317,8 @@ nsHTMLInputElement::SetValueChanged(PRBool aValueChanged)
{
SET_BOOLBIT(mBitField, BF_VALUE_CHANGED, aValueChanged);
if (!aValueChanged) {
if (mValue) {
nsMemory::Free(mValue);
mValue = nsnull;
if (!IsSingleLineTextControl(PR_FALSE)) {
FreeData();
}
}
return NS_OK;
@ -2281,6 +2387,19 @@ nsHTMLInputElement::ParseAttribute(PRInt32 aNamespaceID,
ClearFileNames();
}
// Only single line text inputs have a text editor state.
PRBool isNewTypeSingleLine =
IsSingleLineTextControlInternal(PR_FALSE, newType);
PRBool isCurrentTypeSingleLine =
IsSingleLineTextControl(PR_FALSE);
if (isNewTypeSingleLine && !isCurrentTypeSingleLine) {
FreeData();
mInputData.mState = new nsTextEditorState(this);
NS_ADDREF(mInputData.mState);
} else if (isCurrentTypeSingleLine && !isNewTypeSingleLine) {
FreeData();
}
mType = newType;
}
@ -2909,7 +3028,7 @@ nsHTMLInputElement::RestoreState(nsPresState* aState)
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_HIDDEN:
{
SetValueInternal(inputState->GetValue(), nsnull, PR_FALSE);
SetValueInternal(inputState->GetValue(), PR_FALSE);
break;
}
case NS_FORM_INPUT_FILE:
@ -3286,3 +3405,98 @@ NS_GetRadioGetCheckedChangedVisitor(PRBool* aCheckedChanged,
return NS_OK;
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsSingleLineTextControl() const
{
return IsSingleLineTextControl(PR_FALSE);
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsTextArea() const
{
return PR_FALSE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsPlainTextControl() const
{
// need to check our HTML attribute and/or CSS.
return PR_TRUE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::IsPasswordTextControl() const
{
return mType == NS_FORM_INPUT_PASSWORD;
}
NS_IMETHODIMP_(PRInt32)
nsHTMLInputElement::GetCols()
{
// Else we know (assume) it is an input with size attr
const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::size);
if (attr && attr->Type() == nsAttrValue::eInteger) {
PRInt32 cols = attr->GetIntegerValue();
if (cols > 0) {
return cols;
}
}
return DEFAULT_COLS;
}
NS_IMETHODIMP_(PRInt32)
nsHTMLInputElement::GetWrapCols()
{
return -1; // only textarea's can have wrap cols
}
NS_IMETHODIMP_(PRInt32)
nsHTMLInputElement::GetRows()
{
return DEFAULT_ROWS;
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::GetDefaultValueFromContent(nsAString& aValue)
{
nsTextEditorState *state = GetEditorState();
if (state) {
GetDefaultValue(aValue);
}
}
NS_IMETHODIMP_(PRBool)
nsHTMLInputElement::ValueChanged() const
{
return GET_BOOLBIT(mBitField, BF_VALUE_CHANGED);
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::GetTextEditorValue(nsAString& aValue,
PRBool aIgnoreWrap) const
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->GetValue(aValue, aIgnoreWrap);
}
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::SetTextEditorValue(const nsAString& aValue,
PRBool aUserInput)
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->SetValue(aValue, aUserInput);
}
}
NS_IMETHODIMP_(void)
nsHTMLInputElement::InitializeKeyboardEventListeners()
{
nsTextEditorState *state = GetEditorState();
if (state) {
state->InitializeKeyboardEventListeners();
}
}

View File

@ -49,7 +49,7 @@
#include "nsFocusManager.h"
#include "nsIFrame.h"
class nsHTMLLegendElement : public nsGenericHTMLFormElement,
class nsHTMLLegendElement : public nsGenericHTMLElement,
public nsIDOMHTMLLegendElement
{
public:
@ -60,23 +60,18 @@ public:
NS_DECL_ISUPPORTS_INHERITED
// nsIDOMNode
NS_FORWARD_NSIDOMNODE(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMNODE(nsGenericHTMLElement::)
// nsIDOMElement
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLElement
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLFormElement::)
NS_FORWARD_NSIDOMHTMLELEMENT(nsGenericHTMLElement::)
// nsIDOMHTMLLegendElement
NS_DECL_NSIDOMHTMLLEGENDELEMENT
// nsIFormControl
NS_IMETHOD_(PRUint32) GetType() const { return NS_FORM_LEGEND; }
NS_IMETHOD Reset();
NS_IMETHOD SubmitNamesValues(nsFormSubmission* aFormSubmission,
nsIContent* aSubmitElement);
// nsGenericHTMLElement
NS_IMETHODIMP Focus();
virtual void PerformAccesskey(PRBool aKeyCausesActivation,
@ -120,7 +115,7 @@ NS_IMPL_NS_NEW_HTML_ELEMENT(Legend)
nsHTMLLegendElement::nsHTMLLegendElement(nsINodeInfo *aNodeInfo)
: nsGenericHTMLFormElement(aNodeInfo)
: nsGenericHTMLElement(aNodeInfo)
{
}
@ -139,7 +134,7 @@ DOMCI_DATA(HTMLLegendElement, nsHTMLLegendElement)
NS_INTERFACE_TABLE_HEAD(nsHTMLLegendElement)
NS_HTML_CONTENT_INTERFACE_TABLE1(nsHTMLLegendElement, nsIDOMHTMLLegendElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TO_MAP_SEGUE(nsHTMLLegendElement,
nsGenericHTMLFormElement)
nsGenericHTMLElement)
NS_HTML_CONTENT_INTERFACE_TABLE_TAIL_CLASSINFO(HTMLLegendElement)
@ -204,7 +199,7 @@ nsHTMLLegendElement::GetAttributeChangeHint(const nsIAtom* aAttribute,
PRInt32 aModType) const
{
nsChangeHint retval =
nsGenericHTMLFormElement::GetAttributeChangeHint(aAttribute, aModType);
nsGenericHTMLElement::GetAttributeChangeHint(aAttribute, aModType);
if (aAttribute == nsGkAtoms::align) {
NS_UpdateHint(retval, NS_STYLE_HINT_REFLOW);
}
@ -222,8 +217,8 @@ nsHTMLLegendElement::SetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
UnregAccessKey();
}
nsresult rv = nsGenericHTMLFormElement::SetAttr(aNameSpaceID, aAttribute,
aPrefix, aValue, aNotify);
nsresult rv = nsGenericHTMLElement::SetAttr(aNameSpaceID, aAttribute,
aPrefix, aValue, aNotify);
if (accesskey && !aValue.IsEmpty()) {
SetFlags(NODE_HAS_ACCESSKEY);
@ -244,13 +239,7 @@ nsHTMLLegendElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aAttribute,
UnsetFlags(NODE_HAS_ACCESSKEY);
}
return nsGenericHTMLFormElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
}
nsresult
nsHTMLLegendElement::Reset()
{
return NS_OK;
return nsGenericHTMLElement::UnsetAttr(aNameSpaceID, aAttribute, aNotify);
}
nsresult
@ -258,9 +247,9 @@ nsHTMLLegendElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
nsIContent* aBindingParent,
PRBool aCompileEventHandlers)
{
nsresult rv = nsGenericHTMLFormElement::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent,
aBindingParent,
aCompileEventHandlers);
NS_ENSURE_SUCCESS(rv, rv);
if (aDocument) {
@ -277,7 +266,7 @@ nsHTMLLegendElement::UnbindFromTree(PRBool aDeep, PRBool aNullParent)
UnregAccessKey();
}
nsGenericHTMLFormElement::UnbindFromTree(aDeep, aNullParent);
nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent);
}
NS_IMETHODIMP
@ -310,9 +299,3 @@ nsHTMLLegendElement::PerformAccesskey(PRBool aKeyCausesActivation,
Focus();
}
NS_IMETHODIMP
nsHTMLLegendElement::SubmitNamesValues(nsFormSubmission* aFormSubmission,
nsIContent* aSubmitElement)
{
return NS_OK;
}

View File

@ -77,6 +77,8 @@
#include "mozAutoDocUpdate.h"
#include "nsISupportsPrimitives.h"
#include "nsTextEditorState.h"
static NS_DEFINE_CID(kXULControllersCID, NS_XULCONTROLLERS_CID);
#define NS_NO_CONTENT_DISPATCH (1 << 0)
@ -90,7 +92,6 @@ class nsHTMLTextAreaElement : public nsGenericHTMLFormElement,
{
public:
nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo, PRBool aFromParser = PR_FALSE);
virtual ~nsHTMLTextAreaElement();
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
@ -126,8 +127,29 @@ public:
virtual PRBool RestoreState(nsPresState* aState);
// nsITextControlElemet
NS_IMETHOD TakeTextFrameValue(const nsAString& aValue);
NS_IMETHOD SetValueChanged(PRBool aValueChanged);
NS_IMETHOD_(PRBool) IsSingleLineTextControl() const;
NS_IMETHOD_(PRBool) IsTextArea() const;
NS_IMETHOD_(PRBool) IsPlainTextControl() const;
NS_IMETHOD_(PRBool) IsPasswordTextControl() const;
NS_IMETHOD_(PRInt32) GetCols();
NS_IMETHOD_(PRInt32) GetWrapCols();
NS_IMETHOD_(PRInt32) GetRows();
NS_IMETHOD_(void) GetDefaultValueFromContent(nsAString& aValue);
NS_IMETHOD_(PRBool) ValueChanged() const;
NS_IMETHOD_(void) GetTextEditorValue(nsAString& aValue, PRBool aIgnoreWrap) const;
NS_IMETHOD_(void) SetTextEditorValue(const nsAString& aValue, PRBool aUserInput);
NS_IMETHOD_(nsIEditor*) GetTextEditor();
NS_IMETHOD_(nsISelectionController*) GetSelectionController();
NS_IMETHOD_(nsFrameSelection*) GetConstFrameSelection();
NS_IMETHOD BindToFrame(nsTextControlFrame* aFrame);
NS_IMETHOD_(void) UnbindFromFrame(nsTextControlFrame* aFrame);
NS_IMETHOD CreateEditor();
NS_IMETHOD_(nsIContent*) GetRootEditorNode();
NS_IMETHOD_(nsIContent*) GetPlaceholderNode();
NS_IMETHOD_(void) UpdatePlaceholderText(PRBool aNotify);
NS_IMETHOD_(void) SetPlaceholderClass(PRBool aVisible, PRBool aNotify);
NS_IMETHOD_(void) InitializeKeyboardEventListeners();
// nsIContent
virtual PRBool ParseAttribute(PRInt32 aNamespaceID,
@ -172,9 +194,9 @@ public:
nsGenericHTMLFormElement)
protected:
using nsGenericHTMLFormElement::IsSingleLineTextControl; // get rid of the compiler warning
nsCOMPtr<nsIControllers> mControllers;
/** The current value. This is null if the frame owns the value. */
char* mValue;
/** Whether or not the value has changed since its default value was given. */
PRPackedBool mValueChanged;
/** Whether or not we are already handling select event. */
@ -184,6 +206,8 @@ protected:
PRPackedBool mDoneAddingChildren;
/** Whether our disabled state has changed from the default **/
PRPackedBool mDisabledChanged;
/** The state of the text editor (selection controller and the editor) **/
nsRefPtr<nsTextEditorState> mState;
NS_IMETHOD SelectAll(nsPresContext* aPresContext);
/**
@ -196,7 +220,6 @@ protected:
void GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap);
nsresult SetValueInternal(const nsAString& aValue,
nsITextControlFrame* aFrame,
PRBool aUserInput);
nsresult GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd);
@ -223,22 +246,15 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(TextArea)
nsHTMLTextAreaElement::nsHTMLTextAreaElement(nsINodeInfo *aNodeInfo,
PRBool aFromParser)
: nsGenericHTMLFormElement(aNodeInfo),
mValue(nsnull),
mValueChanged(PR_FALSE),
mHandlingSelect(PR_FALSE),
mDoneAddingChildren(!aFromParser),
mDisabledChanged(PR_FALSE)
mDisabledChanged(PR_FALSE),
mState(new nsTextEditorState(this))
{
AddMutationObserver(this);
}
nsHTMLTextAreaElement::~nsHTMLTextAreaElement()
{
if (mValue) {
nsMemory::Free(mValue);
}
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLTextAreaElement)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLTextAreaElement,
@ -248,6 +264,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLTextAreaElement,
nsGenericHTMLFormElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mControllers)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mState, nsTextEditorState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsHTMLTextAreaElement, nsGenericElement)
@ -397,79 +414,78 @@ nsHTMLTextAreaElement::GetValue(nsAString& aValue)
void
nsHTMLTextAreaElement::GetValueInternal(nsAString& aValue, PRBool aIgnoreWrap)
{
// Get the frame.
// No need to flush here, if there is no frame yet for this textarea
// there won't be a value in it we don't already have even if we
// force the frame to be created.
nsIFrame* primaryFrame = GetPrimaryFrame();
nsITextControlFrame* textControlFrame = nsnull;
if (primaryFrame) {
textControlFrame = do_QueryFrame(primaryFrame);
}
mState->GetValue(aValue, aIgnoreWrap);
}
// If the frame exists and owns the value, get it from the frame. Otherwise
// get it from content.
PRBool frameOwnsValue = PR_FALSE;
if (textControlFrame) {
textControlFrame->OwnsValue(&frameOwnsValue);
}
if (frameOwnsValue) {
textControlFrame->GetValue(aValue, aIgnoreWrap);
} else {
if (!mValueChanged || !mValue) {
GetDefaultValue(aValue);
} else {
CopyUTF8toUTF16(mValue, aValue);
}
}
NS_IMETHODIMP_(nsIEditor*)
nsHTMLTextAreaElement::GetTextEditor()
{
return mState->GetEditor();
}
NS_IMETHODIMP_(nsISelectionController*)
nsHTMLTextAreaElement::GetSelectionController()
{
return mState->GetSelectionController();
}
NS_IMETHODIMP_(nsFrameSelection*)
nsHTMLTextAreaElement::GetConstFrameSelection()
{
return mState->GetConstFrameSelection();
}
NS_IMETHODIMP
nsHTMLTextAreaElement::TakeTextFrameValue(const nsAString& aValue)
nsHTMLTextAreaElement::BindToFrame(nsTextControlFrame* aFrame)
{
if (mValue) {
nsMemory::Free(mValue);
}
nsString value(aValue);
nsContentUtils::PlatformToDOMLineBreaks(value);
mValue = ToNewUTF8String(value);
return NS_OK;
return mState->BindToFrame(aFrame);
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::UnbindFromFrame(nsTextControlFrame* aFrame)
{
mState->UnbindFromFrame(aFrame);
}
NS_IMETHODIMP
nsHTMLTextAreaElement::CreateEditor()
{
return mState->PrepareEditor();
}
NS_IMETHODIMP_(nsIContent*)
nsHTMLTextAreaElement::GetRootEditorNode()
{
return mState->GetRootNode();
}
NS_IMETHODIMP_(nsIContent*)
nsHTMLTextAreaElement::GetPlaceholderNode()
{
return mState->GetPlaceholderNode();
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::UpdatePlaceholderText(PRBool aNotify)
{
mState->UpdatePlaceholderText(aNotify);
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::SetPlaceholderClass(PRBool aVisible, PRBool aNotify)
{
mState->SetPlaceholderClass(aVisible, aNotify);
}
nsresult
nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
nsITextControlFrame* aFrame,
PRBool aUserInput)
{
nsITextControlFrame* textControlFrame = aFrame;
nsIFormControlFrame* formControlFrame = textControlFrame;
if (!textControlFrame) {
// No need to flush here, if there is no frame for this yet forcing
// creation of one will not do us any good
formControlFrame = GetFormControlFrame(PR_FALSE);
if (formControlFrame) {
textControlFrame = do_QueryFrame(formControlFrame);
}
}
PRBool frameOwnsValue = PR_FALSE;
if (textControlFrame) {
textControlFrame->OwnsValue(&frameOwnsValue);
}
if (frameOwnsValue) {
formControlFrame->SetFormProperty(
aUserInput ? nsGkAtoms::userInput : nsGkAtoms::value, aValue);
}
else {
if (mValue) {
nsMemory::Free(mValue);
}
mValue = ToNewUTF8String(aValue);
NS_ENSURE_TRUE(mValue, NS_ERROR_OUT_OF_MEMORY);
SetValueChanged(PR_TRUE);
}
// Need to set the value changed flag here, so that
// nsTextControlFrame::UpdateValueDisplay retrieves the correct value
// if needed.
SetValueChanged(PR_TRUE);
mState->SetValue(aValue, aUserInput);
return NS_OK;
}
@ -477,7 +493,7 @@ nsHTMLTextAreaElement::SetValueInternal(const nsAString& aValue,
NS_IMETHODIMP
nsHTMLTextAreaElement::SetValue(const nsAString& aValue)
{
return SetValueInternal(aValue, nsnull, PR_FALSE);
return SetValueInternal(aValue, PR_FALSE);
}
NS_IMETHODIMP
@ -486,7 +502,7 @@ nsHTMLTextAreaElement::SetUserInput(const nsAString& aValue)
if (!nsContentUtils::IsCallerTrustedForWrite()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
SetValueInternal(aValue, nsnull, PR_TRUE);
SetValueInternal(aValue, PR_TRUE);
return NS_OK;
}
@ -494,9 +510,8 @@ NS_IMETHODIMP
nsHTMLTextAreaElement::SetValueChanged(PRBool aValueChanged)
{
mValueChanged = aValueChanged;
if (!aValueChanged && mValue) {
nsMemory::Free(mValue);
mValue = nsnull;
if (!aValueChanged && !mState->IsEmpty()) {
mState->EmptyValue();
}
return NS_OK;
}
@ -1003,3 +1018,101 @@ nsHTMLTextAreaElement::CopyInnerTo(nsGenericElement* aDest) const
return NS_OK;
}
NS_IMETHODIMP_(PRBool)
nsHTMLTextAreaElement::IsSingleLineTextControl() const
{
return PR_FALSE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLTextAreaElement::IsTextArea() const
{
return PR_TRUE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLTextAreaElement::IsPlainTextControl() const
{
// need to check our HTML attribute and/or CSS.
return PR_TRUE;
}
NS_IMETHODIMP_(PRBool)
nsHTMLTextAreaElement::IsPasswordTextControl() const
{
return PR_FALSE;
}
NS_IMETHODIMP_(PRInt32)
nsHTMLTextAreaElement::GetCols()
{
const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::cols);
if (attr) {
PRInt32 cols = attr->Type() == nsAttrValue::eInteger ?
attr->GetIntegerValue() : 0;
// XXX why a default of 1 char, why hide it
return (cols <= 0) ? 1 : cols;
}
return DEFAULT_COLS;
}
NS_IMETHODIMP_(PRInt32)
nsHTMLTextAreaElement::GetWrapCols()
{
// wrap=off means -1 for wrap width no matter what cols is
nsHTMLTextWrap wrapProp;
nsITextControlElement::GetWrapPropertyEnum(this, wrapProp);
if (wrapProp == nsITextControlElement::eHTMLTextWrap_Off) {
// do not wrap when wrap=off
return -1;
}
// Otherwise we just wrap at the given number of columns
return GetCols();
}
NS_IMETHODIMP_(PRInt32)
nsHTMLTextAreaElement::GetRows()
{
const nsAttrValue* attr = GetParsedAttr(nsGkAtoms::rows);
if (attr && attr->Type() == nsAttrValue::eInteger) {
PRInt32 rows = attr->GetIntegerValue();
return (rows <= 0) ? DEFAULT_ROWS_TEXTAREA : rows;
}
return DEFAULT_ROWS_TEXTAREA;
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue)
{
GetDefaultValue(aValue);
}
NS_IMETHODIMP_(PRBool)
nsHTMLTextAreaElement::ValueChanged() const
{
return mValueChanged;
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::GetTextEditorValue(nsAString& aValue,
PRBool aIgnoreWrap) const
{
mState->GetValue(aValue, aIgnoreWrap);
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::SetTextEditorValue(const nsAString& aValue,
PRBool aUserInput)
{
mState->SetValue(aValue, aUserInput);
}
NS_IMETHODIMP_(void)
nsHTMLTextAreaElement::InitializeKeyboardEventListeners()
{
mState->InitializeKeyboardEventListeners();
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,239 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set sw=2 ts=2 et tw=80: */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla.org client code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Ehsan Akhgari <ehsan@mozilla.com> (Original Author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsTextEditorState_h__
#define nsTextEditorState_h__
#include "nsAutoPtr.h"
#include "nsITextControlElement.h"
#include "nsCycleCollectionParticipant.h"
class nsTextInputListener;
class nsTextControlFrame;
class nsTextInputSelectionImpl;
class nsAnonDivObserver;
class nsISelectionController;
class nsFrameSelection;
class nsIEditor;
class nsITextControlElement;
/**
* nsTextEditorState is a class which is responsible for managing the state of
* plaintext controls. This currently includes the following HTML elements:
* <input type=text>
* <input type=password>
* <textarea>
* and also XUL controls such as <textbox> which use one of these elements behind
* the scenes.
*
* This class is held as a member of nsHTMLInputElement and nsHTMLTextAreaElement.
* The public functions in this class include the public APIs which content/ uses.
* Layout code uses the nsITextControlElement interface to invoke functions on this
* class.
*
* The design motivation behind this class is maintaining all of the things which
* collectively are considered the "state" of the text control in a single location.
* This state includes several things:
*
* * The control's value. This value is stored in the mValue member, and is only
* used when there is no frame for the control, or when the editor object has
* not been initialized yet.
*
* * The control's associated frame. This value is stored in the mBoundFrame member.
* A text control might never have an associated frame during its life cycle,
* or might have several different ones, but at any given moment in time there is
* a maximum of 1 bound frame to each text control.
*
* * The control's associated editor. This value is stored in the mEditor member.
* An editor is initilized for the control only when necessary (that is, when either
* the user is about to interact with the text control, or when some other code
* needs to access the editor object. Without a frame bound to the control, an
* editor is never initialzied. Once initialized, the editor might outlive the frame,
* in which case the same editor will be used if a new frame gets bound to the
* text control.
*
* * The anonymous content associated with the text control's frame, including the
* value div (the DIV element responsible for holding the value of the text control)
* and the placeholder div (the DIV element responsible for holding the placeholder
* value of the text control.) These values are stored in the mRootNode and
* mPlaceholderDiv members, respectively. They will be created when a
* frame is bound to the text control. They will be destroyed when the frame is
* unbound from the object. We could try and hold on to the anonymous content
* between different frames, but unfortunately that is not currently possible
* because they are not unbound from the document in time.
*
* * The frame selection controller. This value is stored in the mSelCon member.
* The frame selection controller is responsible for maintaining the selection state
* on a frame. It is created when a frame is bound to the text control element,
* and will be destroy when the frame is being unbound from the text control element.
* It is created alongside with the frame selection object which is stored in the
* mFrameSel member.
*
* * The editor text listener. This value is stored in the mTextListener member.
* Its job is to listen to selection and keyboard events, and act accordingly.
* It is created when an a frame is first bound to the control, and will be destroyed
* when the frame is unbound from the text control element.
*
* * The editor's cached value. This value is stored in the mCachedValue member.
* It is used to improve the performance of append operations to the text
* control. A mutation observer stored in the mAnonDivObserver has the job of
* invalidating this cache when the anonymous contect containing the value is
* changed.
*
*
* As a general rule, nsTextEditorState objects own the value of the text control, and any
* attempt to retrieve or set the value must be made through those objects. Internally,
* the value can be represented in several different ways, based on the state the control is
* in.
*
* * When the control is first initialized, its value is equal to the default value of
* the DOM node. For <input> text controls, this default value is the value of the
* value attribute. For <textarea> elements, this default value is the value of the
* text node children of the element.
*
* * If the value has been changed through the DOM node (before the editor for the object
* is initialized), the value is stored as a simple string inside the mValue member of
* the nsTextEditorState object.
*
* * If an editor has been initialized for the control, the value is set and retrievd via
* the nsIPlaintextEditor interface, and is internally managed by the editor as the
* native anonymous content tree attached to the control's frame.
*
* * If the text editor state object is unbound from the control's frame, the value is
* transferred to the mValue member variable, and will be managed there until a new
* frame is bound to the text editor state object.
*/
class nsTextEditorState {
public:
explicit nsTextEditorState(nsITextControlElement* aOwningElement);
~nsTextEditorState();
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(nsTextEditorState)
NS_INLINE_DECL_REFCOUNTING(nsTextEditorState)
nsIEditor* GetEditor();
nsISelectionController* GetSelectionController() const;
nsFrameSelection* GetConstFrameSelection();
nsresult BindToFrame(nsTextControlFrame* aFrame);
void UnbindFromFrame(nsTextControlFrame* aFrame);
nsresult PrepareEditor(const nsAString *aValue = nsnull);
void InitializeKeyboardEventListeners();
void SetValue(const nsAString& aValue, PRBool aUserInput);
void GetValue(nsAString& aValue, PRBool aIgnoreWrap) const;
void EmptyValue() { if (mValue) mValue->Truncate(); }
PRBool IsEmpty() const { return mValue ? mValue->IsEmpty() : PR_TRUE; }
nsIContent* GetRootNode() {
if (!mRootNode)
CreateRootNode();
return mRootNode;
}
nsIContent* GetPlaceholderNode() {
if (!mPlaceholderDiv)
CreatePlaceholderNode();
return mPlaceholderDiv;
}
PRBool IsSingleLineTextControl() const {
return mTextCtrlElement->IsSingleLineTextControl();
}
PRBool IsTextArea() const {
return mTextCtrlElement->IsTextArea();
}
PRBool IsPlainTextControl() const {
return mTextCtrlElement->IsPlainTextControl();
}
PRBool IsPasswordTextControl() const {
return mTextCtrlElement->IsPasswordTextControl();
}
PRInt32 GetCols() {
return mTextCtrlElement->GetCols();
}
PRInt32 GetWrapCols() {
return mTextCtrlElement->GetWrapCols();
}
PRInt32 GetRows() {
return mTextCtrlElement->GetRows();
}
// placeholder methods
void SetPlaceholderClass(PRBool aVisible, PRBool aNotify);
void UpdatePlaceholderText(PRBool aNotify);
/**
* Get the maxlength attribute
* @param aMaxLength the value of the max length attr
* @returns PR_FALSE if attr not defined
*/
PRBool GetMaxLength(PRInt32* aMaxLength);
/* called to free up native keybinding services */
static NS_HIDDEN_(void) ShutDown();
void ClearValueCache() { mCachedValue.Truncate(); }
private:
// not copy constructible
nsTextEditorState(const nsTextEditorState&);
// not assignable
void operator= (const nsTextEditorState&);
nsresult CreateRootNode();
nsresult CreatePlaceholderNode();
void ValueWasChanged(PRBool aNotify);
void DestroyEditor();
void Clear();
nsITextControlElement* const mTextCtrlElement;
nsRefPtr<nsTextInputSelectionImpl> mSelCon;
nsCOMPtr<nsIEditor> mEditor;
nsCOMPtr<nsIContent> mRootNode;
nsCOMPtr<nsIContent> mPlaceholderDiv;
nsTextControlFrame* mBoundFrame;
nsTextInputListener* mTextListener;
nsAutoPtr<nsCString> mValue;
nsRefPtr<nsAnonDivObserver> mMutationObserver;
mutable nsString mCachedValue; // Caches non-hard-wrapped value on a multiline control.
PRPackedBool mEditorInitialized;
};
#endif

View File

@ -70,6 +70,7 @@ struct nsSVGEnumMapping;
class nsSVGViewBox;
class nsSVGPreserveAspectRatio;
class nsSVGString;
struct gfxMatrix;
typedef nsStyledElement nsSVGElementBase;

View File

@ -3,7 +3,7 @@ load 369126-1.html
load 403574-1.xhtml
load 430124-1.html
load 430628-1.html
asserts(1-4) load 432114-1.html # bug ?
asserts(1-4) load 432114-1.html # bug 570215
asserts(0-1) load 432114-2.html # bug 492165
load 436900-1.html
asserts(0-2) load 436900-2.html # bug 566159

View File

@ -7302,17 +7302,32 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
native_parent = doc;
// But for HTML form controls, use the form as scope parent.
if (nodeIsElement &&
node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> form_control(do_QueryInterface(node));
if (nodeIsElement) {
if (node->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) {
nsCOMPtr<nsIFormControl> form_control(do_QueryInterface(node));
if (form_control) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
form_control->GetForm(getter_AddRefs(form));
if (form_control) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
form_control->GetForm(getter_AddRefs(form));
if (form) {
// Found a form, use it.
native_parent = form;
if (form) {
// Found a form, use it.
native_parent = form;
}
}
// Legend isn't an HTML form control but should have its fieldset form
// as scope parent at least for backward compatibility.
} else if (node->AsElement()->IsHTML() &&
node->AsElement()->Tag() == nsGkAtoms::legend) {
nsCOMPtr<nsIDOMHTMLLegendElement> legend(do_QueryInterface(node));
if (legend) {
nsCOMPtr<nsIDOMHTMLFormElement> form;
legend->GetForm(getter_AddRefs(form));
if (form) {
native_parent = form;
}
}
}
}

View File

@ -0,0 +1,79 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Android code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michael Wu <mwu@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGeolocation.h"
#include "nsGeoPosition.h"
#include "AndroidBridge.h"
#include "AndroidLocationProvider.h"
using namespace mozilla;
extern nsIGeolocationUpdate *gLocationCallback;
NS_IMPL_ISUPPORTS1(AndroidLocationProvider, nsIGeolocationProvider)
AndroidLocationProvider::AndroidLocationProvider()
{
}
AndroidLocationProvider::~AndroidLocationProvider()
{
NS_IF_RELEASE(gLocationCallback);
}
NS_IMETHODIMP
AndroidLocationProvider::Startup()
{
AndroidBridge::Bridge()->EnableLocation(true);
return NS_OK;
}
NS_IMETHODIMP
AndroidLocationProvider::Watch(nsIGeolocationUpdate* aCallback)
{
NS_IF_RELEASE(gLocationCallback);
gLocationCallback = aCallback;
NS_IF_ADDREF(gLocationCallback);
return NS_OK;
}
NS_IMETHODIMP
AndroidLocationProvider::Shutdown()
{
AndroidBridge::Bridge()->EnableLocation(false);
return NS_OK;
}

View File

@ -0,0 +1,53 @@
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Mozilla Android code.
*
* The Initial Developer of the Original Code is Mozilla Foundation.
* Portions created by the Initial Developer are Copyright (C) 2010
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Michael Wu <mwu@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef AndroidLocationProvider_h
#define AndroidLocationProvider_h
#include "nsIGeolocationProvider.h"
class AndroidLocationProvider : public nsIGeolocationProvider
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIGEOLOCATIONPROVIDER
AndroidLocationProvider();
private:
~AndroidLocationProvider();
};
#endif /* AndroidLocationProvider_h */

View File

@ -37,6 +37,7 @@
#include <stdio.h>
#include <math.h>
#include "nsGeoPosition.h"
#include "MaemoLocationProvider.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfoID.h"
@ -46,138 +47,6 @@
#include "nsIServiceManager.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords
////////////////////////////////////////////////////
class nsGeoPositionCoords : public nsIDOMGeoPositionCoords
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONCOORDS
nsGeoPositionCoords(double aLat, double aLong, double aAlt, double aHError,
double aVError, double aHeading, double aSpeed) :
mLat(aLat), mLong(aLong), mAlt(aAlt), mHError(aHError),
mVError(aVError), mHeading(aHeading), mSpeed(aSpeed) { };
private:
~nsGeoPositionCoords() { }
double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
};
NS_INTERFACE_MAP_BEGIN(nsGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionCoords)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords)
NS_IMETHODIMP
nsGeoPositionCoords::GetLatitude(double *aLatitude)
{
*aLatitude = mLat;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetLongitude(double *aLongitude)
{
*aLongitude = mLong;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitude(double *aAltitude)
{
*aAltitude = mAlt;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAccuracy(double *aAccuracy)
{
*aAccuracy = mHError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitudeAccuracy(double *aAltitudeAccuracy)
{
*aAltitudeAccuracy = mVError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetHeading(double *aHeading)
{
*aHeading = mHeading;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetSpeed(double *aSpeed)
{
*aSpeed = mSpeed;
return NS_OK;
}
////////////////////////////////////////////////////
// nsGeoPosition
////////////////////////////////////////////////////
class nsGeoPosition : public nsIDOMGeoPosition
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITION
nsGeoPosition(double aLat, double aLong, double aAlt, double aHError,
double aVError, double aHeading, double aSpeed,
long long aTimestamp): mTimestamp(aTimestamp)
{
mCoords = new nsGeoPositionCoords(aLat, aLong, aAlt, aHError,
aVError, aHeading, aSpeed);
NS_ASSERTION(mCoords, "null mCoords in nsGeoPosition");
};
private:
~nsGeoPosition() {}
long long mTimestamp;
nsRefPtr<nsGeoPositionCoords> mCoords;
};
NS_INTERFACE_MAP_BEGIN(nsGeoPosition)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPosition)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPosition)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition)
NS_IMETHODIMP
nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp)
{
*aTimestamp = mTimestamp;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords * *aCoords)
{
NS_IF_ADDREF(*aCoords = mCoords);
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetAddress(nsIDOMGeoPositionAddress** aAddress)
{
*aAddress = nsnull;
return NS_OK;
}
NS_IMPL_ISUPPORTS2(MaemoLocationProvider, nsIGeolocationProvider, nsITimerCallback)
MaemoLocationProvider::MaemoLocationProvider() :

View File

@ -62,14 +62,19 @@ LOCAL_INCLUDES = \
$(NULL)
ifdef WINCE_WINDOWS_MOBILE
CPPSRCS += WinMobileLocationProvider.cpp
CPPSRCS += WinMobileLocationProvider.cpp nsGeoPosition.cpp
endif
ifdef MOZ_MAEMO_LIBLOCATION
CPPSRCS += MaemoLocationProvider.cpp
CPPSRCS += MaemoLocationProvider.cpp nsGeoPosition.cpp
LOCAL_INCLUDES += $(MOZ_PLATFORM_MAEMO_CFLAGS)
endif
ifeq ($(MOZ_WIDGET_TOOLKIT),android)
CPPSRCS += AndroidLocationProvider.cpp nsGeoPosition.cpp
EXPORTS += nsGeoPosition.h
endif
EXTRA_COMPONENTS = \
NetworkGeolocationProvider.js \
GPSDGeolocationProvider.js \

View File

@ -36,6 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsGeoPosition.h"
#include "WinMobileLocationProvider.h"
#include "nsGeolocation.h"
#include "nsIClassInfo.h"
@ -44,152 +45,6 @@
#include "nsIPrefBranch.h"
#include "nsIServiceManager.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords
////////////////////////////////////////////////////
/**
* Simple object that holds a single point in space.
*/
class nsGeoPositionCoords : public nsIDOMGeoPositionCoords
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONCOORDS
nsGeoPositionCoords(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed) :
mLat(aLat), mLong(aLong),
mAlt(aAlt), mHError(aHError),
mVError(aVError), mHeading(aHeading),
mSpeed(aSpeed) {};
private:
~nsGeoPositionCoords() {}
double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
};
DOMCI_DATA(GeoPositionCoords, nsGeoPositionCoords)
NS_INTERFACE_MAP_BEGIN(nsGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionCoords)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords)
NS_IMETHODIMP
nsGeoPositionCoords::GetLatitude(double *aLatitude)
{
*aLatitude = mLat;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetLongitude(double *aLongitude)
{
*aLongitude = mLong;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitude(double *aAltitude)
{
*aAltitude = mAlt;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAccuracy(double *aAccuracy)
{
*aAccuracy = mHError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitudeAccuracy(double *aAltitudeAccuracy)
{
*aAltitudeAccuracy = mVError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetHeading(double *aHeading)
{
*aHeading = mHeading;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetSpeed(double *aSpeed)
{
*aSpeed = mSpeed;
return NS_OK;
}
////////////////////////////////////////////////////
// nsGeoPosition
////////////////////////////////////////////////////
class nsGeoPosition : public nsIDOMGeoPosition
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITION
nsGeoPosition(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed, long long aTimestamp): mTimestamp(aTimestamp)
{
mCoords = new nsGeoPositionCoords(aLat, aLong,
aAlt, aHError,
aVError, aHeading,
aSpeed);
NS_ASSERTION(mCoords, "null mCoords in nsGeoPosition");
};
private:
~nsGeoPosition() {}
long long mTimestamp;
nsRefPtr<nsGeoPositionCoords> mCoords;
};
DOMCI_DATA(GeoPosition, nsGeoPosition)
NS_INTERFACE_MAP_BEGIN(nsGeoPosition)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPosition)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPosition)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition)
NS_IMETHODIMP
nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp)
{
*aTimestamp = mTimestamp;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords * *aCoords)
{
NS_IF_ADDREF(*aCoords = mCoords);
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetAddress(nsIDOMGeoPositionAddress** aAddress)
{
*aAddress = nsnull;
return NS_OK;
}
NS_IMPL_ISUPPORTS2(WinMobileLocationProvider, nsIGeolocationProvider, nsITimerCallback)
WinMobileLocationProvider::WinMobileLocationProvider() :

View File

@ -0,0 +1,172 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Geolocation.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsGeoPosition.h"
#include "nsDOMClassInfo.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords
////////////////////////////////////////////////////
nsGeoPositionCoords::nsGeoPositionCoords(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed) :
mLat(aLat), mLong(aLong),
mAlt(aAlt), mHError(aHError),
mVError(aVError), mHeading(aHeading),
mSpeed(aSpeed)
{
}
nsGeoPositionCoords::~nsGeoPositionCoords()
{
}
DOMCI_DATA(GeoPositionCoords, nsGeoPositionCoords)
NS_INTERFACE_MAP_BEGIN(nsGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPositionCoords)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCoords)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPositionCoords)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPositionCoords)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPositionCoords)
NS_IMETHODIMP
nsGeoPositionCoords::GetLatitude(double *aLatitude)
{
*aLatitude = mLat;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetLongitude(double *aLongitude)
{
*aLongitude = mLong;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitude(double *aAltitude)
{
*aAltitude = mAlt;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAccuracy(double *aAccuracy)
{
*aAccuracy = mHError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetAltitudeAccuracy(double *aAltitudeAccuracy)
{
*aAltitudeAccuracy = mVError;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetHeading(double *aHeading)
{
*aHeading = mHeading;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPositionCoords::GetSpeed(double *aSpeed)
{
*aSpeed = mSpeed;
return NS_OK;
}
////////////////////////////////////////////////////
// nsGeoPosition
////////////////////////////////////////////////////
nsGeoPosition::nsGeoPosition(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed, long long aTimestamp) :
mTimestamp(aTimestamp)
{
mCoords = new nsGeoPositionCoords(aLat, aLong,
aAlt, aHError,
aVError, aHeading,
aSpeed);
NS_ASSERTION(mCoords, "null mCoords in nsGeoPosition");
}
nsGeoPosition::~nsGeoPosition()
{
}
DOMCI_DATA(GeoPosition, nsGeoPosition)
NS_INTERFACE_MAP_BEGIN(nsGeoPosition)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMGeoPosition)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPosition)
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(GeoPosition)
NS_INTERFACE_MAP_END
NS_IMPL_THREADSAFE_ADDREF(nsGeoPosition)
NS_IMPL_THREADSAFE_RELEASE(nsGeoPosition)
NS_IMETHODIMP
nsGeoPosition::GetTimestamp(DOMTimeStamp* aTimestamp)
{
*aTimestamp = mTimestamp;
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetCoords(nsIDOMGeoPositionCoords * *aCoords)
{
NS_IF_ADDREF(*aCoords = mCoords);
return NS_OK;
}
NS_IMETHODIMP
nsGeoPosition::GetAddress(nsIDOMGeoPositionAddress** aAddress)
{
*aAddress = nsnull;
return NS_OK;
}

View File

@ -0,0 +1,93 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Geolocation.
*
* The Initial Developer of the Original Code is Mozilla Foundation
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@meer.net> (Original Author)
* Nino D'Aversa <ninodaversa@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsGeoPosition_h
#define nsGeoPosition_h
#include "nsAutoPtr.h"
#include "nsIClassInfo.h"
#include "nsDOMClassInfoID.h"
#include "nsIDOMGeoPositionCoords.h"
#include "nsIDOMGeoPosition.h"
////////////////////////////////////////////////////
// nsGeoPositionCoords
////////////////////////////////////////////////////
/**
* Simple object that holds a single point in space.
*/
class nsGeoPositionCoords : public nsIDOMGeoPositionCoords
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITIONCOORDS
nsGeoPositionCoords(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed);
private:
~nsGeoPositionCoords();
double mLat, mLong, mAlt, mHError, mVError, mHeading, mSpeed;
};
////////////////////////////////////////////////////
// nsGeoPosition
////////////////////////////////////////////////////
class nsGeoPosition : public nsIDOMGeoPosition
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMGEOPOSITION
nsGeoPosition(double aLat, double aLong,
double aAlt, double aHError,
double aVError, double aHeading,
double aSpeed, long long aTimestamp);
private:
~nsGeoPosition();
long long mTimestamp;
nsRefPtr<nsGeoPositionCoords> mCoords;
};
#endif /* nsGeoPosition_h */

View File

@ -62,6 +62,10 @@
#include "MaemoLocationProvider.h"
#endif
#ifdef ANDROID
#include "AndroidLocationProvider.h"
#endif
#include "nsIDOMDocument.h"
#include "nsIDocument.h"
@ -426,6 +430,12 @@ nsresult nsGeolocationService::Init()
if (provider)
mProviders.AppendObject(provider);
#endif
#ifdef ANDROID
provider = new AndroidLocationProvider();
if (provider)
mProviders.AppendObject(provider);
#endif
return NS_OK;
}
@ -962,7 +972,7 @@ nsGeolocation::WindowOwnerStillExists()
return PR_TRUE;
}
#ifndef WINCE_WINDOWS_MOBILE
#if !defined(WINCE_WINDOWS_MOBILE) && !defined(MOZ_MAEMO_LIBLOCATION) && !defined(ANDROID)
DOMCI_DATA(GeoPositionCoords, void)
DOMCI_DATA(GeoPosition, void)
#endif

View File

@ -34,6 +34,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsGeoLocation_h
#define nsGeoLocation_h
#include "nsCOMPtr.h"
#include "nsAutoPtr.h"
@ -223,3 +225,5 @@ private:
// owning back pointer.
nsRefPtr<nsGeolocationService> mService;
};
#endif /* nsGeoLocation_h */

View File

@ -65,7 +65,6 @@
#include "nsITransactionManager.h"
#include "nsIAbsorbingTransaction.h"
#include "nsIPresShell.h"
#include "nsIViewManager.h"
#include "nsISelection.h"
#include "nsISelectionPrivate.h"
#include "nsISelectionController.h"
@ -134,7 +133,6 @@ extern nsIParserService *sParserService;
nsEditor::nsEditor()
: mModCount(0)
, mPresShellWeak(nsnull)
, mViewManager(nsnull)
, mUpdateCount(0)
, mSpellcheckCheckboxState(eTriUnset)
, mPlaceHolderTxn(nsnull)
@ -166,8 +164,6 @@ nsEditor::~nsEditor()
mTxnMgr = nsnull;
delete mPhonetic;
NS_IF_RELEASE(mViewManager);
}
NS_IMPL_CYCLE_COLLECTION_CLASS(nsEditor)
@ -245,15 +241,6 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
nsCOMPtr<nsINode> document = do_QueryInterface(aDoc);
document->AddMutationObserver(this);
// Set up the DTD
// XXX - in the long run we want to get this from the document, but there
// is no way to do that right now. So we leave it null here and set
// up a nav html dtd in nsHTMLEditor::Init
mViewManager = ps->GetViewManager();
if (!mViewManager) {return NS_ERROR_NULL_POINTER;}
NS_ADDREF(mViewManager);
mUpdateCount=0;
/* initialize IME stuff */
@ -281,6 +268,9 @@ nsEditor::Init(nsIDOMDocument *aDoc, nsIPresShell* aPresShell, nsIContent *aRoot
NS_POSTCONDITION(mDocWeak && mPresShellWeak, "bad state");
// Make sure that the editor will be destroyed properly
mDidPreDestroy = PR_FALSE;
return NS_OK;
}
@ -318,7 +308,9 @@ nsEditor::PostCreate()
nsresult
nsEditor::CreateEventListeners()
{
NS_ENSURE_TRUE(!mEventListener, NS_ERROR_ALREADY_INITIALIZED);
// Don't create the handler twice
if (mEventListener)
return NS_OK;
mEventListener = do_QueryInterface(
static_cast<nsIDOMKeyListener*>(new nsEditorEventListener()));
NS_ENSURE_TRUE(mEventListener, NS_ERROR_OUT_OF_MEMORY);
@ -4177,7 +4169,14 @@ nsresult nsEditor::BeginUpdateViewBatch()
}
// Turn off view updating.
mBatch.BeginUpdateViewBatch(mViewManager);
nsCOMPtr<nsIPresShell> ps;
GetPresShell(getter_AddRefs(ps));
if (ps) {
nsCOMPtr<nsIViewManager> viewManager = ps->GetViewManager();
if (viewManager) {
mBatch.BeginUpdateViewBatch(viewManager);
}
}
}
mUpdateCount++;
@ -4219,7 +4218,10 @@ nsresult nsEditor::EndUpdateViewBatch()
GetFlags(&flags);
// Turn view updating back on.
if (mViewManager)
nsCOMPtr<nsIViewManager> viewManager;
if (presShell)
viewManager = presShell->GetViewManager();
if (viewManager)
{
PRUint32 updateFlag = NS_VMREFRESH_IMMEDIATE;

View File

@ -657,7 +657,6 @@ protected:
nsWeakPtr mPresShellWeak; // weak reference to the nsIPresShell
nsWeakPtr mSelConWeak; // weak reference to the nsISelectionController
nsIViewManager *mViewManager;
PRInt32 mUpdateCount;
nsIViewManager::UpdateViewBatch mBatch;

View File

@ -97,7 +97,6 @@ nsresult
nsEditorEventListener::Connect(nsEditor* aEditor)
{
NS_ENSURE_ARG(aEditor);
NS_ENSURE_TRUE(!mEditor, NS_ERROR_NOT_AVAILABLE);
mEditor = aEditor;

View File

@ -8,6 +8,7 @@
<uses-sdk android:minSdkVersion="5"
android:targetSdkVersion="5"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

View File

@ -51,6 +51,7 @@ import android.content.*;
import android.graphics.*;
import android.widget.*;
import android.hardware.*;
import android.location.*;
import android.util.*;
import android.content.DialogInterface;
@ -192,6 +193,24 @@ class GeckoAppShell
}
}
public static void enableLocation(boolean enable) {
LocationManager lm = (LocationManager)
GeckoApp.surfaceView.getContext().getSystemService(Context.LOCATION_SERVICE);
if (enable) {
Criteria crit = new Criteria();
crit.setAccuracy(Criteria.ACCURACY_FINE);
String provider = lm.getBestProvider(crit, true);
if (provider == null)
return;
sendEventToGecko(new GeckoEvent(lm.getLastKnownLocation(provider)));
lm.requestLocationUpdates(provider, 100, (float).5, GeckoApp.surfaceView, Looper.getMainLooper());
} else {
lm.removeUpdates(GeckoApp.surfaceView);
}
}
public static void returnIMEQueryResult(String result, int selectionStart, int selectionEnd) {
GeckoApp.surfaceView.inputConnection.mSelectionStart = selectionStart;
GeckoApp.surfaceView.inputConnection.mSelectionEnd = selectionEnd;

View File

@ -44,6 +44,7 @@ import android.content.*;
import android.graphics.*;
import android.widget.*;
import android.hardware.*;
import android.location.*;
import android.util.Log;
@ -58,10 +59,11 @@ public class GeckoEvent {
public static final int KEY_EVENT = 1;
public static final int MOTION_EVENT = 2;
public static final int SENSOR_EVENT = 3;
public static final int IME_EVENT = 4;
public static final int DRAW = 5;
public static final int SIZE_CHANGED = 6;
public static final int ACTIVITY_STOPPING = 7;
public static final int LOCATION_EVENT = 4;
public static final int IME_EVENT = 5;
public static final int DRAW = 6;
public static final int SIZE_CHANGED = 7;
public static final int ACTIVITY_STOPPING = 8;
public static final int IME_BATCH_END = 0;
public static final int IME_BATCH_BEGIN = 1;
@ -80,6 +82,7 @@ public class GeckoEvent {
public int mKeyCode, mUnicodeChar;
public int mCount, mCount2;
public String mCharacters;
public Location mLocation;
public int mNativeWindow;
@ -116,6 +119,11 @@ public class GeckoEvent {
mZ = s.values[2] / SensorManager.GRAVITY_EARTH;
}
public GeckoEvent(Location l) {
mType = LOCATION_EVENT;
mLocation = l;
}
public GeckoEvent(boolean batchEdit, String text) {
mType = IME_EVENT;
if (text != null)

View File

@ -63,6 +63,7 @@ import android.content.*;
import android.graphics.*;
import android.widget.*;
import android.hardware.*;
import android.location.*;
import android.util.*;
@ -74,7 +75,7 @@ import android.util.*;
*/
class GeckoSurfaceView
extends SurfaceView
implements SurfaceHolder.Callback, SensorEventListener
implements SurfaceHolder.Callback, SensorEventListener, LocationListener
{
public GeckoSurfaceView(Context context) {
super(context);
@ -645,6 +646,7 @@ class GeckoSurfaceView
return inputConnection;
}
// accelerometer
public void onAccuracyChanged(Sensor sensor, int accuracy)
{
}
@ -654,6 +656,24 @@ class GeckoSurfaceView
GeckoAppShell.sendEventToGecko(new GeckoEvent(event));
}
// geolocation
public void onLocationChanged(Location location)
{
GeckoAppShell.sendEventToGecko(new GeckoEvent(location));
}
public void onProviderDisabled(String provider)
{
}
public void onProviderEnabled(String provider)
{
}
public void onStatusChanged(String provider, int status, Bundle extras)
{
}
// event stuff
public boolean onTouchEvent(MotionEvent event) {
GeckoAppShell.sendEventToGecko(new GeckoEvent(event));

View File

@ -224,12 +224,6 @@ EmbedContextMenuInfo::SetFormControlType(nsIDOMEventTarget *originalTarget)
break;
case NS_FORM_LABEL:
break;
case NS_FORM_OPTION:
break;
case NS_FORM_OPTGROUP:
break;
case NS_FORM_LEGEND:
break;
case NS_FORM_SELECT:
break;
case NS_FORM_TEXTAREA:

View File

@ -77,7 +77,7 @@ CPPSRCS = \
$(NULL)
ifeq ($(MOZ_WIDGET_TOOLKIT),windows)
ifndef WINCE
ifdef MOZ_ENABLE_D3D9_LAYER
EXPORTS += LayerManagerD3D9.h
CPPSRCS += \

View File

@ -70,10 +70,6 @@
{ 0xda5b130a, 0x1dd1, 0x11b2, \
{ 0xad, 0x47, 0xf4, 0x55, 0xb1, 0x81, 0x4a, 0x78 } }
#define NS_BLENDER_CID \
{ 0x6049b264, 0xc1e6, 0x11d1, \
{ 0xa8, 0x27, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }
#define NS_DRAWING_SURFACE_CID \
{ 0x199c7040, 0xcab0, 0x11d2, \
{ 0xa8, 0x49, 0x00, 0x40, 0x95, 0x9a, 0x28, 0xc9 } }

View File

@ -41,6 +41,7 @@
#include "nscore.h"
#include "nsISupports.h"
#include "nsRect.h"
#include "nsRegion.h"
enum nsRegionComplexity
{
@ -249,6 +250,11 @@ public:
**/
NS_IMETHOD FreeRects(nsRegionRectSet *aRects) = 0;
/**
* Get the underlying nsIntRegion that this nsIRegion represents.
**/
virtual nsIntRegion GetUnderlyingRegion() const = 0;
/**
* Get the native region that this nsIRegion represents.
* @param aRegion out parameter for native region handle

View File

@ -55,7 +55,7 @@ class nsIFontMetrics;
class nsTransform2D;
class nsString;
class nsIDeviceContext;
class nsIRegion;
class nsIntRegion;
class nsIAtom;
struct nsFont;
@ -98,10 +98,9 @@ typedef enum
// IID for the nsIRenderingContext interface
// 37762dd8-8df0-48cd-a5d6-24573ffdb5b6
#define NS_IRENDERING_CONTEXT_IID \
{ 0xA553DAB8, 0xD8B3, 0x469F, \
{ 0x85, 0xC5, 0xD9, 0x4E, 0xBD, 0x65, 0x37, 0x5D } }
{ 0xefbfeb6c, 0x937e, 0x4889, \
{ 0x92, 0x46, 0x16, 0xc0, 0xe8, 0x4b, 0xfa, 0xae } }
//----------------------------------------------------------------------
@ -185,7 +184,7 @@ public:
* @param aCombine how to combine this region with the current clip region.
* see the bottom of nsIRenderingContext.h
*/
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine) = 0;
NS_IMETHOD SetClipRegion(const nsIntRegion& aRegion, nsClipCombine aCombine) = 0;
/**
* Sets the forground color for the RenderingContext

View File

@ -410,6 +410,7 @@ public:
}
PRUint32 GetNumRects () const { return mImpl.GetNumRects (); }
nsIntRect GetBounds () const { return FromRect (mImpl.GetBounds ()); }
nsRegion ToAppUnits (nscoord aAppUnitsPerPixel) const;
nsIntRect GetLargestRectangle () const { return FromRect (mImpl.GetLargestRectangle()); }
/**

View File

@ -1289,10 +1289,11 @@ void nsRegion::MoveBy (nsPoint aPt)
}
}
nsIntRegion nsRegion::ToOutsidePixels(nscoord aAppUnitsPerPixel) const {
nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const
{
nsIntRegion result;
nsRegionRectIterator rgnIter(*this);
const nsRect *currentRect;
const nsRect* currentRect;
while ((currentRect = rgnIter.Next())) {
nsIntRect deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel);
result.Or(result, deviceRect);
@ -1605,3 +1606,15 @@ void nsRegion::SimpleSubtract (const nsRegion& aRegion)
Optimize();
}
nsRegion nsIntRegion::ToAppUnits (nscoord aAppUnitsPerPixel) const
{
nsRegion result;
nsIntRegionRectIterator rgnIter(*this);
const nsIntRect* currentRect;
while ((currentRect = rgnIter.Next())) {
nsRect appRect = currentRect->ToAppUnits(aAppUnitsPerPixel);
result.Or(result, appRect);
}
return result;
}

View File

@ -60,7 +60,7 @@ void nsThebesRegion::SetTo (const nsIRegion &aRegion)
void nsThebesRegion::SetTo (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
mRegion = nsRect (aX, aY, aWidth, aHeight);
mRegion = nsIntRect (aX, aY, aWidth, aHeight);
}
void nsThebesRegion::Intersect (const nsIRegion &aRegion)
@ -71,7 +71,7 @@ void nsThebesRegion::Intersect (const nsIRegion &aRegion)
void nsThebesRegion::Intersect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
mRegion.And (mRegion, nsRect (aX, aY, aWidth, aHeight));
mRegion.And (mRegion, nsIntRect (aX, aY, aWidth, aHeight));
}
void nsThebesRegion::Union (const nsIRegion &aRegion)
@ -82,7 +82,7 @@ void nsThebesRegion::Union (const nsIRegion &aRegion)
void nsThebesRegion::Union (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
mRegion.Or (mRegion, nsRect (aX, aY, aWidth, aHeight));
mRegion.Or (mRegion, nsIntRect (aX, aY, aWidth, aHeight));
}
void nsThebesRegion::Subtract (const nsIRegion &aRegion)
@ -93,7 +93,7 @@ void nsThebesRegion::Subtract (const nsIRegion &aRegion)
void nsThebesRegion::Subtract (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
mRegion.Sub (mRegion, nsRect (aX, aY, aWidth, aHeight));
mRegion.Sub (mRegion, nsIntRect (aX, aY, aWidth, aHeight));
}
PRBool nsThebesRegion::IsEmpty (void)
@ -109,7 +109,7 @@ PRBool nsThebesRegion::IsEqual (const nsIRegion &aRegion)
void nsThebesRegion::GetBoundingBox (PRInt32 *aX, PRInt32 *aY, PRInt32 *aWidth, PRInt32 *aHeight)
{
nsRect BoundRect;
nsIntRect BoundRect;
BoundRect = mRegion.GetBounds();
*aX = BoundRect.x;
*aY = BoundRect.y;
@ -124,8 +124,8 @@ void nsThebesRegion::Offset (PRInt32 aXOffset, PRInt32 aYOffset)
PRBool nsThebesRegion::ContainsRect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight)
{
nsRegion TmpRegion;
TmpRegion.And (mRegion, nsRect (aX, aY, aWidth, aHeight));
nsIntRegion TmpRegion;
TmpRegion.And (mRegion, nsIntRect (aX, aY, aWidth, aHeight));
return (!TmpRegion.IsEmpty ());
}
@ -157,9 +157,9 @@ nsThebesRegion::GetRects (nsRegionRectSet **aRects)
*aRects = pRegionSet;
nsRegionRectIterator ri (mRegion);
nsIntRegionRectIterator ri (mRegion);
nsRegionRect* pDest = &pRegionSet->mRects [0];
const nsRect* pSrc;
const nsIntRect* pSrc;
while ((pSrc = ri.Next ()))
{
@ -184,6 +184,11 @@ nsThebesRegion::FreeRects (nsRegionRectSet *aRects)
return NS_OK;
}
nsIntRegion nsThebesRegion::GetUnderlyingRegion () const
{
return mRegion;
}
NS_IMETHODIMP
nsThebesRegion::GetNativeRegion (void *&aRegion) const
{

View File

@ -67,12 +67,13 @@ public:
PRBool ContainsRect (PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight);
NS_IMETHOD GetRects (nsRegionRectSet **aRects);
NS_IMETHOD FreeRects (nsRegionRectSet *aRects);
nsIntRegion GetUnderlyingRegion() const;
NS_IMETHOD GetNativeRegion (void *&aRegion) const;
NS_IMETHOD GetRegionComplexity (nsRegionComplexity &aComplexity) const;
NS_IMETHOD GetNumRects (PRUint32 *aRects) const;
protected:
nsRegion mRegion;
nsIntRegion mRegion;
};
#endif

View File

@ -277,10 +277,9 @@ nsThebesRenderingContext::SetClipRect(const nsRect& aRect,
}
NS_IMETHODIMP
nsThebesRenderingContext::SetClipRegion(const nsIRegion& pxRegion,
nsThebesRenderingContext::SetClipRegion(const nsIntRegion& aRegion,
nsClipCombine aCombine)
{
//return NS_OK;
// Region is in device coords, no transformation.
// This should only be called when there is no transform in place, when we
// we just start painting a widget. The region is set by the platform paint
@ -288,45 +287,19 @@ nsThebesRenderingContext::SetClipRegion(const nsIRegion& pxRegion,
NS_ASSERTION(aCombine == nsClipCombine_kReplace,
"Unexpected usage of SetClipRegion");
nsRegionComplexity cplx;
pxRegion.GetRegionComplexity(cplx);
gfxMatrix mat = mThebes->CurrentMatrix();
mThebes->IdentityMatrix();
mThebes->ResetClip();
// GetBoundingBox, GetRects, FreeRects are non-const
nsIRegion *evilPxRegion = const_cast<nsIRegion*>(&pxRegion);
if (cplx == eRegionComplexity_rect) {
PRInt32 x, y, w, h;
evilPxRegion->GetBoundingBox(&x, &y, &w, &h);
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetClipRegion %d [%d,%d,%d,%d]", this, cplx, x, y, w, h));
mThebes->NewPath();
mThebes->Rectangle(gfxRect(x, y, w, h), PR_TRUE);
mThebes->Clip();
} else if (cplx == eRegionComplexity_complex) {
nsRegionRectSet *rects = nsnull;
nsresult rv = evilPxRegion->GetRects (&rects);
PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::SetClipRegion %d %d rects", this, cplx, rects->mNumRects));
if (NS_FAILED(rv) || !rects) {
mThebes->SetMatrix(mat);
return rv;
}
mThebes->NewPath();
for (PRUint32 i = 0; i < rects->mNumRects; i++) {
mThebes->Rectangle(gfxRect(rects->mRects[i].x,
rects->mRects[i].y,
rects->mRects[i].width,
rects->mRects[i].height),
PR_TRUE);
}
mThebes->Clip();
evilPxRegion->FreeRects (rects);
mThebes->NewPath();
nsIntRegionRectIterator iter(aRegion);
const nsIntRect* rect;
while ((rect = iter.Next())) {
mThebes->Rectangle(gfxRect(rect->x, rect->y, rect->width, rect->height),
PR_TRUE);
}
mThebes->Clip();
mThebes->SetMatrix(mat);

View File

@ -140,7 +140,7 @@ public:
NS_IMETHOD PopState(void);
NS_IMETHOD SetClipRect(const nsRect& aRect, nsClipCombine aCombine);
NS_IMETHOD SetLineStyle(nsLineStyle aLineStyle);
NS_IMETHOD SetClipRegion(const nsIRegion& aRegion, nsClipCombine aCombine);
NS_IMETHOD SetClipRegion(const nsIntRegion& aRegion, nsClipCombine aCombine);
NS_IMETHOD SetColor(nscolor aColor);
NS_IMETHOD GetColor(nscolor &aColor) const;
NS_IMETHOD SetFont(const nsFont& aFont, nsIAtom* aLanguage,

View File

@ -109,6 +109,10 @@ _OS_LIBS += uuid
endif
OS_LIBS += $(call EXPAND_LIBNAME,$(_OS_LIBS))
ifdef MOZ_ENABLE_D3D9_LAYER
DEFINES += -DMOZ_ENABLE_D3D9_LAYER
endif
ACDEFINES += -UWIN32_LEAN_AND_MEAN
endif

View File

@ -2,7 +2,7 @@
#include "LayerManagerOGL.h"
#include "BasicLayers.h"
#include "ImageLayers.h"
#if defined(XP_WIN) && !defined(WINCE)
#ifdef MOZ_ENABLE_D3D9_LAYER
#include "LayerManagerD3D9.h"
#endif
@ -13,7 +13,7 @@ void XXXNeverCalled_Layers()
{
BasicLayerManager(nsnull);
LayerManagerOGL(nsnull);
#if defined(XP_WIN) && !defined(WINCE)
#ifdef MOZ_ENABLE_D3D9_LAYER
LayerManagerD3D9(nsnull);
#endif
}

View File

@ -22,10 +22,13 @@
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false">
</ms_asmv3:requestedExecutionLevel>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
</assembly>

View File

@ -392,4 +392,7 @@ enum LinkerInitialized { LINKER_INITIALIZED };
} // base
#include "nscore.h" // pick up mozalloc operator new() etc.
#endif // BASE_BASICTYPES_H_

View File

@ -10,8 +10,13 @@
<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
<ms_asmv3:security>
<ms_asmv3:requestedPrivileges>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false"></ms_asmv3:requestedExecutionLevel>
<ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
</ms_asmv3:requestedPrivileges>
</ms_asmv3:security>
</ms_asmv3:trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />
</application>
</compatibility>
</assembly>

View File

@ -4368,7 +4368,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"
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 $@'
fi
fi

View File

@ -45,6 +45,13 @@
*/
#include <string.h>
/* Gross special case for Gecko, which defines malloc/calloc/free. */
#ifdef mozilla_mozalloc_macro_wrappers_h
# define JS_UNDEFD_MOZALLOC_WRAPPERS
/* The "anti-header" */
# include "mozilla/mozalloc_undef_macro_wrappers.h"
#endif
#include "jsarena.h" /* Added by JSIFY */
#include "jsclist.h"
#include "jslong.h"
@ -3048,4 +3055,8 @@ NewIdArray(JSContext *cx, jsint length);
#pragma warning(pop)
#endif
#ifdef JS_UNDEFD_MOZALLOC_WRAPPERS
# include "mozilla/mozalloc_macro_wrappers.h"
#endif
#endif /* jscntxt_h___ */

View File

@ -38,7 +38,7 @@ load 265736-1.html
load 265736-2.html
load 265899-1.html
load 265973-1.html
asserts(10) asserts-if(MOZ_WIDGET_TOOLKIT=="windows",8) load 265986-1.html
asserts(10) asserts-if(MOZ_WIDGET_TOOLKIT=="windows",8) load 265986-1.html # Bug 512405
load 265999-1.html
load 266222-1.html
asserts(7) load 266360-1.html

View File

@ -3267,7 +3267,7 @@ nsCSSFrameConstructor::InitializeSelectFrame(nsFrameConstructorState& aState,
}
ProcessChildren(aState, aContent, aStyleContext, scrolledFrame, PR_FALSE,
childItems, PR_TRUE, aPendingBinding);
childItems, PR_FALSE, aPendingBinding);
// Set the scrolled frame's initial child lists
scrolledFrame->SetInitialChildList(nsnull, childItems);

View File

@ -86,9 +86,6 @@ struct nsCSSRendering {
* Render the border for an element using css rendering rules
* for borders. aSkipSides is a bitmask of the sides to skip
* when rendering. If 0 then no sides are skipped.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
static void PaintBorder(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -116,9 +113,6 @@ struct nsCSSRendering {
* Render the outline for an element using css rendering rules
* for borders. aSkipSides is a bitmask of the sides to skip
* when rendering. If 0 then no sides are skipped.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
static void PaintOutline(nsPresContext* aPresContext,
nsIRenderingContext& aRenderingContext,
@ -227,9 +221,6 @@ struct nsCSSRendering {
/**
* Render the background for an element using css rendering rules
* for backgrounds.
*
* Both aDirtyRect and aBorderArea are in the local coordinate space
* of aForFrame
*/
enum {
/**

View File

@ -1348,7 +1348,7 @@ nsDisplayTransform::GetFrameBoundsForTransform(const nsIFrame* aFrame)
#endif
/* Returns the delta specified by the -moz-tranform-origin property.
/* Returns the delta specified by the -moz-transform-origin property.
* This is a positive delta, meaning that it indicates the direction to move
* to get from (0, 0) of the frame to the transform origin.
*/

View File

@ -521,12 +521,13 @@ public:
virtual Type GetType() { return TYPE_GENERIC; }
/**
* This is called after we've constructed a display list for event handling.
* When this is called, we've already ensured that aPt is in the item's bounds.
* When this is called, we've already ensured that aRect intersects the
* item's bounds.
*
* @param aState must point to a HitTestState. If you don't have one,
* just create one with the default constructor and pass it in.
* @return the frame that the point is considered over, or nsnull if
* this is not over any frame
* @param aOutFrames each item appends the frame(s) in this display item that
* the rect is considered over (if any) to aOutFrames.
*/
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {}

View File

@ -83,7 +83,7 @@ class nsFrameManager;
class nsILayoutHistoryState;
class nsIReflowCallback;
class nsIDOMNode;
class nsIRegion;
class nsIntRegion;
class nsIStyleSheet;
class nsCSSFrameConstructor;
class nsISelection;
@ -127,8 +127,8 @@ typedef struct CapturingContentInfo {
} CapturingContentInfo;
#define NS_IPRESSHELL_IID \
{ 0x47c5b7c4, 0x8d35, 0x4d36, \
{ 0xa1, 0xf9, 0x19, 0x44, 0xf8, 0xb9, 0x46, 0xb5 } }
{ 0x7ae0e29f, 0x4d2e, 0x4acd, \
{ 0xb5, 0x74, 0xb6, 0x40, 0x8a, 0xca, 0xb8, 0x4d } }
// Constants for ScrollContentIntoView() function
#define NS_PRESSHELL_SCROLL_TOP 0
@ -839,12 +839,12 @@ public:
/**
* Renders a node aNode to a surface and returns it. The aRegion may be used
* to clip the rendering. This region is measured in device pixels from the
* to clip the rendering. This region is measured in CSS pixels from the
* edge of the presshell area. The aPoint, aScreenRect and aSurface
* arguments function in a similar manner as RenderSelection.
*/
virtual already_AddRefed<gfxASurface> RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
nsIntRegion* aRegion,
nsIntPoint& aPoint,
nsIntRect* aScreenRect) = 0;

View File

@ -916,9 +916,7 @@ public:
* Gets the closest frame (the frame passed in or one of its parents) that
* qualifies as a "layer"; used in DOM0 methods that depends upon that
* definition. This is the nearest frame that is either positioned or scrolled
* (the child of a scroll frame). In Gecko terms, it's approximately
* equivalent to having a view, at least for simple HTML. However, views are
* going away, so this is a cleaner definition.
* (the child of a scroll frame).
*/
static nsIFrame* GetClosestLayer(nsIFrame* aFrame);

View File

@ -795,7 +795,7 @@ public:
gfxContext* aThebesContext);
virtual already_AddRefed<gfxASurface> RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
nsIntRegion* aRegion,
nsIntPoint& aPoint,
nsIntRect* aScreenRect);
@ -1030,7 +1030,7 @@ protected:
already_AddRefed<gfxASurface>
PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
nsISelection* aSelection,
nsIRegion* aRegion,
nsIntRegion* aRegion,
nsRect aArea,
nsIntPoint& aPoint,
nsIntRect* aScreenRect);
@ -3649,8 +3649,7 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
nsPoint offset(0,0);
if (mPresContext->IsScreen()) {
// Get the widget to create the rendering context for and calculate
// the offset from the frame to it. (Calculating the offset is important
// if the frame isn't the root frame.)
// the offset from the frame to it.
nsPoint viewOffset;
nsIView* view = aFrame->GetClosestView(&viewOffset);
nsPoint widgetOffset;
@ -5391,11 +5390,16 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
itemToInsert = new (aBuilder)nsDisplayClip(frame, frame, i, textRect);
}
}
else {
// Don't try to descend into subdocuments.
// If this ever changes we'd need to add handling for subdocuments with
// different zoom levels.
else if (content->GetCurrentDoc() ==
aRange->GetStartParent()->GetCurrentDoc()) {
// if the node is within the range, append it to the temporary list
PRBool before, after;
nsRange::CompareNodeToRange(content, aRange, &before, &after);
if (!before && !after) {
nsresult rv =
nsRange::CompareNodeToRange(content, aRange, &before, &after);
if (NS_SUCCEEDED(rv) && !before && !after) {
itemToInsert = i;
surfaceRect.UnionRect(surfaceRect, i->GetBounds(aBuilder));
}
@ -5425,6 +5429,12 @@ PresShell::ClipListToRange(nsDisplayListBuilder *aBuilder,
return surfaceRect;
}
#ifdef DEBUG
#include <stdio.h>
static PRBool gDumpRangePaintList = PR_FALSE;
#endif
RangePaintInfo*
PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
nsRect& aSurfaceRect)
@ -5482,8 +5492,22 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
ancestorRect, &info->mList);
info->mBuilder.LeavePresShell(ancestorFrame, ancestorRect);
#ifdef DEBUG
if (gDumpRangePaintList) {
fprintf(stderr, "CreateRangePaintInfo --- before ClipListToRange:\n");
nsFrame::PrintDisplayList(&(info->mBuilder), info->mList);
}
#endif
nsRect rangeRect = ClipListToRange(&info->mBuilder, &info->mList, range);
#ifdef DEBUG
if (gDumpRangePaintList) {
fprintf(stderr, "CreateRangePaintInfo --- after ClipListToRange:\n");
nsFrame::PrintDisplayList(&(info->mBuilder), info->mList);
}
#endif
// determine the offset of the reference frame for the display list
// to the root frame. This will allow the coordinates used when painting
// to all be offset from the same point
@ -5497,7 +5521,7 @@ PresShell::CreateRangePaintInfo(nsIDOMRange* aRange,
already_AddRefed<gfxASurface>
PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
nsISelection* aSelection,
nsIRegion* aRegion,
nsIntRegion* aRegion,
nsRect aArea,
nsIntPoint& aPoint,
nsIntRect* aScreenRect)
@ -5568,8 +5592,13 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
deviceContext->CreateRenderingContextInstance(*getter_AddRefs(rc));
rc->Init(deviceContext, surface);
if (aRegion)
rc->SetClipRegion(*aRegion, nsClipCombine_kReplace);
if (aRegion) {
// Convert aRegion from CSS pixels to dev pixels
nsIntRegion region =
aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel())
.ToOutsidePixels(pc->AppUnitsPerDevPixel());
rc->SetClipRegion(region, nsClipCombine_kReplace);
}
if (resize)
rc->Scale(scale, scale);
@ -5616,7 +5645,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
already_AddRefed<gfxASurface>
PresShell::RenderNode(nsIDOMNode* aNode,
nsIRegion* aRegion,
nsIntRegion* aRegion,
nsIntPoint& aPoint,
nsIntRect* aScreenRect)
{
@ -5643,9 +5672,7 @@ PresShell::RenderNode(nsIDOMNode* aNode,
if (aRegion) {
// combine the area with the supplied region
nsIntRect rrectPixels;
aRegion->GetBoundingBox(&rrectPixels.x, &rrectPixels.y,
&rrectPixels.width, &rrectPixels.height);
nsIntRect rrectPixels = aRegion->GetBounds();
nsRect rrect = rrectPixels.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel());
area.IntersectRect(area, rrect);
@ -5655,8 +5682,8 @@ PresShell::RenderNode(nsIDOMNode* aNode,
return nsnull;
// move the region so that it is offset from the topleft corner of the surface
aRegion->Offset(-rrectPixels.x + (rrectPixels.x - pc->AppUnitsToDevPixels(area.x)),
-rrectPixels.y + (rrectPixels.y - pc->AppUnitsToDevPixels(area.y)));
aRegion->MoveBy(-pc->AppUnitsToDevPixels(area.x),
-pc->AppUnitsToDevPixels(area.y));
}
return PaintRangePaintInfo(&rangeItems, nsnull, aRegion, area, aPoint,

View File

@ -31,14 +31,15 @@ invalidationLoop();
function doIteration() {
lastPaintCount = plugin.getPaintCount();
ok(true, "Beginning iteration " + iterations + ", last paint count: " + lastPaintCount);
var v = 255 - iterations;
expectedWidth = 201 + iterations;
plugin.style.width = expectedWidth + "px";
checkDone();
}
function checkDone() {
ok(true, "Check to see if we're done: " + plugin.getPaintCount());
if (plugin.getPaintCount() == lastPaintCount) {
setTimeout(checkDone, 30);
return;

View File

@ -17,9 +17,11 @@
SimpleTest.waitForExplicitFinish();
var startPaintCount = window.mozPaintCount;
ok(true, "Got to initial paint count: " + startPaintCount);
var color = 0;
function doFlicker() {
ok(true, "Iteration " + color + ", paint count: " + window.mozPaintCount);
if (window.mozPaintCount - startPaintCount > 20) {
ok(true, "Got enough paints");
SimpleTest.finish();

View File

@ -360,7 +360,6 @@ nsLayoutStatics::Shutdown()
nsJSRuntime::Shutdown();
nsGlobalWindow::ShutDown();
nsDOMClassInfo::ShutDown();
nsTextControlFrame::ShutDown();
nsListControlFrame::Shutdown();
nsXBLWindowKeyHandler::ShutDown();
nsAutoCopyListener::Shutdown();

View File

@ -142,19 +142,11 @@ NS_IMPL_FRAMEARENA_HELPERS(nsFileControlFrame)
nsFileControlFrame::nsFileControlFrame(nsStyleContext* aContext):
nsBlockFrame(aContext),
mTextFrame(nsnull),
mCachedState(nsnull)
mTextFrame(nsnull)
{
AddStateBits(NS_BLOCK_FLOAT_MGR);
}
nsFileControlFrame::~nsFileControlFrame()
{
if (mCachedState) {
delete mCachedState;
mCachedState = nsnull;
}
}
NS_IMETHODIMP
nsFileControlFrame::Init(nsIContent* aContent,
@ -675,11 +667,6 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsPresContext* aPresContext,
if (mState & NS_FRAME_FIRST_REFLOW) {
mTextFrame = GetTextControlFrame(aPresContext, this);
NS_ENSURE_TRUE(mTextFrame, NS_ERROR_UNEXPECTED);
if (mCachedState) {
mTextFrame->SetFormProperty(nsGkAtoms::value, *mCachedState);
delete mCachedState;
mCachedState = nsnull;
}
}
// nsBlockFrame takes care of all our reflow
@ -785,13 +772,11 @@ nsFileControlFrame::SetFormProperty(nsIAtom* aName,
const nsAString& aValue)
{
if (nsGkAtoms::value == aName) {
if (mTextFrame) {
mTextFrame->SetValue(aValue);
} else {
if (mCachedState) delete mCachedState;
mCachedState = new nsString(aValue);
NS_ENSURE_TRUE(mCachedState, NS_ERROR_OUT_OF_MEMORY);
}
nsCOMPtr<nsIDOMHTMLInputElement> textControl =
do_QueryInterface(mTextContent);
NS_ASSERTION(textControl,
"The text control should exist and be an input element");
textControl->SetValue(aValue);
}
return NS_OK;
}

View File

@ -53,7 +53,6 @@ class nsFileControlFrame : public nsBlockFrame,
{
public:
nsFileControlFrame(nsStyleContext* aContext);
virtual ~nsFileControlFrame();
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
@ -168,11 +167,6 @@ protected:
* @see nsFileControlFrame::CreateAnonymousContent
*/
nsCOMPtr<nsIContent> mBrowse;
/**
* The current value, stored during those rare in-between periods where the
* file frame is there but the input frame is not.
*/
nsString* mCachedState;
/**
* Our mouse listener. This makes sure we don't get used after destruction.

View File

@ -52,24 +52,6 @@ public:
NS_IMETHOD GetEditor(nsIEditor **aEditor) = 0;
/**
* Tell whether the frame currently owns the value or the content does (for
* edge cases where the frame has just been created or is just going away).
*
* @param aOwnsValue whether the frame owns the value [out]
*/
NS_IMETHOD OwnsValue(PRBool* aOwnsValue) = 0;
/**
* Get the current value, either from the editor or from the textarea.
*
* @param aValue the value [out]
* @param aIgnoreWrap whether to ignore the wrap attribute when getting the
* value. If this is true, linebreaks will not be inserted even if
* wrap=hard.
*/
NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap) const = 0;
NS_IMETHOD GetTextLength(PRInt32* aTextLength) = 0;
/**
@ -83,7 +65,7 @@ public:
NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd) = 0;
NS_IMETHOD GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd) = 0;
virtual nsISelectionController* GetOwnedSelectionController() = 0;
NS_IMETHOD GetOwnedSelectionController(nsISelectionController** aSelCon) = 0;
virtual nsFrameSelection* GetOwnedFrameSelection() = 0;
virtual nsresult GetPhonetic(nsAString& aPhonetic) = 0;

View File

@ -160,20 +160,18 @@ nsIsIndexFrame::GetInputFrame(nsIFormControlFrame** oFrame)
void
nsIsIndexFrame::GetInputValue(nsString& oString)
{
nsIFormControlFrame* frame = nsnull;
GetInputFrame(&frame);
if (frame) {
((nsNewFrame*)frame)->GetValue(oString, PR_FALSE);
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(mInputContent);
if (txtCtrl) {
txtCtrl->GetTextEditorValue(oString, PR_FALSE);
}
}
void
nsIsIndexFrame::SetInputValue(const nsString& aString)
{
nsIFormControlFrame* frame = nsnull;
GetInputFrame(&frame);
if (frame) {
((nsNewFrame*)frame)->SetValue(aString);
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(mInputContent);
if (txtCtrl) {
txtCtrl->SetTextEditorValue(aString, PR_FALSE);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -41,44 +41,21 @@
#include "nsStackFrame.h"
#include "nsBlockFrame.h"
#include "nsIFormControlFrame.h"
#include "nsIDOMMouseListener.h"
#include "nsIAnonymousContentCreator.h"
#include "nsIEditor.h"
#include "nsITextControlFrame.h"
#include "nsIFontMetrics.h"
#include "nsWeakReference.h" //for service and presshell pointers
#include "nsContentUtils.h"
#include "nsDisplayList.h"
#include "nsIScrollableFrame.h"
#include "nsStubMutationObserver.h"
#include "nsThreadUtils.h"
#include "nsITextControlElement.h"
class nsIEditor;
class nsISelectionController;
class nsTextInputSelectionImpl;
class nsTextInputListener;
class nsIDOMCharacterData;
#ifdef ACCESSIBILITY
class nsIAccessible;
#endif
class nsTextInputSelectionImpl;
class nsTextControlFrame;
class EditorInitializerEntryTracker;
class nsAnonDivObserver : public nsStubMutationObserver
{
public:
nsAnonDivObserver(nsTextControlFrame* aTextControl)
: mTextControl(aTextControl) {}
NS_DECL_ISUPPORTS
NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
private:
nsTextControlFrame* mTextControl;
};
class nsTextEditorState;
class nsTextControlFrame : public nsStackFrame,
public nsIAnonymousContentCreator,
@ -145,10 +122,6 @@ public:
// Utility methods to set current widget state
// Be careful when using this method.
// Calling it may cause |this| to be deleted.
// In that case the method returns an error value.
nsresult SetValue(const nsAString& aValue);
NS_IMETHOD SetInitialChildList(nsIAtom* aListName,
nsFrameList& aChildList);
@ -163,17 +136,14 @@ public:
//==== NSITEXTCONTROLFRAME
NS_IMETHOD GetEditor(nsIEditor **aEditor);
NS_IMETHOD OwnsValue(PRBool* aOwnsValue);
NS_IMETHOD GetValue(nsAString& aValue, PRBool aIgnoreWrap) const;
NS_IMETHOD GetTextLength(PRInt32* aTextLength);
NS_IMETHOD CheckFireOnChange();
NS_IMETHOD SetSelectionStart(PRInt32 aSelectionStart);
NS_IMETHOD SetSelectionEnd(PRInt32 aSelectionEnd);
NS_IMETHOD SetSelectionRange(PRInt32 aSelectionStart, PRInt32 aSelectionEnd);
NS_IMETHOD GetSelectionRange(PRInt32* aSelectionStart, PRInt32* aSelectionEnd);
virtual nsISelectionController* GetOwnedSelectionController();
virtual nsFrameSelection* GetOwnedFrameSelection()
{ return mFrameSel; }
NS_IMETHOD GetOwnedSelectionController(nsISelectionController** aSelCon);
virtual nsFrameSelection* GetOwnedFrameSelection();
nsresult GetPhonetic(nsAString& aPhonetic);
@ -198,26 +168,6 @@ public:
NS_DECL_QUERYFRAME
public: //for methods who access nsTextControlFrame directly
/**
* Find out whether this is a single line text control. (text or password)
* @return whether this is a single line text control
*/
PRBool IsSingleLineTextControl() const;
/**
* Find out whether this control is a textarea.
* @return whether this is a textarea text control
*/
PRBool IsTextArea() const;
/**
* Find out whether this control edits plain text. (Currently always true.)
* @return whether this is a plain text control
*/
PRBool IsPlainTextControl() const;
/**
* Find out whether this is a password control (input type=password)
* @return whether this is a password ontrol
*/
PRBool IsPasswordTextControl() const;
void FireOnInput();
void SetValueChanged(PRBool aValueChanged);
/** Called when the frame is focused, to remember the value for onChange. */
@ -233,17 +183,92 @@ public: //for methods who access nsTextControlFrame directly
return mFireChangeEventState;
}
/* called to free up native keybinding services */
static NS_HIDDEN_(void) ShutDown();
// called by the focus listener
nsresult MaybeBeginSecureKeyboardInput();
void MaybeEndSecureKeyboardInput();
void ClearValueCache() { mCachedValue.Truncate(); }
class ValueSetter {
public:
ValueSetter(nsTextControlFrame* aFrame,
PRBool aHasFocusValue)
: mFrame(aFrame)
, mInited(PR_FALSE)
{
NS_ASSERTION(aFrame, "Should pass a valid frame");
// This method isn't used for user-generated changes, except for calls
// from nsFileControlFrame which sets mFireChangeEventState==true and
// restores it afterwards (ie. we want 'change' events for those changes).
// Focused value must be updated to prevent incorrect 'change' events,
// but only if user hasn't changed the value.
mFocusValueInit = !mFrame->mFireChangeEventState && aHasFocusValue;
}
void Cancel() {
mInited = PR_FALSE;
}
void Init() {
// Since this code does not handle user-generated changes to the text,
// make sure we don't fire oninput when the editor notifies us.
// (mNotifyOnInput must be reset before we return).
// To protect against a reentrant call to SetValue, we check whether
// another SetValue is already happening for this frame. If it is,
// we must wait until we unwind to re-enable oninput events.
mOuterTransaction = mFrame->mNotifyOnInput;
if (mOuterTransaction)
mFrame->mNotifyOnInput = PR_FALSE;
mInited = PR_TRUE;
}
~ValueSetter() {
if (!mInited)
return;
if (mOuterTransaction)
mFrame->mNotifyOnInput = PR_TRUE;
if (mFocusValueInit) {
// Reset mFocusedValue so the onchange event doesn't fire incorrectly.
mFrame->InitFocusedValue();
}
}
private:
nsTextControlFrame* mFrame;
PRPackedBool mFocusValueInit;
PRPackedBool mOuterTransaction;
PRPackedBool mInited;
};
friend class ValueSetter;
#define DEFINE_TEXTCTRL_FORWARDER(type, name) \
type name() { \
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent()); \
NS_ASSERTION(txtCtrl, "Content not a text control element"); \
return txtCtrl->name(); \
}
#define DEFINE_TEXTCTRL_CONST_FORWARDER(type, name) \
type name() const { \
nsCOMPtr<nsITextControlElement> txtCtrl = do_QueryInterface(GetContent()); \
NS_ASSERTION(txtCtrl, "Content not a text control element"); \
return txtCtrl->name(); \
}
DEFINE_TEXTCTRL_CONST_FORWARDER(PRBool, IsSingleLineTextControl)
DEFINE_TEXTCTRL_CONST_FORWARDER(PRBool, IsTextArea)
DEFINE_TEXTCTRL_CONST_FORWARDER(PRBool, IsPlainTextControl)
DEFINE_TEXTCTRL_CONST_FORWARDER(PRBool, IsPasswordTextControl)
DEFINE_TEXTCTRL_FORWARDER(PRInt32, GetCols)
DEFINE_TEXTCTRL_FORWARDER(PRInt32, GetWrapCols)
DEFINE_TEXTCTRL_FORWARDER(PRInt32, GetRows)
#undef DEFINE_TEXTCTRL_CONST_FORWARDER
#undef DEFINE_TEXTCTRL_FORWARDER
protected:
class EditorInitializer;
friend class EditorInitializer;
friend class nsTextEditorState; // needs access to UpdateValueDisplay
class EditorInitializer : public nsRunnable {
public:
@ -257,7 +282,7 @@ protected:
mWeakFrame.GetFrame()->PresContext()->GetPresShell();
PRBool observes = shell->ObservesNativeAnonMutationsForPrint();
shell->ObserveNativeAnonMutationsForPrint(PR_TRUE);
mFrame->EnsureEditorInitializedInternal();
mFrame->EnsureEditorInitialized();
shell->ObserveNativeAnonMutationsForPrint(observes);
}
return NS_OK;
@ -326,24 +351,6 @@ protected:
*/
void PreDestroy();
// Helper methods
/**
* Get the cols attribute (if textarea) or a default
* @return the number of columns to use
*/
PRInt32 GetCols();
/**
* Get the column index to wrap at, or -1 if we shouldn't wrap
*/
PRInt32 GetWrapCols();
/**
* Get the rows attribute (if textarea) or a default
* @return the number of rows to use
*/
PRInt32 GetRows();
// Compute our intrinsic size. This does not include any borders, paddings,
// etc. Just the size of our actual area for the text (and the scrollbars,
// for <textarea>).
@ -357,29 +364,20 @@ private:
nsresult SelectAllOrCollapseToEndOfText(PRBool aSelect);
nsresult SetSelectionEndPoints(PRInt32 aSelStart, PRInt32 aSelEnd);
// placeholder methods
nsresult CreatePlaceholderDiv(nsTArray<nsIContent*>& aElements, nsNodeInfoManager* pNodeInfoManager);
nsresult ShowPlaceholder();
nsresult HidePlaceholder();
nsresult SetPlaceholderClass(PRBool aVisible, PRBool aNotify);
nsresult UpdatePlaceholderText(PRBool aNotify);
// accessors for the notify on input flag
PRBool GetNotifyOnInput() const { return mNotifyOnInput; }
void SetNotifyOnInput(PRBool val) { mNotifyOnInput = val; }
// This method performs the actual tasks of initializing the editor.
// EnsureEditorInitialized is a wrapper of this method which wraps it with
// a weak frame check.
virtual nsresult EnsureEditorInitializedInternal();
/**
* Return the root DOM element, and implicitly initialize the editor if needed.
*/
nsresult GetRootNodeAndInitializeEditor(nsIDOMElement **aRootElement);
private:
nsCOMPtr<nsIContent> mValueDiv;
nsCOMPtr<nsIContent> mPlaceholderDiv;
nsCOMPtr<nsIEditor> mEditor;
// these packed bools could instead use the high order bits on mState, saving 4 bytes
PRPackedBool mUseEditor;
PRPackedBool mIsProcessing;
PRPackedBool mNotifyOnInput;//default this to off to stop any notifications until setup is complete
PRPackedBool mDidPreDestroy; // has PreDestroy been called
// Calls to SetValue will be treated as user values (i.e. trigger onChange
// eventually) when mFireChangeEventState==true, this is used by nsFileControlFrame.
PRPackedBool mFireChangeEventState;
@ -390,12 +388,7 @@ private:
friend class EditorInitializerEntryTracker;
#endif
nsRefPtr<nsTextInputSelectionImpl> mSelCon;
nsCOMPtr<nsFrameSelection> mFrameSel;
nsTextInputListener* mTextListener;
nsString mFocusedValue;
nsString mCachedValue; // Caches non-hard-wrapped value on a multiline control.
nsRefPtr<nsAnonDivObserver> mMutationObserver;
nsRevocableEventPtr<ScrollOnFocusEvent> mScrollEvent;
};

View File

@ -62,6 +62,7 @@ _TEST_FILES = test_bug231389.html \
test_textarea_resize.html \
test_bug478219.xhtml \
test_bug542914.html \
test_bug534785.html \
test_bug536567.html \
bug536567_subframe.html \
test_bug549170.html \

View File

@ -0,0 +1,89 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=534785
-->
<head>
<title>Test for Bug 534785</title>
<script type="application/javascript" src="/MochiKit/packed.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=534785">Mozilla Bug 534785</a>
<p id="display"></p>
<input type="text" value="test">
<div id="reframe">
<textarea></textarea>
<textarea>test</textarea>
<input type="text">
<input type="text" value="test">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 534785 **/
SimpleTest.waitForExplicitFinish();
SimpleTest.waitForFocus(function() {
var i = document.querySelector("input");
i.addEventListener("focus", function() {
is(i.value, "test", "Sanity check");
is(document.activeElement, i, "Should be focused before frame reconstruction");
synthesizeKey("1", {});
is(i.value, "test1", "Can accept keyboard events before frame reconstruction");
// force frame reconstruction
i.style.display = "none";
document.offsetHeight;
i.style.display = "";
document.offsetHeight;
is(document.activeElement, i, "Should be focused after frame reconstruction");
synthesizeKey("2", {});
is(i.value, "test12", "Can accept keyboard events after frame reconstruction");
// Make sure reframing happens gracefully
var reframeDiv = document.getElementById("reframe");
var textAreaWithoutValue = reframeDiv.querySelectorAll("textarea")[0];
var textAreaWithValue = reframeDiv.querySelectorAll("textarea")[1];
var inputWithoutValue = reframeDiv.querySelectorAll("input")[0];
var inputWithValue = reframeDiv.querySelectorAll("input")[1];
reframeDiv.style.display = "none";
document.body.offsetWidth;
reframeDiv.style.display = "";
document.body.offsetWidth;
[textAreaWithoutValue, inputWithoutValue].forEach(function (elem) {
is(elem.value, "", "Value should persist correctly");
});
[textAreaWithValue, inputWithValue].forEach(function (elem) {
is(elem.value, "test", "Value should persist correctly");
});
[inputWithoutValue, inputWithValue].forEach(function (elem) elem.type = "submit");
document.body.offsetWidth;
is(inputWithoutValue.value, "", "Value should persist correctly");
is(inputWithValue.value, "test", "Value should persist correctly");
[inputWithoutValue, inputWithValue].forEach(function (elem) elem.type = "text");
document.body.offsetWidth;
is(inputWithoutValue.value, "", "Value should persist correctly");
is(inputWithValue.value, "test", "Value should persist correctly");
[inputWithoutValue, inputWithValue].forEach(function (elem) elem.focus()); // initialze the editor
reframeDiv.style.display = "none";
document.body.offsetWidth;
reframeDiv.style.display = "";
document.body.offsetWidth;
is(inputWithoutValue.value, "", "Value should persist correctly with editor");
is(inputWithValue.value, "test", "Value should persist correctly with editor");
SimpleTest.finish();
}, false);
i.focus();
});
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,6 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head></head>
<body onload="document.getElementById('a').appendChild(document.createTextNode(' '));">
<div style="position: absolute; -moz-column-count: 2;"><div style="position: absolute; height: 100px;"><fieldset/><fieldset id="a"/></div></div>
</body>
</html>

View File

@ -292,6 +292,7 @@ load 513394-1.html
load 514800-1.html
load 515811-1.html
load 517968.html
load 519031.xhtml
load 520340.html
load 533379-1.html
load 533379-2.html

View File

@ -4315,8 +4315,7 @@ nsFrame::GetSelectionController(nsPresContext *aPresContext, nsISelectionControl
while (frame && (frame->GetStateBits() & NS_FRAME_INDEPENDENT_SELECTION)) {
nsITextControlFrame *tcf = do_QueryFrame(frame);
if (tcf) {
NS_IF_ADDREF(*aSelCon = tcf->GetOwnedSelectionController());
return NS_OK;
return tcf->GetOwnedSelectionController(aSelCon);
}
frame = frame->GetParent();
}

View File

@ -10,18 +10,35 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=527306
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body onload="showText()">
<body onload="runTests()">
<p><a target="_blank" href="https://bugzilla.mozilla.org/show_bug?id=527306">Mozilla Bug 527306</a>
<p><input type="text" id="currenttext" value="FAIL">
<p><input type="text" id="t1" value="FAIL"></p>
<p><input type="text" id="t2" value="FAIL"></p>
<p><input type="text" id="t3" value="FAIL"></p>
<p><textarea id="t4">FAIL</textarea></p>
<pre id="test">
<script>
function showText() {
var t = document.getElementById("currenttext");
function testElement(t) {
t.style.display = "none";
t.value = "PASS";
is(t.value, "PASS", "Value should be set correctly");
}
function runTests() {
var t = document.getElementById("t1");
testElement(t);
t = document.getElementById("t2");
t.focus();
testElement(t);
t = document.getElementById("t3");
t.focus();
t.blur();
testElement(t);
t = document.getElementById("t4");
testElement(t);
SimpleTest.finish();
}

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<input type="checkbox">
<script>
var i = document.getElementsByTagName("input")[0];
i.type = "text";
i.value = "abcdef";
</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<input type="checkbox">
<script>
var i = document.getElementsByTagName("input")[0];
i.value = "abcdef";
i.type = "text";
</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<input type="checkbox" value="foo">
<script>
var i = document.getElementsByTagName("input")[0];
i.type = "text";
i.value = "abcdef";
</script>
</body>
</html>

View File

@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<body>
<input type="checkbox" value="foo">
<script>
var i = document.getElementsByTagName("input")[0];
i.type = "text";
i.value = "abcdef";
</script>
</body>
</html>

View File

@ -5,6 +5,10 @@ include xul/reftest.list
== newline-2.html newline-ref.html
== newline-3.html newline-ref.html
== dynamic-1.html dynamic-ref.html
== dynamic-type-1.html dynamic-ref.html
== dynamic-type-2.html dynamic-ref.html
== dynamic-type-3.html dynamic-ref.html
== dynamic-type-4.html dynamic-ref.html
== passwd-1.html passwd-ref.html
!= passwd-2.html passwd-ref.html
== passwd-3.html passwd-ref.html

View File

@ -0,0 +1,22 @@
<!DOCTYPE html>
<html class="reftest-wait">
<!-- Test: placeholder should appear with dynamic DOM modifications -->
<script type="text/javascript">
function setPlaceholder()
{
var i = document.getElementById('p1');
i.focus();
i.blur();
i.value = "not empty";
i.value = "";
i.value = "my value";
}
function disableReftestWait()
{
document.documentElement.className = '';
}
</script>
<body onload="setPlaceholder(); disableReftestWait();">
<input type="text" id="p1" value="" placeholder="my placeholder">
</body>
</html>

View File

@ -18,3 +18,4 @@
== placeholder-15.html placeholder-focus-ref.html
== placeholder-16.html placeholder-focus-ref.html
== placeholder-17.html placeholder-focus-ref.html
== placeholder-18.html placeholder-overridden-ref.html

View File

@ -18,6 +18,7 @@ HTTP(..) == text-control-baseline-1.html text-control-baseline-1-ref.html
!= textarea-in-ltr-doc-scrollbar.html textarea-in-rtl-doc-scrollbar.html
!= textarea-ltr.html textarea-no-resize.html
random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != textarea-rtl.html textarea-no-resize.html # bug 558201
== textarea-setvalue-framereconstruction-1.html textarea-setvalue-framereconstruction-ref.html
== radio-label-dynamic.html radio-label-dynamic-ref.html
== out-of-bounds-selectedindex.html out-of-bounds-selectedindex-ref.html # test for bug 471741

View File

@ -0,0 +1,48 @@
<!--
This test is mostly a copy of layout/forms/crashtests/373586-1.xhtml,
and it makes sure that the value setter works correctly when setting
the value causes the frame to be reconstructed.
-->
<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait">
<head>
<bindings xmlns="http://www.mozilla.org/xbl">
<binding id="foo">
<content>
<children xmlns="http://www.mozilla.org/xbl" />
</content>
</binding>
</bindings>
<script>
function boom()
{
document.getElementById("div").style.MozBinding = "url('#foo')";
var opt1 = document.getElementById("opt1");
opt1.removeChild(opt1.firstChild);
document.getElementById("textarea").value += " y";
document.getElementById("div").style.MozBinding = "";
document.documentElement.removeAttribute("class")
}
</script>
</head>
<body onload="setTimeout(boom, 30);">
<div id="div">
<textarea rows="3" cols="5" id="textarea">x</textarea>
</div>
<select>
<option id="opt1">opt1</option>
</select>
</body>
</html>

View File

@ -0,0 +1,17 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<body>
<div id="div">
<textarea rows="3" cols="5" id="textarea">x y</textarea>
</div>
<select>
<option id="opt1"></option>
</select>
</body>
</html>

View File

@ -218,7 +218,7 @@ ShouldStartImageLoads(nsRuleData *aRuleData, nsCSSProperty aProperty)
nsCSSProps::PropHasFlags(aProperty, CSS_PROPERTY_START_IMAGE_LOADS);
}
nsresult
void
nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
{
// If we have no data for these structs, then return immediately.
@ -226,7 +226,7 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
// have to worry much less (although still some) about the speed of
// the rest of the function.
if (!(aRuleData->mSIDs & mStyleBits))
return NS_OK;
return;
nsIDocument* doc = aRuleData->mPresContext->Document();
@ -358,8 +358,6 @@ nsCSSCompressedDataBlock::MapRuleInfoInto(nsRuleData *aRuleData) const
}
}
NS_ASSERTION(cursor == cursor_end, "inconsistent data");
return NS_OK;
}
const void*

View File

@ -72,7 +72,7 @@ public:
* Do what |nsIStyleRule::MapRuleInfoInto| needs to do for a style
* rule using this block for storage.
*/
nsresult MapRuleInfoInto(nsRuleData *aRuleData) const;
void MapRuleInfoInto(nsRuleData *aRuleData) const;
/**
* Return the location at which the *value* for the property is

Some files were not shown because too many files have changed in this diff Show More