mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Merge inbound to m-c
This commit is contained in:
commit
abc9a053f3
@ -896,7 +896,7 @@ AccessibleWrap::accNavigate(
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
Accessible* navAccessible = nullptr;
|
||||
int32_t xpRelation = -1;
|
||||
Maybe<RelationType> xpRelation;
|
||||
|
||||
switch(navDir) {
|
||||
case NAVDIR_FIRSTCHILD:
|
||||
@ -921,55 +921,55 @@ AccessibleWrap::accNavigate(
|
||||
|
||||
// MSAA relationship extensions to accNavigate
|
||||
case NAVRELATION_CONTROLLED_BY:
|
||||
xpRelation = static_cast<int32_t>(RelationType::CONTROLLED_BY);
|
||||
xpRelation.construct(RelationType::CONTROLLED_BY);
|
||||
break;
|
||||
case NAVRELATION_CONTROLLER_FOR:
|
||||
xpRelation = static_cast<int32_t>(RelationType::CONTROLLER_FOR);
|
||||
xpRelation.construct(RelationType::CONTROLLER_FOR);
|
||||
break;
|
||||
case NAVRELATION_LABEL_FOR:
|
||||
xpRelation = static_cast<int32_t>(RelationType::LABEL_FOR);
|
||||
xpRelation.construct(RelationType::LABEL_FOR);
|
||||
break;
|
||||
case NAVRELATION_LABELLED_BY:
|
||||
xpRelation = static_cast<int32_t>(RelationType::LABELLED_BY);
|
||||
xpRelation.construct(RelationType::LABELLED_BY);
|
||||
break;
|
||||
case NAVRELATION_MEMBER_OF:
|
||||
xpRelation = static_cast<int32_t>(RelationType::MEMBER_OF);
|
||||
xpRelation.construct(RelationType::MEMBER_OF);
|
||||
break;
|
||||
case NAVRELATION_NODE_CHILD_OF:
|
||||
xpRelation = static_cast<int32_t>(RelationType::NODE_CHILD_OF);
|
||||
xpRelation.construct(RelationType::NODE_CHILD_OF);
|
||||
break;
|
||||
case NAVRELATION_FLOWS_TO:
|
||||
xpRelation = static_cast<int32_t>(RelationType::FLOWS_TO);
|
||||
xpRelation.construct(RelationType::FLOWS_TO);
|
||||
break;
|
||||
case NAVRELATION_FLOWS_FROM:
|
||||
xpRelation = static_cast<int32_t>(RelationType::FLOWS_FROM);
|
||||
xpRelation.construct(RelationType::FLOWS_FROM);
|
||||
break;
|
||||
case NAVRELATION_SUBWINDOW_OF:
|
||||
xpRelation = static_cast<int32_t>(RelationType::SUBWINDOW_OF);
|
||||
xpRelation.construct(RelationType::SUBWINDOW_OF);
|
||||
break;
|
||||
case NAVRELATION_EMBEDS:
|
||||
xpRelation = static_cast<int32_t>(RelationType::EMBEDS);
|
||||
xpRelation.construct(RelationType::EMBEDS);
|
||||
break;
|
||||
case NAVRELATION_EMBEDDED_BY:
|
||||
xpRelation = static_cast<int32_t>(RelationType::EMBEDDED_BY);
|
||||
xpRelation.construct(RelationType::EMBEDDED_BY);
|
||||
break;
|
||||
case NAVRELATION_POPUP_FOR:
|
||||
xpRelation = static_cast<int32_t>(RelationType::POPUP_FOR);
|
||||
xpRelation.construct(RelationType::POPUP_FOR);
|
||||
break;
|
||||
case NAVRELATION_PARENT_WINDOW_OF:
|
||||
xpRelation = static_cast<int32_t>(RelationType::PARENT_WINDOW_OF);
|
||||
xpRelation.construct(RelationType::PARENT_WINDOW_OF);
|
||||
break;
|
||||
case NAVRELATION_DEFAULT_BUTTON:
|
||||
xpRelation = static_cast<int32_t>(RelationType::DEFAULT_BUTTON);
|
||||
xpRelation.construct(RelationType::DEFAULT_BUTTON);
|
||||
break;
|
||||
case NAVRELATION_DESCRIBED_BY:
|
||||
xpRelation = static_cast<int32_t>(RelationType::DESCRIBED_BY);
|
||||
xpRelation.construct(RelationType::DESCRIBED_BY);
|
||||
break;
|
||||
case NAVRELATION_DESCRIPTION_FOR:
|
||||
xpRelation = static_cast<int32_t>(RelationType::DESCRIPTION_FOR);
|
||||
xpRelation.construct(RelationType::DESCRIPTION_FOR);
|
||||
break;
|
||||
case NAVRELATION_NODE_PARENT_OF:
|
||||
xpRelation = static_cast<int32_t>(RelationType::NODE_PARENT_OF);
|
||||
xpRelation.construct(RelationType::NODE_PARENT_OF);
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -978,8 +978,8 @@ AccessibleWrap::accNavigate(
|
||||
|
||||
pvarEndUpAt->vt = VT_EMPTY;
|
||||
|
||||
if (xpRelation >= 0) {
|
||||
Relation rel = RelationByType(static_cast<RelationType>(xpRelation));
|
||||
if (!xpRelation.empty()) {
|
||||
Relation rel = RelationByType(xpRelation.ref());
|
||||
navAccessible = rel.Next();
|
||||
}
|
||||
|
||||
|
@ -6,3 +6,5 @@
|
||||
|
||||
DIRS += ['content', 'locales']
|
||||
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
@ -5,3 +5,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DIRS += ['content', 'locales']
|
||||
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
@ -6,3 +6,5 @@
|
||||
|
||||
DIRS += ['content', 'locales']
|
||||
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
@ -6,3 +6,5 @@
|
||||
|
||||
DIRS += ['content', 'locales']
|
||||
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
@ -1,2 +1 @@
|
||||
DIST_SUBDIR=browser
|
||||
XPI_ROOT_APPID=$(MOZ_APP_ID)
|
||||
|
@ -3,6 +3,7 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
STANDALONE_MAKEFILE := 1
|
||||
DIST_SUBDIR := browser
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
|
@ -4,8 +4,6 @@
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
DIST_SUBDIR=metro
|
||||
|
||||
DEFINES += -DAB_CD=$(MOZ_UI_LOCALE) \
|
||||
-DPACKAGE=browser \
|
||||
-DMOZ_APP_VERSION=$(MOZ_APP_VERSION) \
|
||||
|
@ -6,3 +6,5 @@
|
||||
|
||||
METRO_CHROME_MANIFESTS += ['tests/mochiperf/metro.ini', 'tests/mochitest/metro.ini']
|
||||
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||
|
||||
DIST_SUBDIR = 'metro'
|
||||
|
@ -1,2 +1 @@
|
||||
DIST_SUBDIR=metro
|
||||
XPI_ROOT_APPID={99bceaaa-e3c6-48c1-b981-ef9b46b67d60}
|
||||
|
@ -15,3 +15,5 @@ DIRS += [
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['shell']
|
||||
|
||||
DIST_SUBDIR = 'metro'
|
||||
|
@ -6,9 +6,6 @@ NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# We want this exe in dist/bin
|
||||
DIST_SUBDIR =
|
||||
|
||||
DIST_PROGRAM = CommandExecuteHandler$(BIN_SUFFIX)
|
||||
|
||||
# Don't link against mozglue.dll
|
||||
|
@ -10,3 +10,6 @@ CPP_SOURCES += [
|
||||
'CEHHelper.cpp',
|
||||
'CommandExecuteHandler.cpp',
|
||||
]
|
||||
|
||||
# We want this exe in dist/bin
|
||||
DIST_SUBDIR = ''
|
||||
|
@ -6,8 +6,6 @@ NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
DIST_SUBDIR = metro/install
|
||||
|
||||
OS_LIBS = \
|
||||
kernel32.lib \
|
||||
user32.lib \
|
||||
|
@ -9,3 +9,5 @@ PROGRAM = 'linktool'
|
||||
CPP_SOURCES += [
|
||||
'linktool.cpp',
|
||||
]
|
||||
|
||||
DIST_SUBDIR = 'metro/install'
|
||||
|
@ -13,9 +13,6 @@ NO_PROFILE_GUIDED_OPTIMIZE = 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
# We want this exe in dist/bin
|
||||
DIST_SUBDIR =
|
||||
|
||||
OS_LIBS = \
|
||||
kernel32.lib \
|
||||
user32.lib \
|
||||
|
@ -9,3 +9,6 @@ PROGRAM = 'metrotestharness'
|
||||
CPP_SOURCES += [
|
||||
'metrotestharness.cpp',
|
||||
]
|
||||
|
||||
# We want this exe in dist/bin
|
||||
DIST_SUBDIR = ''
|
||||
|
@ -27,3 +27,5 @@ if CONFIG['MOZ_METRO']:
|
||||
if CONFIG['MAKENSISU']:
|
||||
DIRS += ['installer/windows']
|
||||
|
||||
DIST_SUBDIR = 'browser'
|
||||
export('DIST_SUBDIR')
|
||||
|
@ -175,7 +175,7 @@ AC_DEFUN([MOZ_COMPILER_OPTS],
|
||||
if test "${MOZ_PSEUDO_DERECURSE-unset}" = unset; then
|
||||
dnl Don't enable on pymake, because of bug 918652. Bug 912979 is an annoyance
|
||||
dnl with pymake, too.
|
||||
MOZ_PSEUDO_DERECURSE=no-pymake,no-skip
|
||||
MOZ_PSEUDO_DERECURSE=no-pymake
|
||||
fi
|
||||
|
||||
MOZ_DEBUGGING_OPTS
|
||||
|
@ -449,6 +449,12 @@ def environment(xrePath, env=None, crashreporter=True):
|
||||
asan = bool(mozinfo.info.get("asan"))
|
||||
if asan and (mozinfo.isLinux or mozinfo.isMac):
|
||||
try:
|
||||
# Symbolizer support
|
||||
llvmsym = os.path.join(xrePath, "llvm-symbolizer")
|
||||
if os.path.isfile(llvmsym):
|
||||
env["ASAN_SYMBOLIZER_PATH"] = llvmsym
|
||||
log.info("ASan using symbolizer at %s", llvmsym)
|
||||
|
||||
totalMemory = systemMemory()
|
||||
|
||||
# Only 2 GB RAM or less available? Use custom ASan options to reduce
|
||||
|
@ -56,4 +56,3 @@ GARBAGE += dummy
|
||||
endif
|
||||
|
||||
test.$(OBJ_SUFFIX): CFLAGS := -O0
|
||||
host_elf.$(OBJ_SUFFIX) host_elfhack.$(OBJ_SUFFIX): elfxx.h
|
||||
|
@ -29,6 +29,81 @@ endif
|
||||
|
||||
-include $(DEPTH)/.mozconfig.mk
|
||||
|
||||
# Integrate with mozbuild-generated make files. We first verify that no
|
||||
# variables provided by the automatically generated .mk files are
|
||||
# present. If they are, this is a violation of the separation of
|
||||
# responsibility between Makefile.in and mozbuild files.
|
||||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
ANDROID_GENERATED_RESFILES \
|
||||
ANDROID_RESFILES \
|
||||
CMMSRCS \
|
||||
CPP_UNIT_TESTS \
|
||||
DIRS \
|
||||
EXTRA_PP_COMPONENTS \
|
||||
EXTRA_PP_JS_MODULES \
|
||||
GTEST_CMMSRCS \
|
||||
GTEST_CPPSRCS \
|
||||
GTEST_CSRCS \
|
||||
HOST_CSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
IS_COMPONENT \
|
||||
JS_MODULES_PATH \
|
||||
LIBRARY_NAME \
|
||||
LIBXUL_LIBRARY \
|
||||
MODULE \
|
||||
MSVC_ENABLE_PGO \
|
||||
NO_DIST_INSTALL \
|
||||
PARALLEL_DIRS \
|
||||
SDK_HEADERS \
|
||||
SIMPLE_PROGRAMS \
|
||||
TEST_DIRS \
|
||||
TIERS \
|
||||
TOOL_DIRS \
|
||||
XPCSHELL_TESTS \
|
||||
XPIDL_MODULE \
|
||||
$(NULL)
|
||||
|
||||
_DEPRECATED_VARIABLES := \
|
||||
MOCHITEST_FILES_PARTS \
|
||||
MOCHITEST_BROWSER_FILES_PARTS \
|
||||
$(NULL)
|
||||
|
||||
ifndef EXTERNALLY_MANAGED_MAKE_FILE
|
||||
# Using $(firstword) may not be perfect. But it should be good enough for most
|
||||
# scenarios.
|
||||
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
|
||||
|
||||
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
|
||||
))
|
||||
|
||||
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
|
||||
))
|
||||
|
||||
# Import the automatically generated backend file. If this file doesn't exist,
|
||||
# the backend hasn't been properly configured. We want this to be a fatal
|
||||
# error, hence not using "-include".
|
||||
ifndef STANDALONE_MAKEFILE
|
||||
GLOBAL_DEPS += backend.mk
|
||||
include backend.mk
|
||||
endif
|
||||
|
||||
# Freeze the values specified by moz.build to catch them if they fail.
|
||||
|
||||
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
|
||||
$(foreach var,$(_DEPRECATED_VARIABLES),$(eval $(var)_FROZEN := '$($(var))'))
|
||||
|
||||
CHECK_MOZBUILD_VARIABLES = $(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES), \
|
||||
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
|
||||
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
|
||||
)) $(foreach var,$(_DEPRECATED_VARIABLES), \
|
||||
$(if $(subst $($(var)_FROZEN),,'$($(var))'), \
|
||||
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build),\
|
||||
))
|
||||
|
||||
endif
|
||||
|
||||
space = $(NULL) $(NULL)
|
||||
|
||||
# Include defs.mk files that can be found in $(srcdir)/$(DEPTH),
|
||||
@ -74,12 +149,16 @@ RM = rm -f
|
||||
LIBXUL_DIST ?= $(DIST)
|
||||
|
||||
# FINAL_TARGET specifies the location into which we copy end-user-shipped
|
||||
# build products (typelibs, components, chrome).
|
||||
# build products (typelibs, components, chrome). It may already be specified by
|
||||
# a moz.build file.
|
||||
#
|
||||
# If XPI_NAME is set, the files will be shipped to $(DIST)/xpi-stage/$(XPI_NAME)
|
||||
# instead of $(DIST)/bin. In both cases, if DIST_SUBDIR is set, the files will be
|
||||
# shipped to a $(DIST_SUBDIR) subdirectory.
|
||||
FINAL_TARGET = $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIST_SUBDIR:%=/%)
|
||||
FINAL_TARGET ?= $(if $(XPI_NAME),$(DIST)/xpi-stage/$(XPI_NAME),$(DIST)/bin)$(DIST_SUBDIR:%=/%)
|
||||
# Override the stored value for the check to make sure that the variable is not
|
||||
# redefined in the Makefile.in value.
|
||||
FINAL_TARGET_FROZEN := '$(FINAL_TARGET)'
|
||||
|
||||
ifdef XPI_NAME
|
||||
DEFINES += -DXPI_NAME=$(XPI_NAME)
|
||||
|
102
config/rules.mk
102
config/rules.mk
@ -16,72 +16,9 @@ $(error Do not include rules.mk twice!)
|
||||
endif
|
||||
INCLUDED_RULES_MK = 1
|
||||
|
||||
# Integrate with mozbuild-generated make files. We first verify that no
|
||||
# variables provided by the automatically generated .mk files are
|
||||
# present. If they are, this is a violation of the separation of
|
||||
# responsibility between Makefile.in and mozbuild files.
|
||||
_MOZBUILD_EXTERNAL_VARIABLES := \
|
||||
ANDROID_GENERATED_RESFILES \
|
||||
ANDROID_RESFILES \
|
||||
CMMSRCS \
|
||||
CPP_UNIT_TESTS \
|
||||
DIRS \
|
||||
EXTRA_PP_COMPONENTS \
|
||||
EXTRA_PP_JS_MODULES \
|
||||
GTEST_CMMSRCS \
|
||||
GTEST_CPPSRCS \
|
||||
GTEST_CSRCS \
|
||||
HOST_CSRCS \
|
||||
HOST_LIBRARY_NAME \
|
||||
IS_COMPONENT \
|
||||
JS_MODULES_PATH \
|
||||
LIBRARY_NAME \
|
||||
LIBXUL_LIBRARY \
|
||||
MODULE \
|
||||
MSVC_ENABLE_PGO \
|
||||
NO_DIST_INSTALL \
|
||||
PARALLEL_DIRS \
|
||||
SDK_HEADERS \
|
||||
SIMPLE_PROGRAMS \
|
||||
TEST_DIRS \
|
||||
TIERS \
|
||||
TOOL_DIRS \
|
||||
XPCSHELL_TESTS \
|
||||
XPIDL_MODULE \
|
||||
$(NULL)
|
||||
|
||||
_DEPRECATED_VARIABLES := \
|
||||
XPIDL_FLAGS \
|
||||
MOCHITEST_FILES_PARTS \
|
||||
MOCHITEST_BROWSER_FILES_PARTS \
|
||||
MOCHITEST_WEBAPPRT_CHROME_FILES \
|
||||
$(NULL)
|
||||
|
||||
ifndef EXTERNALLY_MANAGED_MAKE_FILE
|
||||
# Using $(firstword) may not be perfect. But it should be good enough for most
|
||||
# scenarios.
|
||||
_current_makefile = $(CURDIR)/$(firstword $(MAKEFILE_LIST))
|
||||
|
||||
$(foreach var,$(_MOZBUILD_EXTERNAL_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). It should only be defined in moz.build files),\
|
||||
))
|
||||
|
||||
$(foreach var,$(_DEPRECATED_VARIABLES),$(if $(filter file override,$(subst $(NULL) ,_,$(origin $(var)))),\
|
||||
$(error Variable $(var) is defined in $(_current_makefile). This variable has been deprecated. It does nothing. It must be removed in order to build)\
|
||||
))
|
||||
|
||||
ifneq (,$(XPIDLSRCS)$(SDK_XPIDLSRCS))
|
||||
$(error XPIDLSRCS and SDK_XPIDLSRCS have been merged and moved to moz.build files as the XPIDL_SOURCES variable. You must move these variables out of $(_current_makefile))
|
||||
endif
|
||||
|
||||
# Import the automatically generated backend file. If this file doesn't exist,
|
||||
# the backend hasn't been properly configured. We want this to be a fatal
|
||||
# error, hence not using "-include".
|
||||
ifndef STANDALONE_MAKEFILE
|
||||
GLOBAL_DEPS += backend.mk
|
||||
include backend.mk
|
||||
endif
|
||||
endif
|
||||
# Make sure that anything that needs to be defined in moz.build wasn't
|
||||
# overwritten.
|
||||
_eval_for_side_effects := $(CHECK_MOZBUILD_VARIABLES)
|
||||
|
||||
ifndef MOZILLA_DIR
|
||||
MOZILLA_DIR = $(topsrcdir)
|
||||
@ -382,12 +319,12 @@ OBJS = $(strip $(_OBJS))
|
||||
endif
|
||||
|
||||
HOST_COBJS = $(addprefix host_,$(HOST_CSRCS:.c=.$(OBJ_SUFFIX)))
|
||||
HOST_CCOBJS = $(addprefix host_,$(patsubst %.cc,%.$(OBJ_SUFFIX),$(filter %.cc,$(HOST_CPPSRCS))))
|
||||
HOST_CPPOBJS = $(addprefix host_,$(patsubst %.cpp,%.$(OBJ_SUFFIX),$(filter %.cpp,$(HOST_CPPSRCS))))
|
||||
# HOST_CPPOBJS can have different extensions (eg: .cpp, .cc)
|
||||
HOST_CPPOBJS = $(addprefix host_,$(addsuffix .$(OBJ_SUFFIX),$(basename $(HOST_CPPSRCS))))
|
||||
HOST_CMOBJS = $(addprefix host_,$(HOST_CMSRCS:.m=.$(OBJ_SUFFIX)))
|
||||
HOST_CMMOBJS = $(addprefix host_,$(HOST_CMMSRCS:.mm=.$(OBJ_SUFFIX)))
|
||||
ifndef HOST_OBJS
|
||||
_HOST_OBJS = $(HOST_COBJS) $(HOST_CCOBJS) $(HOST_CPPOBJS) $(HOST_CMOBJS) $(HOST_CMMOBJS)
|
||||
_HOST_OBJS = $(HOST_COBJS) $(HOST_CPPOBJS) $(HOST_CMOBJS) $(HOST_CMMOBJS)
|
||||
HOST_OBJS = $(strip $(_HOST_OBJS))
|
||||
endif
|
||||
|
||||
@ -879,7 +816,7 @@ endif
|
||||
$(HOST_PROGRAM): $(HOST_PROGOBJS) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||
$(REPORT_BUILD)
|
||||
ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
|
||||
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
@ -896,9 +833,9 @@ ifdef MSMANIFEST_TOOL
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
ifeq ($(HOST_CPP_PROG_LINK),1)
|
||||
$(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_CXX) -o $@ $(HOST_CXXFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
else
|
||||
$(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
endif # HOST_CPP_PROG_LINK
|
||||
endif
|
||||
|
||||
@ -935,12 +872,12 @@ endif
|
||||
$(HOST_SIMPLE_PROGRAMS): host_%$(HOST_BIN_SUFFIX): host_%.$(OBJ_SUFFIX) $(HOST_LIBS_DEPS) $(HOST_EXTRA_DEPS) $(GLOBAL_DEPS)
|
||||
$(REPORT_BUILD)
|
||||
ifeq (WINNT_,$(HOST_OS_ARCH)_$(GNU_CC))
|
||||
$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
else
|
||||
ifneq (,$(HOST_CPPSRCS)$(USE_HOST_CXX))
|
||||
$(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_CXX) $(HOST_OUTOPTION)$@ $(HOST_CXXFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
else
|
||||
$(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
$(EXPAND_LIBS_EXEC) --uselist -- $(HOST_CC) $(HOST_OUTOPTION)$@ $(HOST_CFLAGS) $(INCLUDES) $< $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
endif
|
||||
endif
|
||||
|
||||
@ -993,7 +930,7 @@ endif # OS/2
|
||||
$(HOST_LIBRARY): $(HOST_OBJS) Makefile
|
||||
$(REPORT_BUILD)
|
||||
$(RM) $@
|
||||
$(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
|
||||
$(EXPAND_LIBS_EXEC) --extract -- $(HOST_AR) $(HOST_AR_FLAGS) $(HOST_OBJS)
|
||||
$(HOST_RANLIB) $@
|
||||
|
||||
ifdef HAVE_DTRACE
|
||||
@ -1079,27 +1016,24 @@ define src_objdep
|
||||
$(basename $(notdir $1)).$(OBJ_SUFFIX): $1 $(call mkdir_deps,$(MDDEPDIR))
|
||||
endef
|
||||
$(foreach f,$(CSRCS) $(SSRCS) $(CPPSRCS) $(CMSRCS) $(CMMSRCS) $(ASFILES),$(eval $(call src_objdep,$(f))))
|
||||
$(foreach f,$(HOST_CSRCS) $(HOST_CPPSRCS) $(HOST_CMSRCS) $(HOST_CMMSRCS),$(eval host_$(call src_objdep,$(f))))
|
||||
|
||||
$(OBJS) $(HOST_OBJS) $(PROGOBJS) $(HOST_PROGOBJS): $(GLOBAL_DEPS)
|
||||
|
||||
# Rules for building native targets must come first because of the host_ prefix
|
||||
$(HOST_COBJS): host_%.$(OBJ_SUFFIX): %.c
|
||||
$(HOST_COBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CPPOBJS): host_%.$(OBJ_SUFFIX): %.cpp
|
||||
$(HOST_CPPOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CCOBJS): host_%.$(OBJ_SUFFIX): %.cc
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CMOBJS): host_%.$(OBJ_SUFFIX): %.m
|
||||
$(HOST_CMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
$(HOST_CMMOBJS): host_%.$(OBJ_SUFFIX): %.mm
|
||||
$(HOST_CMMOBJS):
|
||||
$(REPORT_BUILD)
|
||||
$(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS)
|
||||
|
||||
|
@ -5,10 +5,10 @@
|
||||
|
||||
LOCALE_SRCDIR = $(srcdir)/l10n
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
STANDALONE_MAKEFILE := 1
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
XPI_NAME = test_jar_mn
|
||||
|
||||
DEFINES += \
|
||||
|
@ -8486,6 +8486,14 @@ COMPILE_CXXFLAGS=`echo \
|
||||
$_DEPEND_CFLAGS \
|
||||
$COMPILE_CXXFLAGS`
|
||||
|
||||
HOST_CFLAGS=`echo \
|
||||
$HOST_CFLAGS \
|
||||
$_DEPEND_CFLAGS`
|
||||
|
||||
HOST_CXXFLAGS=`echo \
|
||||
$HOST_CXXFLAGS \
|
||||
$_DEPEND_CFLAGS`
|
||||
|
||||
AC_SUBST(SYSTEM_LIBXUL)
|
||||
AC_SUBST(MOZ_NATIVE_JPEG)
|
||||
AC_SUBST(MOZ_NATIVE_PNG)
|
||||
|
@ -6,7 +6,7 @@
|
||||
#ifndef nsContentCreatorFunctions_h__
|
||||
#define nsContentCreatorFunctions_h__
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsError.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "mozilla/dom/FromParser.h"
|
||||
|
||||
|
@ -15,17 +15,17 @@
|
||||
#define __nsContentPolicyUtils_h__
|
||||
|
||||
#include "nsIContentPolicy.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
//XXXtw sadly, this makes consumers of nsContentPolicyUtils depend on widget
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
|
||||
class nsACString;
|
||||
class nsIPrincipal;
|
||||
|
||||
#define NS_CONTENTPOLICY_CONTRACTID "@mozilla.org/layout/content-policy;1"
|
||||
#define NS_CONTENTPOLICY_CATEGORY "content-policy"
|
||||
|
@ -9,7 +9,6 @@
|
||||
#ifndef nsContentUtils_h___
|
||||
#define nsContentUtils_h___
|
||||
|
||||
#include <math.h>
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#include <float.h>
|
||||
#endif
|
||||
@ -21,7 +20,6 @@
|
||||
#include "js/TypeDecls.h"
|
||||
#include "js/Value.h"
|
||||
#include "js/RootingAPI.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
|
@ -7,10 +7,9 @@
|
||||
#define nsINameSpaceManager_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsStringGlue.h"
|
||||
|
||||
class nsIAtom;
|
||||
class nsString;
|
||||
class nsAString;
|
||||
|
||||
#define kNameSpaceID_Unknown -1
|
||||
// 0 is special at C++, so use a static const int32_t for
|
||||
|
@ -6,7 +6,7 @@
|
||||
#define nsViewportInfo_h___
|
||||
|
||||
#include <stdint.h>
|
||||
#include "nscore.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "Units.h"
|
||||
|
||||
/**
|
||||
|
@ -1451,10 +1451,11 @@ Element::DispatchClickEvent(nsPresContext* aPresContext,
|
||||
uint32_t clickCount = 1;
|
||||
float pressure = 0;
|
||||
uint16_t inputSource = 0;
|
||||
if (aSourceEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
clickCount = static_cast<WidgetMouseEvent*>(aSourceEvent)->clickCount;
|
||||
pressure = static_cast<WidgetMouseEvent*>(aSourceEvent)->pressure;
|
||||
inputSource = static_cast<WidgetMouseEvent*>(aSourceEvent)->inputSource;
|
||||
WidgetMouseEvent* sourceMouseEvent = aSourceEvent->AsMouseEvent();
|
||||
if (sourceMouseEvent) {
|
||||
clickCount = sourceMouseEvent->clickCount;
|
||||
pressure = sourceMouseEvent->pressure;
|
||||
inputSource = sourceMouseEvent->inputSource;
|
||||
} else if (aSourceEvent->eventStructType == NS_KEY_EVENT) {
|
||||
inputSource = nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD;
|
||||
}
|
||||
@ -2225,8 +2226,7 @@ Element::PostHandleEventForLinks(nsEventChainPostVisitor& aVisitor)
|
||||
switch (aVisitor.mEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
{
|
||||
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
if (aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
// don't make the link grab the focus if there is no link handler
|
||||
nsILinkHandler *handler = aVisitor.mPresContext->GetLinkHandler();
|
||||
|
@ -694,8 +694,7 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
((this == aVisitor.mEvent->originalTarget &&
|
||||
!ChromeOnlyAccess()) || isAnonForEvents)) {
|
||||
nsCOMPtr<nsIContent> relatedTarget =
|
||||
do_QueryInterface(
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->relatedTarget);
|
||||
do_QueryInterface(aVisitor.mEvent->AsMouseEvent()->relatedTarget);
|
||||
if (relatedTarget &&
|
||||
relatedTarget->OwnerDoc() == OwnerDoc()) {
|
||||
|
||||
|
@ -1097,6 +1097,7 @@ GK_ATOM(tt, "tt")
|
||||
GK_ATOM(tty, "tty")
|
||||
GK_ATOM(tv, "tv")
|
||||
GK_ATOM(type, "type")
|
||||
GK_ATOM(typemustmatch, "typemustmatch")
|
||||
GK_ATOM(u, "u")
|
||||
GK_ATOM(ul, "ul")
|
||||
GK_ATOM(underflow, "underflow")
|
||||
|
@ -3,7 +3,6 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/*
|
||||
* A base class implementing nsIObjectLoadingContent for use by
|
||||
* various content nodes that want to provide plugin/document/image
|
||||
@ -1380,6 +1379,7 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
|
||||
nsresult rv;
|
||||
nsAutoCString newMime;
|
||||
nsAutoString typeAttr;
|
||||
nsCOMPtr<nsIURI> newURI;
|
||||
nsCOMPtr<nsIURI> newBaseURI;
|
||||
ObjectType newType;
|
||||
@ -1406,10 +1406,11 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
newMime.AssignLiteral("application/x-java-vm");
|
||||
isJava = true;
|
||||
} else {
|
||||
nsAutoString typeAttr;
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, typeAttr);
|
||||
if (!typeAttr.IsEmpty()) {
|
||||
CopyUTF16toUTF8(typeAttr, newMime);
|
||||
nsAutoString rawTypeAttr;
|
||||
thisContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, rawTypeAttr);
|
||||
if (!rawTypeAttr.IsEmpty()) {
|
||||
typeAttr = rawTypeAttr;
|
||||
CopyUTF16toUTF8(rawTypeAttr, newMime);
|
||||
isJava = nsPluginHost::IsJavaMIMEType(newMime.get());
|
||||
}
|
||||
}
|
||||
@ -1646,19 +1647,23 @@ nsObjectLoadingContent::UpdateObjectParameters(bool aJavaURI)
|
||||
//
|
||||
// In order of preference:
|
||||
//
|
||||
// 1) Use our type hint if it matches a plugin
|
||||
// 2) If we have eAllowPluginSkipChannel, use the uri file extension if
|
||||
// 1) Perform typemustmatch check.
|
||||
// If check is sucessful use type without further checks.
|
||||
// If check is unsuccessful set stateInvalid to true
|
||||
// 2) Use our type hint if it matches a plugin
|
||||
// 3) If we have eAllowPluginSkipChannel, use the uri file extension if
|
||||
// it matches a plugin
|
||||
// 3) If the channel returns a binary stream type:
|
||||
// 3a) If we have a type non-null non-document type hint, use that
|
||||
// 3b) If the uri file extension matches a plugin type, use that
|
||||
// 4) Use the channel type
|
||||
//
|
||||
// XXX(johns): HTML5's "typesmustmatch" attribute would need to be
|
||||
// honored here if implemented
|
||||
// 4) If the channel returns a binary stream type:
|
||||
// 4a) If we have a type non-null non-document type hint, use that
|
||||
// 4b) If the uri file extension matches a plugin type, use that
|
||||
// 5) Use the channel type
|
||||
|
||||
bool overrideChannelType = false;
|
||||
if (typeHint == eType_Plugin) {
|
||||
if (thisContent->HasAttr(kNameSpaceID_None, nsGkAtoms::typemustmatch)) {
|
||||
if (!typeAttr.LowerCaseEqualsASCII(channelType.get())) {
|
||||
stateInvalid = true;
|
||||
}
|
||||
} else if (typeHint == eType_Plugin) {
|
||||
LOG(("OBJLC [%p]: Using plugin type hint in favor of any channel type",
|
||||
this));
|
||||
overrideChannelType = true;
|
||||
|
@ -506,6 +506,7 @@ support-files =
|
||||
[test_bug814576.html]
|
||||
[test_bug819051.html]
|
||||
[test_bug820909.html]
|
||||
[test_bug827160.html]
|
||||
[test_bug840098.html]
|
||||
[test_bug868999.html]
|
||||
[test_bug869000.html]
|
||||
|
63
content/base/test/test_bug827160.html
Normal file
63
content/base/test/test_bug827160.html
Normal file
@ -0,0 +1,63 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=827160
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 827160</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SpecialPowers.js"></script>
|
||||
<script type="application/javascript" src="utils.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=827160">Mozilla Bug 827160</a>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
// Make sure the test plugin is not click-to-play
|
||||
var pluginHost = SpecialPowers.Cc["@mozilla.org/plugin/host;1"]
|
||||
.getService(SpecialPowers.Ci.nsIPluginHost);
|
||||
var pluginTags = pluginHost.getPluginTags();
|
||||
for (var tag of pluginTags) {
|
||||
if (tag.name == "Test Plug-in" || tag.name == "Second Test Plug-in") {
|
||||
var oldEnabledState = tag.enabledState;
|
||||
tag.enabledState = SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED;
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
tag.enabledState = oldEnabledState;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Should load test plugin application/x-test -->
|
||||
<object id="shouldLoad" data="data:application/x-test,foo"></object>
|
||||
<!-- Should load test plugin application/x-test2, ignoring type="" -->
|
||||
<object id="shouldIgnoreType" type="application/x-test" data="data:application/x-test2,foo"></object>
|
||||
<!-- Should load nothing, channel type does not match type and typeMustMatch is present -->
|
||||
<object id="shouldNotLoad" type="application/x-test" data="data:application/x-test2,foo" typemustmatch></object>
|
||||
<!-- Should not load test plugin application/x-test2, no type field is present -->
|
||||
<object id="shouldNotLoadMissingType" data="data:application/x-test2,foo" typemustmatch></object>
|
||||
<!-- Should load, no data field is present -->
|
||||
<object id="shouldLoadMissingData" type="application/x-test" typemustmatch></object>
|
||||
<pre id="test">
|
||||
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
const OBJLC = SpecialPowers.Ci.nsIObjectLoadingContent;
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldLoad")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load without type, failed expected load");
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldIgnoreType")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with type, failed expected load");
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldNotLoad")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch, load success even though failure expected");
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldNotLoadMissingType")).displayedType, OBJLC.TYPE_NULL, "Testing object load with typemustmatch and with type, load success even though failure expected");
|
||||
is(SpecialPowers.wrap(document.getElementById("shouldLoadMissingData")).displayedType, OBJLC.TYPE_PLUGIN, "Testing object load with typemustmatch and without data, failed expected load");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -20,6 +20,7 @@
|
||||
#include "mozilla/dom/HTMLCanvasElement.h"
|
||||
#include "nsWrapperCache.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
|
||||
#include "GLContextProvider.h"
|
||||
#include "gfxImageSurface.h"
|
||||
|
@ -24,8 +24,7 @@ DOMWheelEvent::DOMWheelEvent(EventTarget* aOwner,
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<WidgetWheelEvent*>(mEvent)->inputSource =
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
mEvent->AsWheelEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,7 +60,7 @@ DOMWheelEvent::InitWheelEvent(const nsAString & aType,
|
||||
aRelatedTarget, aModifiersList);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
WidgetWheelEvent* wheelEvent = static_cast<WidgetWheelEvent*>(mEvent);
|
||||
WidgetWheelEvent* wheelEvent = mEvent->AsWheelEvent();
|
||||
wheelEvent->deltaX = aDeltaX;
|
||||
wheelEvent->deltaY = aDeltaY;
|
||||
wheelEvent->deltaZ = aDeltaZ;
|
||||
@ -70,6 +69,12 @@ DOMWheelEvent::InitWheelEvent(const nsAString & aType,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
double
|
||||
DOMWheelEvent::DeltaX()
|
||||
{
|
||||
return mEvent->AsWheelEvent()->deltaX;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaX(double* aDeltaX)
|
||||
{
|
||||
@ -79,6 +84,12 @@ DOMWheelEvent::GetDeltaX(double* aDeltaX)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
double
|
||||
DOMWheelEvent::DeltaY()
|
||||
{
|
||||
return mEvent->AsWheelEvent()->deltaY;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaY(double* aDeltaY)
|
||||
{
|
||||
@ -88,6 +99,12 @@ DOMWheelEvent::GetDeltaY(double* aDeltaY)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
double
|
||||
DOMWheelEvent::DeltaZ()
|
||||
{
|
||||
return mEvent->AsWheelEvent()->deltaZ;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaZ(double* aDeltaZ)
|
||||
{
|
||||
@ -97,6 +114,12 @@ DOMWheelEvent::GetDeltaZ(double* aDeltaZ)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
DOMWheelEvent::DeltaMode()
|
||||
{
|
||||
return mEvent->AsWheelEvent()->deltaMode;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DOMWheelEvent::GetDeltaMode(uint32_t* aDeltaMode)
|
||||
{
|
||||
@ -153,7 +176,7 @@ DOMWheelEvent::Constructor(const GlobalObject& aGlobal,
|
||||
aParam.mButton, aParam.mRelatedTarget,
|
||||
modifierList, aParam.mDeltaX,
|
||||
aParam.mDeltaY, aParam.mDeltaZ, aParam.mDeltaMode);
|
||||
static_cast<WidgetWheelEvent*>(e->mEvent)->buttons = aParam.mButtons;
|
||||
e->mEvent->AsWheelEvent()->buttons = aParam.mButtons;
|
||||
e->SetTrusted(trusted);
|
||||
return e.forget();
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsDOMMouseEvent.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/WheelEventBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -43,25 +43,10 @@ public:
|
||||
return mozilla::dom::WheelEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
double DeltaX()
|
||||
{
|
||||
return static_cast<WidgetWheelEvent*>(mEvent)->deltaX;
|
||||
}
|
||||
|
||||
double DeltaY()
|
||||
{
|
||||
return static_cast<WidgetWheelEvent*>(mEvent)->deltaY;
|
||||
}
|
||||
|
||||
double DeltaZ()
|
||||
{
|
||||
return static_cast<WidgetWheelEvent*>(mEvent)->deltaZ;
|
||||
}
|
||||
|
||||
uint32_t DeltaMode()
|
||||
{
|
||||
return static_cast<WidgetWheelEvent*>(mEvent)->deltaMode;
|
||||
}
|
||||
double DeltaX();
|
||||
double DeltaY();
|
||||
double DeltaZ();
|
||||
uint32_t DeltaMode();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
@ -24,8 +24,7 @@ nsDOMDragEvent::nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<WidgetMouseEvent*>(mEvent)->inputSource =
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
mEvent->AsMouseEvent()->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -517,7 +517,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_GUI_EVENT:
|
||||
{
|
||||
WidgetGUIEvent* oldGUIEvent = static_cast<WidgetGUIEvent*>(mEvent);
|
||||
WidgetGUIEvent* oldGUIEvent = mEvent->AsGUIEvent();
|
||||
// Not copying widget, it is a weak reference.
|
||||
WidgetGUIEvent* guiEvent = new WidgetGUIEvent(false, msg, nullptr);
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
@ -543,7 +543,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_MOUSE_EVENT:
|
||||
{
|
||||
WidgetMouseEvent* oldMouseEvent = static_cast<WidgetMouseEvent*>(mEvent);
|
||||
WidgetMouseEvent* oldMouseEvent = mEvent->AsMouseEvent();
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
new WidgetMouseEvent(false, msg, nullptr, oldMouseEvent->reason);
|
||||
mouseEvent->AssignMouseEventData(*oldMouseEvent, true);
|
||||
@ -607,7 +607,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_WHEEL_EVENT:
|
||||
{
|
||||
WidgetWheelEvent* oldWheelEvent = static_cast<WidgetWheelEvent*>(mEvent);
|
||||
WidgetWheelEvent* oldWheelEvent = mEvent->AsWheelEvent();
|
||||
WidgetWheelEvent* wheelEvent = new WidgetWheelEvent(false, msg, nullptr);
|
||||
wheelEvent->AssignWheelEventData(*oldWheelEvent, true);
|
||||
newEvent = wheelEvent;
|
||||
@ -677,7 +677,7 @@ nsDOMEvent::DuplicatePrivateData()
|
||||
}
|
||||
case NS_SVGZOOM_EVENT:
|
||||
{
|
||||
WidgetGUIEvent* oldGUIEvent = static_cast<WidgetGUIEvent*>(mEvent);
|
||||
WidgetGUIEvent* oldGUIEvent = mEvent->AsGUIEvent();
|
||||
WidgetGUIEvent* guiEvent = new WidgetGUIEvent(false, msg, nullptr);
|
||||
guiEvent->eventStructType = NS_SVGZOOM_EVENT;
|
||||
guiEvent->AssignGUIEventData(*oldGUIEvent, true);
|
||||
@ -925,8 +925,7 @@ nsDOMEvent::GetEventPopupControlState(WidgetEvent* aEvent)
|
||||
break;
|
||||
case NS_MOUSE_EVENT :
|
||||
if (aEvent->mFlags.mIsTrusted &&
|
||||
static_cast<WidgetMouseEvent*>(aEvent)->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton) {
|
||||
switch(aEvent->message) {
|
||||
case NS_MOUSE_BUTTON_UP :
|
||||
if (::PopupAllowedForEvent("mouseup"))
|
||||
@ -1027,7 +1026,7 @@ nsDOMEvent::GetScreenCoords(nsPresContext* aPresContext,
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
WidgetGUIEvent* guiEvent = static_cast<WidgetGUIEvent*>(aEvent);
|
||||
WidgetGUIEvent* guiEvent = aEvent->AsGUIEvent();
|
||||
if (!guiEvent->widget) {
|
||||
return LayoutDeviceIntPoint::ToUntyped(aPoint);
|
||||
}
|
||||
@ -1082,7 +1081,7 @@ nsDOMEvent::GetClientCoords(nsPresContext* aPresContext,
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!aPresContext ||
|
||||
!static_cast<WidgetGUIEvent*>(aEvent)->widget) {
|
||||
!aEvent->AsGUIEvent()->widget) {
|
||||
return aDefaultPoint;
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,8 @@ nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
|
||||
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
||||
// It's not that important, though, since a scroll event is not a real
|
||||
// DOM event.
|
||||
|
||||
|
||||
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
}
|
||||
@ -29,20 +30,13 @@ nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
|
||||
mEventIsInternal = true;
|
||||
mEvent->time = PR_Now();
|
||||
mEvent->refPoint.x = mEvent->refPoint.y = 0;
|
||||
static_cast<WidgetMouseEvent*>(mEvent)->inputSource =
|
||||
nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
mouseEvent->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
|
||||
}
|
||||
|
||||
switch (mEvent->eventStructType)
|
||||
{
|
||||
case NS_MOUSE_EVENT:
|
||||
NS_ASSERTION(static_cast<WidgetMouseEvent*>(mEvent)->reason
|
||||
!= WidgetMouseEvent::eSynthesized,
|
||||
"Don't dispatch DOM events from synthesized mouse events");
|
||||
mDetail = static_cast<WidgetMouseEvent*>(mEvent)->clickCount;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (mouseEvent) {
|
||||
MOZ_ASSERT(mouseEvent->reason != WidgetMouseEvent::eSynthesized,
|
||||
"Don't dispatch DOM events from synthesized mouse events");
|
||||
mDetail = mouseEvent->clickCount;
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,8 +72,8 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
|
||||
mouseEventBase->refPoint.x = aScreenX;
|
||||
mouseEventBase->refPoint.y = aScreenY;
|
||||
|
||||
if (mEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(mEvent);
|
||||
WidgetMouseEvent* mouseEvent = mEvent->AsMouseEvent();
|
||||
if (mouseEvent) {
|
||||
mouseEvent->clickCount = aDetail;
|
||||
}
|
||||
break;
|
||||
|
@ -120,7 +120,7 @@ nsDOMUIEvent::GetMovementPoint()
|
||||
mEvent->eventStructType != NS_WHEEL_EVENT &&
|
||||
mEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
mEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!(static_cast<WidgetGUIEvent*>(mEvent)->widget)) {
|
||||
!mEvent->AsGUIEvent()->widget) {
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
|
@ -50,8 +50,7 @@ public:
|
||||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
mozilla::WidgetGUIEvent* event =
|
||||
static_cast<mozilla::WidgetGUIEvent*>(aEvent);
|
||||
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
if (!event->widget) {
|
||||
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
}
|
||||
@ -74,7 +73,7 @@ public:
|
||||
aEvent->eventStructType != NS_DRAG_EVENT &&
|
||||
aEvent->eventStructType != NS_SIMPLE_GESTURE_EVENT) ||
|
||||
!aPresContext ||
|
||||
!static_cast<mozilla::WidgetGUIEvent*>(aEvent)->widget) {
|
||||
!aEvent->AsGUIEvent()->widget) {
|
||||
return aDefaultClientPoint
|
||||
? *aDefaultClientPoint
|
||||
: CSSIntPoint(0, 0);
|
||||
|
@ -697,7 +697,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
case NS_SCROLLPORT_EVENT:
|
||||
case NS_UI_EVENT:
|
||||
return NS_NewDOMUIEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
aEvent->AsGUIEvent());
|
||||
case NS_SCROLLAREA_EVENT:
|
||||
return NS_NewDOMScrollAreaEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsScrollAreaEvent());
|
||||
@ -718,7 +718,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
aEvent->AsMouseScrollEvent());
|
||||
case NS_WHEEL_EVENT:
|
||||
return NS_NewDOMWheelEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetWheelEvent*>(aEvent));
|
||||
aEvent->AsWheelEvent());
|
||||
case NS_DRAG_EVENT:
|
||||
return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
|
||||
aEvent->AsDragEvent());
|
||||
@ -730,7 +730,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
||||
aEvent->AsClipboardEvent());
|
||||
case NS_SVGZOOM_EVENT:
|
||||
return NS_NewDOMSVGZoomEvent(aDOMEvent, aOwner, aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
aEvent->AsGUIEvent());
|
||||
case NS_SMIL_TIME_EVENT:
|
||||
return NS_NewDOMTimeEvent(aDOMEvent, aOwner, aPresContext, aEvent);
|
||||
|
||||
|
@ -136,8 +136,7 @@ IsMouseEventReal(WidgetEvent* aEvent)
|
||||
{
|
||||
NS_ABORT_IF_FALSE(aEvent->IsMouseDerivedEvent(), "Not a mouse event");
|
||||
// Return true if not synthesized.
|
||||
return static_cast<WidgetMouseEvent*>(aEvent)->reason ==
|
||||
WidgetMouseEvent::eReal;
|
||||
return aEvent->AsMouseEvent()->reason == WidgetMouseEvent::eReal;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_DOCSHELL_FOCUS
|
||||
@ -502,7 +501,7 @@ nsMouseWheelTransaction::OnEvent(WidgetEvent* aEvent)
|
||||
if (IsMouseEventReal(aEvent)) {
|
||||
// If the cursor is moving to be outside the frame,
|
||||
// terminate the scrollwheel transaction.
|
||||
nsIntPoint pt = GetScreenPoint(static_cast<WidgetGUIEvent*>(aEvent));
|
||||
nsIntPoint pt = GetScreenPoint(aEvent->AsGUIEvent());
|
||||
nsIntRect r = sTargetFrame->GetScreenRectExternal();
|
||||
if (!r.Contains(pt)) {
|
||||
EndTransaction();
|
||||
@ -1043,38 +1042,34 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
nsMouseWheelTransaction::OnEvent(aEvent);
|
||||
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
switch (static_cast<WidgetMouseEvent*>(aEvent)->button) {
|
||||
case NS_MOUSE_BUTTON_DOWN: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
switch (mouseEvent->button) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
#ifndef XP_OS2
|
||||
BeginTrackingDragGesture(aPresContext,
|
||||
static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aTargetFrame);
|
||||
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
|
||||
#endif
|
||||
mLClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
|
||||
SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aStatus);
|
||||
mLClickCount = mouseEvent->clickCount;
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
sNormalLMouseEventInProcess = true;
|
||||
break;
|
||||
case WidgetMouseEvent::eMiddleButton:
|
||||
mMClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
|
||||
SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aStatus);
|
||||
mMClickCount = mouseEvent->clickCount;
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
case WidgetMouseEvent::eRightButton:
|
||||
#ifdef XP_OS2
|
||||
BeginTrackingDragGesture(aPresContext,
|
||||
static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aTargetFrame);
|
||||
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
|
||||
#endif
|
||||
mRClickCount = static_cast<WidgetMouseEvent*>(aEvent)->clickCount;
|
||||
SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aStatus);
|
||||
mRClickCount = mouseEvent->clickCount;
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
switch (static_cast<WidgetMouseEvent*>(aEvent)->button) {
|
||||
}
|
||||
case NS_MOUSE_BUTTON_UP: {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
switch (mouseEvent->button) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
KillClickHoldTimer();
|
||||
@ -1090,17 +1085,17 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
#endif
|
||||
// then fall through...
|
||||
case WidgetMouseEvent::eMiddleButton:
|
||||
SetClickCount(aPresContext, static_cast<WidgetMouseEvent*>(aEvent),
|
||||
aStatus);
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NS_MOUSE_EXIT:
|
||||
// If the event is not a top-level window exit, then it's not
|
||||
// really an exit --- we may have traversed widget boundaries but
|
||||
// we're still in our toplevel window.
|
||||
{
|
||||
WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->exit != WidgetMouseEvent::eTopLevel) {
|
||||
// Treat it as a synthetic move so we don't generate spurious
|
||||
// "exit" or "move" events. Any necessary "out" or "over" events
|
||||
@ -1109,26 +1104,28 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
mouseEvent->reason = WidgetMouseEvent::eSynthesized;
|
||||
// then fall through...
|
||||
} else {
|
||||
GenerateMouseEnterExit(static_cast<WidgetGUIEvent*>(aEvent));
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
//This is a window level mouse exit event and should stop here
|
||||
aEvent->message = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
case NS_MOUSE_MOVE:
|
||||
case NS_MOUSE_MOVE: {
|
||||
// on the Mac, GenerateDragGesture() may not return until the drag
|
||||
// has completed and so |aTargetFrame| may have been deleted (moving
|
||||
// a bookmark, for example). If this is the case, however, we know
|
||||
// that ClearFrameRefs() has been called and it cleared out
|
||||
// |mCurrentTarget|. As a result, we should pass |mCurrentTarget|
|
||||
// into UpdateCursor().
|
||||
GenerateDragGesture(aPresContext, static_cast<WidgetMouseEvent*>(aEvent));
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
GenerateDragGesture(aPresContext, mouseEvent);
|
||||
UpdateCursor(aPresContext, aEvent, mCurrentTarget, aStatus);
|
||||
GenerateMouseEnterExit(static_cast<WidgetGUIEvent*>(aEvent));
|
||||
GenerateMouseEnterExit(mouseEvent);
|
||||
// Flush pending layout changes, so that later mouse move events
|
||||
// will go to the right nodes.
|
||||
FlushPendingEvents(aPresContext);
|
||||
break;
|
||||
}
|
||||
case NS_DRAGDROP_GESTURE:
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
// an external drag gesture event came in, not generated internally
|
||||
@ -1139,8 +1136,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
case NS_DRAGDROP_OVER:
|
||||
// NS_DRAGDROP_DROP is fired before NS_DRAGDROP_DRAGDROP so send
|
||||
// the enter/exit events before NS_DRAGDROP_DROP.
|
||||
GenerateDragDropEnterExit(aPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
GenerateDragDropEnterExit(aPresContext, aEvent->AsDragEvent());
|
||||
break;
|
||||
|
||||
case NS_KEY_PRESS:
|
||||
@ -1192,7 +1188,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetWheelEvent* wheelEvent = static_cast<WidgetWheelEvent*>(aEvent);
|
||||
WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent();
|
||||
WheelPrefs::GetInstance()->ApplyUserPrefsToDelta(wheelEvent);
|
||||
|
||||
// If we won't dispatch a DOM event for this event, nothing to do anymore.
|
||||
@ -1597,15 +1593,13 @@ nsEventStateManager::DispatchCrossProcessEvent(WidgetEvent* aEvent,
|
||||
|
||||
switch (aEvent->eventStructType) {
|
||||
case NS_MOUSE_EVENT: {
|
||||
WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
|
||||
return remote->SendRealMouseEvent(*mouseEvent);
|
||||
return remote->SendRealMouseEvent(*aEvent->AsMouseEvent());
|
||||
}
|
||||
case NS_KEY_EVENT: {
|
||||
return remote->SendRealKeyEvent(*aEvent->AsKeyboardEvent());
|
||||
}
|
||||
case NS_WHEEL_EVENT: {
|
||||
WidgetWheelEvent* wheelEvent = static_cast<WidgetWheelEvent*>(aEvent);
|
||||
return remote->SendMouseWheelEvent(*wheelEvent);
|
||||
return remote->SendMouseWheelEvent(*aEvent->AsWheelEvent());
|
||||
}
|
||||
case NS_TOUCH_EVENT: {
|
||||
// Let the child process synthesize a mouse event if needed, and
|
||||
@ -3180,8 +3174,8 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
switch (aEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
{
|
||||
if (static_cast<WidgetMouseEvent*>(aEvent)->button ==
|
||||
WidgetMouseEvent::eLeftButton &&
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
if (mouseEvent->button == WidgetMouseEvent::eLeftButton &&
|
||||
!sNormalLMouseEventInProcess) {
|
||||
// We got a mouseup event while a mousedown event was being processed.
|
||||
// Make sure that the capturing content is cleared.
|
||||
@ -3310,9 +3304,9 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
|
||||
// The rest is left button-specific.
|
||||
if (static_cast<WidgetMouseEvent*>(aEvent)->button !=
|
||||
WidgetMouseEvent::eLeftButton)
|
||||
if (mouseEvent->button != WidgetMouseEvent::eLeftButton) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (activeContent) {
|
||||
// The nearest enclosing element goes into the
|
||||
@ -3369,8 +3363,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
// Make sure to dispatch the click even if there is no frame for
|
||||
// the current target element. This is required for Web compatibility.
|
||||
ret = CheckForAndDispatchClick(presContext,
|
||||
static_cast<WidgetMouseEvent*>(aEvent),
|
||||
ret = CheckForAndDispatchClick(presContext, aEvent->AsMouseEvent(),
|
||||
aStatus);
|
||||
}
|
||||
|
||||
@ -3397,7 +3390,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
break;
|
||||
}
|
||||
|
||||
WidgetWheelEvent* wheelEvent = static_cast<WidgetWheelEvent*>(aEvent);
|
||||
WidgetWheelEvent* wheelEvent = aEvent->AsWheelEvent();
|
||||
switch (WheelPrefs::GetInstance()->ComputeActionFor(wheelEvent)) {
|
||||
case WheelPrefs::ACTION_SCROLL: {
|
||||
// For scrolling of default action, we should honor the mouse wheel
|
||||
@ -3599,7 +3592,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
WidgetDragEvent event(aEvent->mFlags.mIsTrusted,
|
||||
NS_DRAGDROP_DRAGDROP, widget);
|
||||
|
||||
WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(aEvent);
|
||||
WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent();
|
||||
event.refPoint = mouseEvent->refPoint;
|
||||
if (mouseEvent->widget) {
|
||||
event.refPoint += LayoutDeviceIntPoint::FromUntyped(mouseEvent->widget->WidgetToScreenOffset());
|
||||
@ -3623,8 +3616,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
|
||||
case NS_DRAGDROP_EXIT:
|
||||
// make sure to fire the enter and exit_synth events after the
|
||||
// NS_DRAGDROP_EXIT event, otherwise we'll clean up too early
|
||||
GenerateDragDropEnterExit(presContext,
|
||||
static_cast<WidgetGUIEvent*>(aEvent));
|
||||
GenerateDragDropEnterExit(presContext, aEvent->AsDragEvent());
|
||||
break;
|
||||
|
||||
case NS_KEY_UP:
|
||||
@ -4004,7 +3996,7 @@ public:
|
||||
nsIFrame* frame = aVisitor.mPresContext->GetPrimaryFrameFor(mTarget);
|
||||
if (frame) {
|
||||
frame->HandleEvent(aVisitor.mPresContext,
|
||||
static_cast<WidgetGUIEvent*>(aVisitor.mEvent),
|
||||
aVisitor.mEvent->AsGUIEvent(),
|
||||
&aVisitor.mEventStatus);
|
||||
}
|
||||
}
|
||||
@ -4026,7 +4018,7 @@ nsEventStateManager::IsHandlingUserInput()
|
||||
}
|
||||
|
||||
nsIFrame*
|
||||
nsEventStateManager::DispatchMouseEvent(WidgetGUIEvent* aEvent,
|
||||
nsEventStateManager::DispatchMouseEvent(WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent)
|
||||
@ -4052,14 +4044,14 @@ nsEventStateManager::DispatchMouseEvent(WidgetGUIEvent* aEvent,
|
||||
|
||||
PROFILER_LABEL("Input", "DispatchMouseEvent");
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetMouseEvent event(aEvent->mFlags.mIsTrusted, aMessage, aEvent->widget,
|
||||
WidgetMouseEvent::eReal);
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.modifiers = static_cast<WidgetMouseEvent*>(aEvent)->modifiers;
|
||||
event.buttons = static_cast<WidgetMouseEvent*>(aEvent)->buttons;
|
||||
event.pluginEvent = static_cast<WidgetMouseEvent*>(aEvent)->pluginEvent;
|
||||
WidgetMouseEvent event(aMouseEvent->mFlags.mIsTrusted, aMessage,
|
||||
aMouseEvent->widget, WidgetMouseEvent::eReal);
|
||||
event.refPoint = aMouseEvent->refPoint;
|
||||
event.modifiers = aMouseEvent->modifiers;
|
||||
event.buttons = aMouseEvent->buttons;
|
||||
event.pluginEvent = aMouseEvent->pluginEvent;
|
||||
event.relatedTarget = aRelatedContent;
|
||||
event.inputSource = static_cast<WidgetMouseEvent*>(aEvent)->inputSource;
|
||||
event.inputSource = aMouseEvent->inputSource;
|
||||
|
||||
nsWeakFrame previousTarget = mCurrentTarget;
|
||||
|
||||
@ -4090,8 +4082,8 @@ class MouseEnterLeaveDispatcher
|
||||
public:
|
||||
MouseEnterLeaveDispatcher(nsEventStateManager* aESM,
|
||||
nsIContent* aTarget, nsIContent* aRelatedTarget,
|
||||
WidgetGUIEvent* aEvent, uint32_t aType)
|
||||
: mESM(aESM), mEvent(aEvent), mType(aType)
|
||||
WidgetMouseEvent* aMouseEvent, uint32_t aType)
|
||||
: mESM(aESM), mMouseEvent(aMouseEvent), mType(aType)
|
||||
{
|
||||
nsPIDOMWindow* win =
|
||||
aTarget ? aTarget->OwnerDoc()->GetInnerWindow() : nullptr;
|
||||
@ -4119,11 +4111,13 @@ public:
|
||||
{
|
||||
if (mType == NS_MOUSEENTER) {
|
||||
for (int32_t i = mTargets.Count() - 1; i >= 0; --i) {
|
||||
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
|
||||
mESM->DispatchMouseEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
}
|
||||
} else {
|
||||
for (int32_t i = 0; i < mTargets.Count(); ++i) {
|
||||
mESM->DispatchMouseEvent(mEvent, mType, mTargets[i], mRelatedTarget);
|
||||
mESM->DispatchMouseEvent(mMouseEvent, mType, mTargets[i],
|
||||
mRelatedTarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4131,12 +4125,12 @@ public:
|
||||
nsEventStateManager* mESM;
|
||||
nsCOMArray<nsIContent> mTargets;
|
||||
nsCOMPtr<nsIContent> mRelatedTarget;
|
||||
WidgetGUIEvent* mEvent;
|
||||
WidgetMouseEvent* mMouseEvent;
|
||||
uint32_t mType;
|
||||
};
|
||||
|
||||
void
|
||||
nsEventStateManager::NotifyMouseOut(WidgetGUIEvent* aEvent,
|
||||
nsEventStateManager::NotifyMouseOut(WidgetMouseEvent* aMouseEvent,
|
||||
nsIContent* aMovingInto)
|
||||
{
|
||||
if (!mLastMouseOverElement)
|
||||
@ -4159,7 +4153,7 @@ nsEventStateManager::NotifyMouseOut(WidgetGUIEvent* aEvent,
|
||||
if (presContext) {
|
||||
nsEventStateManager* kidESM = presContext->EventStateManager();
|
||||
// Not moving into any element in this subdocument
|
||||
kidESM->NotifyMouseOut(aEvent, nullptr);
|
||||
kidESM->NotifyMouseOut(aMouseEvent, nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4183,10 +4177,10 @@ nsEventStateManager::NotifyMouseOut(WidgetGUIEvent* aEvent,
|
||||
}
|
||||
|
||||
MouseEnterLeaveDispatcher leaveDispatcher(this, mLastMouseOverElement, aMovingInto,
|
||||
aEvent, NS_MOUSELEAVE);
|
||||
aMouseEvent, NS_MOUSELEAVE);
|
||||
|
||||
// Fire mouseout
|
||||
DispatchMouseEvent(aEvent, NS_MOUSE_EXIT_SYNTH,
|
||||
DispatchMouseEvent(aMouseEvent, NS_MOUSE_EXIT_SYNTH,
|
||||
mLastMouseOverElement, aMovingInto);
|
||||
|
||||
mLastMouseOverFrame = nullptr;
|
||||
@ -4197,7 +4191,7 @@ nsEventStateManager::NotifyMouseOut(WidgetGUIEvent* aEvent,
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStateManager::NotifyMouseOver(WidgetGUIEvent* aEvent,
|
||||
nsEventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
|
||||
nsIContent* aContent)
|
||||
{
|
||||
NS_ASSERTION(aContent, "Mouse must be over something");
|
||||
@ -4220,7 +4214,7 @@ nsEventStateManager::NotifyMouseOver(WidgetGUIEvent* aEvent,
|
||||
nsIPresShell *parentShell = parentDoc->GetShell();
|
||||
if (parentShell) {
|
||||
nsEventStateManager* parentESM = parentShell->GetPresContext()->EventStateManager();
|
||||
parentESM->NotifyMouseOver(aEvent, docContent);
|
||||
parentESM->NotifyMouseOver(aMouseEvent, docContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4234,9 +4228,9 @@ nsEventStateManager::NotifyMouseOver(WidgetGUIEvent* aEvent,
|
||||
nsCOMPtr<nsIContent> lastMouseOverElement = mLastMouseOverElement;
|
||||
|
||||
MouseEnterLeaveDispatcher enterDispatcher(this, aContent, lastMouseOverElement,
|
||||
aEvent, NS_MOUSEENTER);
|
||||
aMouseEvent, NS_MOUSEENTER);
|
||||
|
||||
NotifyMouseOut(aEvent, aContent);
|
||||
NotifyMouseOut(aMouseEvent, aContent);
|
||||
|
||||
// Store the first mouseOver event we fire and don't refire mouseOver
|
||||
// to that element while the first mouseOver is still ongoing.
|
||||
@ -4245,7 +4239,7 @@ nsEventStateManager::NotifyMouseOver(WidgetGUIEvent* aEvent,
|
||||
SetContentState(aContent, NS_EVENT_STATE_HOVER);
|
||||
|
||||
// Fire mouseover
|
||||
mLastMouseOverFrame = DispatchMouseEvent(aEvent, NS_MOUSE_ENTER_SYNTH,
|
||||
mLastMouseOverFrame = DispatchMouseEvent(aMouseEvent, NS_MOUSE_ENTER_SYNTH,
|
||||
aContent, lastMouseOverElement);
|
||||
mLastMouseOverElement = aContent;
|
||||
|
||||
@ -4297,7 +4291,7 @@ GetWindowInnerRectCenter(nsPIDOMWindow* aWindow,
|
||||
}
|
||||
|
||||
void
|
||||
nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
||||
{
|
||||
EnsureDocument(mPresContext);
|
||||
if (!mDocument)
|
||||
@ -4306,13 +4300,13 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
// Hold onto old target content through the event and reset after.
|
||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||
|
||||
switch(aEvent->message) {
|
||||
switch(aMouseEvent->message) {
|
||||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
|
||||
// Movement is calculated in nsDOMUIEvent::GetMovementPoint() as:
|
||||
// previous_mousemove_refPoint - current_mousemove_refPoint.
|
||||
if (sIsPointerLocked && aEvent->widget) {
|
||||
if (sIsPointerLocked && aMouseEvent->widget) {
|
||||
// The pointer is locked. If the pointer is not located at the center of
|
||||
// the window, dispatch a synthetic mousemove to return the pointer there.
|
||||
// Doing this between "real" pointer moves gives the impression that the
|
||||
@ -4320,22 +4314,23 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
// boundary. We cancel the synthetic event so that we don't end up
|
||||
// dispatching the centering move event to content.
|
||||
LayoutDeviceIntPoint center =
|
||||
GetWindowInnerRectCenter(mDocument->GetWindow(), aEvent->widget,
|
||||
GetWindowInnerRectCenter(mDocument->GetWindow(), aMouseEvent->widget,
|
||||
mPresContext);
|
||||
aEvent->lastRefPoint = center;
|
||||
if (aEvent->refPoint != center) {
|
||||
aMouseEvent->lastRefPoint = center;
|
||||
if (aMouseEvent->refPoint != center) {
|
||||
// Mouse move doesn't finish at the center of the window. Dispatch a
|
||||
// synthetic native mouse event to move the pointer back to the center
|
||||
// of the window, to faciliate more movement. But first, record that
|
||||
// we've dispatched a synthetic mouse movement, so we can cancel it
|
||||
// in the other branch here.
|
||||
sSynthCenteringPoint = center;
|
||||
aEvent->widget->SynthesizeNativeMouseMove(
|
||||
LayoutDeviceIntPoint::ToUntyped(center) + aEvent->widget->WidgetToScreenOffset());
|
||||
} else if (aEvent->refPoint == sSynthCenteringPoint) {
|
||||
aMouseEvent->widget->SynthesizeNativeMouseMove(
|
||||
LayoutDeviceIntPoint::ToUntyped(center) +
|
||||
aMouseEvent->widget->WidgetToScreenOffset());
|
||||
} else if (aMouseEvent->refPoint == sSynthCenteringPoint) {
|
||||
// This is the "synthetic native" event we dispatched to re-center the
|
||||
// pointer. Cancel it so we don't expose the centering move to content.
|
||||
aEvent->mFlags.mPropagationStopped = true;
|
||||
aMouseEvent->mFlags.mPropagationStopped = true;
|
||||
// Clear sSynthCenteringPoint so we don't cancel other events
|
||||
// targeted at the center.
|
||||
sSynthCenteringPoint = kInvalidRefPoint;
|
||||
@ -4345,16 +4340,16 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
// the first move we've encountered, or the mouse has just re-entered
|
||||
// the application window. We should report (0,0) movement for this
|
||||
// case, so make the current and previous refPoints the same.
|
||||
aEvent->lastRefPoint = aEvent->refPoint;
|
||||
aMouseEvent->lastRefPoint = aMouseEvent->refPoint;
|
||||
} else {
|
||||
aEvent->lastRefPoint = sLastRefPoint;
|
||||
aMouseEvent->lastRefPoint = sLastRefPoint;
|
||||
}
|
||||
|
||||
// Update the last known refPoint with the current refPoint.
|
||||
sLastRefPoint = aEvent->refPoint;
|
||||
sLastRefPoint = aMouseEvent->refPoint;
|
||||
|
||||
// Get the target content target (mousemove target == mouseover target)
|
||||
nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aEvent);
|
||||
nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aMouseEvent);
|
||||
if (!targetElement) {
|
||||
// We're always over the document root, even if we're only
|
||||
// over dead space in a page (whose frame is not associated with
|
||||
@ -4362,7 +4357,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
targetElement = mDocument->GetRootElement();
|
||||
}
|
||||
if (targetElement) {
|
||||
NotifyMouseOver(aEvent, targetElement);
|
||||
NotifyMouseOver(aMouseEvent, targetElement);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -4372,7 +4367,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
// into any new element.
|
||||
|
||||
if (mLastMouseOverFrame &&
|
||||
nsContentUtils::GetTopLevelWidget(aEvent->widget) !=
|
||||
nsContentUtils::GetTopLevelWidget(aMouseEvent->widget) !=
|
||||
nsContentUtils::GetTopLevelWidget(mLastMouseOverFrame->GetNearestWidget())) {
|
||||
// the MouseOut event widget doesn't have same top widget with
|
||||
// mLastMouseOverFrame, it's a spurious event for mLastMouseOverFrame
|
||||
@ -4383,7 +4378,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetGUIEvent* aEvent)
|
||||
// movement the next time we re-enter the window.
|
||||
sLastRefPoint = kInvalidRefPoint;
|
||||
|
||||
NotifyMouseOut(aEvent, nullptr);
|
||||
NotifyMouseOut(aMouseEvent, nullptr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -4451,12 +4446,12 @@ nsEventStateManager::SetPointerLock(nsIWidget* aWidget,
|
||||
|
||||
void
|
||||
nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
WidgetDragEvent* aDragEvent)
|
||||
{
|
||||
//Hold onto old target content through the event and reset after.
|
||||
nsCOMPtr<nsIContent> targetBeforeEvent = mCurrentTargetContent;
|
||||
|
||||
switch(aEvent->message) {
|
||||
switch(aDragEvent->message) {
|
||||
case NS_DRAGDROP_OVER:
|
||||
{
|
||||
// when dragging from one frame to another, events are fired in the
|
||||
@ -4465,23 +4460,25 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
//We'll need the content, too, to check if it changed separately from the frames.
|
||||
nsCOMPtr<nsIContent> lastContent;
|
||||
nsCOMPtr<nsIContent> targetContent;
|
||||
mCurrentTarget->GetContentForEvent(aEvent, getter_AddRefs(targetContent));
|
||||
mCurrentTarget->GetContentForEvent(aDragEvent,
|
||||
getter_AddRefs(targetContent));
|
||||
|
||||
if (sLastDragOverFrame) {
|
||||
//The frame has changed but the content may not have. Check before dispatching to content
|
||||
sLastDragOverFrame->GetContentForEvent(aEvent, getter_AddRefs(lastContent));
|
||||
sLastDragOverFrame->GetContentForEvent(aDragEvent,
|
||||
getter_AddRefs(lastContent));
|
||||
|
||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||
aEvent, NS_DRAGDROP_EXIT_SYNTH,
|
||||
aDragEvent, NS_DRAGDROP_EXIT_SYNTH,
|
||||
targetContent, lastContent, sLastDragOverFrame);
|
||||
}
|
||||
|
||||
FireDragEnterOrExit(aPresContext, aEvent, NS_DRAGDROP_ENTER,
|
||||
FireDragEnterOrExit(aPresContext, aDragEvent, NS_DRAGDROP_ENTER,
|
||||
lastContent, targetContent, mCurrentTarget);
|
||||
|
||||
if (sLastDragOverFrame) {
|
||||
FireDragEnterOrExit(sLastDragOverFrame->PresContext(),
|
||||
aEvent, NS_DRAGDROP_LEAVE_SYNTH,
|
||||
aDragEvent, NS_DRAGDROP_LEAVE_SYNTH,
|
||||
targetContent, lastContent, sLastDragOverFrame);
|
||||
}
|
||||
|
||||
@ -4495,14 +4492,15 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
//This is actually the window mouse exit event.
|
||||
if (sLastDragOverFrame) {
|
||||
nsCOMPtr<nsIContent> lastContent;
|
||||
sLastDragOverFrame->GetContentForEvent(aEvent, getter_AddRefs(lastContent));
|
||||
sLastDragOverFrame->GetContentForEvent(aDragEvent,
|
||||
getter_AddRefs(lastContent));
|
||||
|
||||
nsRefPtr<nsPresContext> lastDragOverFramePresContext = sLastDragOverFrame->PresContext();
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aEvent, NS_DRAGDROP_EXIT_SYNTH,
|
||||
aDragEvent, NS_DRAGDROP_EXIT_SYNTH,
|
||||
nullptr, lastContent, sLastDragOverFrame);
|
||||
FireDragEnterOrExit(lastDragOverFramePresContext,
|
||||
aEvent, NS_DRAGDROP_LEAVE_SYNTH,
|
||||
aDragEvent, NS_DRAGDROP_LEAVE_SYNTH,
|
||||
nullptr, lastContent, sLastDragOverFrame);
|
||||
|
||||
sLastDragOverFrame = nullptr;
|
||||
@ -4520,19 +4518,20 @@ nsEventStateManager::GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
|
||||
void
|
||||
nsEventStateManager::FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent,
|
||||
WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
nsWeakFrame& aTargetFrame)
|
||||
{
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
WidgetDragEvent event(aEvent->mFlags.mIsTrusted, aMsg, aEvent->widget);
|
||||
event.refPoint = aEvent->refPoint;
|
||||
event.modifiers = static_cast<WidgetMouseEvent*>(aEvent)->modifiers;
|
||||
event.buttons = static_cast<WidgetMouseEvent*>(aEvent)->buttons;
|
||||
WidgetDragEvent event(aDragEvent->mFlags.mIsTrusted, aMsg,
|
||||
aDragEvent->widget);
|
||||
event.refPoint = aDragEvent->refPoint;
|
||||
event.modifiers = aDragEvent->modifiers;
|
||||
event.buttons = aDragEvent->buttons;
|
||||
event.relatedTarget = aRelatedTarget;
|
||||
event.inputSource = static_cast<WidgetMouseEvent*>(aEvent)->inputSource;
|
||||
event.inputSource = aDragEvent->inputSource;
|
||||
|
||||
mCurrentTargetContent = aTargetContent;
|
||||
|
||||
@ -5093,8 +5092,7 @@ bool
|
||||
nsEventStateManager::EventStatusOK(WidgetGUIEvent* aEvent)
|
||||
{
|
||||
return !(aEvent->message == NS_MOUSE_BUTTON_DOWN &&
|
||||
static_cast<WidgetMouseEvent*>(aEvent)->button ==
|
||||
WidgetMouseEvent::eLeftButton &&
|
||||
aEvent->AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||
!sNormalLMouseEventInProcess);
|
||||
}
|
||||
|
||||
|
@ -256,7 +256,7 @@ protected:
|
||||
* content. This returns the primary frame for the content (or null
|
||||
* if it goes away during the event).
|
||||
*/
|
||||
nsIFrame* DispatchMouseEvent(mozilla::WidgetGUIEvent* aEvent,
|
||||
nsIFrame* DispatchMouseEvent(mozilla::WidgetMouseEvent* aMouseEvent,
|
||||
uint32_t aMessage,
|
||||
nsIContent* aTargetContent,
|
||||
nsIContent* aRelatedContent);
|
||||
@ -264,24 +264,26 @@ protected:
|
||||
* Synthesize DOM and frame mouseover and mouseout events from this
|
||||
* MOUSE_MOVE or MOUSE_EXIT event.
|
||||
*/
|
||||
void GenerateMouseEnterExit(mozilla::WidgetGUIEvent* aEvent);
|
||||
void GenerateMouseEnterExit(mozilla::WidgetMouseEvent* aMouseEvent);
|
||||
/**
|
||||
* Tell this ESM and ESMs in parent documents that the mouse is
|
||||
* over some content in this document.
|
||||
*/
|
||||
void NotifyMouseOver(mozilla::WidgetGUIEvent* aEvent, nsIContent* aContent);
|
||||
void NotifyMouseOver(mozilla::WidgetMouseEvent* aMouseEvent,
|
||||
nsIContent* aContent);
|
||||
/**
|
||||
* Tell this ESM and ESMs in affected child documents that the mouse
|
||||
* has exited this document's currently hovered content.
|
||||
* @param aEvent the event that triggered the mouseout
|
||||
* @param aMouseEvent the event that triggered the mouseout
|
||||
* @param aMovingInto the content node we've moved into. This is used to set
|
||||
* the relatedTarget for mouseout events. Also, if it's non-null
|
||||
* NotifyMouseOut will NOT change the current hover content to null;
|
||||
* in that case the caller is responsible for updating hover state.
|
||||
*/
|
||||
void NotifyMouseOut(mozilla::WidgetGUIEvent* aEvent, nsIContent* aMovingInto);
|
||||
void NotifyMouseOut(mozilla::WidgetMouseEvent* aMouseEvent,
|
||||
nsIContent* aMovingInto);
|
||||
void GenerateDragDropEnterExit(nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent);
|
||||
mozilla::WidgetDragEvent* aDragEvent);
|
||||
/**
|
||||
* Fire the dragenter and dragexit/dragleave events when the mouse moves to a
|
||||
* new target.
|
||||
@ -291,7 +293,7 @@ protected:
|
||||
* @param aTargetFrame target frame for the event
|
||||
*/
|
||||
void FireDragEnterOrExit(nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent,
|
||||
mozilla::WidgetDragEvent* aDragEvent,
|
||||
uint32_t aMsg,
|
||||
nsIContent* aRelatedTarget,
|
||||
nsIContent* aTargetContent,
|
||||
|
@ -534,7 +534,7 @@ nsIMEStateManager::DispatchCompositionEvent(nsINode* aEventTargetNode,
|
||||
|
||||
EnsureTextCompositionArray();
|
||||
|
||||
WidgetGUIEvent* GUIEvent = static_cast<WidgetGUIEvent*>(aEvent);
|
||||
WidgetGUIEvent* GUIEvent = aEvent->AsGUIEvent();
|
||||
|
||||
TextComposition* composition =
|
||||
sTextCompositions->GetCompositionFor(GUIEvent->widget);
|
||||
|
@ -7,11 +7,12 @@
|
||||
#define mozilla_dom_HTMLAudioElement_h
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsITimer.h"
|
||||
#include "nsIDOMHTMLAudioElement.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "mozilla/dom/TypedArray.h"
|
||||
|
||||
class nsITimer;
|
||||
|
||||
typedef uint16_t nsMediaNetworkState;
|
||||
typedef uint16_t nsMediaReadyState;
|
||||
|
||||
|
@ -12,10 +12,8 @@
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsSize.h"
|
||||
#include "nsError.h"
|
||||
#include "nsNodeInfoManager.h"
|
||||
|
||||
#include "nsICanvasElementExternal.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "mozilla/gfx/Rect.h"
|
||||
|
||||
class nsICanvasRenderingContextInternal;
|
||||
|
@ -9,37 +9,36 @@
|
||||
#include "nsIDOMHTMLMediaElement.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "MediaDecoderOwner.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIDOMRange.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "AudioStream.h"
|
||||
#include "VideoFrameContainer.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "DOMMediaStream.h"
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
#include "nsIDOMWakeLock.h"
|
||||
#include "AudioChannelCommon.h"
|
||||
#include "DecoderTraits.h"
|
||||
#include "MediaMetadataManager.h"
|
||||
#include "AudioChannelAgent.h"
|
||||
#include "nsIAudioChannelAgent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/dom/TextTrack.h"
|
||||
#include "mozilla/dom/TextTrackList.h"
|
||||
#include "mozilla/ErrorResult.h"
|
||||
|
||||
// Define to output information on decoding and painting framerate
|
||||
/* #define DEBUG_FRAME_RATE 1 */
|
||||
|
||||
class nsIChannel;
|
||||
class nsIHttpChannel;
|
||||
class nsILoadGroup;
|
||||
|
||||
typedef uint16_t nsMediaNetworkState;
|
||||
typedef uint16_t nsMediaReadyState;
|
||||
|
||||
namespace mozilla {
|
||||
class AudioStream;
|
||||
class ErrorResult;
|
||||
class MediaResource;
|
||||
class MediaDecoder;
|
||||
class VideoFrameContainer;
|
||||
namespace dom {
|
||||
class TextTrack;
|
||||
class TimeRanges;
|
||||
}
|
||||
}
|
||||
|
||||
class nsITimer;
|
||||
|
@ -10,12 +10,12 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMHTMLVideoElement.h"
|
||||
#include "mozilla/dom/HTMLMediaElement.h"
|
||||
#include "mozilla/dom/VideoPlaybackQuality.h"
|
||||
#include "nsPerformance.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class VideoPlaybackQuality;
|
||||
|
||||
class HTMLVideoElement MOZ_FINAL : public HTMLMediaElement,
|
||||
public nsIDOMHTMLVideoElement
|
||||
{
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define nsIFormSubmission_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -14,10 +14,10 @@
|
||||
#define nsIFormProcessor_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsTArrayForwardDeclare.h"
|
||||
|
||||
class nsString;
|
||||
class nsIDOMHTMLElement;
|
||||
|
||||
// {0ae53c0f-8ea2-4916-bedc-717443c3e185}
|
||||
#define NS_FORMPROCESSOR_CID \
|
||||
|
@ -19,6 +19,9 @@
|
||||
#include <algorithm>
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "mozilla/dom/TimeRanges.h"
|
||||
#include "AudioStream.h"
|
||||
|
||||
static bool
|
||||
IsAudioAPIEnabled()
|
||||
|
@ -281,30 +281,25 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
{
|
||||
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
if (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
if (aVisitor.mEvent->mFlags.mIsTrusted) {
|
||||
nsEventStateManager* esm =
|
||||
aVisitor.mPresContext->EventStateManager();
|
||||
nsEventStateManager::SetActiveManager(
|
||||
static_cast<nsEventStateManager*>(esm), this);
|
||||
}
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm)
|
||||
fm->SetFocus(this, nsIFocusManager::FLAG_BYMOUSE |
|
||||
nsIFocusManager::FLAG_NOSCROLL);
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
} else if (
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eMiddleButton ||
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eRightButton) {
|
||||
// cancel all of these events for buttons
|
||||
//XXXsmaug What to do with these events? Why these should be cancelled?
|
||||
if (aVisitor.mDOMEvent) {
|
||||
aVisitor.mDOMEvent->StopPropagation();
|
||||
}
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
|
||||
if (mouseEvent->mFlags.mIsTrusted) {
|
||||
nsEventStateManager* esm =
|
||||
aVisitor.mPresContext->EventStateManager();
|
||||
nsEventStateManager::SetActiveManager(
|
||||
static_cast<nsEventStateManager*>(esm), this);
|
||||
}
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm)
|
||||
fm->SetFocus(this, nsIFocusManager::FLAG_BYMOUSE |
|
||||
nsIFocusManager::FLAG_NOSCROLL);
|
||||
mouseEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
} else if (mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
||||
mouseEvent->button == WidgetMouseEvent::eRightButton) {
|
||||
// cancel all of these events for buttons
|
||||
//XXXsmaug What to do with these events? Why these should be cancelled?
|
||||
if (aVisitor.mDOMEvent) {
|
||||
aVisitor.mDOMEvent->StopPropagation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,12 +310,10 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
case NS_MOUSE_BUTTON_UP:
|
||||
case NS_MOUSE_DOUBLECLICK:
|
||||
{
|
||||
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
aVisitor.mDOMEvent &&
|
||||
(static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eMiddleButton ||
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eRightButton)) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (aVisitor.mDOMEvent &&
|
||||
(mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
||||
mouseEvent->button == WidgetMouseEvent::eRightButton)) {
|
||||
aVisitor.mDOMEvent->StopPropagation();
|
||||
}
|
||||
}
|
||||
|
@ -373,10 +373,7 @@ HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
// the Generic Element as this could cause a click event to fire
|
||||
// twice, once by the image frame for the map and once by the Anchor
|
||||
// element. (bug 39723)
|
||||
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
aVisitor.mEvent->message == NS_MOUSE_CLICK &&
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
if (aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
bool isMap = false;
|
||||
GetIsMap(&isMap);
|
||||
if (isMap) {
|
||||
|
@ -3172,8 +3172,7 @@ HTMLInputElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
}
|
||||
if (IsSingleLineTextControl(false) &&
|
||||
aVisitor.mEvent->message == NS_MOUSE_CLICK &&
|
||||
aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eMiddleButton) {
|
||||
aVisitor.mEvent->mFlags.mNoContentDispatch = false;
|
||||
}
|
||||
@ -3674,11 +3673,9 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
{
|
||||
// cancel all of these events for buttons
|
||||
//XXXsmaug Why?
|
||||
if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
(static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eMiddleButton ||
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
WidgetMouseEvent::eRightButton)) {
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
if (mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
|
||||
mouseEvent->button == WidgetMouseEvent::eRightButton) {
|
||||
if (mType == NS_FORM_INPUT_BUTTON ||
|
||||
mType == NS_FORM_INPUT_RESET ||
|
||||
mType == NS_FORM_INPUT_SUBMIT) {
|
||||
@ -3797,9 +3794,8 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
|
||||
break; // ignore
|
||||
}
|
||||
if (aVisitor.mEvent->message == NS_MOUSE_BUTTON_DOWN) {
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent);
|
||||
if (mouseEvent->buttons == WidgetMouseEvent::eLeftButtonFlag) {
|
||||
if (aVisitor.mEvent->AsMouseEvent()->buttons ==
|
||||
WidgetMouseEvent::eLeftButtonFlag) {
|
||||
StartRangeThumbDrag(inputEvent);
|
||||
} else if (mIsDraggingRange) {
|
||||
CancelRangeThumbDrag();
|
||||
|
@ -131,9 +131,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
mHandlingEvent = true;
|
||||
switch (aVisitor.mEvent->message) {
|
||||
case NS_MOUSE_BUTTON_DOWN:
|
||||
NS_ASSERTION(aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT,
|
||||
"wrong event struct for event");
|
||||
if (static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
if (aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eLeftButton) {
|
||||
// We reset the mouse-down point on every event because there is
|
||||
// no guarantee we will reach the NS_MOUSE_CLICK code below.
|
||||
@ -147,8 +145,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
|
||||
case NS_MOUSE_CLICK:
|
||||
if (aVisitor.mEvent->IsLeftClickEvent()) {
|
||||
const WidgetMouseEvent* event =
|
||||
static_cast<const WidgetMouseEvent*>(aVisitor.mEvent);
|
||||
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
|
||||
LayoutDeviceIntPoint* mouseDownPoint =
|
||||
static_cast<LayoutDeviceIntPoint*>(
|
||||
GetProperty(nsGkAtoms::labelMouseDownPtProperty));
|
||||
@ -158,7 +155,7 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
LayoutDeviceIntPoint dragDistance = *mouseDownPoint;
|
||||
DeleteProperty(nsGkAtoms::labelMouseDownPtProperty);
|
||||
|
||||
dragDistance -= aVisitor.mEvent->refPoint;
|
||||
dragDistance -= mouseEvent->refPoint;
|
||||
const int CLICK_DISTANCE = 2;
|
||||
dragSelect = dragDistance.x > CLICK_DISTANCE ||
|
||||
dragDistance.x < -CLICK_DISTANCE ||
|
||||
@ -167,13 +164,13 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
}
|
||||
// Don't click the for-content if we did drag-select text or if we
|
||||
// have a kbd modifier (which adjusts a selection).
|
||||
if (dragSelect || event->IsShift() || event->IsControl() ||
|
||||
event->IsAlt() || event->IsMeta()) {
|
||||
if (dragSelect || mouseEvent->IsShift() || mouseEvent->IsControl() ||
|
||||
mouseEvent->IsAlt() || mouseEvent->IsMeta()) {
|
||||
break;
|
||||
}
|
||||
// Only set focus on the first click of multiple clicks to prevent
|
||||
// to prevent immediate de-focus.
|
||||
if (event->clickCount <= 1) {
|
||||
if (mouseEvent->clickCount <= 1) {
|
||||
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
|
||||
if (fm) {
|
||||
// Use FLAG_BYMOVEFOCUS here so that the label is scrolled to.
|
||||
@ -196,12 +193,11 @@ HTMLLabelElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
|
||||
// will actually create a new event.
|
||||
EventFlags eventFlags;
|
||||
eventFlags.mMultipleActionsPrevented = true;
|
||||
DispatchClickEvent(aVisitor.mPresContext,
|
||||
aVisitor.mEvent->AsInputEvent(),
|
||||
DispatchClickEvent(aVisitor.mPresContext, mouseEvent,
|
||||
content, false, &eventFlags, &status);
|
||||
// Do we care about the status this returned? I don't think we do...
|
||||
// Don't run another <label> off of this click
|
||||
aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
mouseEvent->mFlags.mMultipleActionsPrevented = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -75,6 +75,7 @@
|
||||
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsIMediaList.h"
|
||||
#include "nsIDOMWakeLock.h"
|
||||
|
||||
#include "ImageContainer.h"
|
||||
#include "nsIPowerManagerService.h"
|
||||
@ -1136,14 +1137,14 @@ nsresult HTMLMediaElement::LoadResource()
|
||||
ReportLoadError("MediaLoadInvalidURI", params, ArrayLength(params));
|
||||
return rv;
|
||||
}
|
||||
mMediaSource = source.forget();
|
||||
nsRefPtr<MediaSourceDecoder> decoder = new MediaSourceDecoder(this);
|
||||
if (!mMediaSource->Attach(decoder)) {
|
||||
if (!source->Attach(decoder)) {
|
||||
// TODO: Handle failure: run "If the media data cannot be fetched at
|
||||
// all, due to network errors, causing the user agent to give up
|
||||
// trying to fetch the resource" section of resource fetch algorithm.
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
mMediaSource = source.forget();
|
||||
nsRefPtr<MediaResource> resource = new MediaSourceResource();
|
||||
return FinishDecoderSetup(decoder, resource, nullptr, nullptr);
|
||||
}
|
||||
|
@ -97,6 +97,14 @@ public:
|
||||
{
|
||||
SetHTMLAttr(nsGkAtoms::type, aValue, aRv);
|
||||
}
|
||||
bool TypeMustMatch()
|
||||
{
|
||||
return GetBoolAttr(nsGkAtoms::typemustmatch);
|
||||
}
|
||||
void SetTypeMustMatch(bool aValue, ErrorResult& aRv)
|
||||
{
|
||||
SetHTMLBoolAttr(nsGkAtoms::typemustmatch, aValue, aRv);
|
||||
}
|
||||
void GetName(DOMString& aValue)
|
||||
{
|
||||
GetHTMLAttr(nsGkAtoms::name, aValue);
|
||||
|
@ -477,8 +477,7 @@ HTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
||||
aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
|
||||
}
|
||||
if (aVisitor.mEvent->message == NS_MOUSE_CLICK &&
|
||||
aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
|
||||
static_cast<WidgetMouseEvent*>(aVisitor.mEvent)->button ==
|
||||
aVisitor.mEvent->AsMouseEvent()->button ==
|
||||
WidgetMouseEvent::eMiddleButton) {
|
||||
aVisitor.mEvent->mFlags.mNoContentDispatch = false;
|
||||
}
|
||||
|
@ -34,6 +34,9 @@
|
||||
#include "MediaError.h"
|
||||
#include "MediaDecoder.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsIDOMWakeLock.h"
|
||||
#include "nsPerformance.h"
|
||||
#include "mozilla/dom/VideoPlaybackQuality.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(Video)
|
||||
|
||||
|
26
content/media/test/crashtests/926665.html
Normal file
26
content/media/test/crashtests/926665.html
Normal file
@ -0,0 +1,26 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<script style="display: none;" id="fuzz1" type="text/javascript;version=1.7">
|
||||
|
||||
function boom()
|
||||
{
|
||||
var mediaSource = new window.MediaSource();
|
||||
var mediaSourceURL = URL.createObjectURL(mediaSource);
|
||||
var v1 = document.createElement('video');
|
||||
v1.src = mediaSourceURL;
|
||||
mediaSource.addEventListener("sourceopen", function (e) {
|
||||
var v2 = document.createElement('video');
|
||||
v2.src = mediaSourceURL;
|
||||
setTimeout(function () {
|
||||
v2.src = "data:text/plain,1";
|
||||
v1.src = "data:text/plain,2";
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body onload="boom();"></body>
|
||||
</html>
|
@ -59,3 +59,4 @@ load 910171-1.html
|
||||
load 920987.html
|
||||
skip-if(B2G) load oscillator-ended-1.html # intermittent B2G timeouts, bug 920338
|
||||
skip-if(B2G) load oscillator-ended-2.html # intermittent B2G timeouts, bug 920338
|
||||
test-pref(media.mediasource.enabled,true) load 926665.html
|
||||
|
@ -162,6 +162,7 @@ NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(Exception)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
tmp->mThrownJSVal.setNull();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CI_INTERFACE_GETTER1(Exception, nsIXPCException)
|
||||
|
@ -11796,12 +11796,10 @@ nsGlobalChromeWindow::BeginWindowMove(nsIDOMEvent *aMouseDownEvent, nsIDOMElemen
|
||||
}
|
||||
|
||||
NS_ENSURE_TRUE(aMouseDownEvent, NS_ERROR_FAILURE);
|
||||
WidgetEvent* internalEvent = aMouseDownEvent->GetInternalNSEvent();
|
||||
NS_ENSURE_TRUE(internalEvent &&
|
||||
internalEvent->eventStructType == NS_MOUSE_EVENT,
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
aMouseDownEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
NS_ENSURE_TRUE(mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT,
|
||||
NS_ERROR_FAILURE);
|
||||
WidgetMouseEvent* mouseEvent = static_cast<WidgetMouseEvent*>(internalEvent);
|
||||
|
||||
return widget->BeginMoveDrag(mouseEvent);
|
||||
}
|
||||
|
||||
|
@ -326,7 +326,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||
JS::Rooted<JSObject*> callee(cx, &args.callee());
|
||||
|
||||
if (!args.computeThis(cx).isObject()) {
|
||||
if (!args.thisv().isObject()) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_CANT_CONVERT_TO,
|
||||
"null", "object");
|
||||
return false;
|
||||
@ -341,7 +341,7 @@ InterfaceObjectToString(JSContext* cx, unsigned argc, JS::Value *vp)
|
||||
size_t length;
|
||||
const jschar* name = JS_GetInternedStringCharsAndLength(jsname, &length);
|
||||
|
||||
if (js::GetObjectJSClass(&args.computeThis(cx).toObject()) != clasp) {
|
||||
if (js::GetObjectJSClass(&args.thisv().toObject()) != clasp) {
|
||||
JS_ReportErrorNumber(cx, js_GetErrorMessage, NULL, JSMSG_INCOMPATIBLE_PROTO,
|
||||
NS_ConvertUTF16toUTF8(name).get(), "toString",
|
||||
"object");
|
||||
|
@ -2,8 +2,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = indexedDB
|
||||
|
||||
DIST_FILES = \
|
||||
bootstrap.js \
|
||||
install.rdf \
|
||||
|
@ -4,3 +4,4 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = 'indexedDB'
|
||||
|
@ -5,7 +5,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=872377
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 872377</title>
|
||||
<title>Test for Bug 872377 and Bug 928304</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
@ -20,10 +20,22 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=872377
|
||||
is(rtcSession[key], jsonCopy[key], "key " + key + " should match.");
|
||||
}
|
||||
|
||||
/** Test for Bug 928304 **/
|
||||
|
||||
var rtcIceCandidate = new mozRTCIceCandidate({ candidate: "dummy",
|
||||
sdpMid: "test",
|
||||
sdpMLineIndex: 3 });
|
||||
jsonCopy = JSON.parse(JSON.stringify(rtcIceCandidate));
|
||||
for (key in rtcIceCandidate) {
|
||||
if (typeof(rtcIceCandidate[key]) == "function") continue;
|
||||
is(rtcIceCandidate[key], jsonCopy[key], "key " + key + " should match.");
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=872377">Mozilla Bug 872377</a>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=928304">Mozilla Bug 928304</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
|
@ -1830,9 +1830,10 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
||||
#endif
|
||||
|
||||
if (mInstance) {
|
||||
WidgetEvent* event = aKeyEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_KEY_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
|
||||
WidgetKeyboardEvent* keyEvent =
|
||||
aKeyEvent->GetInternalNSEvent()->AsKeyboardEvent();
|
||||
if (keyEvent && keyEvent->eventStructType == NS_KEY_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*keyEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->StopPropagation();
|
||||
@ -1864,10 +1865,11 @@ nsPluginInstanceOwner::ProcessMouseDown(nsIDOMEvent* aMouseEvent)
|
||||
}
|
||||
}
|
||||
|
||||
WidgetEvent* event = aMouseEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_MOUSE_EVENT) {
|
||||
mLastMouseDownButtonType = static_cast<WidgetMouseEvent*>(event)->button;
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
mLastMouseDownButtonType = mouseEvent->button;
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
return aMouseEvent->PreventDefault(); // consume event
|
||||
}
|
||||
@ -1887,14 +1889,15 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
||||
if (!mWidgetVisible)
|
||||
return NS_OK;
|
||||
|
||||
WidgetEvent* event = aMouseEvent->GetInternalNSEvent();
|
||||
if (event && event->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*static_cast<WidgetGUIEvent*>(event));
|
||||
WidgetMouseEvent* mouseEvent =
|
||||
aMouseEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (mouseEvent && mouseEvent->eventStructType == NS_MOUSE_EVENT) {
|
||||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->StopPropagation();
|
||||
}
|
||||
if (event->message == NS_MOUSE_BUTTON_UP) {
|
||||
if (mouseEvent->message == NS_MOUSE_BUTTON_UP) {
|
||||
mLastMouseDownButtonType = -1;
|
||||
}
|
||||
}
|
||||
@ -1926,9 +1929,9 @@ nsPluginInstanceOwner::HandleEvent(nsIDOMEvent* aEvent)
|
||||
// element above the plugin, the mouse is still above the plugin, and the
|
||||
// mouse-down event caused the element to disappear. See bug 627649 and
|
||||
// bug 909678.
|
||||
WidgetMouseEvent *event =
|
||||
static_cast<WidgetMouseEvent*>(aEvent->GetInternalNSEvent());
|
||||
if (event && ((int) event->button != mLastMouseDownButtonType)) {
|
||||
WidgetMouseEvent* mouseEvent = aEvent->GetInternalNSEvent()->AsMouseEvent();
|
||||
if (mouseEvent &&
|
||||
static_cast<int>(mouseEvent->button) != mLastMouseDownButtonType) {
|
||||
aEvent->PreventDefault();
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2038,8 +2041,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
// If we're in a dragging operation that started over another frame,
|
||||
// convert it into a mouse-entered event (in the Cocoa Event Model).
|
||||
// See bug 525078.
|
||||
if ((static_cast<const WidgetMouseEvent&>(anEvent).button ==
|
||||
WidgetMouseEvent::eLeftButton) &&
|
||||
if (anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||
(nsIPresShell::GetCapturingContent() != mObjectFrame->GetContent())) {
|
||||
synthCocoaEvent.type = NPCocoaEventMouseEntered;
|
||||
synthCocoaEvent.data.mouse.pluginX = static_cast<double>(ptPx.x);
|
||||
@ -2074,12 +2076,11 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
}
|
||||
|
||||
if ((response == kNPEventHandled || response == kNPEventStartIME) &&
|
||||
!(anEvent.eventStructType == NS_MOUSE_EVENT &&
|
||||
anEvent.message == NS_MOUSE_BUTTON_DOWN &&
|
||||
static_cast<const WidgetMouseEvent&>(anEvent).button ==
|
||||
WidgetMouseEvent::eLeftButton &&
|
||||
!mContentFocused))
|
||||
!(anEvent.message == NS_MOUSE_BUTTON_DOWN &&
|
||||
anEvent.AsMouseEvent()->button == WidgetMouseEvent::eLeftButton &&
|
||||
!mContentFocused)) {
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
pluginWidget->EndDrawPlugin();
|
||||
#endif
|
||||
@ -2095,8 +2096,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
// XXX Should extend this list to synthesize events for more event
|
||||
// types
|
||||
pluginEvent.event = 0;
|
||||
const WidgetMouseEvent* mouseEvent =
|
||||
static_cast<const WidgetMouseEvent*>(&anEvent);
|
||||
const WidgetMouseEvent* mouseEvent = anEvent.AsMouseEvent();
|
||||
switch (anEvent.message) {
|
||||
case NS_MOUSE_MOVE:
|
||||
pluginEvent.event = WM_MOUSEMOVE;
|
||||
@ -2215,8 +2215,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
|
||||
mObjectFrame->GetContentRectRelativeToSelf().TopLeft();
|
||||
nsIntPoint pluginPoint(presContext->AppUnitsToDevPixels(appPoint.x),
|
||||
presContext->AppUnitsToDevPixels(appPoint.y));
|
||||
const WidgetMouseEvent& mouseEvent =
|
||||
static_cast<const WidgetMouseEvent&>(anEvent);
|
||||
const WidgetMouseEvent& mouseEvent = *anEvent.AsMouseEvent();
|
||||
// Get reference point relative to screen:
|
||||
LayoutDeviceIntPoint rootPoint(-1, -1);
|
||||
if (widget)
|
||||
|
@ -19,7 +19,8 @@ interface HTMLObjectElement : HTMLElement {
|
||||
attribute DOMString data;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString type;
|
||||
// attribute boolean typeMustMatch;
|
||||
[Pure, SetterThrows]
|
||||
attribute boolean typeMustMatch;
|
||||
[Pure, SetterThrows]
|
||||
attribute DOMString name;
|
||||
[Pure, SetterThrows]
|
||||
|
@ -21,7 +21,5 @@ interface mozRTCIceCandidate {
|
||||
attribute DOMString? sdpMid;
|
||||
attribute unsigned short? sdpMLineIndex;
|
||||
|
||||
// Bug 863402 serializer support
|
||||
//
|
||||
//serializer = {attribute};
|
||||
jsonifier;
|
||||
};
|
||||
|
@ -2,8 +2,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = workerbootstrap
|
||||
|
||||
DIST_FILES = \
|
||||
bootstrap.js \
|
||||
install.rdf \
|
||||
|
@ -4,3 +4,4 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = 'workerbootstrap'
|
||||
|
@ -2,7 +2,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = worker
|
||||
DIST_FILES = \
|
||||
install.rdf \
|
||||
worker.js \
|
||||
|
@ -14,3 +14,5 @@ EXTRA_COMPONENTS += [
|
||||
'WorkerTest.js',
|
||||
'WorkerTest.manifest',
|
||||
]
|
||||
|
||||
XPI_NAME = 'worker'
|
||||
|
@ -27,8 +27,6 @@
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
XPI_NAME = winembed
|
||||
|
||||
RESFILE = winEmbed.res
|
||||
|
||||
LIBS = \
|
||||
|
@ -13,3 +13,5 @@ CPP_SOURCES += [
|
||||
'WindowCreator.cpp',
|
||||
'winEmbed.cpp',
|
||||
]
|
||||
|
||||
XPI_NAME = 'winembed'
|
||||
|
@ -3,8 +3,6 @@
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
XPI_NAME = widgetutils
|
||||
|
||||
INSTALL_EXTENSION_ID = widgetutils@extensions.mozilla.org
|
||||
DIST_FILES = install.rdf
|
||||
NO_JAR_AUTO_REG = 1
|
||||
|
@ -8,3 +8,4 @@ DIRS += ['src']
|
||||
|
||||
MODULE = 'widgetutils'
|
||||
|
||||
XPI_NAME = 'widgetutils'
|
||||
|
@ -3,7 +3,6 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
XPI_NAME = widgetutils
|
||||
SHORT_LIBNAME = widgetutils
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
@ -12,7 +11,3 @@ EXTRA_DSO_LDOPTS = \
|
||||
$(NSPR_LIBS) \
|
||||
$(MOZ_COMPONENT_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifdef TARGET_XPCOM_ABI
|
||||
FINAL_TARGET=$(DIST)/xpi-stage/$(XPI_NAME)/platform/$(OS_TARGET)_$(TARGET_XPCOM_ABI)
|
||||
endif
|
||||
|
@ -14,3 +14,7 @@ LIBRARY_NAME = 'widgetutils'
|
||||
|
||||
IS_COMPONENT = True
|
||||
|
||||
XPI_NAME = 'widgetutils'
|
||||
|
||||
if CONFIG['TARGET_XPCOM_ABI']:
|
||||
FINAL_TARGET += '/platform/%(OS_TARGET)s_%(TARGET_XPCOM_ABI)s' % CONFIG
|
||||
|
@ -103,8 +103,16 @@ public:
|
||||
{
|
||||
MarkDestroyed();
|
||||
|
||||
if (mContext)
|
||||
if (mContext) {
|
||||
if ([NSOpenGLContext currentContext] == mContext) {
|
||||
// Clear the current context before releasing. If we don't do
|
||||
// this, the next time we call [NSOpenGLContext currentContext],
|
||||
// "invalid context" will be printed to the console.
|
||||
[NSOpenGLContext clearCurrentContext];
|
||||
}
|
||||
[mContext release];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
GLContextType GetContextType() {
|
||||
|
@ -43,6 +43,7 @@ ClientLayerManager::ClientLayerManager(nsIWidget* aWidget)
|
||||
, mIsRepeatTransaction(false)
|
||||
, mTransactionIncomplete(false)
|
||||
, mCompositorMightResample(false)
|
||||
, mNeedsComposite(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ClientLayerManager);
|
||||
}
|
||||
@ -299,8 +300,9 @@ ClientLayerManager::ForwardTransaction()
|
||||
mPhase = PHASE_FORWARD;
|
||||
|
||||
// forward this transaction's changeset to our LayerManagerComposite
|
||||
bool sent;
|
||||
AutoInfallibleTArray<EditReply, 10> replies;
|
||||
if (HasShadowManager() && ShadowLayerForwarder::EndTransaction(&replies)) {
|
||||
if (HasShadowManager() && ShadowLayerForwarder::EndTransaction(&replies, &sent)) {
|
||||
for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
|
||||
const EditReply& reply = replies[i];
|
||||
|
||||
@ -349,6 +351,10 @@ ClientLayerManager::ForwardTransaction()
|
||||
NS_RUNTIMEABORT("not reached");
|
||||
}
|
||||
}
|
||||
|
||||
if (sent) {
|
||||
mNeedsComposite = false;
|
||||
}
|
||||
} else if (HasShadowManager()) {
|
||||
NS_WARNING("failed to forward Layers transaction");
|
||||
}
|
||||
|
@ -142,6 +142,12 @@ public:
|
||||
#endif
|
||||
bool InTransaction() { return mPhase != PHASE_NONE; }
|
||||
|
||||
void SetNeedsComposite(bool aNeedsComposite)
|
||||
{
|
||||
mNeedsComposite = aNeedsComposite;
|
||||
}
|
||||
bool NeedsComposite() const { return mNeedsComposite; }
|
||||
|
||||
protected:
|
||||
enum TransactionPhase {
|
||||
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
|
||||
@ -200,6 +206,7 @@ private:
|
||||
bool mIsRepeatTransaction;
|
||||
bool mTransactionIncomplete;
|
||||
bool mCompositorMightResample;
|
||||
bool mNeedsComposite;
|
||||
};
|
||||
|
||||
class ClientLayer : public ShadowableLayer
|
||||
|
@ -372,8 +372,7 @@ APZCTreeManager::ProcessMouseEvent(const WidgetMouseEvent& aEvent,
|
||||
MultiTouchInput inputForApzc(aEvent);
|
||||
ApplyTransform(&(inputForApzc.mTouches[0].mScreenPoint), transformToApzc);
|
||||
gfx3DMatrix outTransform = transformToApzc * transformToScreen;
|
||||
ApplyTransform(&(static_cast<WidgetMouseEvent*>(aOutEvent)->refPoint),
|
||||
outTransform);
|
||||
ApplyTransform(&aOutEvent->refPoint, outTransform);
|
||||
return apzc->ReceiveInputEvent(inputForApzc);
|
||||
}
|
||||
|
||||
@ -418,10 +417,9 @@ APZCTreeManager::ReceiveInputEvent(const WidgetInputEvent& aEvent,
|
||||
}
|
||||
case NS_MOUSE_EVENT: {
|
||||
// For b2g emulation
|
||||
const WidgetMouseEvent& mouseEvent =
|
||||
static_cast<const WidgetMouseEvent&>(aEvent);
|
||||
WidgetMouseEvent* outEvent = static_cast<WidgetMouseEvent*>(aOutEvent);
|
||||
return ProcessMouseEvent(mouseEvent, outEvent);
|
||||
const WidgetMouseEvent& mouseEvent = *aEvent.AsMouseEvent();
|
||||
WidgetMouseEvent* outMouseEvent = aOutEvent->AsMouseEvent();
|
||||
return ProcessMouseEvent(mouseEvent, outMouseEvent);
|
||||
}
|
||||
default: {
|
||||
return ProcessEvent(aEvent, aOutEvent);
|
||||
|
@ -326,7 +326,9 @@ LayerManagerComposite::Render()
|
||||
|
||||
{
|
||||
PROFILER_LABEL("LayerManagerComposite", "PreRender");
|
||||
mCompositor->GetWidget()->PreRender(this);
|
||||
if (!mCompositor->GetWidget()->PreRender(this)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
nsIntRect clipRect;
|
||||
@ -344,6 +346,7 @@ LayerManagerComposite::Render()
|
||||
}
|
||||
|
||||
if (actualBounds.IsEmpty()) {
|
||||
mCompositor->GetWidget()->PostRender(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -373,6 +376,8 @@ LayerManagerComposite::Render()
|
||||
PROFILER_LABEL("LayerManagerComposite", "EndFrame");
|
||||
mCompositor->EndFrame();
|
||||
}
|
||||
|
||||
mCompositor->GetWidget()->PostRender(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -467,8 +467,10 @@ ShadowLayerForwarder::UseTexture(CompositableClient* aCompositable,
|
||||
}
|
||||
|
||||
bool
|
||||
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
||||
ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies, bool* aSent)
|
||||
{
|
||||
*aSent = false;
|
||||
|
||||
PROFILER_LABEL("ShadowLayerForwarder", "EndTranscation");
|
||||
RenderTraceScope rendertrace("Foward Transaction", "000091");
|
||||
NS_ABORT_IF_FALSE(HasShadowManager(), "no manager to forward to");
|
||||
@ -582,6 +584,7 @@ ShadowLayerForwarder::EndTransaction(InfallibleTArray<EditReply>* aReplies)
|
||||
}
|
||||
}
|
||||
|
||||
*aSent = true;
|
||||
mIsFirstPaint = false;
|
||||
MOZ_LAYERS_LOG(("[LayersForwarder] ... done"));
|
||||
return true;
|
||||
|
@ -334,7 +334,7 @@ public:
|
||||
* |aReplies| are directions from the LayerManagerComposite to the
|
||||
* caller of EndTransaction().
|
||||
*/
|
||||
bool EndTransaction(InfallibleTArray<EditReply>* aReplies);
|
||||
bool EndTransaction(InfallibleTArray<EditReply>* aReplies, bool* aSent);
|
||||
|
||||
/**
|
||||
* Set an actor through which layer updates will be pushed.
|
||||
|
@ -900,6 +900,11 @@ private:
|
||||
class gfxContextMatrixAutoSaveRestore
|
||||
{
|
||||
public:
|
||||
gfxContextMatrixAutoSaveRestore() :
|
||||
mContext(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
gfxContextMatrixAutoSaveRestore(gfxContext *aContext) :
|
||||
mContext(aContext), mMatrix(aContext->CurrentMatrix())
|
||||
{
|
||||
@ -907,11 +912,28 @@ public:
|
||||
|
||||
~gfxContextMatrixAutoSaveRestore()
|
||||
{
|
||||
mContext->SetMatrix(mMatrix);
|
||||
if (mContext) {
|
||||
mContext->SetMatrix(mMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
void SetContext(gfxContext *aContext)
|
||||
{
|
||||
NS_ASSERTION(!mContext, "Not going to restore the matrix on some context!");
|
||||
mContext = aContext;
|
||||
mMatrix = aContext->CurrentMatrix();
|
||||
}
|
||||
|
||||
void Restore()
|
||||
{
|
||||
if (mContext) {
|
||||
mContext->SetMatrix(mMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
const gfxMatrix& Matrix()
|
||||
{
|
||||
MOZ_ASSERT(mContext, "mMatrix doesn't contain a useful matrix");
|
||||
return mMatrix;
|
||||
}
|
||||
|
||||
|
@ -429,12 +429,7 @@ gfxPlatformMac::UseAcceleratedCanvas()
|
||||
bool
|
||||
gfxPlatformMac::SupportsOffMainThreadCompositing()
|
||||
{
|
||||
// 10.6.X has crashes on tinderbox with OMTC, so disable it
|
||||
// for now.
|
||||
if (OSXVersion() >= 0x1070) {
|
||||
return true;
|
||||
}
|
||||
return GetPrefLayersOffMainThreadCompositionForceEnabled();
|
||||
return true;
|
||||
}
|
||||
|
||||
qcms_profile *
|
||||
|
@ -39,10 +39,6 @@ NSDISTMODE = copy
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq (android,$(MOZ_WIDGET_TOOLKIT))
|
||||
FINAL_TARGET = $(DIST)/bin/lib
|
||||
endif
|
||||
|
||||
ifdef _MSC_VER
|
||||
# Always enter a Windows program through wmain, whether or not we're
|
||||
# a console application.
|
||||
|
@ -12,6 +12,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
|
||||
CPP_SOURCES += [
|
||||
'MozillaRuntimeMainAndroid.cpp',
|
||||
]
|
||||
FINAL_TARGET = 'dist/bin/lib'
|
||||
else:
|
||||
CPP_SOURCES += [
|
||||
'MozillaRuntimeMain.cpp',
|
||||
|
@ -1,923 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: sw=4 ts=4 et :
|
||||
*/
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ipc/AsyncChannel.h"
|
||||
#include "mozilla/ipc/BrowserProcessSubThread.h"
|
||||
#include "mozilla/ipc/ProtocolUtils.h"
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsTraceRefcnt.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace std;
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::ipc::AsyncChannel>
|
||||
{
|
||||
static void RetainCallee(mozilla::ipc::AsyncChannel* obj) { }
|
||||
static void ReleaseCallee(mozilla::ipc::AsyncChannel* obj) { }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::ipc::AsyncChannel::ProcessLink>
|
||||
{
|
||||
static void RetainCallee(mozilla::ipc::AsyncChannel::ProcessLink* obj) { }
|
||||
static void ReleaseCallee(mozilla::ipc::AsyncChannel::ProcessLink* obj) { }
|
||||
};
|
||||
|
||||
// We rely on invariants about the lifetime of the transport:
|
||||
//
|
||||
// - outlives this AsyncChannel
|
||||
// - deleted on the IO thread
|
||||
//
|
||||
// These invariants allow us to send messages directly through the
|
||||
// transport without having to worry about orphaned Send() tasks on
|
||||
// the IO thread touching AsyncChannel memory after it's been deleted
|
||||
// on the worker thread. We also don't need to refcount the
|
||||
// Transport, because whatever task triggers its deletion only runs on
|
||||
// the IO thread, and only runs after this AsyncChannel is done with
|
||||
// the Transport.
|
||||
template<>
|
||||
struct RunnableMethodTraits<mozilla::ipc::AsyncChannel::Transport>
|
||||
{
|
||||
static void RetainCallee(mozilla::ipc::AsyncChannel::Transport* obj) { }
|
||||
static void ReleaseCallee(mozilla::ipc::AsyncChannel::Transport* obj) { }
|
||||
};
|
||||
|
||||
namespace {
|
||||
|
||||
// This is an async message
|
||||
class GoodbyeMessage : public IPC::Message
|
||||
{
|
||||
public:
|
||||
enum { ID = GOODBYE_MESSAGE_TYPE };
|
||||
GoodbyeMessage() :
|
||||
IPC::Message(MSG_ROUTING_NONE, ID, PRIORITY_NORMAL)
|
||||
{
|
||||
}
|
||||
// XXX not much point in implementing this; maybe could help with
|
||||
// debugging?
|
||||
static bool Read(const Message* msg)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
void Log(const std::string& aPrefix,
|
||||
FILE* aOutf) const
|
||||
{
|
||||
fputs("(special `Goodbye' message)", aOutf);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace <anon>
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
AsyncChannel::Link::Link(AsyncChannel *aChan)
|
||||
: mChan(aChan)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncChannel::Link::~Link()
|
||||
{
|
||||
mChan = 0;
|
||||
}
|
||||
|
||||
AsyncChannel::ProcessLink::ProcessLink(AsyncChannel *aChan)
|
||||
: Link(aChan)
|
||||
, mExistingListener(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncChannel::ProcessLink::~ProcessLink()
|
||||
{
|
||||
mIOLoop = 0;
|
||||
if (mTransport) {
|
||||
mTransport->set_listener(0);
|
||||
|
||||
// we only hold a weak ref to the transport, which is "owned"
|
||||
// by GeckoChildProcess/GeckoThread
|
||||
mTransport = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::Open(mozilla::ipc::Transport* aTransport,
|
||||
MessageLoop *aIOLoop,
|
||||
Side aSide)
|
||||
{
|
||||
NS_PRECONDITION(aTransport, "need transport layer");
|
||||
|
||||
// FIXME need to check for valid channel
|
||||
|
||||
mTransport = aTransport;
|
||||
|
||||
// FIXME figure out whether we're in parent or child, grab IO loop
|
||||
// appropriately
|
||||
bool needOpen = true;
|
||||
if(aIOLoop) {
|
||||
// We're a child or using the new arguments. Either way, we
|
||||
// need an open.
|
||||
needOpen = true;
|
||||
mChan->mChild = (aSide == AsyncChannel::Unknown) || (aSide == AsyncChannel::Child);
|
||||
} else {
|
||||
NS_PRECONDITION(aSide == Unknown, "expected default side arg");
|
||||
|
||||
// parent
|
||||
mChan->mChild = false;
|
||||
needOpen = false;
|
||||
aIOLoop = XRE_GetIOMessageLoop();
|
||||
}
|
||||
|
||||
mIOLoop = aIOLoop;
|
||||
|
||||
NS_ASSERTION(mIOLoop, "need an IO loop");
|
||||
NS_ASSERTION(mChan->mWorkerLoop, "need a worker loop");
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
|
||||
if (needOpen) {
|
||||
// Transport::Connect() has not been called. Call it so
|
||||
// we start polling our pipe and processing outgoing
|
||||
// messages.
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ProcessLink::OnChannelOpened));
|
||||
} else {
|
||||
// Transport::Connect() has already been called. Take
|
||||
// over the channel from the previous listener and process
|
||||
// any queued messages.
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ProcessLink::OnTakeConnectedChannel));
|
||||
}
|
||||
|
||||
// Should not wait here if something goes wrong with the channel.
|
||||
while (!mChan->Connected() &&
|
||||
mChan->mChannelState != AsyncChannel::ChannelError) {
|
||||
mChan->mMonitor->Wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::EchoMessage(Message *msg)
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
// NB: Go through this OnMessageReceived indirection so that
|
||||
// echoing this message does the right thing for SyncChannel
|
||||
// and RPCChannel too
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &ProcessLink::OnEchoMessage, msg));
|
||||
// OnEchoMessage takes ownership of |msg|
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::SendMessage(Message *msg)
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(mTransport, &Transport::Send, msg));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::SendClose()
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
mIOLoop->PostTask(
|
||||
FROM_HERE, NewRunnableMethod(this, &ProcessLink::OnCloseChannel));
|
||||
}
|
||||
|
||||
AsyncChannel::ThreadLink::ThreadLink(AsyncChannel *aChan,
|
||||
AsyncChannel *aTargetChan)
|
||||
: Link(aChan),
|
||||
mTargetChan(aTargetChan)
|
||||
{
|
||||
}
|
||||
|
||||
AsyncChannel::ThreadLink::~ThreadLink()
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
// Bug 848949: We need to prevent the other side
|
||||
// from sending us any more messages to avoid Use-After-Free.
|
||||
// The setup here is as shown:
|
||||
//
|
||||
// (Us) (Them)
|
||||
// AsyncChannel AsyncChannel
|
||||
// | ^ \ / ^ |
|
||||
// | | X | |
|
||||
// v | / \ | v
|
||||
// ThreadLink ThreadLink
|
||||
//
|
||||
// We want to null out the diagonal link from their ThreadLink
|
||||
// to our AsyncChannel. Note that we must hold the monitor so
|
||||
// that we do this atomically with respect to them trying to send
|
||||
// us a message.
|
||||
if (mTargetChan) {
|
||||
static_cast<ThreadLink*>(mTargetChan->mLink)->mTargetChan = 0;
|
||||
}
|
||||
mTargetChan = 0;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ThreadLink::EchoMessage(Message *msg)
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
mChan->OnMessageReceivedFromLink(*msg);
|
||||
delete msg;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ThreadLink::SendMessage(Message *msg)
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (mTargetChan)
|
||||
mTargetChan->OnMessageReceivedFromLink(*msg);
|
||||
delete msg;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ThreadLink::SendClose()
|
||||
{
|
||||
mChan->AssertWorkerThread();
|
||||
mChan->mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
mChan->mChannelState = ChannelClosed;
|
||||
|
||||
// In a ProcessLink, we would close our half the channel. This
|
||||
// would show up on the other side as an error on the I/O thread.
|
||||
// The I/O thread would then invoke OnChannelErrorFromLink().
|
||||
// As usual, we skip that process and just invoke the
|
||||
// OnChannelErrorFromLink() method directly.
|
||||
if (mTargetChan)
|
||||
mTargetChan->OnChannelErrorFromLink();
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::ThreadLink::Unsound_IsClosed() const
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
return mChan->mChannelState == ChannelClosed;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AsyncChannel::ThreadLink::Unsound_NumQueuedMessages() const
|
||||
{
|
||||
// ThreadLinks don't have a message queue.
|
||||
return 0;
|
||||
}
|
||||
|
||||
AsyncChannel::AsyncChannel(AsyncListener* aListener)
|
||||
: mListener(aListener->asWeakPtr()),
|
||||
mChannelState(ChannelClosed),
|
||||
mWorkerLoop(),
|
||||
mChild(false),
|
||||
mChannelErrorTask(nullptr),
|
||||
mLink(nullptr),
|
||||
mWorkerLoopID(-1)
|
||||
{
|
||||
MOZ_COUNT_CTOR(AsyncChannel);
|
||||
}
|
||||
|
||||
AsyncChannel::~AsyncChannel()
|
||||
{
|
||||
MOZ_COUNT_DTOR(AsyncChannel);
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::Open(Transport* aTransport,
|
||||
MessageLoop* aIOLoop,
|
||||
AsyncChannel::Side aSide)
|
||||
{
|
||||
ProcessLink *link;
|
||||
NS_PRECONDITION(!mLink, "Open() called > once");
|
||||
mMonitor = new RefCountedMonitor();
|
||||
mWorkerLoop = MessageLoop::current();
|
||||
mWorkerLoopID = mWorkerLoop->id();
|
||||
mLink = link = new ProcessLink(this);
|
||||
link->Open(aTransport, aIOLoop, aSide); // n.b.: sets mChild
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Opens a connection to another thread in the same process.
|
||||
|
||||
This handshake proceeds as follows:
|
||||
- Let A be the thread initiating the process (either child or parent)
|
||||
and B be the other thread.
|
||||
- A spawns thread for B, obtaining B's message loop
|
||||
- A creates ProtocolChild and ProtocolParent instances.
|
||||
Let PA be the one appropriate to A and PB the side for B.
|
||||
- A invokes PA->Open(PB, ...):
|
||||
- set state to mChannelOpening
|
||||
- this will place a work item in B's worker loop (see next bullet)
|
||||
and then spins until PB->mChannelState becomes mChannelConnected
|
||||
- meanwhile, on PB's worker loop, the work item is removed and:
|
||||
- invokes PB->SlaveOpen(PA, ...):
|
||||
- sets its state and that of PA to Connected
|
||||
*/
|
||||
bool
|
||||
AsyncChannel::Open(AsyncChannel *aTargetChan,
|
||||
MessageLoop *aTargetLoop,
|
||||
AsyncChannel::Side aSide)
|
||||
{
|
||||
NS_PRECONDITION(aTargetChan, "Need a target channel");
|
||||
NS_PRECONDITION(ChannelClosed == mChannelState, "Not currently closed");
|
||||
|
||||
CommonThreadOpenInit(aTargetChan, aSide);
|
||||
|
||||
Side oppSide = Unknown;
|
||||
switch(aSide) {
|
||||
case Child: oppSide = Parent; break;
|
||||
case Parent: oppSide = Child; break;
|
||||
case Unknown: break;
|
||||
}
|
||||
|
||||
mMonitor = new RefCountedMonitor();
|
||||
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
mChannelState = ChannelOpening;
|
||||
aTargetLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(aTargetChan, &AsyncChannel::OnOpenAsSlave,
|
||||
this, oppSide));
|
||||
|
||||
while (ChannelOpening == mChannelState)
|
||||
mMonitor->Wait();
|
||||
NS_ASSERTION(ChannelConnected == mChannelState, "not connected when awoken");
|
||||
return (ChannelConnected == mChannelState);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::CommonThreadOpenInit(AsyncChannel *aTargetChan, Side aSide)
|
||||
{
|
||||
mWorkerLoop = MessageLoop::current();
|
||||
mWorkerLoopID = mWorkerLoop->id();
|
||||
mLink = new ThreadLink(this, aTargetChan);
|
||||
mChild = (aSide == Child);
|
||||
}
|
||||
|
||||
// Invoked when the other side has begun the open.
|
||||
void
|
||||
AsyncChannel::OnOpenAsSlave(AsyncChannel *aTargetChan, Side aSide)
|
||||
{
|
||||
NS_PRECONDITION(ChannelClosed == mChannelState,
|
||||
"Not currently closed");
|
||||
NS_PRECONDITION(ChannelOpening == aTargetChan->mChannelState,
|
||||
"Target channel not in the process of opening");
|
||||
|
||||
CommonThreadOpenInit(aTargetChan, aSide);
|
||||
mMonitor = aTargetChan->mMonitor;
|
||||
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
NS_ASSERTION(ChannelOpening == aTargetChan->mChannelState,
|
||||
"Target channel not in the process of opening");
|
||||
mChannelState = ChannelConnected;
|
||||
aTargetChan->mChannelState = ChannelConnected;
|
||||
aTargetChan->mMonitor->Notify();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::Close()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
|
||||
if (ChannelError == mChannelState ||
|
||||
ChannelTimeout == mChannelState) {
|
||||
// See bug 538586: if the listener gets deleted while the
|
||||
// IO thread's NotifyChannelError event is still enqueued
|
||||
// and subsequently deletes us, then the error event will
|
||||
// also be deleted and the listener will never be notified
|
||||
// of the channel error.
|
||||
if (mListener) {
|
||||
MonitorAutoUnlock unlock(*mMonitor);
|
||||
NotifyMaybeChannelError();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (ChannelConnected != mChannelState)
|
||||
// XXX be strict about this until there's a compelling reason
|
||||
// to relax
|
||||
NS_RUNTIMEABORT("Close() called on closed channel!");
|
||||
|
||||
AssertWorkerThread();
|
||||
|
||||
// notify the other side that we're about to close our socket
|
||||
SendSpecialMessage(new GoodbyeMessage());
|
||||
|
||||
SynchronouslyClose();
|
||||
}
|
||||
|
||||
NotifyChannelClosed();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::SynchronouslyClose()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
mLink->SendClose();
|
||||
while (ChannelClosed != mChannelState)
|
||||
mMonitor->Wait();
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::Send(Message* _msg)
|
||||
{
|
||||
nsAutoPtr<Message> msg(_msg);
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
NS_ABORT_IF_FALSE(MSG_ROUTING_NONE != msg->routing_id(), "need a route");
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
|
||||
if (!Connected()) {
|
||||
ReportConnectionError("AsyncChannel");
|
||||
return false;
|
||||
}
|
||||
|
||||
mLink->SendMessage(msg.forget());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::Echo(Message* _msg)
|
||||
{
|
||||
nsAutoPtr<Message> msg(_msg);
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
NS_ABORT_IF_FALSE(MSG_ROUTING_NONE != msg->routing_id(), "need a route");
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
|
||||
if (!Connected()) {
|
||||
ReportConnectionError("AsyncChannel");
|
||||
return false;
|
||||
}
|
||||
|
||||
mLink->EchoMessage(msg.forget());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::OnDispatchMessage(const Message& msg)
|
||||
{
|
||||
AssertWorkerThread();
|
||||
NS_ASSERTION(!msg.is_reply(), "can't process replies here");
|
||||
NS_ASSERTION(!(msg.is_sync() || msg.is_rpc()), "async dispatch only");
|
||||
|
||||
if (MSG_ROUTING_NONE == msg.routing_id()) {
|
||||
if (!OnSpecialMessage(msg.type(), msg))
|
||||
// XXX real error handling
|
||||
NS_RUNTIMEABORT("unhandled special message!");
|
||||
return;
|
||||
}
|
||||
|
||||
// it's OK to dispatch messages if the channel is closed/error'd,
|
||||
// since we don't have a reply to send back
|
||||
|
||||
(void)MaybeHandleError(mListener->OnMessageReceived(msg), "AsyncChannel");
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::OnSpecialMessage(uint16_t id, const Message& msg)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::SendSpecialMessage(Message* msg) const
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mLink->SendMessage(msg);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::OnNotifyMaybeChannelError()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
|
||||
mChannelErrorTask = nullptr;
|
||||
|
||||
// OnChannelError holds mMonitor when it posts this task and this
|
||||
// task cannot be allowed to run until OnChannelError has
|
||||
// exited. We enforce that order by grabbing the mutex here which
|
||||
// should only continue once OnChannelError has completed.
|
||||
{
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
if (ShouldDeferNotifyMaybeError()) {
|
||||
mChannelErrorTask =
|
||||
NewRunnableMethod(this, &AsyncChannel::OnNotifyMaybeChannelError);
|
||||
// 10 ms delay is completely arbitrary
|
||||
mWorkerLoop->PostDelayedTask(FROM_HERE, mChannelErrorTask, 10);
|
||||
return;
|
||||
}
|
||||
|
||||
NotifyMaybeChannelError();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::NotifyChannelClosed()
|
||||
{
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
|
||||
if (ChannelClosed != mChannelState)
|
||||
NS_RUNTIMEABORT("channel should have been closed!");
|
||||
|
||||
// OK, the IO thread just closed the channel normally. Let the
|
||||
// listener know about it.
|
||||
mListener->OnChannelClose();
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::NotifyMaybeChannelError()
|
||||
{
|
||||
mMonitor->AssertNotCurrentThreadOwns();
|
||||
|
||||
// TODO sort out Close() on this side racing with Close() on the
|
||||
// other side
|
||||
if (ChannelClosing == mChannelState) {
|
||||
// the channel closed, but we received a "Goodbye" message
|
||||
// warning us about it. no worries
|
||||
mChannelState = ChannelClosed;
|
||||
NotifyChannelClosed();
|
||||
return;
|
||||
}
|
||||
|
||||
// Oops, error! Let the listener know about it.
|
||||
mChannelState = ChannelError;
|
||||
mListener->OnChannelError();
|
||||
|
||||
Clear();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::Clear()
|
||||
{
|
||||
// Don't clear mWorkerLoopID; we use it in AssertLinkThread() and
|
||||
// AssertWorkerThread().
|
||||
//
|
||||
// Also don't clear mListener. If we clear it, then sending a message
|
||||
// through this channel after it's Clear()'ed can cause this process to
|
||||
// crash.
|
||||
//
|
||||
// In practice, mListener owns the channel, so the channel gets deleted
|
||||
// before mListener. But just to be safe, mListener is a weak pointer.
|
||||
|
||||
mWorkerLoop = 0;
|
||||
|
||||
delete mLink;
|
||||
mLink = 0;
|
||||
|
||||
if (mChannelErrorTask) {
|
||||
mChannelErrorTask->Cancel();
|
||||
mChannelErrorTask = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintErrorMessage(bool isChild, const char* channelName, const char* msg)
|
||||
{
|
||||
printf_stderr("\n###!!! [%s][%s] Error: %s\n\n",
|
||||
isChild ? "Child" : "Parent", channelName, msg);
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::MaybeHandleError(Result code, const char* channelName)
|
||||
{
|
||||
if (MsgProcessed == code)
|
||||
return true;
|
||||
|
||||
const char* errorMsg = nullptr;
|
||||
switch (code) {
|
||||
case MsgNotKnown:
|
||||
errorMsg = "Unknown message: not processed";
|
||||
break;
|
||||
case MsgNotAllowed:
|
||||
errorMsg = "Message not allowed: cannot be sent/recvd in this state";
|
||||
break;
|
||||
case MsgPayloadError:
|
||||
errorMsg = "Payload error: message could not be deserialized";
|
||||
break;
|
||||
case MsgProcessingError:
|
||||
errorMsg = "Processing error: message was deserialized, but the handler returned false (indicating failure)";
|
||||
break;
|
||||
case MsgRouteError:
|
||||
errorMsg = "Route error: message sent to unknown actor ID";
|
||||
break;
|
||||
case MsgValueError:
|
||||
errorMsg = "Value error: message was deserialized, but contained an illegal value";
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_RUNTIMEABORT("unknown Result code");
|
||||
return false;
|
||||
}
|
||||
|
||||
PrintErrorMessage(mChild, channelName, errorMsg);
|
||||
|
||||
mListener->OnProcessingError(code);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ReportConnectionError(const char* channelName) const
|
||||
{
|
||||
const char* errorMsg = nullptr;
|
||||
switch (mChannelState) {
|
||||
case ChannelClosed:
|
||||
errorMsg = "Closed channel: cannot send/recv";
|
||||
break;
|
||||
case ChannelOpening:
|
||||
errorMsg = "Opening channel: not yet ready for send/recv";
|
||||
break;
|
||||
case ChannelTimeout:
|
||||
errorMsg = "Channel timeout: cannot send/recv";
|
||||
break;
|
||||
case ChannelClosing:
|
||||
errorMsg = "Channel closing: too late to send/recv, messages will be lost";
|
||||
break;
|
||||
case ChannelError:
|
||||
errorMsg = "Channel error: cannot send/recv";
|
||||
break;
|
||||
|
||||
default:
|
||||
NS_RUNTIMEABORT("unreached");
|
||||
}
|
||||
|
||||
PrintErrorMessage(mChild, channelName, errorMsg);
|
||||
|
||||
mListener->OnProcessingError(MsgDropped);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::DispatchOnChannelConnected(int32_t peer_pid)
|
||||
{
|
||||
AssertWorkerThread();
|
||||
if (mListener)
|
||||
mListener->OnChannelConnected(peer_pid);
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::Unsound_IsClosed() const
|
||||
{
|
||||
if (!mLink) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return mLink->Unsound_IsClosed();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AsyncChannel::Unsound_NumQueuedMessages() const
|
||||
{
|
||||
if (!mLink) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mLink->Unsound_NumQueuedMessages();
|
||||
}
|
||||
|
||||
//
|
||||
// The methods below run in the context of the IO thread
|
||||
//
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnMessageReceived(const Message& msg)
|
||||
{
|
||||
AssertIOThread();
|
||||
NS_ASSERTION(mChan->mChannelState != ChannelError, "Shouldn't get here!");
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
mChan->OnMessageReceivedFromLink(msg);
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnEchoMessage(Message* msg)
|
||||
{
|
||||
AssertIOThread();
|
||||
OnMessageReceived(*msg);
|
||||
delete msg;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnChannelOpened()
|
||||
{
|
||||
mChan->AssertLinkThread();
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
|
||||
mExistingListener = mTransport->set_listener(this);
|
||||
#ifdef DEBUG
|
||||
if (mExistingListener) {
|
||||
queue<Message> pending;
|
||||
mExistingListener->GetQueuedMessages(pending);
|
||||
MOZ_ASSERT(pending.empty());
|
||||
}
|
||||
#endif // DEBUG
|
||||
|
||||
mChan->mChannelState = ChannelOpening;
|
||||
lock.Notify();
|
||||
}
|
||||
/*assert*/mTransport->Connect();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnTakeConnectedChannel()
|
||||
{
|
||||
AssertIOThread();
|
||||
|
||||
queue<Message> pending;
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
|
||||
mChan->mChannelState = ChannelConnected;
|
||||
|
||||
mExistingListener = mTransport->set_listener(this);
|
||||
if (mExistingListener) {
|
||||
mExistingListener->GetQueuedMessages(pending);
|
||||
}
|
||||
lock.Notify();
|
||||
}
|
||||
|
||||
// Dispatch whatever messages the previous listener had queued up.
|
||||
while (!pending.empty()) {
|
||||
OnMessageReceived(pending.front());
|
||||
pending.pop();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnChannelConnected(int32_t peer_pid)
|
||||
{
|
||||
AssertIOThread();
|
||||
|
||||
{
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
mChan->mChannelState = ChannelConnected;
|
||||
mChan->mMonitor->Notify();
|
||||
}
|
||||
|
||||
if(mExistingListener)
|
||||
mExistingListener->OnChannelConnected(peer_pid);
|
||||
|
||||
mChan->mWorkerLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(mChan,
|
||||
&AsyncChannel::DispatchOnChannelConnected,
|
||||
peer_pid));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnChannelError()
|
||||
{
|
||||
AssertIOThread();
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
mChan->OnChannelErrorFromLink();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessLink::OnCloseChannel()
|
||||
{
|
||||
AssertIOThread();
|
||||
|
||||
mTransport->Close();
|
||||
|
||||
MonitorAutoLock lock(*mChan->mMonitor);
|
||||
mChan->mChannelState = ChannelClosed;
|
||||
mChan->mMonitor->Notify();
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::ProcessLink::Unsound_IsClosed() const
|
||||
{
|
||||
return mTransport->Unsound_IsClosed();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
AsyncChannel::ProcessLink::Unsound_NumQueuedMessages() const
|
||||
{
|
||||
return mTransport->Unsound_NumQueuedMessages();
|
||||
}
|
||||
|
||||
//
|
||||
// The methods below run in the context of the link thread
|
||||
//
|
||||
|
||||
void
|
||||
AsyncChannel::OnMessageReceivedFromLink(const Message& msg)
|
||||
{
|
||||
AssertLinkThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (!MaybeInterceptSpecialIOMessage(msg))
|
||||
// wake up the worker, there's work to do
|
||||
mWorkerLoop->PostTask(
|
||||
FROM_HERE,
|
||||
NewRunnableMethod(this, &AsyncChannel::OnDispatchMessage, msg));
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::OnChannelErrorFromLink()
|
||||
{
|
||||
AssertLinkThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (ChannelClosing != mChannelState) {
|
||||
mChannelState = ChannelError;
|
||||
mMonitor->Notify();
|
||||
}
|
||||
|
||||
PostErrorNotifyTask();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::CloseWithError()
|
||||
{
|
||||
AssertWorkerThread();
|
||||
|
||||
MonitorAutoLock lock(*mMonitor);
|
||||
if (ChannelConnected != mChannelState) {
|
||||
return;
|
||||
}
|
||||
SynchronouslyClose();
|
||||
mChannelState = ChannelError;
|
||||
PostErrorNotifyTask();
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::PostErrorNotifyTask()
|
||||
{
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (mChannelErrorTask)
|
||||
return;
|
||||
|
||||
// This must be the last code that runs on this thread!
|
||||
mChannelErrorTask =
|
||||
NewRunnableMethod(this, &AsyncChannel::OnNotifyMaybeChannelError);
|
||||
mWorkerLoop->PostTask(FROM_HERE, mChannelErrorTask);
|
||||
}
|
||||
|
||||
bool
|
||||
AsyncChannel::MaybeInterceptSpecialIOMessage(const Message& msg)
|
||||
{
|
||||
AssertLinkThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
if (MSG_ROUTING_NONE == msg.routing_id()
|
||||
&& GOODBYE_MESSAGE_TYPE == msg.type()) {
|
||||
ProcessGoodbyeMessage();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
AsyncChannel::ProcessGoodbyeMessage()
|
||||
{
|
||||
AssertLinkThread();
|
||||
mMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
// TODO sort out Close() on this side racing with Close() on the
|
||||
// other side
|
||||
mChannelState = ChannelClosing;
|
||||
}
|
||||
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
@ -81,6 +81,7 @@ MessageChannel::~MessageChannel()
|
||||
DebugOnly<BOOL> ok = CloseHandle(mEvent);
|
||||
MOZ_ASSERT(ok);
|
||||
#endif
|
||||
Clear();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -455,13 +455,16 @@ class MOZ_NONHEAP_CLASS Handle : public js::HandleBase<T>
|
||||
bool operator!=(const T &other) const { return *ptr != other; }
|
||||
bool operator==(const T &other) const { return *ptr == other; }
|
||||
|
||||
/* Change this handle to point to the same rooted location RHS does. */
|
||||
void repoint(const Handle &rhs) { ptr = rhs.address(); }
|
||||
|
||||
private:
|
||||
Handle() {}
|
||||
|
||||
const T *ptr;
|
||||
|
||||
template <typename S>
|
||||
void operator=(S v) MOZ_DELETE;
|
||||
template <typename S> void operator=(S) MOZ_DELETE;
|
||||
void operator=(Handle) MOZ_DELETE;
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -136,31 +136,31 @@ PrintBacktrace()
|
||||
# define JS_OOM_POSSIBLY_FAIL_REPORT(cx) do {} while(0)
|
||||
# endif /* DEBUG */
|
||||
|
||||
static JS_INLINE void* js_malloc(size_t bytes)
|
||||
static inline void* js_malloc(size_t bytes)
|
||||
{
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return malloc(bytes);
|
||||
}
|
||||
|
||||
static JS_INLINE void* js_calloc(size_t bytes)
|
||||
static inline void* js_calloc(size_t bytes)
|
||||
{
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return calloc(bytes, 1);
|
||||
}
|
||||
|
||||
static JS_INLINE void* js_calloc(size_t nmemb, size_t size)
|
||||
static inline void* js_calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return calloc(nmemb, size);
|
||||
}
|
||||
|
||||
static JS_INLINE void* js_realloc(void* p, size_t bytes)
|
||||
static inline void* js_realloc(void* p, size_t bytes)
|
||||
{
|
||||
JS_OOM_POSSIBLY_FAIL();
|
||||
return realloc(p, bytes);
|
||||
}
|
||||
|
||||
static JS_INLINE void js_free(void* p)
|
||||
static inline void js_free(void* p)
|
||||
{
|
||||
free(p);
|
||||
}
|
||||
|
@ -603,16 +603,11 @@ ifneq (,$(IMPORT_LIBRARY))
|
||||
endif
|
||||
$(MAKE) -C shell install
|
||||
|
||||
# Extra dependencies and rules for auto-generated headers
|
||||
host_jskwgen.$(OBJ_SUFFIX): jsversion.h vm/Keywords.h
|
||||
|
||||
# Use CURDIR to avoid finding a jsautokw.h in the source tree (from a
|
||||
# previous build?) via VPATH when we're building in a separate tree.
|
||||
$(CURDIR)/jsautokw.h: host_jskwgen$(HOST_BIN_SUFFIX)
|
||||
./host_jskwgen$(HOST_BIN_SUFFIX) $@
|
||||
|
||||
host_jsoplengen.$(OBJ_SUFFIX): jsopcode.tbl
|
||||
|
||||
# Use CURDIR to avoid finding a jsautooplen.h in the source tree (from
|
||||
# a previous build?) via VPATH when we're building in a separate tree.
|
||||
$(CURDIR)/jsautooplen.h: host_jsoplengen$(HOST_BIN_SUFFIX)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user