mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 969757 - Remove the dead code in our tree which pretends to support OS/2; r=roc,mcmanus,gps,jorendorf,bsmedberg sr=bsmedberg
This commit is contained in:
parent
6cd72749ed
commit
b870bb3fe9
@ -72,7 +72,7 @@ static bool IsArg(const char* arg, const char* s)
|
||||
return !strcasecmp(arg, s);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
if (*arg == '/')
|
||||
return !strcasecmp(++arg, s);
|
||||
#endif
|
||||
|
@ -104,13 +104,9 @@
|
||||
#endif
|
||||
@BINPATH@/application.ini
|
||||
@BINPATH@/platform.ini
|
||||
#ifndef XP_OS2
|
||||
#ifndef MOZ_FOLD_LIBS
|
||||
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
|
||||
#endif
|
||||
#else
|
||||
@BINPATH@/mozsqlt3@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/blocklist.xml
|
||||
@BINPATH@/ua-update.json
|
||||
#ifdef XP_UNIX
|
||||
@ -453,11 +449,7 @@
|
||||
@BINPATH@/components/nsSessionStore.js
|
||||
@BINPATH@/components/nsURLFormatter.manifest
|
||||
@BINPATH@/components/nsURLFormatter.js
|
||||
#ifndef XP_OS2
|
||||
@BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
|
||||
#else
|
||||
@BINPATH@/components/brwsrcmp@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.manifest
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.js
|
||||
@BINPATH@/components/toolkitplaces.manifest
|
||||
@ -749,11 +741,6 @@ bin/libfreebl_32int64_3.so
|
||||
bin/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
|
||||
#endif
|
||||
|
||||
; [OS/2]
|
||||
#ifdef XP_OS2
|
||||
@BINPATH@/MozSounds.cmd
|
||||
#endif
|
||||
|
||||
[b2g]
|
||||
#ifndef MOZ_WIDGET_GONK
|
||||
#ifdef XP_WIN32
|
||||
|
@ -74,11 +74,6 @@ RCFLAGS += -DMOZ_PHOENIX --include-dir $(srcdir)
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
RCFLAGS += -DMOZ_PHOENIX
|
||||
RCFLAGS += -DFIREFOX_ICO='"$(DIST)/branding/firefox-os2.ico"' -DDOCUMENT_ICO='"$(DIST)/branding/document-os2.ico"'
|
||||
endif
|
||||
|
||||
PROGRAMS_DEST = $(DIST)/bin
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
@ -99,7 +94,7 @@ LDFLAGS += /HEAP:0x40000
|
||||
endif #}
|
||||
endif #}
|
||||
|
||||
ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter-out WINNT,$(OS_ARCH)))
|
||||
|
||||
ifdef COMPILE_ENVIRONMENT
|
||||
libs::
|
||||
|
@ -110,7 +110,7 @@ static bool IsArg(const char* arg, const char* s)
|
||||
return !strcasecmp(arg, s);
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
if (*arg == '/')
|
||||
return !strcasecmp(++arg, s);
|
||||
#endif
|
||||
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* 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 <os2.h>
|
||||
|
||||
// Splash screen dialog ID.
|
||||
#define IDD_SPLASH 100
|
||||
|
||||
// Splash screen bitmap ID.
|
||||
#define IDB_SPLASH 101
|
||||
|
||||
ICON 1 FIREFOX_ICO
|
||||
|
||||
DLGTEMPLATE IDD_SPLASH DISCARDABLE
|
||||
BEGIN
|
||||
DIALOG "", IDD_SPLASH, 0, 0, 390, 261, , FCF_BORDER
|
||||
BEGIN
|
||||
END
|
||||
END
|
||||
|
||||
//BITMAP IDB_SPLASH "splash.bmp"
|
@ -47,13 +47,6 @@ BRANDING_FILES := \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BRANDING_FILES := \
|
||||
firefox-os2.ico \
|
||||
document-os2.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
||||
|
Binary file not shown.
Binary file not shown.
@ -47,13 +47,6 @@ BRANDING_FILES := \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BRANDING_FILES := \
|
||||
firefox-os2.ico \
|
||||
document-os2.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
||||
|
Binary file not shown.
Binary file not shown.
@ -47,13 +47,6 @@ BRANDING_FILES := \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BRANDING_FILES := \
|
||||
firefox-os2.ico \
|
||||
document-os2.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
||||
|
Binary file not shown.
Binary file not shown.
@ -47,13 +47,6 @@ BRANDING_FILES := \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BRANDING_FILES := \
|
||||
firefox-os2.ico \
|
||||
document-os2.ico \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
BRANDING_DEST := $(DIST)/branding
|
||||
BRANDING_TARGET := export
|
||||
INSTALL_TARGETS += BRANDING
|
||||
|
Binary file not shown.
Binary file not shown.
@ -50,9 +50,6 @@
|
||||
#ifdef XP_WIN
|
||||
#define USE_WIN_TITLE_STYLE
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
#define USE_WIN_TITLE_STYLE
|
||||
#endif
|
||||
|
||||
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
|
@ -27,9 +27,6 @@
|
||||
#ifdef XP_WIN
|
||||
#define USE_WIN_TITLE_STYLE
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
#define USE_WIN_TITLE_STYLE
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
<?xul-overlay href="chrome://browser/content/macBrowserOverlay.xul"?>
|
||||
|
@ -141,15 +141,11 @@
|
||||
@BINPATH@/update-settings.ini
|
||||
#endif
|
||||
@BINPATH@/platform.ini
|
||||
#ifndef XP_OS2
|
||||
#ifndef MOZ_NATIVE_SQLITE
|
||||
#ifndef MOZ_FOLD_LIBS
|
||||
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
@BINPATH@/mozsqlt3@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/browser/blocklist.xml
|
||||
#ifdef XP_UNIX
|
||||
#ifndef XP_MACOSX
|
||||
@ -430,11 +426,7 @@
|
||||
@BINPATH@/browser/components/nsSessionStore.js
|
||||
@BINPATH@/components/nsURLFormatter.manifest
|
||||
@BINPATH@/components/nsURLFormatter.js
|
||||
#ifndef XP_OS2
|
||||
@BINPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
|
||||
#else
|
||||
@BINPATH@/browser/components/brwsrcmp@DLL_SUFFIX@
|
||||
#endif
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.manifest
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.js
|
||||
@BINPATH@/components/toolkitplaces.manifest
|
||||
@ -792,13 +784,6 @@ bin/libfreebl_32int64_3.so
|
||||
#endif
|
||||
#endif
|
||||
|
||||
; [OS/2]
|
||||
#ifdef XP_OS2
|
||||
@BINPATH@/MozSounds.cmd
|
||||
@BINPATH@/*.xqs
|
||||
@BINPATH@/components/*.xqs
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WEBAPP_RUNTIME
|
||||
[WebappRuntime]
|
||||
#ifdef XP_WIN
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
# finds the location of the browser and puts it in the variable $(browser_path)
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT,$(OS_ARCH)))
|
||||
program = $(MOZ_APP_NAME)$(BIN_SUFFIX)
|
||||
else
|
||||
program = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
|
||||
|
@ -7,10 +7,10 @@
|
||||
# This cannot be named "build" because of bug 922191.
|
||||
SPHINX_TREES['buildsystem'] = 'docs'
|
||||
|
||||
if CONFIG['OS_ARCH'] not in ('WINNT', 'OS2'):
|
||||
DIRS += ['unix']
|
||||
elif CONFIG['OS_ARCH'] == 'WINNT':
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['win32']
|
||||
else:
|
||||
DIRS += ['unix']
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Android' and not CONFIG['MOZ_ANDROID_LIBSTDCXX']:
|
||||
DIRS += ['stlport']
|
||||
|
@ -1,21 +0,0 @@
|
||||
REM This Source Code Form is subject to the terms of the Mozilla Public
|
||||
REM License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
REM file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
/* Invoke unit tests on OS/2 */
|
||||
PARSE ARG dist prog parm
|
||||
dist=forwardtoback(dist);
|
||||
prog=forwardtoback(prog);
|
||||
'set BEGINLIBPATH='dist'\bin;%BEGINLIBPATH%'
|
||||
'set LIBPATHSTRICT=T'
|
||||
prog parm
|
||||
exit
|
||||
|
||||
forwardtoback: procedure
|
||||
arg pathname
|
||||
parse var pathname pathname'/'rest
|
||||
do while (rest <> "")
|
||||
pathname = pathname'\'rest
|
||||
parse var pathname pathname'/'rest
|
||||
end
|
||||
return pathname
|
@ -282,7 +282,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURI* aChromeURI, nsIURI* *aResult)
|
||||
return rv;
|
||||
|
||||
if (flags & PLATFORM_PACKAGE) {
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
path.Insert("win/", 0);
|
||||
#elif defined(XP_MACOSX)
|
||||
path.Insert("mac/", 0);
|
||||
|
@ -123,7 +123,7 @@ check-jar-mn::
|
||||
$(MAKE) -C tests/src-simple check-jar
|
||||
$(MAKE) -C tests/src-simple check-flat
|
||||
$(MAKE) -C tests/src-simple check-flat USE_EXTENSION_MANIFEST=1
|
||||
ifneq (,$(filter-out WINNT OS2,$(OS_ARCH)))
|
||||
ifneq (,$(filter-out WINNT,$(OS_ARCH)))
|
||||
$(MAKE) -C tests/src-simple check-symlink
|
||||
endif
|
||||
|
||||
|
@ -447,10 +447,6 @@ endif
|
||||
|
||||
TAR_CREATE_FLAGS = -chf
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
TAR_CREATE_FLAGS = -cf
|
||||
endif
|
||||
|
||||
#
|
||||
# Personal makefile customizations go in these optional make include files.
|
||||
#
|
||||
@ -646,9 +642,6 @@ endif
|
||||
# Set link flags according to whether we want a console.
|
||||
ifdef MOZ_WINCONSOLE
|
||||
ifeq ($(MOZ_WINCONSOLE),1)
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BIN_FLAGS += -Zlinker -PM:VIO
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef GNU_CC
|
||||
WIN32_EXE_LDFLAGS += -mconsole
|
||||
@ -657,9 +650,6 @@ WIN32_EXE_LDFLAGS += -SUBSYSTEM:CONSOLE
|
||||
endif
|
||||
endif
|
||||
else # MOZ_WINCONSOLE
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
BIN_FLAGS += -Zlinker -PM:PM
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef GNU_CC
|
||||
WIN32_EXE_LDFLAGS += -mwindows
|
||||
@ -714,19 +704,15 @@ NSINSTALL_NATIVECMD := %nsinstall nsinstall
|
||||
ifdef NSINSTALL_BIN
|
||||
NSINSTALL = $(NSINSTALL_BIN)
|
||||
else
|
||||
ifeq (OS2,$(CROSS_COMPILE)$(OS_ARCH))
|
||||
NSINSTALL = $(MOZ_TOOLS_DIR)/nsinstall
|
||||
else
|
||||
ifeq ($(HOST_OS_ARCH),WINNT)
|
||||
NSINSTALL = $(NSINSTALL_PY)
|
||||
else
|
||||
NSINSTALL = $(DIST)/bin/nsinstall$(HOST_BIN_SUFFIX)
|
||||
endif # WINNT
|
||||
endif # OS2
|
||||
endif # NSINSTALL_BIN
|
||||
|
||||
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT OS2, $(OS_ARCH)))
|
||||
ifeq (,$(CROSS_COMPILE)$(filter-out WINNT, $(OS_ARCH)))
|
||||
INSTALL = $(NSINSTALL) -t
|
||||
ifdef .PYMAKE
|
||||
install_cmd = $(NSINSTALL_NATIVECMD) -t $(1)
|
||||
@ -738,7 +724,7 @@ else
|
||||
# target-specific.
|
||||
INSTALL = $(if $(filter copy, $(NSDISTMODE)), $(NSINSTALL) -t, $(if $(filter absolute_symlink, $(NSDISTMODE)), $(NSINSTALL) -L $(PWD), $(NSINSTALL) -R))
|
||||
|
||||
endif # WINNT/OS2
|
||||
endif # WINNT
|
||||
|
||||
# The default for install_cmd is simply INSTALL
|
||||
install_cmd ?= $(INSTALL) $(1)
|
||||
@ -795,13 +781,9 @@ MERGE_FILE = $(LOCALE_SRCDIR)/$(1)
|
||||
endif
|
||||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifeq (OS2,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd '$(LIBXUL_DIST)'
|
||||
else
|
||||
ifneq (WINNT,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
||||
endif # ! WINNT
|
||||
endif # ! OS2
|
||||
|
||||
#
|
||||
# Java macros
|
||||
@ -844,7 +826,7 @@ HOST_EXTRA_LIBS += $(call EXPAND_LIBNAME_PATH,host_stdc++compat,$(DEPTH)/build/u
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (,$(filter $(OS_TARGET),WINNT Darwin OS2))
|
||||
ifeq (,$(filter $(OS_TARGET),WINNT Darwin))
|
||||
CHECK_TEXTREL = @$(TOOLCHAIN_PREFIX)readelf -d $(1) | grep TEXTREL > /dev/null && echo 'TEST-UNEXPECTED-FAIL | check_textrel | We do not want text relocations in libraries and programs' || true
|
||||
endif
|
||||
|
||||
|
@ -67,7 +67,7 @@ SHARED_LIBRARY_DEST ?= $(FINAL_TARGET)
|
||||
SHARED_LIBRARY_TARGET = binaries libs
|
||||
INSTALL_TARGETS += SHARED_LIBRARY
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT,$(OS_ARCH)))
|
||||
ifndef NO_INSTALL_IMPORT_LIBRARY
|
||||
IMPORT_LIB_FILES = $(IMPORT_LIBRARY)
|
||||
endif # NO_INSTALL_IMPORT_LIBRARY
|
||||
|
@ -36,7 +36,7 @@ libs::
|
||||
$(MAKE) -C $(DEPTH)/nsprpub install prefix=$(ABS_DIST)/sdk exec_prefix=$(ABS_DIST)/sdk bindir=$(ABS_DIST)/sdk/dummy includedir=$(ABS_DIST)/include/nspr libdir=$(ABS_DIST)/sdk/lib datadir=$(ABS_DIST)/sdk/dummy DESTDIR= $(EXTRA_MAKE_FLAGS)
|
||||
$(INSTALL) $(DEPTH)/nsprpub/config/nspr-config $(DIST)/sdk/bin
|
||||
$(RM) -rf $(DIST)/sdk/dummy
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) # {
|
||||
ifneq (,$(filter WINNT,$(OS_ARCH))) # {
|
||||
$(RM) -f $(DIST)/sdk/lib/$(DLL_PREFIX)nspr4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plc4$(DLL_SUFFIX) $(DIST)/sdk/lib/$(DLL_PREFIX)plds4$(DLL_SUFFIX)
|
||||
$(RM) -f $(DIST)/sdk/lib/$(LIB_PREFIX)nspr4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plc4_s.$(LIB_SUFFIX) $(DIST)/sdk/lib/$(LIB_PREFIX)plds4_s.$(LIB_SUFFIX)
|
||||
else # } {
|
||||
|
@ -56,11 +56,7 @@ else
|
||||
REPORT_BUILD = $(info $(notdir $@))
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
EXEC =
|
||||
else
|
||||
EXEC = exec
|
||||
endif
|
||||
|
||||
# Don't copy xulrunner files at install time, when using system xulrunner
|
||||
ifdef SYSTEM_LIBXUL
|
||||
@ -191,7 +187,7 @@ ifdef LIB_IS_C_ONLY
|
||||
MKSHLIB = $(MKCSHLIB)
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT,$(OS_ARCH)))
|
||||
IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX)
|
||||
endif
|
||||
|
||||
@ -201,10 +197,6 @@ else
|
||||
SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX)
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
DEF_FILE := $(SHARED_LIBRARY:.dll=.def)
|
||||
endif
|
||||
|
||||
EMBED_MANIFEST_AT=2
|
||||
|
||||
endif # MKSHLIB
|
||||
@ -729,9 +721,6 @@ distclean::
|
||||
$(wildcard *.$(OBJ_SUFFIX)) $(wildcard *.ho) $(wildcard host_*.o*) \
|
||||
$(wildcard *.$(LIB_SUFFIX)) $(wildcard *$(DLL_SUFFIX)) \
|
||||
$(wildcard *.$(IMPORT_LIB_SUFFIX))
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
-$(RM) $(PROGRAM:.exe=.map)
|
||||
endif
|
||||
|
||||
alltags:
|
||||
$(RM) TAGS
|
||||
@ -872,23 +861,6 @@ ifeq ($(OS_ARCH),WINNT)
|
||||
$(IMPORT_LIBRARY): $(SHARED_LIBRARY) ;
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS)
|
||||
$(RM) $@
|
||||
echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@
|
||||
echo PROTMODE >> $@
|
||||
echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@
|
||||
echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@
|
||||
echo EXPORTS >> $@
|
||||
|
||||
$(ADD_TO_DEF_FILE)
|
||||
|
||||
$(IMPORT_LIBRARY): $(SHARED_LIBRARY)
|
||||
$(REPORT_BUILD)
|
||||
$(RM) $@
|
||||
$(IMPLIB) $@ $^
|
||||
endif # OS/2
|
||||
|
||||
$(HOST_LIBRARY): $(HOST_OBJS) Makefile
|
||||
$(REPORT_BUILD)
|
||||
$(RM) $@
|
||||
@ -1076,22 +1048,18 @@ $(filter %.i,$(CMMSRCS:%.mm=%.i)): %.i: %.mm $(call mkdir_deps,$(MDDEPDIR))
|
||||
$(RESFILE): %.res: %.rc
|
||||
$(REPORT_BUILD)
|
||||
@echo Creating Resource file: $@
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
$(RC) $(RCFLAGS:-D%=-d %) -i $(subst /,\,$(srcdir)) -r $< $@
|
||||
else
|
||||
ifdef GNU_CC
|
||||
$(RC) $(RCFLAGS) $(filter-out -U%,$(DEFINES)) $(INCLUDES:-I%=--include-dir %) $(OUTOPTION)$@ $(_VPATH_SRCS)
|
||||
else
|
||||
$(RC) $(RCFLAGS) -r $(DEFINES) $(INCLUDES) $(OUTOPTION)$@ $(_VPATH_SRCS)
|
||||
endif
|
||||
endif
|
||||
|
||||
# Cancel GNU make built-in implicit rules
|
||||
ifndef .PYMAKE
|
||||
MAKEFLAGS += -r
|
||||
endif
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
ifneq (,$(filter WINNT,$(OS_ARCH)))
|
||||
SEP := ;
|
||||
else
|
||||
SEP := :
|
||||
|
@ -221,7 +221,6 @@ cairo-atsui.h
|
||||
cairo-beos.h
|
||||
cairo-ft.h
|
||||
cairo-glitz.h
|
||||
cairo-os2.h
|
||||
cairo-pdf.h
|
||||
cairo-ps.h
|
||||
cairo-tee.h
|
||||
@ -690,7 +689,6 @@ oleidl.h
|
||||
OpenGL/OpenGL.h
|
||||
OpenTptInternet.h
|
||||
OpenTransport.h
|
||||
os2.h
|
||||
OS.h
|
||||
osreldate.h
|
||||
ostream
|
||||
|
138
configure.in
138
configure.in
@ -1046,9 +1046,6 @@ solaris*)
|
||||
AC_SUBST(SOLARIS_SUNPRO_CC)
|
||||
AC_SUBST(SOLARIS_SUNPRO_CXX)
|
||||
;;
|
||||
OS_2)
|
||||
HOST_OS_ARCH=OS2
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$OS_ARCH" in
|
||||
@ -1087,11 +1084,6 @@ AIX)
|
||||
OS_RELEASE=`uname -v`.`uname -r`
|
||||
OS_TEST=${target_cpu}
|
||||
;;
|
||||
OS_2)
|
||||
OS_ARCH=OS2
|
||||
OS_TARGET=OS2
|
||||
OS_RELEASE=`uname -v`
|
||||
;;
|
||||
Darwin)
|
||||
case "${target_cpu}" in
|
||||
powerpc*)
|
||||
@ -1542,16 +1534,6 @@ AC_SUBST(HAVE_64BIT_OS)
|
||||
AC_LANG_RESTORE
|
||||
fi # COMPILE_ENVIRONMENT
|
||||
|
||||
dnl ========================================================
|
||||
dnl Enable high-memory support on OS/2 by default.
|
||||
dnl ========================================================
|
||||
MOZ_OS2_HIGH_MEMORY=1
|
||||
MOZ_ARG_DISABLE_BOOL(os2-high-mem,
|
||||
[ --disable-os2-high-mem Disable high-memory support on OS/2],
|
||||
MOZ_OS2_HIGH_MEMORY=,
|
||||
MOZ_OS2_HIGH_MEMORY=1 )
|
||||
AC_SUBST(MOZ_OS2_HIGH_MEMORY)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Use profiling compile flags
|
||||
dnl ========================================================
|
||||
@ -1742,14 +1724,6 @@ case "$host" in
|
||||
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O3}"
|
||||
;;
|
||||
|
||||
*os2*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_OS2 -DNO_X11 -Zomf"
|
||||
HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
|
||||
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
|
||||
HOST_BIN_SUFFIX=.exe
|
||||
MOZ_FIX_LINK_PATHS=
|
||||
;;
|
||||
|
||||
*)
|
||||
HOST_CFLAGS="$HOST_CFLAGS -DXP_UNIX"
|
||||
HOST_OPTIMIZE_FLAGS="${HOST_OPTIMIZE_FLAGS=-O2}"
|
||||
@ -2257,71 +2231,6 @@ ia64*-hpux*)
|
||||
fi
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
MKSHLIB='$(CXX) $(CXXFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
MKCSHLIB='$(CC) $(CFLAGS) $(DSO_PIC_CFLAGS) $(DSO_LDOPTS) -o $@'
|
||||
AC_DEFINE(OS2)
|
||||
AC_DEFINE(XP_OS2)
|
||||
AC_DEFINE(OS2EMX_PLAIN_CHAR)
|
||||
AC_DEFINE(TCPV40HDRS)
|
||||
DLL_PREFIX=
|
||||
LIB_PREFIX=
|
||||
LIB_SUFFIX=lib
|
||||
BIN_SUFFIX=".exe"
|
||||
DLL_SUFFIX=".dll"
|
||||
IMPORT_LIB_SUFFIX=lib
|
||||
DSO_PIC_CFLAGS=
|
||||
AR=emxomfar
|
||||
AR_FLAGS='r $@'
|
||||
CFLAGS="$CFLAGS -Zomf"
|
||||
CXXFLAGS="$CXXFLAGS -Zomf"
|
||||
DSO_LDOPTS='-Zdll'
|
||||
BIN_FLAGS='-Zlinker /ST:0x100000'
|
||||
IMPLIB='emximp -o'
|
||||
FILTER='true'
|
||||
LDFLAGS='-Zmap'
|
||||
WARNINGS_AS_ERRORS='-Werror'
|
||||
MOZ_DEBUG_FLAGS="-g -fno-inline"
|
||||
MOZ_OPTIMIZE_FLAGS="-O2"
|
||||
MOZ_OPTIMIZE_LDFLAGS="-s -Zlinker /EXEPACK:2 -Zlinker /PACKCODE -Zlinker /PACKDATA"
|
||||
LIBXUL_LIBS='-L$(LIBXUL_DIST)/lib $(LIBXUL_DIST)/lib/xul.lib $(LIBXUL_DIST)/lib/mozalloc.lib'
|
||||
TARGET_MD_ARCH=os2
|
||||
_PLATFORM_DEFAULT_TOOLKIT="cairo-os2"
|
||||
RC=rc.exe
|
||||
MC=mc.exe
|
||||
RCFLAGS='-n'
|
||||
MOZ_USER_DIR="Mozilla"
|
||||
ZIP="$ZIP -X"
|
||||
STRIP=lxlite
|
||||
STRIP_FLAGS="/yua /ydd /yxd /ynl /anp /b- /cs+ /d /i- /ml1 /mr2 /mf2 /r+ /u+ /x- /zs:0 /zx /zd"
|
||||
|
||||
if test "$MOZTOOLS"; then
|
||||
MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
|
||||
else
|
||||
AC_MSG_ERROR([MOZTOOLS is not set])
|
||||
fi
|
||||
if test -n "$MOZ_OS2_HIGH_MEMORY"; then
|
||||
DSO_LDOPTS="$DSO_LDOPTS -Zhigh-mem"
|
||||
LDFLAGS="$LDFLAGS -Zhigh-mem"
|
||||
MOZ_OPTIMIZE_LDFLAGS="$MOZ_OPTIMIZE_LDFLAGS -Zhigh-mem"
|
||||
AC_DEFINE(MOZ_OS2_HIGH_MEMORY)
|
||||
fi
|
||||
|
||||
# GCC for OS/2 currently predefines these, but we don't want them
|
||||
_DEFINES_CFLAGS="$_DEFINES_CFLAGS -Uunix -U__unix -U__unix__"
|
||||
_DEFINES_CXXFLAGS="$_DEFINES_CXXFLAGS -Uunix -U__unix -U__unix__"
|
||||
|
||||
AC_CACHE_CHECK(for __declspec(dllexport),
|
||||
ac_os2_declspec,
|
||||
[AC_TRY_COMPILE([__declspec(dllexport) void ac_os2_declspec(void) {}],
|
||||
[return 0;],
|
||||
ac_os2_declspec="yes",
|
||||
ac_os2_declspec="no")])
|
||||
if test "$ac_os2_declspec" != "yes"; then
|
||||
AC_MSG_ERROR([Compiler does not support __declspec(dllexport), install GCC-4.3.2 or newer])
|
||||
fi
|
||||
;;
|
||||
|
||||
*-solaris*)
|
||||
AC_DEFINE(SOLARIS)
|
||||
TARGET_NSPR_MDCPUCFG='\"md/_solaris.cfg\"'
|
||||
@ -2417,10 +2326,6 @@ ia64*-hpux*)
|
||||
esac
|
||||
;;
|
||||
|
||||
*-os2*)
|
||||
HOST_NSPR_MDCPUCFG='\"md/_os2.cfg\"'
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
case "$target" in
|
||||
@ -2453,9 +2358,6 @@ if test -z "$MKSHLIB_FORCE_ALL" -o -z "$MKSHLIB_UNFORCE_ALL"; then
|
||||
NO_LD_ARCHIVE_FLAGS=1
|
||||
fi
|
||||
case "$target" in
|
||||
*-os2*)
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
;;
|
||||
*-aix4.3*|*-aix5*)
|
||||
NO_LD_ARCHIVE_FLAGS=
|
||||
;;
|
||||
@ -2811,8 +2713,6 @@ dnl against libSystem causes issues when debugging (see bug 299601).
|
||||
case $target in
|
||||
*-darwin*)
|
||||
;;
|
||||
*-os2*)
|
||||
;;
|
||||
*)
|
||||
AC_SEARCH_LIBS(dlopen, dl,
|
||||
MOZ_CHECK_HEADER(dlfcn.h,
|
||||
@ -2837,13 +2737,7 @@ if test ! "$GNU_CXX"; then
|
||||
esac
|
||||
fi
|
||||
|
||||
dnl OS/2 has socket in libc.
|
||||
case $target in
|
||||
*-os2*)
|
||||
;;
|
||||
*)
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
esac
|
||||
AC_CHECK_LIB(socket, socket)
|
||||
|
||||
XLDFLAGS="$X_LIBS"
|
||||
XLIBS="$X_EXTRA_LIBS"
|
||||
@ -3122,7 +3016,7 @@ fi
|
||||
AC_LANG_CPLUSPLUS
|
||||
|
||||
case $target_os in
|
||||
darwin*|mingw*|os2*)
|
||||
darwin*|mingw*)
|
||||
;;
|
||||
*)
|
||||
|
||||
@ -3697,7 +3591,7 @@ if test -n "$MOZ_NATIVE_NSS"; then
|
||||
else
|
||||
NSS_CFLAGS='-I$(LIBXUL_DIST)/include/nss'
|
||||
|
||||
if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2"; then
|
||||
if test -z "$GNU_CC" -a "$OS_ARCH" = "WINNT"; then
|
||||
NSS_LIBS="\
|
||||
\$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)crmf.\$(LIB_SUFFIX) \
|
||||
\$(LIBXUL_DIST)/lib/\$(LIB_PREFIX)smime$NSS_VERSION.\$(LIB_SUFFIX) \
|
||||
@ -4282,7 +4176,6 @@ MOZ_ARG_HEADER(Toolkit Options)
|
||||
Select default toolkit
|
||||
Platform specific defaults:
|
||||
Mac OS X - cairo-cocoa
|
||||
OS/2 - cairo-os2
|
||||
Win32 - cairo-windows
|
||||
* - cairo-gtk2
|
||||
* - cairo-gtk3
|
||||
@ -4295,7 +4188,6 @@ MOZ_ARG_HEADER(Toolkit Options)
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk2-x11" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-gtk3" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-qt" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-os2" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-cocoa" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-uikit" \
|
||||
-o "$_DEFAULT_TOOLKIT" = "cairo-android" \
|
||||
@ -4391,14 +4283,6 @@ cairo-qt)
|
||||
AC_DEFINE(QT_NO_KEYWORDS)
|
||||
;;
|
||||
|
||||
cairo-os2)
|
||||
MOZ_WIDGET_TOOLKIT=os2
|
||||
USE_FC_FREETYPE=1
|
||||
TK_CFLAGS='$(MOZ_CAIRO_CFLAGS) $(MOZ_PIXMAN_CFLAGS)'
|
||||
TK_LIBS='$(MOZ_CAIRO_LIBS) $(MOZ_PIXMAN_LIBS)'
|
||||
MOZ_PDF_PRINTING=1
|
||||
;;
|
||||
|
||||
cairo-cocoa)
|
||||
MOZ_WIDGET_TOOLKIT=cocoa
|
||||
AC_DEFINE(MOZ_WIDGET_COCOA)
|
||||
@ -6850,8 +6734,8 @@ fi
|
||||
if test "${OS_TARGET}" = "Android"; then
|
||||
dnl On Android, we use WRAP_LDFLAGS to link everything to mozglue
|
||||
:
|
||||
elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin" -o "${OS_TARGET}" = "OS2"; then
|
||||
dnl On Windows, OSX and OS2, we want to link all our binaries against mozglue
|
||||
elif test "${OS_TARGET}" = "WINNT" -o "${OS_TARGET}" = "Darwin"; then
|
||||
dnl On Windows and OSX, we want to link all our binaries against mozglue
|
||||
if test -z "$GNU_CC"; then
|
||||
MOZ_GLUE_LDFLAGS='$(call EXPAND_LIBNAME_PATH,mozglue,$(LIBXUL_DIST)/lib)'
|
||||
else
|
||||
@ -7563,7 +7447,7 @@ if test "$MOZ_CHROME_FILE_FORMAT" = "omni"; then
|
||||
AC_DEFINE(MOZ_OMNIJAR)
|
||||
fi
|
||||
MOZ_PACKAGER_FORMAT="$MOZ_CHROME_FILE_FORMAT"
|
||||
if test "$OS_ARCH" = "WINNT" -o "$OS_ARCH" = "OS2" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
|
||||
if test "$OS_ARCH" = "WINNT" -o "$MOZ_WIDGET_TOOLKIT" = "android"; then
|
||||
MOZ_CHROME_FILE_FORMAT=flat
|
||||
else
|
||||
MOZ_CHROME_FILE_FORMAT=symlink
|
||||
@ -8043,13 +7927,6 @@ if test "$MOZ_TREE_CAIRO"; then
|
||||
MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1)
|
||||
fi
|
||||
;;
|
||||
os2)
|
||||
OS2_SURFACE_FEATURE="#define CAIRO_HAS_OS2_SURFACE 1"
|
||||
FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1"
|
||||
MOZ_ENABLE_CAIRO_FT=1
|
||||
CAIRO_FT_CFLAGS="-I${MZFTCFGFT2}/include"
|
||||
CAIRO_FT_OSLIBS="-L${MZFTCFGFT2}/lib -lmozft -lmzfntcfg"
|
||||
;;
|
||||
esac
|
||||
if test "$USE_FC_FREETYPE"; then
|
||||
FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1"
|
||||
@ -8425,7 +8302,6 @@ AC_SUBST(XPCOM_STANDALONE_STATICRUNTIME_GLUE_LDOPTS)
|
||||
AC_SUBST(USE_DEPENDENT_LIBS)
|
||||
|
||||
AC_SUBST(MOZ_BUILD_ROOT)
|
||||
AC_SUBST(MOZ_OS2_TOOLS)
|
||||
|
||||
AC_SUBST(MOZ_POST_DSO_LIB_COMMAND)
|
||||
AC_SUBST(MOZ_POST_PROGRAM_COMMAND)
|
||||
@ -8797,7 +8673,7 @@ dnl ========================================================
|
||||
|
||||
if test "$OS_ARCH" = "Darwin"; then
|
||||
AC_DEFINE(XP_UNIX)
|
||||
elif test "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "OS2"; then
|
||||
elif test "$OS_ARCH" != "WINNT"; then
|
||||
AC_DEFINE(XP_UNIX)
|
||||
fi
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
#ifndef nsContentUtils_h___
|
||||
#define nsContentUtils_h___
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
#include <float.h>
|
||||
#endif
|
||||
|
||||
|
@ -50,7 +50,7 @@ using namespace mozilla::dom;
|
||||
|
||||
// on win32 and os/2, context menus come up on mouse up. On other platforms,
|
||||
// they appear on mouse down. Certain bits of code care about this difference.
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
#define NS_CONTEXT_MENU_IS_MOUSEUP 1
|
||||
#endif
|
||||
|
||||
|
@ -48,9 +48,3 @@ include $(topsrcdir)/config/rules.mk
|
||||
|
||||
# next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others
|
||||
LOCAL_INCLUDES += -I$(srcdir)
|
||||
|
||||
ifeq ($(OS_ARCH),OS2)
|
||||
ADD_TO_DEF_FILE = $(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) \
|
||||
$(srcdir)/sqlite.def | sed -e '1,/^EXPORTS$$/ d' -e 's,sqlite3,_\0,' \
|
||||
-e 's,\ DATA.*$$,,' >> $(DEF_FILE)
|
||||
endif
|
||||
|
@ -50,9 +50,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
if CONFIG['MOZ_DEBUG']:
|
||||
DEFINES['SQLITE_DEBUG'] = 1
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'OS2' and CONFIG['MOZ_OS2_HIGH_MEMORY']:
|
||||
DEFINES['OS2_HIGH_MEMORY'] = True
|
||||
|
||||
if CONFIG['OS_TARGET'] == 'Android':
|
||||
# default to user readable only to fit Android security model
|
||||
DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600'
|
||||
|
@ -163,7 +163,7 @@ nsDefaultURIFixup::CreateFixupURI(const nsACString& aStringURI, uint32_t aFixupF
|
||||
if(*aURI)
|
||||
return NS_OK;
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
// Not a file URL, so translate '\' to '/' for convenience in the common protocols
|
||||
// e.g. catch
|
||||
//
|
||||
@ -602,7 +602,7 @@ nsresult nsDefaultURIFixup::ConvertFileToStringURI(const nsACString& aIn,
|
||||
{
|
||||
bool attemptFixup = false;
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
// Check for \ in the url-string or just a drive (PC)
|
||||
if(kNotFound != aIn.FindChar('\\') ||
|
||||
(aIn.Length() == 2 && (aIn.Last() == ':' || aIn.Last() == '|')))
|
||||
|
@ -2027,8 +2027,6 @@ NS_GetNavigatorPlatform(nsAString& aPlatform)
|
||||
aPlatform.AssignLiteral("MacIntel");
|
||||
#elif defined(XP_MACOSX) && defined(__x86_64__)
|
||||
aPlatform.AssignLiteral("MacIntel");
|
||||
#elif defined(XP_OS2)
|
||||
aPlatform.AssignLiteral("OS/2");
|
||||
#else
|
||||
// XXX Communicator uses compiled-in build-time string defines
|
||||
// to indicate the platform it was compiled *for*, not what it is
|
||||
|
@ -1977,7 +1977,7 @@ nsFocusManager::RaiseWindow(nsPIDOMWindow* aWindow)
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
// Windows would rather we focus the child widget, otherwise, the toplevel
|
||||
// widget will always end up being focused. Fortunately, focusing the child
|
||||
// widget will also have the effect of raising the window this widget is in.
|
||||
|
@ -1047,9 +1047,7 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
case NS_MOUSE_BUTTON_DOWN: {
|
||||
switch (mouseEvent->button) {
|
||||
case WidgetMouseEvent::eLeftButton:
|
||||
#ifndef XP_OS2
|
||||
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
|
||||
#endif
|
||||
mLClickCount = mouseEvent->clickCount;
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
sNormalLMouseEventInProcess = true;
|
||||
@ -1059,9 +1057,6 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
case WidgetMouseEvent::eRightButton:
|
||||
#ifdef XP_OS2
|
||||
BeginTrackingDragGesture(aPresContext, mouseEvent, aTargetFrame);
|
||||
#endif
|
||||
mRClickCount = mouseEvent->clickCount;
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
@ -1074,16 +1069,10 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
||||
if (Prefs::ClickHoldContextMenu()) {
|
||||
KillClickHoldTimer();
|
||||
}
|
||||
#ifndef XP_OS2
|
||||
StopTrackingDragGesture();
|
||||
#endif
|
||||
sNormalLMouseEventInProcess = false;
|
||||
// then fall through...
|
||||
case WidgetMouseEvent::eRightButton:
|
||||
#ifdef XP_OS2
|
||||
StopTrackingDragGesture();
|
||||
#endif
|
||||
// then fall through...
|
||||
case WidgetMouseEvent::eMiddleButton:
|
||||
SetClickCount(aPresContext, mouseEvent, aStatus);
|
||||
break;
|
||||
|
@ -117,6 +117,6 @@ TEST_DIRS += [
|
||||
'imptests',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt', 'os2'):
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk2', 'cocoa', 'windows', 'android', 'qt'):
|
||||
TEST_DIRS += ['plugins/test']
|
||||
|
||||
|
@ -164,7 +164,7 @@ PluginPRLibrary::NP_GetValue(void *future, NPPVariable aVariable,
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginPRLibrary::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
mNP_GetValue(nullptr),
|
||||
#endif
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
mNP_GetEntryPoints(nullptr),
|
||||
#endif
|
||||
mNPP_New(nullptr),
|
||||
@ -72,7 +72,7 @@ public:
|
||||
return false;
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
mNP_GetEntryPoints = (NP_GetEntryPointsFunc)
|
||||
PR_FindFunctionSymbol(mLibrary, "NP_GetEntryPoints");
|
||||
if (!mNP_GetEntryPoints)
|
||||
@ -95,7 +95,7 @@ public:
|
||||
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
|
||||
void *aValue, NPError* error);
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error);
|
||||
#endif
|
||||
|
||||
@ -130,7 +130,7 @@ private:
|
||||
#if defined(XP_UNIX) && !defined(XP_MACOSX)
|
||||
NP_GetValueFunc mNP_GetValue;
|
||||
#endif
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
NP_GetEntryPointsFunc mNP_GetEntryPoints;
|
||||
#endif
|
||||
NPP_NewProcPtr mNPP_New;
|
||||
|
@ -65,11 +65,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
'nsPluginNativeWindowWin.cpp',
|
||||
'nsPluginsDirWin.cpp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindowOS2.cpp',
|
||||
'nsPluginsDirOS2.cpp',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
UNIFIED_SOURCES += [
|
||||
'nsPluginNativeWindow.cpp',
|
||||
|
@ -6,18 +6,8 @@
|
||||
#ifndef npapi_h_
|
||||
#define npapi_h_
|
||||
|
||||
#if defined(__OS2__)
|
||||
#pragma pack(1)
|
||||
#endif
|
||||
|
||||
#include "nptypes.h"
|
||||
|
||||
#if defined(__OS2__) || defined(OS2)
|
||||
#ifndef XP_OS2
|
||||
#define XP_OS2 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) && !defined(__SYMBIAN32__)
|
||||
#include <windef.h>
|
||||
#ifndef XP_WIN
|
||||
@ -537,13 +527,6 @@ typedef struct _NPEvent
|
||||
uintptr_t wParam;
|
||||
uintptr_t lParam;
|
||||
} NPEvent;
|
||||
#elif defined(XP_OS2)
|
||||
typedef struct _NPEvent
|
||||
{
|
||||
uint32_t event;
|
||||
uint32_t wParam;
|
||||
uint32_t lParam;
|
||||
} NPEvent;
|
||||
#elif defined(XP_UNIX) && defined(MOZ_X11)
|
||||
typedef XEvent NPEvent;
|
||||
#else
|
||||
@ -785,12 +768,6 @@ enum NPEventType {
|
||||
/* Function Prototypes */
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
#if defined(__OS2__)
|
||||
#define NP_LOADDS _System
|
||||
#else
|
||||
#define NP_LOADDS
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -801,108 +778,105 @@ extern "C" {
|
||||
const char* NPP_GetMIMEDescription(void);
|
||||
#endif
|
||||
|
||||
NPError NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
uint16_t mode, int16_t argc, char* argn[],
|
||||
char* argv[], NPSavedData* saved);
|
||||
NPError NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
|
||||
NPError NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
|
||||
NPError NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type,
|
||||
NPStream* stream, NPBool seekable,
|
||||
uint16_t* stype);
|
||||
NPError NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream,
|
||||
NPReason reason);
|
||||
int32_t NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
|
||||
int32_t NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32_t offset,
|
||||
int32_t len, void* buffer);
|
||||
void NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream,
|
||||
const char* fname);
|
||||
void NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
|
||||
int16_t NP_LOADDS NPP_HandleEvent(NPP instance, void* event);
|
||||
void NP_LOADDS NPP_URLNotify(NPP instance, const char* url,
|
||||
NPReason reason, void* notifyData);
|
||||
NPError NP_LOADDS NPP_GetValue(NPP instance, NPPVariable variable, void *value);
|
||||
NPError NP_LOADDS NPP_SetValue(NPP instance, NPNVariable variable, void *value);
|
||||
NPBool NP_LOADDS NPP_GotFocus(NPP instance, NPFocusDirection direction);
|
||||
void NP_LOADDS NPP_LostFocus(NPP instance);
|
||||
void NP_LOADDS NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
|
||||
NPError NP_LOADDS NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
|
||||
char** NP_LOADDS NPP_GetSitesWithData(void);
|
||||
void NP_LOADDS NPP_DidComposite(NPP instance);
|
||||
NPError NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
uint16_t mode, int16_t argc, char* argn[],
|
||||
char* argv[], NPSavedData* saved);
|
||||
NPError NPP_Destroy(NPP instance, NPSavedData** save);
|
||||
NPError NPP_SetWindow(NPP instance, NPWindow* window);
|
||||
NPError NPP_NewStream(NPP instance, NPMIMEType type,
|
||||
NPStream* stream, NPBool seekable,
|
||||
uint16_t* stype);
|
||||
NPError NPP_DestroyStream(NPP instance, NPStream* stream,
|
||||
NPReason reason);
|
||||
int32_t NPP_WriteReady(NPP instance, NPStream* stream);
|
||||
int32_t NPP_Write(NPP instance, NPStream* stream, int32_t offset,
|
||||
int32_t len, void* buffer);
|
||||
void NPP_StreamAsFile(NPP instance, NPStream* stream,
|
||||
const char* fname);
|
||||
void NPP_Print(NPP instance, NPPrint* platformPrint);
|
||||
int16_t NPP_HandleEvent(NPP instance, void* event);
|
||||
void NPP_URLNotify(NPP instance, const char* url,
|
||||
NPReason reason, void* notifyData);
|
||||
NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value);
|
||||
NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
|
||||
NPBool NPP_GotFocus(NPP instance, NPFocusDirection direction);
|
||||
void NPP_LostFocus(NPP instance);
|
||||
void NPP_URLRedirectNotify(NPP instance, const char* url, int32_t status, void* notifyData);
|
||||
NPError NPP_ClearSiteData(const char* site, uint64_t flags, uint64_t maxAge);
|
||||
char** NPP_GetSitesWithData(void);
|
||||
void NPP_DidComposite(NPP instance);
|
||||
|
||||
/* NPN_* functions are provided by the navigator and called by the plugin. */
|
||||
void NP_LOADDS NPN_Version(int* plugin_major, int* plugin_minor,
|
||||
int* netscape_major, int* netscape_minor);
|
||||
NPError NP_LOADDS NPN_GetURLNotify(NPP instance, const char* url,
|
||||
const char* target, void* notifyData);
|
||||
NPError NP_LOADDS NPN_GetURL(NPP instance, const char* url,
|
||||
const char* target);
|
||||
NPError NP_LOADDS NPN_PostURLNotify(NPP instance, const char* url,
|
||||
const char* target, uint32_t len,
|
||||
const char* buf, NPBool file,
|
||||
void* notifyData);
|
||||
NPError NP_LOADDS NPN_PostURL(NPP instance, const char* url,
|
||||
const char* target, uint32_t len,
|
||||
const char* buf, NPBool file);
|
||||
NPError NP_LOADDS NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
|
||||
NPError NP_LOADDS NPN_NewStream(NPP instance, NPMIMEType type,
|
||||
const char* target, NPStream** stream);
|
||||
int32_t NP_LOADDS NPN_Write(NPP instance, NPStream* stream, int32_t len,
|
||||
void* buffer);
|
||||
NPError NP_LOADDS NPN_DestroyStream(NPP instance, NPStream* stream,
|
||||
NPReason reason);
|
||||
void NP_LOADDS NPN_Status(NPP instance, const char* message);
|
||||
const char* NP_LOADDS NPN_UserAgent(NPP instance);
|
||||
void* NP_LOADDS NPN_MemAlloc(uint32_t size);
|
||||
void NP_LOADDS NPN_MemFree(void* ptr);
|
||||
uint32_t NP_LOADDS NPN_MemFlush(uint32_t size);
|
||||
void NP_LOADDS NPN_ReloadPlugins(NPBool reloadPages);
|
||||
NPError NP_LOADDS NPN_GetValue(NPP instance, NPNVariable variable,
|
||||
void *value);
|
||||
NPError NP_LOADDS NPN_SetValue(NPP instance, NPPVariable variable,
|
||||
void *value);
|
||||
void NP_LOADDS NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
|
||||
void NP_LOADDS NPN_InvalidateRegion(NPP instance,
|
||||
NPRegion invalidRegion);
|
||||
void NP_LOADDS NPN_ForceRedraw(NPP instance);
|
||||
void NP_LOADDS NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
|
||||
void NP_LOADDS NPN_PopPopupsEnabledState(NPP instance);
|
||||
void NP_LOADDS NPN_PluginThreadAsyncCall(NPP instance,
|
||||
void (*func) (void *),
|
||||
void *userData);
|
||||
NPError NP_LOADDS NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
|
||||
const char *url, char **value,
|
||||
uint32_t *len);
|
||||
NPError NP_LOADDS NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
|
||||
const char *url, const char *value,
|
||||
uint32_t len);
|
||||
NPError NP_LOADDS NPN_GetAuthenticationInfo(NPP instance,
|
||||
const char *protocol,
|
||||
const char *host, int32_t port,
|
||||
const char *scheme,
|
||||
const char *realm,
|
||||
char **username, uint32_t *ulen,
|
||||
char **password,
|
||||
uint32_t *plen);
|
||||
uint32_t NP_LOADDS NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
|
||||
void NP_LOADDS NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
|
||||
NPError NP_LOADDS NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
|
||||
NPBool NP_LOADDS NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
NPBool NP_LOADDS NPN_HandleEvent(NPP instance, void *event, NPBool handled);
|
||||
NPBool NP_LOADDS NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
|
||||
void NP_LOADDS NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
|
||||
NPError NP_LOADDS NPN_InitAsyncSurface(NPP instance, NPSize *size,
|
||||
NPImageFormat format, void *initData,
|
||||
NPAsyncSurface *surface);
|
||||
NPError NP_LOADDS NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
|
||||
void NP_LOADDS NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
|
||||
void NPN_Version(int* plugin_major, int* plugin_minor,
|
||||
int* netscape_major, int* netscape_minor);
|
||||
NPError NPN_GetURLNotify(NPP instance, const char* url,
|
||||
const char* target, void* notifyData);
|
||||
NPError NPN_GetURL(NPP instance, const char* url,
|
||||
const char* target);
|
||||
NPError NPN_PostURLNotify(NPP instance, const char* url,
|
||||
const char* target, uint32_t len,
|
||||
const char* buf, NPBool file,
|
||||
void* notifyData);
|
||||
NPError NPN_PostURL(NPP instance, const char* url,
|
||||
const char* target, uint32_t len,
|
||||
const char* buf, NPBool file);
|
||||
NPError NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
|
||||
NPError NPN_NewStream(NPP instance, NPMIMEType type,
|
||||
const char* target, NPStream** stream);
|
||||
int32_t NPN_Write(NPP instance, NPStream* stream, int32_t len,
|
||||
void* buffer);
|
||||
NPError NPN_DestroyStream(NPP instance, NPStream* stream,
|
||||
NPReason reason);
|
||||
void NPN_Status(NPP instance, const char* message);
|
||||
const char* NPN_UserAgent(NPP instance);
|
||||
void* NPN_MemAlloc(uint32_t size);
|
||||
void NPN_MemFree(void* ptr);
|
||||
uint32_t NPN_MemFlush(uint32_t size);
|
||||
void NPN_ReloadPlugins(NPBool reloadPages);
|
||||
NPError NPN_GetValue(NPP instance, NPNVariable variable,
|
||||
void *value);
|
||||
NPError NPN_SetValue(NPP instance, NPPVariable variable,
|
||||
void *value);
|
||||
void NPN_InvalidateRect(NPP instance, NPRect *invalidRect);
|
||||
void NPN_InvalidateRegion(NPP instance,
|
||||
NPRegion invalidRegion);
|
||||
void NPN_ForceRedraw(NPP instance);
|
||||
void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled);
|
||||
void NPN_PopPopupsEnabledState(NPP instance);
|
||||
void NPN_PluginThreadAsyncCall(NPP instance,
|
||||
void (*func) (void *),
|
||||
void *userData);
|
||||
NPError NPN_GetValueForURL(NPP instance, NPNURLVariable variable,
|
||||
const char *url, char **value,
|
||||
uint32_t *len);
|
||||
NPError NPN_SetValueForURL(NPP instance, NPNURLVariable variable,
|
||||
const char *url, const char *value,
|
||||
uint32_t len);
|
||||
NPError NPN_GetAuthenticationInfo(NPP instance,
|
||||
const char *protocol,
|
||||
const char *host, int32_t port,
|
||||
const char *scheme,
|
||||
const char *realm,
|
||||
char **username, uint32_t *ulen,
|
||||
char **password,
|
||||
uint32_t *plen);
|
||||
uint32_t NPN_ScheduleTimer(NPP instance, uint32_t interval, NPBool repeat, void (*timerFunc)(NPP npp, uint32_t timerID));
|
||||
void NPN_UnscheduleTimer(NPP instance, uint32_t timerID);
|
||||
NPError NPN_PopUpContextMenu(NPP instance, NPMenu* menu);
|
||||
NPBool NPN_ConvertPoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
NPBool NPN_HandleEvent(NPP instance, void *event, NPBool handled);
|
||||
NPBool NPN_UnfocusInstance(NPP instance, NPFocusDirection direction);
|
||||
void NPN_URLRedirectResponse(NPP instance, void* notifyData, NPBool allow);
|
||||
NPError NPN_InitAsyncSurface(NPP instance, NPSize *size,
|
||||
NPImageFormat format, void *initData,
|
||||
NPAsyncSurface *surface);
|
||||
NPError NPN_FinalizeAsyncSurface(NPP instance, NPAsyncSurface *surface);
|
||||
void NPN_SetCurrentAsyncSurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* RC_INVOKED */
|
||||
#if defined(__OS2__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#endif /* npapi_h_ */
|
||||
|
@ -6,13 +6,6 @@
|
||||
#ifndef npfunctions_h_
|
||||
#define npfunctions_h_
|
||||
|
||||
#ifdef __OS2__
|
||||
#pragma pack(1)
|
||||
#define NP_LOADDS _System
|
||||
#else
|
||||
#define NP_LOADDS
|
||||
#endif
|
||||
|
||||
#include "npapi.h"
|
||||
#include "npruntime.h"
|
||||
|
||||
@ -20,27 +13,27 @@
|
||||
#include <jni.h>
|
||||
#endif
|
||||
|
||||
typedef NPError (* NP_LOADDS NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
|
||||
typedef NPError (* NP_LOADDS NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
|
||||
typedef NPError (* NP_LOADDS NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
|
||||
typedef NPError (* NP_LOADDS NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
|
||||
typedef NPError (* NP_LOADDS NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
|
||||
typedef int32_t (* NP_LOADDS NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
|
||||
typedef int32_t (* NP_LOADDS NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
|
||||
typedef void (* NP_LOADDS NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
|
||||
typedef void (* NP_LOADDS NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
|
||||
typedef int16_t (* NP_LOADDS NPP_HandleEventProcPtr)(NPP instance, void* event);
|
||||
typedef void (* NP_LOADDS NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
|
||||
typedef NPError (* NPP_NewProcPtr)(NPMIMEType pluginType, NPP instance, uint16_t mode, int16_t argc, char* argn[], char* argv[], NPSavedData* saved);
|
||||
typedef NPError (* NPP_DestroyProcPtr)(NPP instance, NPSavedData** save);
|
||||
typedef NPError (* NPP_SetWindowProcPtr)(NPP instance, NPWindow* window);
|
||||
typedef NPError (* NPP_NewStreamProcPtr)(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16_t* stype);
|
||||
typedef NPError (* NPP_DestroyStreamProcPtr)(NPP instance, NPStream* stream, NPReason reason);
|
||||
typedef int32_t (* NPP_WriteReadyProcPtr)(NPP instance, NPStream* stream);
|
||||
typedef int32_t (* NPP_WriteProcPtr)(NPP instance, NPStream* stream, int32_t offset, int32_t len, void* buffer);
|
||||
typedef void (* NPP_StreamAsFileProcPtr)(NPP instance, NPStream* stream, const char* fname);
|
||||
typedef void (* NPP_PrintProcPtr)(NPP instance, NPPrint* platformPrint);
|
||||
typedef int16_t (* NPP_HandleEventProcPtr)(NPP instance, void* event);
|
||||
typedef void (* NPP_URLNotifyProcPtr)(NPP instance, const char* url, NPReason reason, void* notifyData);
|
||||
/* Any NPObjects returned to the browser via NPP_GetValue should be retained
|
||||
by the plugin on the way out. The browser is responsible for releasing. */
|
||||
typedef NPError (* NP_LOADDS NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
|
||||
typedef NPError (* NP_LOADDS NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
|
||||
typedef NPBool (* NP_LOADDS NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
|
||||
typedef void (* NP_LOADDS NPP_LostFocusPtr)(NPP instance);
|
||||
typedef void (* NP_LOADDS NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
|
||||
typedef NPError (* NP_LOADDS NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
|
||||
typedef char** (* NP_LOADDS NPP_GetSitesWithDataPtr)(void);
|
||||
typedef void (* NP_LOADDS NPP_DidCompositePtr)(NPP instance);
|
||||
typedef NPError (* NPP_GetValueProcPtr)(NPP instance, NPPVariable variable, void *ret_value);
|
||||
typedef NPError (* NPP_SetValueProcPtr)(NPP instance, NPNVariable variable, void *value);
|
||||
typedef NPBool (* NPP_GotFocusPtr)(NPP instance, NPFocusDirection direction);
|
||||
typedef void (* NPP_LostFocusPtr)(NPP instance);
|
||||
typedef void (* NPP_URLRedirectNotifyPtr)(NPP instance, const char* url, int32_t status, void* notifyData);
|
||||
typedef NPError (* NPP_ClearSiteDataPtr)(const char* site, uint64_t flags, uint64_t maxAge);
|
||||
typedef char** (* NPP_GetSitesWithDataPtr)(void);
|
||||
typedef void (* NPP_DidCompositePtr)(NPP instance);
|
||||
|
||||
typedef NPError (*NPN_GetValueProcPtr)(NPP instance, NPNVariable variable, void *ret_value);
|
||||
typedef NPError (*NPN_SetValueProcPtr)(NPP instance, NPPVariable variable, void *value);
|
||||
@ -219,12 +212,8 @@ typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
|
||||
#if defined(_WIN32)
|
||||
#define OSCALL WINAPI
|
||||
#else
|
||||
#if defined(__OS2__)
|
||||
#define OSCALL _System
|
||||
#else
|
||||
#define OSCALL
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
/* GCC 3.3 and later support the visibility attribute. */
|
||||
@ -238,24 +227,11 @@ typedef OSErr (*BP_GetSupportedMIMETypesProcPtr)(BPSupportedMIMETypes*, UInt32);
|
||||
#define NP_EXPORT(__type) NP_VISIBILITY_DEFAULT __type
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32) || defined (__OS2__)
|
||||
#if defined(_WIN32)
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
/* plugin meta member functions */
|
||||
#if defined(__OS2__)
|
||||
typedef struct _NPPluginData { /* Alternate OS2 Plugin interface */
|
||||
char *pMimeTypes;
|
||||
char *pFileExtents;
|
||||
char *pFileOpenTemplate;
|
||||
char *pProductName;
|
||||
char *pProductDescription;
|
||||
unsigned long dwProductVersionMS;
|
||||
unsigned long dwProductVersionLS;
|
||||
} NPPluginData;
|
||||
typedef NPError (OSCALL *NP_GetPluginDataFunc)(NPPluginData*);
|
||||
NPError OSCALL NP_GetPluginData(NPPluginData * pPluginData);
|
||||
#endif
|
||||
typedef NPError (OSCALL *NP_GetEntryPointsFunc)(NPPluginFuncs*);
|
||||
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs);
|
||||
typedef NPError (OSCALL *NP_InitializeFunc)(NPNetscapeFuncs*);
|
||||
@ -269,10 +245,6 @@ const char* NP_GetMIMEDescription(void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__OS2__)
|
||||
#pragma pack()
|
||||
#endif
|
||||
|
||||
#ifdef XP_UNIX
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -11,7 +11,7 @@
|
||||
* true/false macros are available.
|
||||
*/
|
||||
|
||||
#if defined(WIN32) || defined(OS2)
|
||||
#if defined(WIN32)
|
||||
/*
|
||||
* Win32 and OS/2 don't know C99, so define [u]int_16/32/64 here. The bool
|
||||
* is predefined tho, both in C and C++.
|
||||
|
@ -63,12 +63,6 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
#include "nsJSNPRuntime.h"
|
||||
#include "nsIHttpAuthManager.h"
|
||||
#include "nsICookieService.h"
|
||||
@ -431,7 +425,7 @@ nsNPAPIPlugin::CreatePlugin(nsPluginTag *aPluginTag, nsNPAPIPlugin** aResult)
|
||||
nsresult rv;
|
||||
|
||||
// Exchange NPAPI entry points.
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
// NP_GetEntryPoints must be called before NP_Initialize on Windows.
|
||||
rv = pluginLib->NP_GetEntryPoints(&plugin->mPluginFuncs, &pluginCallError);
|
||||
if (rv != NS_OK || pluginCallError != NPERR_NO_ERROR) {
|
||||
@ -864,7 +858,7 @@ namespace mozilla {
|
||||
namespace plugins {
|
||||
namespace parent {
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturl(NPP npp, const char* relativeURL, const char* target)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -900,7 +894,7 @@ _geturl(NPP npp, const char* relativeURL, const char* target)
|
||||
eNPPStreamTypeInternal_Get);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
||||
void* notifyData)
|
||||
{
|
||||
@ -920,7 +914,7 @@ _geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
||||
notifyData);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturlnotify(NPP npp, const char *relativeURL, const char *target,
|
||||
uint32_t len, const char *buf, NPBool file, void *notifyData)
|
||||
{
|
||||
@ -944,7 +938,7 @@ _posturlnotify(NPP npp, const char *relativeURL, const char *target,
|
||||
notifyData, len, buf, file);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturl(NPP npp, const char *relativeURL, const char *target,
|
||||
uint32_t len, const char *buf, NPBool file)
|
||||
{
|
||||
@ -964,7 +958,7 @@ _posturl(NPP npp, const char *relativeURL, const char *target,
|
||||
len, buf, file);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -998,7 +992,7 @@ _newstream(NPP npp, NPMIMEType type, const char* target, NPStream* *result)
|
||||
return err;
|
||||
}
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
_write(NPP npp, NPStream *pstream, int32_t len, void *buffer)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1035,7 +1029,7 @@ _write(NPP npp, NPStream *pstream, int32_t len, void *buffer)
|
||||
return (int32_t)count;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_destroystream(NPP npp, NPStream *pstream, NPError reason)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1085,7 +1079,7 @@ _destroystream(NPP npp, NPStream *pstream, NPError reason)
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_status(NPP npp, const char *message)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1107,7 +1101,7 @@ _status(NPP npp, const char *message)
|
||||
inst->ShowStatus(message);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_memfree (void *ptr)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1119,7 +1113,7 @@ _memfree (void *ptr)
|
||||
nsMemory::Free(ptr);
|
||||
}
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_memflush(uint32_t size)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1131,7 +1125,7 @@ _memflush(uint32_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_reloadplugins(NPBool reloadPages)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1148,7 +1142,7 @@ _reloadplugins(NPBool reloadPages)
|
||||
pluginHost->ReloadPlugins();
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1172,7 +1166,7 @@ _invalidaterect(NPP npp, NPRect *invalidRect)
|
||||
inst->InvalidateRect((NPRect *)invalidRect);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1195,12 +1189,12 @@ _invalidateregion(NPP npp, NPRegion invalidRegion)
|
||||
inst->InvalidateRegion((NPRegion)invalidRegion);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_forceredraw(NPP npp)
|
||||
{
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_getwindowobject(NPP npp)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1220,7 +1214,7 @@ _getwindowobject(NPP npp)
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, cx, global);
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_getpluginelement(NPP npp)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1257,7 +1251,7 @@ _getpluginelement(NPP npp)
|
||||
return nsJSObjWrapper::GetNewOrUsed(npp, cx, obj);
|
||||
}
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
_getstringidentifier(const NPUTF8* name)
|
||||
{
|
||||
if (!name) {
|
||||
@ -1272,7 +1266,7 @@ _getstringidentifier(const NPUTF8* name)
|
||||
return doGetIdentifier(cx, name);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_getstringidentifiers(const NPUTF8** names, int32_t nameCount,
|
||||
NPIdentifier *identifiers)
|
||||
{
|
||||
@ -1292,7 +1286,7 @@ _getstringidentifiers(const NPUTF8** names, int32_t nameCount,
|
||||
}
|
||||
}
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
_getintidentifier(int32_t intid)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1301,7 +1295,7 @@ _getintidentifier(int32_t intid)
|
||||
return IntToNPIdentifier(intid);
|
||||
}
|
||||
|
||||
NPUTF8* NP_CALLBACK
|
||||
NPUTF8*
|
||||
_utf8fromidentifier(NPIdentifier id)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1321,7 +1315,7 @@ _utf8fromidentifier(NPIdentifier id)
|
||||
::JS_GetStringLength(str)));
|
||||
}
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
_intfromidentifier(NPIdentifier id)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1335,7 +1329,7 @@ _intfromidentifier(NPIdentifier id)
|
||||
return NPIdentifierToInt(id);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_identifierisstring(NPIdentifier id)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1345,7 +1339,7 @@ _identifierisstring(NPIdentifier id)
|
||||
return NPIdentifierIsString(id);
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_createobject(NPP npp, NPClass* aClass)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1388,7 +1382,7 @@ _createobject(NPP npp, NPClass* aClass)
|
||||
return npobj;
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_retainobject(NPObject* npobj)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1405,7 +1399,7 @@ _retainobject(NPObject* npobj)
|
||||
return npobj;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_releaseobject(NPObject* npobj)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1431,7 +1425,7 @@ _releaseobject(NPObject* npobj)
|
||||
}
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result)
|
||||
{
|
||||
@ -1454,7 +1448,7 @@ _invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args,
|
||||
return npobj->_class->invoke(npobj, method, args, argCount, result);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result)
|
||||
{
|
||||
@ -1475,7 +1469,7 @@ _invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
return npobj->_class->invokeDefault(npobj, args, argCount, result);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1567,7 +1561,7 @@ _evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result)
|
||||
(!result || JSValToNPVariant(npp, cx, rval, result));
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
NPVariant *result)
|
||||
{
|
||||
@ -1673,7 +1667,7 @@ _getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
const NPVariant *value)
|
||||
{
|
||||
@ -1694,7 +1688,7 @@ _setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
return npobj->_class->setProperty(npobj, property, value);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_removeproperty(NPP npp, NPObject* npobj, NPIdentifier property)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1714,7 +1708,7 @@ _removeproperty(NPP npp, NPObject* npobj, NPIdentifier property)
|
||||
return npobj->_class->removeProperty(npobj, property);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1734,7 +1728,7 @@ _hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName)
|
||||
return npobj->_class->hasProperty(npobj, propertyName);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1754,7 +1748,7 @@ _hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName)
|
||||
return npobj->_class->hasMethod(npobj, methodName);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
|
||||
uint32_t *count)
|
||||
{
|
||||
@ -1781,7 +1775,7 @@ _enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
|
||||
return npobj->_class->enumerate(npobj, identifier, count);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_construct(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result)
|
||||
{
|
||||
@ -1801,7 +1795,7 @@ _construct(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
return npobj->_class->construct(npobj, args, argCount, result);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_releasevariantvalue(NPVariant* variant)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1858,7 +1852,7 @@ _releasevariantvalue(NPVariant* variant)
|
||||
VOID_TO_NPVARIANT(*variant);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setexception(NPObject* npobj, const NPUTF8 *message)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1877,7 +1871,7 @@ _setexception(NPObject* npobj, const NPUTF8 *message)
|
||||
gNPPException = strdup(message);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -1940,8 +1934,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
return NPERR_GENERIC_ERROR;
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2) || (MOZ_WIDGET_GTK == 2) \
|
||||
|| defined(MOZ_WIDGET_QT)
|
||||
#if defined(XP_WIN) || (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
|
||||
case NPNVnetscapeWindow: {
|
||||
if (!npp || !npp->ndata)
|
||||
return NPERR_INVALID_INSTANCE_ERROR;
|
||||
@ -2348,7 +2341,7 @@ _getvalue(NPP npp, NPNVariable variable, void *result)
|
||||
}
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalue(NPP npp, NPPVariable variable, void *result)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2444,7 +2437,7 @@ _setvalue(NPP npp, NPPVariable variable, void *result)
|
||||
}
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_requestread(NPStream *pstream, NPByteRange *rangeList)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2490,14 +2483,14 @@ _requestread(NPStream *pstream, NPByteRange *rangeList)
|
||||
}
|
||||
|
||||
// Deprecated, only stubbed out
|
||||
void* NP_CALLBACK /* OJI type: JRIEnv* */
|
||||
void* /* OJI type: JRIEnv* */
|
||||
_getJavaEnv()
|
||||
{
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaEnv\n"));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const char * NP_CALLBACK
|
||||
const char *
|
||||
_useragent(NPP npp)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2520,7 +2513,7 @@ _useragent(NPP npp)
|
||||
return retstr;
|
||||
}
|
||||
|
||||
void * NP_CALLBACK
|
||||
void *
|
||||
_memalloc (uint32_t size)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2531,14 +2524,14 @@ _memalloc (uint32_t size)
|
||||
}
|
||||
|
||||
// Deprecated, only stubbed out
|
||||
void* NP_CALLBACK /* OJI type: jref */
|
||||
void* /* OJI type: jref */
|
||||
_getJavaPeer(NPP npp)
|
||||
{
|
||||
NPN_PLUGIN_LOG(PLUGIN_LOG_NORMAL, ("NPN_GetJavaPeer: npp=%p\n", (void*)npp));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pushpopupsenabledstate(NPP npp, NPBool enabled)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2552,7 +2545,7 @@ _pushpopupsenabledstate(NPP npp, NPBool enabled)
|
||||
inst->PushPopupsEnabledState(enabled);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_poppopupsenabledstate(NPP npp)
|
||||
{
|
||||
if (!NS_IsMainThread()) {
|
||||
@ -2566,7 +2559,7 @@ _poppopupsenabledstate(NPP npp)
|
||||
inst->PopPopupsEnabledState();
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
@ -2582,7 +2575,7 @@ _pluginthreadasynccall(NPP instance, PluginThreadCallback func, void *userData)
|
||||
}
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len)
|
||||
{
|
||||
@ -2641,7 +2634,7 @@ _getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
const char *value, uint32_t len)
|
||||
{
|
||||
@ -2695,7 +2688,7 @@ _setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getauthenticationinfo(NPP instance, const char *protocol, const char *host,
|
||||
int32_t port, const char *scheme, const char *realm,
|
||||
char **username, uint32_t *ulen, char **password,
|
||||
@ -2754,7 +2747,7 @@ _getauthenticationinfo(NPP instance, const char *protocol, const char *host,
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2764,7 +2757,7 @@ _scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc t
|
||||
return inst->ScheduleTimer(interval, repeat, timerFunc);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_unscheduletimer(NPP instance, uint32_t timerID)
|
||||
{
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
@ -2780,7 +2773,7 @@ _unscheduletimer(NPP instance, uint32_t timerID)
|
||||
inst->UnscheduleTimer(timerID);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_popupcontextmenu(NPP instance, NPMenu* menu)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2790,7 +2783,7 @@ _popupcontextmenu(NPP instance, NPMenu* menu)
|
||||
return inst->PopUpContextMenu(menu);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2800,7 +2793,7 @@ _initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initDa
|
||||
return inst->InitAsyncSurface(size, format, initData, surface);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2810,7 +2803,7 @@ _finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
|
||||
return inst->FinalizeAsyncSurface(surface);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2820,7 +2813,7 @@ _setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
|
||||
inst->SetCurrentAsyncSurface(surface, changed);
|
||||
}
|
||||
|
||||
NPBool NP_CALLBACK
|
||||
NPBool
|
||||
_convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
@ -2830,7 +2823,7 @@ _convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace so
|
||||
return inst->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_urlredirectresponse(NPP instance, void* notifyData, NPBool allow)
|
||||
{
|
||||
nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *)instance->ndata;
|
||||
|
@ -14,18 +14,8 @@
|
||||
|
||||
#include "mozilla/PluginLibrary.h"
|
||||
|
||||
/*
|
||||
* Use this macro before each exported function
|
||||
* (between the return address and the function
|
||||
* itself), to ensure that the function has the
|
||||
* right calling conventions on OS/2.
|
||||
*/
|
||||
#define NP_CALLBACK NP_LOADDS
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
|
||||
#elif defined(XP_OS2)
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
|
||||
#else
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
|
||||
#endif
|
||||
@ -143,103 +133,103 @@ NPStringIdentifierIsPermanent(NPP npp, NPIdentifier id)
|
||||
|
||||
#define NPIdentifier_VOID (JSIdToNPIdentifier(JSID_VOID))
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_getwindowobject(NPP npp);
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_getpluginelement(NPP npp);
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
_getstringidentifier(const NPUTF8* name);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_getstringidentifiers(const NPUTF8** names, int32_t nameCount,
|
||||
NPIdentifier *identifiers);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_identifierisstring(NPIdentifier identifiers);
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
_getintidentifier(int32_t intid);
|
||||
|
||||
NPUTF8* NP_CALLBACK
|
||||
NPUTF8*
|
||||
_utf8fromidentifier(NPIdentifier identifier);
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
_intfromidentifier(NPIdentifier identifier);
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_createobject(NPP npp, NPClass* aClass);
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
_retainobject(NPObject* npobj);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_releaseobject(NPObject* npobj);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invoke(NPP npp, NPObject* npobj, NPIdentifier method, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invokeDefault(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_evaluate(NPP npp, NPObject* npobj, NPString *script, NPVariant *result);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_getproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
NPVariant *result);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_setproperty(NPP npp, NPObject* npobj, NPIdentifier property,
|
||||
const NPVariant *value);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_removeproperty(NPP npp, NPObject* npobj, NPIdentifier property);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasproperty(NPP npp, NPObject* npobj, NPIdentifier propertyName);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasmethod(NPP npp, NPObject* npobj, NPIdentifier methodName);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_enumerate(NPP npp, NPObject *npobj, NPIdentifier **identifier,
|
||||
uint32_t *count);
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_construct(NPP npp, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_releasevariantvalue(NPVariant *variant);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setexception(NPObject* npobj, const NPUTF8 *message);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pushpopupsenabledstate(NPP npp, NPBool enabled);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_poppopupsenabledstate(NPP npp);
|
||||
|
||||
typedef void(*PluginThreadCallback)(void *);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pluginthreadasynccall(NPP instance, PluginThreadCallback func,
|
||||
void *userData);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalueforurl(NPP instance, NPNURLVariable variable, const char *url,
|
||||
const char *value, uint32_t len);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getauthenticationinfo(NPP instance, const char *protocol, const char *host,
|
||||
int32_t port, const char *scheme, const char *realm,
|
||||
char **username, uint32_t *ulen, char **password,
|
||||
@ -247,95 +237,95 @@ _getauthenticationinfo(NPP instance, const char *protocol, const char *host,
|
||||
|
||||
typedef void(*PluginTimerFunc)(NPP npp, uint32_t timerID);
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat, PluginTimerFunc timerFunc);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_unscheduletimer(NPP instance, uint32_t timerID);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_popupcontextmenu(NPP instance, NPMenu* menu);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_initasyncsurface(NPP instance, NPSize *size, NPImageFormat format, void *initData, NPAsyncSurface *surface);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
|
||||
|
||||
NPBool NP_CALLBACK
|
||||
NPBool
|
||||
_convertpoint(NPP instance, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_requestread(NPStream *pstream, NPByteRange *rangeList);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturlnotify(NPP npp, const char* relativeURL, const char* target,
|
||||
void* notifyData);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalue(NPP npp, NPNVariable variable, void *r_value);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalue(NPP npp, NPPVariable variable, void *r_value);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturl(NPP npp, const char* relativeURL, const char* target);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturlnotify(NPP npp, const char* relativeURL, const char *target,
|
||||
uint32_t len, const char *buf, NPBool file, void* notifyData);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturl(NPP npp, const char* relativeURL, const char *target, uint32_t len,
|
||||
const char *buf, NPBool file);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_newstream(NPP npp, NPMIMEType type, const char* window, NPStream** pstream);
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
_write(NPP npp, NPStream *pstream, int32_t len, void *buffer);
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_destroystream(NPP npp, NPStream *pstream, NPError reason);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_status(NPP npp, const char *message);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_memfree (void *ptr);
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_memflush(uint32_t size);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_reloadplugins(NPBool reloadPages);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidaterect(NPP npp, NPRect *invalidRect);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidateregion(NPP npp, NPRegion invalidRegion);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_forceredraw(NPP npp);
|
||||
|
||||
const char* NP_CALLBACK
|
||||
const char*
|
||||
_useragent(NPP npp);
|
||||
|
||||
void* NP_CALLBACK
|
||||
void*
|
||||
_memalloc (uint32_t size);
|
||||
|
||||
// Deprecated entry points for the old Java plugin.
|
||||
void* NP_CALLBACK /* OJI type: JRIEnv* */
|
||||
void* /* OJI type: JRIEnv* */
|
||||
_getJavaEnv();
|
||||
|
||||
void* NP_CALLBACK /* OJI type: jref */
|
||||
void* /* OJI type: jref */
|
||||
_getJavaPeer(NPP npp);
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_urlredirectresponse(NPP instance, void* notifyData, NPBool allow);
|
||||
|
||||
} /* namespace parent */
|
||||
|
@ -698,7 +698,7 @@ nsresult nsNPAPIPluginInstance::HandleEvent(void* event, int16_t* result,
|
||||
|
||||
if (pluginFunctions->event) {
|
||||
mCurrentPluginEvent = event;
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
NS_TRY_SAFE_CALL_RETURN(tmpResult, (*pluginFunctions->event)(&mNPP, event), this,
|
||||
aSafeToReenterGecko);
|
||||
#else
|
||||
|
@ -866,7 +866,7 @@ nsNPAPIPluginStreamListener::HandleRedirectNotification(nsIChannel *oldChannel,
|
||||
|
||||
NPP npp;
|
||||
mInst->GetNPP(&npp);
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
NS_TRY_SAFE_CALL_VOID((*pluginFunctions->urlredirectnotify)(npp, spec.get(), static_cast<int32_t>(status), mNPStreamWrapper->mNPStream.notifyData), mInst,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
#else
|
||||
|
@ -654,7 +654,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetNetscapeWindow(void *value)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_WIN)
|
||||
void** pvalue = (void**)value;
|
||||
nsViewManager* vm = mObjectFrame->PresContext()->GetPresShell()->GetViewManager();
|
||||
if (!vm)
|
||||
@ -2450,32 +2450,6 @@ void nsPluginInstanceOwner::Paint(const RECT& aDirty, HDC aDC)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, HPS aHPS)
|
||||
{
|
||||
if (!mInstance || !mObjectFrame)
|
||||
return;
|
||||
|
||||
NPWindow *window;
|
||||
GetWindow(window);
|
||||
nsIntRect relDirtyRect = aDirtyRect.ToOutsidePixels(mObjectFrame->PresContext()->AppUnitsPerDevPixel());
|
||||
|
||||
// we got dirty rectangle in relative window coordinates, but we
|
||||
// need it in absolute units and in the (left, top, right, bottom) form
|
||||
RECTL rectl;
|
||||
rectl.xLeft = relDirtyRect.x + window->x;
|
||||
rectl.yBottom = relDirtyRect.y + window->y;
|
||||
rectl.xRight = rectl.xLeft + relDirtyRect.width;
|
||||
rectl.yTop = rectl.yBottom + relDirtyRect.height;
|
||||
|
||||
NPEvent pluginEvent;
|
||||
pluginEvent.event = WM_PAINT;
|
||||
pluginEvent.wParam = (uint32_t)aHPS;
|
||||
pluginEvent.lParam = (uint32_t)&rectl;
|
||||
mInstance->HandleEvent(&pluginEvent, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_ANDROID
|
||||
|
||||
void nsPluginInstanceOwner::Paint(gfxContext* aContext,
|
||||
|
@ -38,12 +38,6 @@ class gfxXlibSurface;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
#define INCL_PM
|
||||
#define INCL_GPI
|
||||
#include <os2.h>
|
||||
#endif
|
||||
|
||||
class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
|
||||
public nsIDOMEventListener,
|
||||
public nsIPrivacyTransitionObserver,
|
||||
@ -150,8 +144,6 @@ public:
|
||||
void Paint(gfxContext* aContext,
|
||||
const gfxRect& aFrameRect,
|
||||
const gfxRect& aDirtyRect);
|
||||
#elif defined(XP_OS2)
|
||||
void Paint(const nsRect& aDirtyRect, HPS aHPS);
|
||||
#endif
|
||||
|
||||
//locals
|
||||
|
@ -1,523 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#define INCL_WIN
|
||||
#include "os2.h"
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "nsPluginNativeWindow.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsTWeakRef.h"
|
||||
|
||||
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation"
|
||||
#define NS_PLUGIN_CUSTOM_MSG_ID "MozFlashUserRelay"
|
||||
#define WM_USER_FLASH WM_USER+1
|
||||
#ifndef WM_FOCUSCHANGED
|
||||
#define WM_FOCUSCHANGED 0x000E
|
||||
#endif
|
||||
|
||||
#define NP_POPUP_API_VERSION 16
|
||||
|
||||
#define nsMajorVersion(v) (((int32_t)(v) >> 16) & 0xffff)
|
||||
#define nsMinorVersion(v) ((int32_t)(v) & 0xffff)
|
||||
#define versionOK(suppliedV, requiredV) \
|
||||
(nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
|
||||
&& nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
|
||||
|
||||
typedef nsTWeakRef<class nsPluginNativeWindowOS2> PluginWindowWeakRef;
|
||||
|
||||
extern "C" {
|
||||
PVOID APIENTRY WinQueryProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
|
||||
PVOID APIENTRY WinRemoveProperty(HWND hwnd, PCSZ pszNameOrAtom);
|
||||
|
||||
BOOL APIENTRY WinSetProperty(HWND hwnd, PCSZ pszNameOrAtom,
|
||||
PVOID pvData, ULONG ulFlags);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static ULONG sWM_FLASHBOUNCEMSG = 0;
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* PLEvent handling code
|
||||
*/
|
||||
|
||||
class PluginWindowEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
PluginWindowEvent();
|
||||
void Init(const PluginWindowWeakRef &ref, HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
||||
void Clear();
|
||||
HWND GetWnd() { return mWnd; };
|
||||
ULONG GetMsg() { return mMsg; };
|
||||
MPARAM GetWParam() { return mWParam; };
|
||||
MPARAM GetLParam() { return mLParam; };
|
||||
bool InUse() { return mWnd != nullptr; };
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
protected:
|
||||
PluginWindowWeakRef mPluginWindowRef;
|
||||
HWND mWnd;
|
||||
ULONG mMsg;
|
||||
MPARAM mWParam;
|
||||
MPARAM mLParam;
|
||||
};
|
||||
|
||||
PluginWindowEvent::PluginWindowEvent()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
void PluginWindowEvent::Clear()
|
||||
{
|
||||
mWnd = nullptr;
|
||||
mMsg = 0;
|
||||
mWParam = 0;
|
||||
mLParam = 0;
|
||||
}
|
||||
|
||||
void PluginWindowEvent::Init(const PluginWindowWeakRef &ref, HWND aWnd,
|
||||
ULONG aMsg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
NS_ASSERTION(aWnd != nullptr, "invalid plugin event value");
|
||||
NS_ASSERTION(mWnd == nullptr, "event already in use");
|
||||
mPluginWindowRef = ref;
|
||||
mWnd = aWnd;
|
||||
mMsg = aMsg;
|
||||
mWParam = mp1;
|
||||
mLParam = mp2;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
class nsDelayedPopupsEnabledEvent : public nsRunnable
|
||||
{
|
||||
public:
|
||||
nsDelayedPopupsEnabledEvent(nsNPAPIPluginInstance *inst)
|
||||
: mInst(inst)
|
||||
{}
|
||||
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
||||
private:
|
||||
nsRefPtr<nsNPAPIPluginInstance> mInst;
|
||||
};
|
||||
|
||||
NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
||||
{
|
||||
mInst->PushPopupsEnabledState(false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* nsPluginNativeWindow OS/2-specific class declaration
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
nsPluginType_Unknown = 0,
|
||||
nsPluginType_Flash,
|
||||
nsPluginType_Java_vm,
|
||||
nsPluginType_Other
|
||||
} nsPluginType;
|
||||
|
||||
class nsPluginNativeWindowOS2 : public nsPluginNativeWindow
|
||||
{
|
||||
public:
|
||||
nsPluginNativeWindowOS2();
|
||||
virtual ~nsPluginNativeWindowOS2();
|
||||
|
||||
virtual nsresult CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance);
|
||||
|
||||
private:
|
||||
nsresult SubclassAndAssociateWindow();
|
||||
nsresult UndoSubclassAndAssociateWindow();
|
||||
|
||||
public:
|
||||
// locals
|
||||
PFNWP GetWindowProc();
|
||||
PluginWindowEvent* GetPluginWindowEvent(HWND aWnd,
|
||||
ULONG aMsg,
|
||||
MPARAM mp1,
|
||||
MPARAM mp2);
|
||||
|
||||
private:
|
||||
PFNWP mPluginWinProc;
|
||||
PluginWindowWeakRef mWeakRef;
|
||||
nsRefPtr<PluginWindowEvent> mCachedPluginWindowEvent;
|
||||
|
||||
public:
|
||||
nsPluginType mPluginType;
|
||||
};
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
static bool ProcessFlashMessageDelayed(nsPluginNativeWindowOS2 * aWin,
|
||||
nsNPAPIPluginInstance * aInst,
|
||||
HWND hWnd, ULONG msg,
|
||||
MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
NS_ENSURE_TRUE(aWin, NS_ERROR_NULL_POINTER);
|
||||
NS_ENSURE_TRUE(aInst, NS_ERROR_NULL_POINTER);
|
||||
|
||||
if (msg == sWM_FLASHBOUNCEMSG) {
|
||||
// See PluginWindowEvent::Run() below.
|
||||
NS_TRY_SAFE_CALL_VOID((aWin->GetWindowProc())(hWnd, WM_USER_FLASH, mp1, mp2),
|
||||
inst,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (msg != WM_USER_FLASH)
|
||||
return false; // no need to delay
|
||||
|
||||
// do stuff
|
||||
nsCOMPtr<nsIRunnable> pwe = aWin->GetPluginWindowEvent(hWnd, msg, mp1, mp2);
|
||||
if (pwe) {
|
||||
NS_DispatchToCurrentThread(pwe);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* New plugin window procedure
|
||||
*/
|
||||
|
||||
static MRESULT EXPENTRY PluginWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
||||
{
|
||||
nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *)
|
||||
::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
if (!win)
|
||||
return (MRESULT)TRUE;
|
||||
|
||||
// The DispatchEvent(NS_PLUGIN_ACTIVATE) below can trigger a reentrant focus
|
||||
// event which might destroy us. Hold a strong ref on the plugin instance
|
||||
// to prevent that, bug 374229.
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
win->GetPluginInstance(inst);
|
||||
|
||||
// check plugin mime type and cache whether it is Flash or java-vm or not;
|
||||
// flash and java-vm will need special treatment later
|
||||
if (win->mPluginType == nsPluginType_Unknown) {
|
||||
if (inst) {
|
||||
const char* mimetype = nullptr;
|
||||
inst->GetMIMEType(&mimetype);
|
||||
if (mimetype) {
|
||||
if (!strcmp(mimetype, "application/x-shockwave-flash"))
|
||||
win->mPluginType = nsPluginType_Flash;
|
||||
else if (!strcmp(mimetype, "application/x-java-vm"))
|
||||
win->mPluginType = nsPluginType_Java_vm;
|
||||
else
|
||||
win->mPluginType = nsPluginType_Other;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool enablePopups = false;
|
||||
|
||||
// Activate/deactivate mouse capture on the plugin widget
|
||||
// here, before we pass the Windows event to the plugin
|
||||
// because its possible our widget won't get paired events
|
||||
// (see bug 131007) and we'll look frozen. Note that this
|
||||
// is also done in ChildWindow::DispatchMouseEvent.
|
||||
switch (msg) {
|
||||
case WM_BUTTON1DOWN:
|
||||
case WM_BUTTON2DOWN:
|
||||
case WM_BUTTON3DOWN: {
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
win->GetPluginWidget(getter_AddRefs(widget));
|
||||
if (widget)
|
||||
widget->CaptureMouse(true);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_BUTTON1UP:
|
||||
case WM_BUTTON2UP:
|
||||
case WM_BUTTON3UP: {
|
||||
if (msg == WM_BUTTON1UP)
|
||||
enablePopups = true;
|
||||
|
||||
nsCOMPtr<nsIWidget> widget;
|
||||
win->GetPluginWidget(getter_AddRefs(widget));
|
||||
if (widget)
|
||||
widget->CaptureMouse(false);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_CHAR:
|
||||
// Ignore repeating keydown messages...
|
||||
if (SHORT1FROMMP(mp1) & KC_PREVDOWN)
|
||||
break;
|
||||
enablePopups = true;
|
||||
break;
|
||||
|
||||
// When the child of a plugin gets the focus, nsWindow doesn't get
|
||||
// a WM_FOCUSCHANGED msg, so plugin and window activation events
|
||||
// don't happen. This fixes the problem by synthesizing a msg
|
||||
// that makes it look like the plugin widget just got the focus.
|
||||
case WM_FOCUSCHANGE: {
|
||||
|
||||
// Some plugins don't pass this msg on. If the default window proc
|
||||
// doesn't receive it, window activation/deactivation won't happen.
|
||||
WinDefWindowProc(hWnd, msg, mp1, mp2);
|
||||
|
||||
// If focus is being gained, and the plugin widget neither lost nor
|
||||
// gained the focus, then a child just got it from some other window.
|
||||
// If that other window was neither a child of the widget nor owned
|
||||
// by a child of the widget (e.g. a popup menu), post a WM_FOCUSCHANGED
|
||||
// msg that identifies the child as the window losing focus. After
|
||||
// nsWindow:: ActivatePlugin() activates the plugin, it will restore
|
||||
// the focus to the child.
|
||||
if (SHORT1FROMMP(mp2) && (HWND)mp1 != hWnd) {
|
||||
HWND hFocus = WinQueryFocus(HWND_DESKTOP);
|
||||
if (hFocus != hWnd &&
|
||||
WinIsChild(hFocus, hWnd) &&
|
||||
!WinIsChild((HWND)mp1, hWnd) &&
|
||||
!WinIsChild(WinQueryWindow((HWND)mp1, QW_OWNER), hWnd)) {
|
||||
WinPostMsg(hWnd, WM_FOCUSCHANGED, (MPARAM)hFocus, mp2);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Macromedia Flash plugin may flood the message queue with some special messages
|
||||
// (WM_USER+1) causing 100% CPU consumption and GUI freeze, see mozilla bug 132759;
|
||||
// we can prevent this from happening by delaying the processing such messages;
|
||||
if (win->mPluginType == nsPluginType_Flash) {
|
||||
if (ProcessFlashMessageDelayed(win, inst, hWnd, msg, mp1, mp2))
|
||||
return (MRESULT)TRUE;
|
||||
}
|
||||
|
||||
if (enablePopups && inst) {
|
||||
uint16_t apiVersion;
|
||||
if (NS_SUCCEEDED(inst->GetPluginAPIVersion(&apiVersion)) &&
|
||||
!versionOK(apiVersion, NP_POPUP_API_VERSION))
|
||||
inst->PushPopupsEnabledState(true);
|
||||
}
|
||||
|
||||
MRESULT res = (MRESULT)TRUE;
|
||||
if (win->mPluginType == nsPluginType_Java_vm)
|
||||
NS_TRY_SAFE_CALL_RETURN(res, ::WinDefWindowProc(hWnd, msg, mp1, mp2), inst,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
else
|
||||
NS_TRY_SAFE_CALL_RETURN(res, (win->GetWindowProc())(hWnd, msg, mp1, mp2), inst,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
|
||||
if (inst) {
|
||||
// Popups are enabled (were enabled before the call to
|
||||
// CallWindowProc()). Some plugins (at least the flash player)
|
||||
// post messages from their key handlers etc that delay the actual
|
||||
// processing, so we need to delay the disabling of popups so that
|
||||
// popups remain enabled when the flash player ends up processing
|
||||
// the actual key handlers. We do this by posting an event that
|
||||
// does the disabling, this way our disabling will happen after
|
||||
// the handlers in the plugin are done.
|
||||
|
||||
// Note that it's not fatal if any of this fails (which won't
|
||||
// happen unless we're out of memory anyways) since the plugin
|
||||
// code will pop any popup state pushed by this plugin on
|
||||
// destruction.
|
||||
|
||||
nsCOMPtr<nsIRunnable> event = new nsDelayedPopupsEnabledEvent(inst);
|
||||
if (event)
|
||||
NS_DispatchToCurrentThread(event);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/**
|
||||
* nsPluginNativeWindowOS2 implementation
|
||||
*/
|
||||
|
||||
nsPluginNativeWindowOS2::nsPluginNativeWindowOS2() : nsPluginNativeWindow()
|
||||
{
|
||||
// initialize the struct fields
|
||||
window = nullptr;
|
||||
x = 0;
|
||||
y = 0;
|
||||
width = 0;
|
||||
height = 0;
|
||||
|
||||
mPluginWinProc = nullptr;
|
||||
mPluginType = nsPluginType_Unknown;
|
||||
|
||||
// once the atom has been added, it won't be deleted
|
||||
if (!sWM_FLASHBOUNCEMSG) {
|
||||
sWM_FLASHBOUNCEMSG = ::WinFindAtom(WinQuerySystemAtomTable(),
|
||||
NS_PLUGIN_CUSTOM_MSG_ID);
|
||||
if (!sWM_FLASHBOUNCEMSG)
|
||||
sWM_FLASHBOUNCEMSG = ::WinAddAtom(WinQuerySystemAtomTable(),
|
||||
NS_PLUGIN_CUSTOM_MSG_ID);
|
||||
}
|
||||
}
|
||||
|
||||
nsPluginNativeWindowOS2::~nsPluginNativeWindowOS2()
|
||||
{
|
||||
// clear weak reference to self to prevent any pending events from
|
||||
// dereferencing this.
|
||||
mWeakRef.forget();
|
||||
}
|
||||
|
||||
PFNWP nsPluginNativeWindowOS2::GetWindowProc()
|
||||
{
|
||||
return mPluginWinProc;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP PluginWindowEvent::Run()
|
||||
{
|
||||
nsPluginNativeWindowOS2 *win = mPluginWindowRef.get();
|
||||
if (!win)
|
||||
return NS_OK;
|
||||
|
||||
HWND hWnd = GetWnd();
|
||||
if (!hWnd)
|
||||
return NS_OK;
|
||||
|
||||
nsRefPtr<nsNPAPIPluginInstance> inst;
|
||||
win->GetPluginInstance(inst);
|
||||
|
||||
if (GetMsg() == WM_USER_FLASH)
|
||||
// XXX Unwind issues related to runnable event callback depth for this
|
||||
// event and destruction of the plugin. (Bug 493601)
|
||||
::WinPostMsg(hWnd, sWM_FLASHBOUNCEMSG, GetWParam(), GetLParam());
|
||||
else
|
||||
// Currently not used, but added so that processing events here
|
||||
// is more generic.
|
||||
NS_TRY_SAFE_CALL_VOID((win->GetWindowProc())
|
||||
(hWnd, GetMsg(), GetWParam(), GetLParam()),
|
||||
inst,
|
||||
NS_PLUGIN_CALL_UNSAFE_TO_REENTER_GECKO);
|
||||
|
||||
Clear();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PluginWindowEvent*
|
||||
nsPluginNativeWindowOS2::GetPluginWindowEvent(HWND aWnd, ULONG aMsg, MPARAM aMp1, MPARAM aMp2)
|
||||
{
|
||||
if (!mWeakRef) {
|
||||
mWeakRef = this;
|
||||
if (!mWeakRef)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PluginWindowEvent *event;
|
||||
|
||||
// We have the ability to alloc if needed in case in the future some plugin
|
||||
// should post multiple PostMessages. However, this could lead to many
|
||||
// alloc's per second which could become a performance issue. See bug 169247.
|
||||
if (!mCachedPluginWindowEvent) {
|
||||
event = new PluginWindowEvent();
|
||||
if (!event)
|
||||
return nullptr;
|
||||
mCachedPluginWindowEvent = event;
|
||||
}
|
||||
else
|
||||
if (mCachedPluginWindowEvent->InUse()) {
|
||||
event = new PluginWindowEvent();
|
||||
if (!event)
|
||||
return nullptr;
|
||||
}
|
||||
else
|
||||
event = mCachedPluginWindowEvent;
|
||||
|
||||
event->Init(mWeakRef, aWnd, aMsg, aMp1, aMp2);
|
||||
return event;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowOS2::CallSetWindow(nsRefPtr<nsNPAPIPluginInstance> &aPluginInstance)
|
||||
{
|
||||
// check the incoming instance, null indicates that window is going away and we are
|
||||
// not interested in subclassing business any more, undo and don't subclass
|
||||
if (!aPluginInstance) {
|
||||
UndoSubclassAndAssociateWindow();
|
||||
}
|
||||
|
||||
nsPluginNativeWindow::CallSetWindow(aPluginInstance);
|
||||
|
||||
if (aPluginInstance)
|
||||
SubclassAndAssociateWindow();
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowOS2::SubclassAndAssociateWindow()
|
||||
{
|
||||
if (type != NPWindowTypeWindow)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
HWND hWnd = (HWND)window;
|
||||
if (!hWnd)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// check if we need to re-subclass
|
||||
PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP);
|
||||
if (PluginWndProc == currentWndProc)
|
||||
return NS_OK;
|
||||
|
||||
mPluginWinProc = ::WinSubclassWindow(hWnd, PluginWndProc);
|
||||
if (!mPluginWinProc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
#ifdef DEBUG
|
||||
nsPluginNativeWindowOS2 * win = (nsPluginNativeWindowOS2 *)
|
||||
::WinQueryProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
|
||||
#endif
|
||||
|
||||
if (!::WinSetProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (PVOID)this, 0))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPluginNativeWindowOS2::UndoSubclassAndAssociateWindow()
|
||||
{
|
||||
// release plugin instance
|
||||
SetPluginInstance(nullptr);
|
||||
|
||||
// remove window property
|
||||
HWND hWnd = (HWND)window;
|
||||
if (::WinIsWindow(/*HAB*/0, hWnd))
|
||||
::WinRemoveProperty(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
|
||||
// restore the original win proc
|
||||
// but only do this if this were us last time
|
||||
if (mPluginWinProc) {
|
||||
PFNWP currentWndProc = (PFNWP)::WinQueryWindowPtr(hWnd, QWP_PFNWP);
|
||||
if (currentWndProc == PluginWndProc)
|
||||
::WinSubclassWindow(hWnd, mPluginWinProc);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult PLUG_NewPluginNativeWindow(nsPluginNativeWindow ** aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
|
||||
*aPluginNativeWindow = new nsPluginNativeWindowOS2();
|
||||
|
||||
return *aPluginNativeWindow ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult PLUG_DeletePluginNativeWindow(nsPluginNativeWindow * aPluginNativeWindow)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPluginNativeWindow);
|
||||
nsPluginNativeWindowOS2 *p = (nsPluginNativeWindowOS2 *)aPluginNativeWindow;
|
||||
delete p;
|
||||
return NS_OK;
|
||||
}
|
@ -1,274 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
// OS/2 plugin-loading code.
|
||||
|
||||
#define INCL_DOS
|
||||
#define INCL_DOSERRORS
|
||||
#include <os2.h>
|
||||
|
||||
#include "nsPluginsDir.h"
|
||||
#include "prlink.h"
|
||||
#include "plstr.h"
|
||||
#include "prmem.h"
|
||||
#include "prprf.h"
|
||||
#include "npapi.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
||||
/* Load a string stored as RCDATA in a resource segment */
|
||||
/* Returned string needs to be PR_Free'd by caller */
|
||||
static char *LoadRCDATAString( HMODULE hMod, ULONG resid)
|
||||
{
|
||||
APIRET rc;
|
||||
ULONG ulSize = 0;
|
||||
char *string = 0;
|
||||
|
||||
rc = DosQueryResourceSize( hMod, RT_RCDATA, resid, &ulSize);
|
||||
|
||||
if( rc == NO_ERROR)
|
||||
{
|
||||
char *readOnlyString = 0;
|
||||
rc = DosGetResource( hMod, RT_RCDATA, resid, (void**) &readOnlyString);
|
||||
|
||||
/* allow for 0-termination if user hasn't got it right */
|
||||
if( readOnlyString[ ulSize - 1] != '\0')
|
||||
ulSize++;
|
||||
|
||||
if( rc == NO_ERROR)
|
||||
{
|
||||
/* copy string & zero-terminate */
|
||||
string = (char*) PR_Malloc( ulSize);
|
||||
memcpy( string, readOnlyString, ulSize - 1);
|
||||
string[ ulSize - 1] = '\0';
|
||||
|
||||
DosFreeResource( readOnlyString);
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
/* Load a version string stored as RCDATA in a resource segment */
|
||||
/* Returned string needs to be PR_Free'd by caller */
|
||||
static char *LoadRCDATAVersion(HMODULE hMod, ULONG resid)
|
||||
{
|
||||
APIRET rc;
|
||||
ULONG ulSize = 0;
|
||||
char *string = 0;
|
||||
|
||||
rc = DosQueryResourceSize(hMod, RT_RCDATA, resid, &ulSize);
|
||||
|
||||
// version info is should be 8 chars
|
||||
if (rc == NO_ERROR && ulSize == 8)
|
||||
{
|
||||
char *version = nullptr;
|
||||
rc = DosGetResource(hMod, RT_RCDATA, resid, (void**) &version);
|
||||
|
||||
if (rc == NO_ERROR)
|
||||
{
|
||||
string = PR_smprintf("%d.%d.%d.%d\n",
|
||||
version[0], version[2], version[4], version[6]);
|
||||
|
||||
DosFreeResource(version);
|
||||
}
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
static uint32_t CalculateVariantCount(char* mimeTypes)
|
||||
{
|
||||
uint32_t variants = 1;
|
||||
|
||||
if(mimeTypes == nullptr)
|
||||
return 0;
|
||||
|
||||
char* index = mimeTypes;
|
||||
while (*index)
|
||||
{
|
||||
if (*index == '|')
|
||||
variants++;
|
||||
|
||||
++index;
|
||||
}
|
||||
return variants;
|
||||
}
|
||||
|
||||
static char** MakeStringArray(uint32_t variants, char* data)
|
||||
{
|
||||
if((variants <= 0) || (data == nullptr))
|
||||
return nullptr;
|
||||
|
||||
char ** array = (char **)PR_Calloc(variants, sizeof(char *));
|
||||
if(array == nullptr)
|
||||
return nullptr;
|
||||
|
||||
char * start = data;
|
||||
for(uint32_t i = 0; i < variants; i++)
|
||||
{
|
||||
char * p = PL_strchr(start, '|');
|
||||
if(p != nullptr)
|
||||
*p = 0;
|
||||
|
||||
array[i] = PL_strdup(start);
|
||||
start = ++p;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
static void FreeStringArray(uint32_t variants, char ** array)
|
||||
{
|
||||
if((variants == 0) || (array == nullptr))
|
||||
return;
|
||||
|
||||
for(uint32_t i = 0; i < variants; i++)
|
||||
{
|
||||
if(array[i] != nullptr)
|
||||
{
|
||||
PL_strfree(array[i]);
|
||||
array[i] = nullptr;
|
||||
}
|
||||
}
|
||||
PR_Free(array);
|
||||
}
|
||||
|
||||
// nsPluginsDir class
|
||||
|
||||
bool nsPluginsDir::IsPluginFile(nsIFile* file)
|
||||
{
|
||||
nsAutoCString leaf;
|
||||
if (NS_FAILED(file->GetNativeLeafName(leaf)))
|
||||
return false;
|
||||
|
||||
const char *leafname = leaf.get();
|
||||
|
||||
if( nullptr != leafname)
|
||||
{
|
||||
int len = strlen( leafname);
|
||||
if( len > 6 && // np*.dll
|
||||
(0 == strnicmp( &(leafname[len - 4]), ".dll", 4)) &&
|
||||
(0 == strnicmp( leafname, "np", 2)))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// nsPluginFile implementation
|
||||
|
||||
nsPluginFile::nsPluginFile(nsIFile* file)
|
||||
: mPlugin(file)
|
||||
{}
|
||||
|
||||
nsPluginFile::~nsPluginFile()
|
||||
{}
|
||||
|
||||
// Loads the plugin into memory using NSPR's shared-library loading
|
||||
nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
|
||||
{
|
||||
if (!mPlugin)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsAutoCString temp;
|
||||
mPlugin->GetNativePath(temp);
|
||||
|
||||
*outLibrary = PR_LoadLibrary(temp.get());
|
||||
return *outLibrary == nullptr ? NS_ERROR_FAILURE : NS_OK;
|
||||
}
|
||||
|
||||
// Obtains all of the information currently available for this plugin.
|
||||
nsresult nsPluginFile::GetPluginInfo(nsPluginInfo &info, PRLibrary **outLibrary)
|
||||
{
|
||||
*outLibrary = nullptr;
|
||||
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
HMODULE hPlug = 0; // Need a HMODULE to query resource statements
|
||||
char failure[ CCHMAXPATH] = "";
|
||||
APIRET ret;
|
||||
|
||||
nsAutoCString path;
|
||||
if (NS_FAILED(rv = mPlugin->GetNativePath(path)))
|
||||
return rv;
|
||||
|
||||
nsAutoCString fileName;
|
||||
if (NS_FAILED(rv = mPlugin->GetNativeLeafName(fileName)))
|
||||
return rv;
|
||||
|
||||
ret = DosLoadModule( failure, CCHMAXPATH, path.get(), &hPlug);
|
||||
info.fVersion = nullptr;
|
||||
|
||||
while( ret == NO_ERROR)
|
||||
{
|
||||
info.fName = LoadRCDATAString( hPlug, NP_INFO_ProductName);
|
||||
|
||||
info.fVersion = LoadRCDATAVersion( hPlug, NP_INFO_ProductVersion);
|
||||
|
||||
// get description (doesn't matter if it's missing)...
|
||||
info.fDescription = LoadRCDATAString( hPlug, NP_INFO_FileDescription);
|
||||
|
||||
char * mimeType = LoadRCDATAString( hPlug, NP_INFO_MIMEType);
|
||||
if( nullptr == mimeType) break;
|
||||
|
||||
char * mimeDescription = LoadRCDATAString( hPlug, NP_INFO_FileOpenName);
|
||||
if( nullptr == mimeDescription) break;
|
||||
|
||||
char * extensions = LoadRCDATAString( hPlug, NP_INFO_FileExtents);
|
||||
if( nullptr == extensions) break;
|
||||
|
||||
info.fVariantCount = CalculateVariantCount(mimeType);
|
||||
|
||||
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
|
||||
if( info.fMimeTypeArray == nullptr) break;
|
||||
|
||||
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
|
||||
if( nullptr == info.fMimeDescriptionArray) break;
|
||||
|
||||
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
|
||||
if( nullptr == info.fExtensionArray) break;
|
||||
|
||||
info.fFullPath = PL_strdup(path.get());
|
||||
info.fFileName = PL_strdup(fileName.get());
|
||||
|
||||
rv = NS_OK;
|
||||
break;
|
||||
}
|
||||
|
||||
if( 0 != hPlug)
|
||||
DosFreeModule( hPlug);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsPluginFile::FreePluginInfo(nsPluginInfo& info)
|
||||
{
|
||||
if(info.fName != nullptr)
|
||||
PL_strfree(info.fName);
|
||||
|
||||
if(info.fFullPath != nullptr)
|
||||
PL_strfree(info.fFullPath);
|
||||
|
||||
if(info.fFileName != nullptr)
|
||||
PL_strfree(info.fFileName);
|
||||
|
||||
if(info.fVersion != nullptr)
|
||||
PL_strfree(info.fVersion);
|
||||
|
||||
if(info.fDescription != nullptr)
|
||||
PL_strfree(info.fDescription);
|
||||
|
||||
if(info.fMimeTypeArray != nullptr)
|
||||
FreeStringArray(info.fVariantCount, info.fMimeTypeArray);
|
||||
|
||||
if(info.fMimeDescriptionArray != nullptr)
|
||||
FreeStringArray(info.fVariantCount, info.fMimeDescriptionArray);
|
||||
|
||||
if(info.fExtensionArray != nullptr)
|
||||
FreeStringArray(info.fVariantCount, info.fExtensionArray);
|
||||
|
||||
memset((void *)&info, 0, sizeof(info));
|
||||
|
||||
return NS_OK;
|
||||
}
|
@ -54,7 +54,7 @@ public:
|
||||
virtual nsresult NP_GetMIMEDescription(const char** mimeDesc) = 0;
|
||||
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
|
||||
void *aValue, NPError* error) = 0;
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error) = 0;
|
||||
#endif
|
||||
virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
|
@ -904,8 +904,6 @@ struct ParamTraits<NPCoordinateSpace>
|
||||
# include "mozilla/plugins/NPEventOSX.h"
|
||||
#elif defined(XP_WIN)
|
||||
# include "mozilla/plugins/NPEventWindows.h"
|
||||
#elif defined(XP_OS2)
|
||||
# error Sorry, OS/2 is not supported
|
||||
#elif defined(ANDROID)
|
||||
# include "mozilla/plugins/NPEventAndroid.h"
|
||||
#elif defined(XP_UNIX)
|
||||
|
@ -777,168 +777,168 @@ namespace mozilla {
|
||||
namespace plugins {
|
||||
namespace child {
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_requestread(NPStream *pstream, NPByteRange *rangeList);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_geturlnotify(NPP aNPP, const char* relativeURL, const char* target,
|
||||
void* notifyData);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_getvalue(NPP aNPP, NPNVariable variable, void *r_value);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_setvalue(NPP aNPP, NPPVariable variable, void *r_value);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_geturl(NPP aNPP, const char* relativeURL, const char* target);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_posturlnotify(NPP aNPP, const char* relativeURL, const char *target,
|
||||
uint32_t len, const char *buf, NPBool file, void* notifyData);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_posturl(NPP aNPP, const char* relativeURL, const char *target, uint32_t len,
|
||||
const char *buf, NPBool file);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_newstream(NPP aNPP, NPMIMEType type, const char* window, NPStream** pstream);
|
||||
|
||||
static int32_t NP_CALLBACK
|
||||
static int32_t
|
||||
_write(NPP aNPP, NPStream *pstream, int32_t len, void *buffer);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_destroystream(NPP aNPP, NPStream *pstream, NPError reason);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_status(NPP aNPP, const char *message);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_memfree (void *ptr);
|
||||
|
||||
static uint32_t NP_CALLBACK
|
||||
static uint32_t
|
||||
_memflush(uint32_t size);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_reloadplugins(NPBool reloadPages);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_invalidaterect(NPP aNPP, NPRect *invalidRect);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_invalidateregion(NPP aNPP, NPRegion invalidRegion);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_forceredraw(NPP aNPP);
|
||||
|
||||
static const char* NP_CALLBACK
|
||||
static const char*
|
||||
_useragent(NPP aNPP);
|
||||
|
||||
static void* NP_CALLBACK
|
||||
static void*
|
||||
_memalloc (uint32_t size);
|
||||
|
||||
// Deprecated entry points for the old Java plugin.
|
||||
static void* NP_CALLBACK /* OJI type: JRIEnv* */
|
||||
static void* /* OJI type: JRIEnv* */
|
||||
_getjavaenv(void);
|
||||
|
||||
// Deprecated entry points for the old Java plugin.
|
||||
static void* NP_CALLBACK /* OJI type: jref */
|
||||
static void* /* OJI type: jref */
|
||||
_getjavapeer(NPP aNPP);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_invoke(NPP aNPP, NPObject* npobj, NPIdentifier method, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_invokedefault(NPP aNPP, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_evaluate(NPP aNPP, NPObject* npobj, NPString *script, NPVariant *result);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_getproperty(NPP aNPP, NPObject* npobj, NPIdentifier property,
|
||||
NPVariant *result);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_setproperty(NPP aNPP, NPObject* npobj, NPIdentifier property,
|
||||
const NPVariant *value);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_removeproperty(NPP aNPP, NPObject* npobj, NPIdentifier property);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_hasproperty(NPP aNPP, NPObject* npobj, NPIdentifier propertyName);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_hasmethod(NPP aNPP, NPObject* npobj, NPIdentifier methodName);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_enumerate(NPP aNPP, NPObject *npobj, NPIdentifier **identifier,
|
||||
uint32_t *count);
|
||||
|
||||
static bool NP_CALLBACK
|
||||
static bool
|
||||
_construct(NPP aNPP, NPObject* npobj, const NPVariant *args,
|
||||
uint32_t argCount, NPVariant *result);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_releasevariantvalue(NPVariant *variant);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_setexception(NPObject* npobj, const NPUTF8 *message);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_pushpopupsenabledstate(NPP aNPP, NPBool enabled);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_poppopupsenabledstate(NPP aNPP);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_pluginthreadasynccall(NPP instance, PluginThreadCallback func,
|
||||
void *userData);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
const char *value, uint32_t len);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_getauthenticationinfo(NPP npp, const char *protocol,
|
||||
const char *host, int32_t port,
|
||||
const char *scheme, const char *realm,
|
||||
char **username, uint32_t *ulen,
|
||||
char **password, uint32_t *plen);
|
||||
|
||||
static uint32_t NP_CALLBACK
|
||||
static uint32_t
|
||||
_scheduletimer(NPP instance, uint32_t interval, NPBool repeat,
|
||||
void (*timerFunc)(NPP npp, uint32_t timerID));
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_unscheduletimer(NPP instance, uint32_t timerID);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_popupcontextmenu(NPP instance, NPMenu* menu);
|
||||
|
||||
static NPBool NP_CALLBACK
|
||||
static NPBool
|
||||
_convertpoint(NPP instance,
|
||||
double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
||||
double *destX, double *destY, NPCoordinateSpace destSpace);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_urlredirectresponse(NPP instance, void* notifyData, NPBool allow);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_initasyncsurface(NPP instance, NPSize *size,
|
||||
NPImageFormat format, void *initData,
|
||||
NPAsyncSurface *surface);
|
||||
|
||||
static NPError NP_CALLBACK
|
||||
static NPError
|
||||
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface);
|
||||
|
||||
static void NP_CALLBACK
|
||||
static void
|
||||
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed);
|
||||
|
||||
} /* namespace child */
|
||||
@ -1019,7 +1019,7 @@ namespace mozilla {
|
||||
namespace plugins {
|
||||
namespace child {
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_requestread(NPStream* aStream,
|
||||
NPByteRange* aRangeList)
|
||||
{
|
||||
@ -1032,7 +1032,7 @@ _requestread(NPStream* aStream,
|
||||
return bs->NPN_RequestRead(aRangeList);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturlnotify(NPP aNPP,
|
||||
const char* aRelativeURL,
|
||||
const char* aTarget,
|
||||
@ -1060,7 +1060,7 @@ _geturlnotify(NPP aNPP,
|
||||
return err;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalue(NPP aNPP,
|
||||
NPNVariable aVariable,
|
||||
void* aValue)
|
||||
@ -1116,7 +1116,7 @@ _getvalue(NPP aNPP,
|
||||
return NPERR_GENERIC_ERROR;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalue(NPP aNPP,
|
||||
NPPVariable aVariable,
|
||||
void* aValue)
|
||||
@ -1126,7 +1126,7 @@ _setvalue(NPP aNPP,
|
||||
return InstCast(aNPP)->NPN_SetValue(aVariable, aValue);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_geturl(NPP aNPP,
|
||||
const char* aRelativeURL,
|
||||
const char* aTarget)
|
||||
@ -1140,7 +1140,7 @@ _geturl(NPP aNPP,
|
||||
return err;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturlnotify(NPP aNPP,
|
||||
const char* aRelativeURL,
|
||||
const char* aTarget,
|
||||
@ -1172,7 +1172,7 @@ _posturlnotify(NPP aNPP,
|
||||
return err;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_posturl(NPP aNPP,
|
||||
const char* aRelativeURL,
|
||||
const char* aTarget,
|
||||
@ -1192,7 +1192,7 @@ _posturl(NPP aNPP,
|
||||
return err;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_newstream(NPP aNPP,
|
||||
NPMIMEType aMIMEType,
|
||||
const char* aWindow,
|
||||
@ -1203,7 +1203,7 @@ _newstream(NPP aNPP,
|
||||
return InstCast(aNPP)->NPN_NewStream(aMIMEType, aWindow, aStream);
|
||||
}
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
_write(NPP aNPP,
|
||||
NPStream* aStream,
|
||||
int32_t aLength,
|
||||
@ -1219,7 +1219,7 @@ _write(NPP aNPP,
|
||||
return ps->NPN_Write(aLength, aBuffer);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_destroystream(NPP aNPP,
|
||||
NPStream* aStream,
|
||||
NPError aReason)
|
||||
@ -1242,7 +1242,7 @@ _destroystream(NPP aNPP,
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_status(NPP aNPP,
|
||||
const char* aMessage)
|
||||
{
|
||||
@ -1251,7 +1251,7 @@ _status(NPP aNPP,
|
||||
NS_WARNING("Not yet implemented!");
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_memfree(void* aPtr)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1260,7 +1260,7 @@ _memfree(void* aPtr)
|
||||
NS_Free(aPtr);
|
||||
}
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_memflush(uint32_t aSize)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1269,7 +1269,7 @@ _memflush(uint32_t aSize)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_reloadplugins(NPBool aReloadPages)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1278,7 +1278,7 @@ _reloadplugins(NPBool aReloadPages)
|
||||
PluginModuleChild::current()->SendNPN_ReloadPlugins(!!aReloadPages);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidaterect(NPP aNPP,
|
||||
NPRect* aInvalidRect)
|
||||
{
|
||||
@ -1290,7 +1290,7 @@ _invalidaterect(NPP aNPP,
|
||||
}
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_invalidateregion(NPP aNPP,
|
||||
NPRegion aInvalidRegion)
|
||||
{
|
||||
@ -1299,7 +1299,7 @@ _invalidateregion(NPP aNPP,
|
||||
NS_WARNING("Not yet implemented!");
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_forceredraw(NPP aNPP)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1309,7 +1309,7 @@ _forceredraw(NPP aNPP)
|
||||
// never be necessary.
|
||||
}
|
||||
|
||||
const char* NP_CALLBACK
|
||||
const char*
|
||||
_useragent(NPP aNPP)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1317,7 +1317,7 @@ _useragent(NPP aNPP)
|
||||
return PluginModuleChild::current()->GetUserAgent();
|
||||
}
|
||||
|
||||
void* NP_CALLBACK
|
||||
void*
|
||||
_memalloc(uint32_t aSize)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1327,21 +1327,21 @@ _memalloc(uint32_t aSize)
|
||||
}
|
||||
|
||||
// Deprecated entry points for the old Java plugin.
|
||||
void* NP_CALLBACK /* OJI type: JRIEnv* */
|
||||
void* /* OJI type: JRIEnv* */
|
||||
_getjavaenv(void)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* NP_CALLBACK /* OJI type: jref */
|
||||
void* /* OJI type: jref */
|
||||
_getjavapeer(NPP aNPP)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invoke(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aMethod,
|
||||
@ -1358,7 +1358,7 @@ _invoke(NPP aNPP,
|
||||
return aNPObj->_class->invoke(aNPObj, aMethod, aArgs, aArgCount, aResult);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_invokedefault(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
const NPVariant* aArgs,
|
||||
@ -1374,7 +1374,7 @@ _invokedefault(NPP aNPP,
|
||||
return aNPObj->_class->invokeDefault(aNPObj, aArgs, aArgCount, aResult);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_evaluate(NPP aNPP,
|
||||
NPObject* aObject,
|
||||
NPString* aScript,
|
||||
@ -1405,7 +1405,7 @@ _evaluate(NPP aNPP,
|
||||
return actor->Evaluate(aScript, aResult);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_getproperty(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aPropertyName,
|
||||
@ -1420,7 +1420,7 @@ _getproperty(NPP aNPP,
|
||||
return aNPObj->_class->getProperty(aNPObj, aPropertyName, aResult);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_setproperty(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aPropertyName,
|
||||
@ -1435,7 +1435,7 @@ _setproperty(NPP aNPP,
|
||||
return aNPObj->_class->setProperty(aNPObj, aPropertyName, aValue);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_removeproperty(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aPropertyName)
|
||||
@ -1449,7 +1449,7 @@ _removeproperty(NPP aNPP,
|
||||
return aNPObj->_class->removeProperty(aNPObj, aPropertyName);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasproperty(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aPropertyName)
|
||||
@ -1463,7 +1463,7 @@ _hasproperty(NPP aNPP,
|
||||
return aNPObj->_class->hasProperty(aNPObj, aPropertyName);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_hasmethod(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier aMethodName)
|
||||
@ -1477,7 +1477,7 @@ _hasmethod(NPP aNPP,
|
||||
return aNPObj->_class->hasMethod(aNPObj, aMethodName);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_enumerate(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
NPIdentifier** aIdentifiers,
|
||||
@ -1499,7 +1499,7 @@ _enumerate(NPP aNPP,
|
||||
return aNPObj->_class->enumerate(aNPObj, aIdentifiers, aCount);
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
_construct(NPP aNPP,
|
||||
NPObject* aNPObj,
|
||||
const NPVariant* aArgs,
|
||||
@ -1518,7 +1518,7 @@ _construct(NPP aNPP,
|
||||
return aNPObj->_class->construct(aNPObj, aArgs, aArgCount, aResult);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_releasevariantvalue(NPVariant* aVariant)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1538,7 +1538,7 @@ _releasevariantvalue(NPVariant* aVariant)
|
||||
VOID_TO_NPVARIANT(*aVariant);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setexception(NPObject* aNPObj,
|
||||
const NPUTF8* aMessage)
|
||||
{
|
||||
@ -1559,7 +1559,7 @@ _setexception(NPObject* aNPObj,
|
||||
NullableString(aMessage));
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pushpopupsenabledstate(NPP aNPP,
|
||||
NPBool aEnabled)
|
||||
{
|
||||
@ -1569,7 +1569,7 @@ _pushpopupsenabledstate(NPP aNPP,
|
||||
InstCast(aNPP)->CallNPN_PushPopupsEnabledState(aEnabled ? true : false);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_poppopupsenabledstate(NPP aNPP)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1578,7 +1578,7 @@ _poppopupsenabledstate(NPP aNPP)
|
||||
InstCast(aNPP)->CallNPN_PopPopupsEnabledState();
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_pluginthreadasynccall(NPP aNPP,
|
||||
PluginThreadCallback aFunc,
|
||||
void* aUserData)
|
||||
@ -1590,7 +1590,7 @@ _pluginthreadasynccall(NPP aNPP,
|
||||
InstCast(aNPP)->AsyncCall(aFunc, aUserData);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
char **value, uint32_t *len)
|
||||
{
|
||||
@ -1620,7 +1620,7 @@ _getvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
return NPERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
const char *value, uint32_t len)
|
||||
{
|
||||
@ -1646,7 +1646,7 @@ _setvalueforurl(NPP npp, NPNURLVariable variable, const char *url,
|
||||
return NPERR_INVALID_PARAM;
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_getauthenticationinfo(NPP npp, const char *protocol,
|
||||
const char *host, int32_t port,
|
||||
const char *scheme, const char *realm,
|
||||
@ -1679,7 +1679,7 @@ _getauthenticationinfo(NPP npp, const char *protocol,
|
||||
return result;
|
||||
}
|
||||
|
||||
uint32_t NP_CALLBACK
|
||||
uint32_t
|
||||
_scheduletimer(NPP npp, uint32_t interval, NPBool repeat,
|
||||
void (*timerFunc)(NPP npp, uint32_t timerID))
|
||||
{
|
||||
@ -1688,7 +1688,7 @@ _scheduletimer(NPP npp, uint32_t interval, NPBool repeat,
|
||||
return InstCast(npp)->ScheduleTimer(interval, repeat, timerFunc);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_unscheduletimer(NPP npp, uint32_t timerID)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1708,7 +1708,7 @@ static void ProcessBrowserEvents(void* pluginModule) {
|
||||
}
|
||||
#endif
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_popupcontextmenu(NPP instance, NPMenu* menu)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -1759,7 +1759,7 @@ _popupcontextmenu(NPP instance, NPMenu* menu)
|
||||
#endif
|
||||
}
|
||||
|
||||
NPBool NP_CALLBACK
|
||||
NPBool
|
||||
_convertpoint(NPP instance,
|
||||
double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
|
||||
double *destX, double *destY, NPCoordinateSpace destSpace)
|
||||
@ -1787,13 +1787,13 @@ _convertpoint(NPP instance,
|
||||
return result;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_urlredirectresponse(NPP instance, void* notifyData, NPBool allow)
|
||||
{
|
||||
InstCast(instance)->NPN_URLRedirectResponse(notifyData, allow);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_initasyncsurface(NPP instance, NPSize *size,
|
||||
NPImageFormat format, void *initData,
|
||||
NPAsyncSurface *surface)
|
||||
@ -1801,13 +1801,13 @@ _initasyncsurface(NPP instance, NPSize *size,
|
||||
return InstCast(instance)->NPN_InitAsyncSurface(size, format, initData, surface);
|
||||
}
|
||||
|
||||
NPError NP_CALLBACK
|
||||
NPError
|
||||
_finalizeasyncsurface(NPP instance, NPAsyncSurface *surface)
|
||||
{
|
||||
return InstCast(instance)->NPN_FinalizeAsyncSurface(surface);
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
_setcurrentasyncsurface(NPP instance, NPAsyncSurface *surface, NPRect *changed)
|
||||
{
|
||||
InstCast(instance)->NPN_SetCurrentAsyncSurface(surface, changed);
|
||||
@ -2077,7 +2077,7 @@ PluginModuleChild::DeallocPPluginInstanceChild(PPluginInstanceChild* aActor)
|
||||
return true;
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
PluginModuleChild::NPN_CreateObject(NPP aNPP, NPClass* aClass)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -2111,7 +2111,7 @@ PluginModuleChild::NPN_CreateObject(NPP aNPP, NPClass* aClass)
|
||||
return newObject;
|
||||
}
|
||||
|
||||
NPObject* NP_CALLBACK
|
||||
NPObject*
|
||||
PluginModuleChild::NPN_RetainObject(NPObject* aNPObj)
|
||||
{
|
||||
AssertPluginThread();
|
||||
@ -2125,7 +2125,7 @@ PluginModuleChild::NPN_RetainObject(NPObject* aNPObj)
|
||||
return aNPObj;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
PluginModuleChild::NPN_ReleaseObject(NPObject* aNPObj)
|
||||
{
|
||||
AssertPluginThread();
|
||||
@ -2192,7 +2192,7 @@ PluginModuleChild::CollectForInstance(NPObjectData* d, void* userArg)
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -2215,7 +2215,7 @@ PluginModuleChild::NPN_GetStringIdentifier(const NPUTF8* aName)
|
||||
return ident;
|
||||
}
|
||||
|
||||
void NP_CALLBACK
|
||||
void
|
||||
PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames,
|
||||
int32_t aNameCount,
|
||||
NPIdentifier* aIdentifiers)
|
||||
@ -2247,7 +2247,7 @@ PluginModuleChild::NPN_GetStringIdentifiers(const NPUTF8** aNames,
|
||||
}
|
||||
}
|
||||
|
||||
bool NP_CALLBACK
|
||||
bool
|
||||
PluginModuleChild::NPN_IdentifierIsString(NPIdentifier aIdentifier)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -2257,7 +2257,7 @@ PluginModuleChild::NPN_IdentifierIsString(NPIdentifier aIdentifier)
|
||||
return ident->IsString();
|
||||
}
|
||||
|
||||
NPIdentifier NP_CALLBACK
|
||||
NPIdentifier
|
||||
PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -2277,7 +2277,7 @@ PluginModuleChild::NPN_GetIntIdentifier(int32_t aIntId)
|
||||
return ident;
|
||||
}
|
||||
|
||||
NPUTF8* NP_CALLBACK
|
||||
NPUTF8*
|
||||
PluginModuleChild::NPN_UTF8FromIdentifier(NPIdentifier aIdentifier)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
@ -2288,7 +2288,7 @@ PluginModuleChild::NPN_UTF8FromIdentifier(NPIdentifier aIdentifier)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t NP_CALLBACK
|
||||
int32_t
|
||||
PluginModuleChild::NPN_IntFromIdentifier(NPIdentifier aIdentifier)
|
||||
{
|
||||
PLUGIN_LOG_DEBUG_FUNCTION;
|
||||
|
@ -35,18 +35,8 @@
|
||||
|
||||
// NOTE: stolen from nsNPAPIPlugin.h
|
||||
|
||||
/*
|
||||
* Use this macro before each exported function
|
||||
* (between the return address and the function
|
||||
* itself), to ensure that the function has the
|
||||
* right calling conventions on OS/2.
|
||||
*/
|
||||
#define NP_CALLBACK NP_LOADDS
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (__stdcall * _name)
|
||||
#elif defined(XP_OS2)
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (_System * _name)
|
||||
#else
|
||||
#define NS_NPAPIPLUGIN_CALLBACK(_type, _name) _type (* _name)
|
||||
#endif
|
||||
@ -198,27 +188,27 @@ public:
|
||||
/**
|
||||
* The child implementation of NPN_CreateObject.
|
||||
*/
|
||||
static NPObject* NP_CALLBACK NPN_CreateObject(NPP aNPP, NPClass* aClass);
|
||||
static NPObject* NPN_CreateObject(NPP aNPP, NPClass* aClass);
|
||||
/**
|
||||
* The child implementation of NPN_RetainObject.
|
||||
*/
|
||||
static NPObject* NP_CALLBACK NPN_RetainObject(NPObject* aNPObj);
|
||||
static NPObject* NPN_RetainObject(NPObject* aNPObj);
|
||||
/**
|
||||
* The child implementation of NPN_ReleaseObject.
|
||||
*/
|
||||
static void NP_CALLBACK NPN_ReleaseObject(NPObject* aNPObj);
|
||||
static void NPN_ReleaseObject(NPObject* aNPObj);
|
||||
|
||||
/**
|
||||
* The child implementations of NPIdentifier-related functions.
|
||||
*/
|
||||
static NPIdentifier NP_CALLBACK NPN_GetStringIdentifier(const NPUTF8* aName);
|
||||
static void NP_CALLBACK NPN_GetStringIdentifiers(const NPUTF8** aNames,
|
||||
static NPIdentifier NPN_GetStringIdentifier(const NPUTF8* aName);
|
||||
static void NPN_GetStringIdentifiers(const NPUTF8** aNames,
|
||||
int32_t aNameCount,
|
||||
NPIdentifier* aIdentifiers);
|
||||
static NPIdentifier NP_CALLBACK NPN_GetIntIdentifier(int32_t aIntId);
|
||||
static bool NP_CALLBACK NPN_IdentifierIsString(NPIdentifier aIdentifier);
|
||||
static NPUTF8* NP_CALLBACK NPN_UTF8FromIdentifier(NPIdentifier aIdentifier);
|
||||
static int32_t NP_CALLBACK NPN_IntFromIdentifier(NPIdentifier aIdentifier);
|
||||
static NPIdentifier NPN_GetIntIdentifier(int32_t aIntId);
|
||||
static bool NPN_IdentifierIsString(NPIdentifier aIdentifier);
|
||||
static NPUTF8* NPN_UTF8FromIdentifier(NPIdentifier aIdentifier);
|
||||
static int32_t NPN_IntFromIdentifier(NPIdentifier aIdentifier);
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
void ProcessNativeEvents();
|
||||
|
@ -1295,7 +1295,7 @@ PluginModuleParent::NP_GetValue(void *future, NPPVariable aVariable,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
nsresult
|
||||
PluginModuleParent::NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error)
|
||||
{
|
||||
|
@ -260,7 +260,7 @@ private:
|
||||
virtual nsresult NP_GetMIMEDescription(const char** mimeDesc);
|
||||
virtual nsresult NP_GetValue(void *future, NPPVariable aVariable,
|
||||
void *aValue, NPError* error);
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_OS2)
|
||||
#if defined(XP_WIN) || defined(XP_MACOSX)
|
||||
virtual nsresult NP_GetEntryPoints(NPPluginFuncs* pFuncs, NPError* error);
|
||||
#endif
|
||||
virtual nsresult NPP_New(NPMIMEType pluginType, NPP instance,
|
||||
|
@ -647,7 +647,7 @@ extern const char *sMimeDescription;
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
NP_EXPORT(const char*) NP_GetMIMEDescription()
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#elif defined(XP_WIN)
|
||||
const char* NP_GetMIMEDescription()
|
||||
#endif
|
||||
{
|
||||
@ -701,7 +701,7 @@ static bool fillPluginFunctionTable(NPPluginFuncs* pFuncs)
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs)
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_Initialize(NPNetscapeFuncs* bFuncs)
|
||||
#elif defined(XP_UNIX)
|
||||
NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
|
||||
@ -741,10 +741,10 @@ NP_EXPORT(NPError) NP_Initialize(NPNetscapeFuncs* bFuncs, NPPluginFuncs* pFuncs)
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
NP_EXPORT(NPError) NP_GetEntryPoints(NPPluginFuncs* pFuncs)
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
|
||||
#endif
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN) || defined(XP_OS2)
|
||||
#if defined(XP_MACOSX) || defined(XP_WIN)
|
||||
{
|
||||
if (!fillPluginFunctionTable(pFuncs)) {
|
||||
return NPERR_INVALID_FUNCTABLE_ERROR;
|
||||
@ -756,7 +756,7 @@ NPError OSCALL NP_GetEntryPoints(NPPluginFuncs* pFuncs)
|
||||
|
||||
#if defined(XP_UNIX)
|
||||
NP_EXPORT(NPError) NP_Shutdown()
|
||||
#elif defined(XP_WIN) || defined(XP_OS2)
|
||||
#elif defined(XP_WIN)
|
||||
NPError OSCALL NP_Shutdown()
|
||||
#endif
|
||||
{
|
||||
|
@ -1,105 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
*
|
||||
* Copyright (c) 2008, Mozilla Corporation
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* * Neither the name of the Mozilla Corporation nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Josh Aas <josh@mozilla.com>
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nptest_platform.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
bool
|
||||
pluginSupportsWindowMode()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
pluginSupportsWindowlessMode()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
pluginSupportsAsyncBitmapDrawing()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
NPError
|
||||
pluginInstanceInit(InstanceData* instanceData)
|
||||
{
|
||||
return NPERR_NO_ERROR;
|
||||
}
|
||||
|
||||
void
|
||||
pluginInstanceShutdown(InstanceData* instanceData)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
pluginDoSetWindow(InstanceData* instanceData, NPWindow* newWindow)
|
||||
{
|
||||
instanceData->window = *newWindow;
|
||||
}
|
||||
|
||||
void
|
||||
pluginWidgetInit(InstanceData* instanceData, void* oldWindow)
|
||||
{
|
||||
}
|
||||
|
||||
int16_t
|
||||
pluginHandleEvent(InstanceData* instanceData, void* event)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t pluginGetEdge(InstanceData* instanceData, RectEdge edge)
|
||||
{
|
||||
// XXX nothing here yet since we don't support windowed plugins
|
||||
return NPTEST_INT32_ERROR;
|
||||
}
|
||||
|
||||
int32_t pluginGetClipRegionRectCount(InstanceData* instanceData)
|
||||
{
|
||||
// XXX nothing here yet since we don't support windowed plugins
|
||||
return NPTEST_INT32_ERROR;
|
||||
}
|
||||
|
||||
int32_t pluginGetClipRegionRectEdge(InstanceData* instanceData,
|
||||
int32_t rectIndex, RectEdge edge)
|
||||
{
|
||||
// XXX nothing here yet since we don't support windowed plugins
|
||||
return NPTEST_INT32_ERROR;
|
||||
}
|
||||
|
||||
void pluginDoInternalConsistencyCheck(InstanceData* instanceData, string& error)
|
||||
{
|
||||
}
|
@ -28,10 +28,6 @@ elif toolkit == 'android':
|
||||
UNIFIED_SOURCES += [
|
||||
relative_path + '/nptest_droid.cpp',
|
||||
]
|
||||
elif toolkit == 'os2':
|
||||
UNIFIED_SOURCES += [
|
||||
relative_path + '/nptest_os2.cpp',
|
||||
]
|
||||
elif toolkit == 'qt':
|
||||
UNIFIED_SOURCES += [
|
||||
relative_path + '/nptest_qt.cpp',
|
||||
|
@ -4,7 +4,7 @@
|
||||
# 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/.
|
||||
|
||||
if CONFIG['OS_ARCH'] in ('OS2', 'WINNT'):
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['win']
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "nsILocale.h"
|
||||
#include "nsILocaleService.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsLocaleCID.h"
|
||||
#include "prmem.h"
|
||||
|
||||
#define kAscending (1<<0)
|
||||
|
@ -204,9 +204,7 @@ nsHTMLEditorEventListener::MouseDown(nsIDOMEvent* aMouseEvent)
|
||||
// for all context clicks
|
||||
if (element || isContextClick)
|
||||
{
|
||||
#ifndef XP_OS2
|
||||
mouseEvent->PreventDefault();
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
|
@ -91,15 +91,6 @@ interface nsIPrintingPrompt : nsISupports
|
||||
* showPageSetup - displays a XUL dialog
|
||||
* showProgress - displays a XUL dialog
|
||||
* showPrinterProperties - displays a XUL dialog
|
||||
*
|
||||
* OS2:
|
||||
*
|
||||
* Defaults for platform service:
|
||||
* showPrintDialog - displays a XUL dialog
|
||||
* showPageSetup - displays a XUL dialog
|
||||
* showProgress - displays a XUL dialog
|
||||
* showPrinterProperties - displays a native dialog
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -87,15 +87,6 @@ interface nsIPrintingPromptService : nsISupports
|
||||
* showPageSetup - displays a XUL dialog
|
||||
* showProgress - displays a XUL dialog
|
||||
* showPrinterProperties - displays a XUL dialog
|
||||
*
|
||||
* OS2:
|
||||
*
|
||||
* Defaults for platform service:
|
||||
* showPrintDialog - displays a XUL dialog
|
||||
* showPageSetup - displays a XUL dialog
|
||||
* showProgress - displays a XUL dialog
|
||||
* showPrinterProperties - displays a native dialog
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -21,11 +21,7 @@ LOCAL_INCLUDES += [
|
||||
'../windowwatcher/src',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
|
||||
LOCAL_INCLUDES += [
|
||||
'../printingui/src/os2',
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
LOCAL_INCLUDES += [
|
||||
'../printingui/src/win',
|
||||
]
|
||||
|
@ -6,9 +6,7 @@
|
||||
|
||||
toolkit = CONFIG['MOZ_WIDGET_TOOLKIT']
|
||||
|
||||
if toolkit == 'os2':
|
||||
DIRS += ['os2']
|
||||
elif toolkit == 'windows':
|
||||
if toolkit == 'windows':
|
||||
DIRS += ['win']
|
||||
elif toolkit == 'cocoa':
|
||||
DIRS += ['mac']
|
||||
|
@ -1,13 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
SOURCES += [
|
||||
'nsPrintingPromptService.cpp',
|
||||
'nsPrintProgress.cpp',
|
||||
'nsPrintProgressParams.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'embedcomponents'
|
@ -1,254 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "nsPrintProgress.h"
|
||||
|
||||
#include "nsIBaseWindow.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsXPCOM.h"
|
||||
#include "nsISupportsPrimitives.h"
|
||||
#include "nsIComponentManager.h"
|
||||
|
||||
NS_IMPL_ADDREF(nsPrintProgress)
|
||||
NS_IMPL_RELEASE(nsPrintProgress)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsPrintProgress)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIPrintStatusFeedback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrintProgress)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrintStatusFeedback)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIWebProgressListener)
|
||||
NS_INTERFACE_MAP_END_THREADSAFE
|
||||
|
||||
|
||||
nsPrintProgress::nsPrintProgress()
|
||||
{
|
||||
m_closeProgress = false;
|
||||
m_processCanceled = false;
|
||||
m_pendingStateFlags = -1;
|
||||
m_pendingStateValue = 0;
|
||||
}
|
||||
|
||||
nsPrintProgress::~nsPrintProgress()
|
||||
{
|
||||
(void)ReleaseListeners();
|
||||
}
|
||||
|
||||
/* void openProgressDialog (in nsIDOMWindow parent, in string dialogURL, in nsISupports parameters); */
|
||||
NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent,
|
||||
const char *dialogURL,
|
||||
nsISupports *parameters,
|
||||
nsIObserver *openDialogObserver,
|
||||
bool *notifyOnOpen)
|
||||
{
|
||||
*notifyOnOpen = true;
|
||||
m_observer = openDialogObserver;
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (m_dialog)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
|
||||
if (!dialogURL || !*dialogURL)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
if (parent)
|
||||
{
|
||||
// Set up window.arguments[0]...
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(array));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsISupportsInterfacePointer> ifptr =
|
||||
do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
ifptr->SetData(static_cast<nsIPrintProgress*>(this));
|
||||
ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress));
|
||||
|
||||
array->AppendElement(ifptr);
|
||||
|
||||
array->AppendElement(parameters);
|
||||
|
||||
// Open the dialog.
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL),
|
||||
NS_LITERAL_STRING("_blank"),
|
||||
NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"),
|
||||
array, getter_AddRefs(newWindow));
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void closeProgressDialog (in boolean forceClose); */
|
||||
NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose)
|
||||
{
|
||||
m_closeProgress = true;
|
||||
return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, forceClose);
|
||||
}
|
||||
|
||||
/* nsIPrompt GetPrompter (); */
|
||||
NS_IMETHODIMP nsPrintProgress::GetPrompter(nsIPrompt **_retval)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(_retval);
|
||||
*_retval = nullptr;
|
||||
|
||||
if (! m_closeProgress && m_dialog)
|
||||
return m_dialog->GetPrompter(_retval);
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
/* attribute boolean processCanceledByUser; */
|
||||
NS_IMETHODIMP nsPrintProgress::GetProcessCanceledByUser(bool *aProcessCanceledByUser)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aProcessCanceledByUser);
|
||||
*aProcessCanceledByUser = m_processCanceled;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsPrintProgress::SetProcessCanceledByUser(bool aProcessCanceledByUser)
|
||||
{
|
||||
m_processCanceled = aProcessCanceledByUser;
|
||||
OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, false);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void RegisterListener (in nsIWebProgressListener listener); */
|
||||
NS_IMETHODIMP nsPrintProgress::RegisterListener(nsIWebProgressListener * listener)
|
||||
{
|
||||
if (!listener) //Nothing to do with a null listener!
|
||||
return NS_OK;
|
||||
|
||||
m_listenerList.AppendObject(listener);
|
||||
if (m_closeProgress || m_processCanceled)
|
||||
listener->OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, 0);
|
||||
else
|
||||
{
|
||||
listener->OnStatusChange(nullptr, nullptr, 0, m_pendingStatus.get());
|
||||
if (m_pendingStateFlags != -1)
|
||||
listener->OnStateChange(nullptr, nullptr, m_pendingStateFlags, m_pendingStateValue);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void UnregisterListener (in nsIWebProgressListener listener); */
|
||||
NS_IMETHODIMP nsPrintProgress::UnregisterListener(nsIWebProgressListener *listener)
|
||||
{
|
||||
if (listener)
|
||||
m_listenerList.RemoveObject(listener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void doneIniting (); */
|
||||
NS_IMETHODIMP nsPrintProgress::DoneIniting()
|
||||
{
|
||||
if (m_observer) {
|
||||
m_observer->Observe(nullptr, nullptr, nullptr);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
|
||||
{
|
||||
m_pendingStateFlags = aStateFlags;
|
||||
m_pendingStateValue = aStatus;
|
||||
|
||||
uint32_t count = m_listenerList.Count();
|
||||
for (uint32_t i = count - 1; i < count; i --)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i);
|
||||
if (progressListener)
|
||||
progressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
|
||||
{
|
||||
uint32_t count = m_listenerList.Count();
|
||||
for (uint32_t i = count - 1; i < count; i --)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.safeObjectAt(i);
|
||||
if (progressListener)
|
||||
progressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
|
||||
{
|
||||
if (aMessage && *aMessage)
|
||||
m_pendingStatus = aMessage;
|
||||
|
||||
uint32_t count = m_listenerList.Count();
|
||||
for (uint32_t i = count - 1; i < count; i --)
|
||||
{
|
||||
nsCOMPtr<nsIWebProgressListener> progressListener = m_listenerList.SafeObjectAt(i);
|
||||
if (progressListener)
|
||||
progressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
|
||||
NS_IMETHODIMP nsPrintProgress::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsPrintProgress::ReleaseListeners()
|
||||
{
|
||||
m_listenerList.Clear();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintProgress::ShowStatusString(const char16_t *status)
|
||||
{
|
||||
return OnStatusChange(nullptr, nullptr, NS_OK, status);
|
||||
}
|
||||
|
||||
/* void startMeteors (); */
|
||||
NS_IMETHODIMP nsPrintProgress::StartMeteors()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void stopMeteors (); */
|
||||
NS_IMETHODIMP nsPrintProgress::StopMeteors()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void showProgress (in long percent); */
|
||||
NS_IMETHODIMP nsPrintProgress::ShowProgress(int32_t percent)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* [noscript] void setDocShell (in nsIDocShell shell, in nsIDOMWindow window); */
|
||||
NS_IMETHODIMP nsPrintProgress::SetDocShell(nsIDocShell *shell, nsIDOMWindow *window)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
/* void closeWindow (); */
|
||||
NS_IMETHODIMP nsPrintProgress::CloseWindow()
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __nsPrintProgress_h
|
||||
#define __nsPrintProgress_h
|
||||
|
||||
#include "nsIPrintProgress.h"
|
||||
|
||||
#include "nsCOMArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIPrintStatusFeedback.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPrintProgress : public nsIPrintProgress, public nsIPrintStatusFeedback
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIPRINTPROGRESS
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_NSIPRINTSTATUSFEEDBACK
|
||||
|
||||
nsPrintProgress();
|
||||
virtual ~nsPrintProgress();
|
||||
|
||||
private:
|
||||
nsresult ReleaseListeners();
|
||||
|
||||
bool m_closeProgress;
|
||||
bool m_processCanceled;
|
||||
nsString m_pendingStatus;
|
||||
int32_t m_pendingStateFlags;
|
||||
int32_t m_pendingStateValue;
|
||||
nsCOMPtr<nsIDOMWindow> m_dialog;
|
||||
nsCOMArray<nsIWebProgressListener> m_listenerList;
|
||||
nsCOMPtr<nsIObserver> m_observer;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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 "nsPrintProgressParams.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsPrintProgressParams, nsIPrintProgressParams)
|
||||
|
||||
nsPrintProgressParams::nsPrintProgressParams()
|
||||
{
|
||||
}
|
||||
|
||||
nsPrintProgressParams::~nsPrintProgressParams()
|
||||
{
|
||||
}
|
||||
|
||||
/* attribute wstring docTitle; */
|
||||
NS_IMETHODIMP nsPrintProgressParams::GetDocTitle(char16_t * *aDocTitle)
|
||||
{
|
||||
NS_ENSURE_ARG(aDocTitle);
|
||||
|
||||
*aDocTitle = ToNewUnicode(mDocTitle);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintProgressParams::SetDocTitle(const char16_t * aDocTitle)
|
||||
{
|
||||
mDocTitle = aDocTitle;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute wstring docURL; */
|
||||
NS_IMETHODIMP nsPrintProgressParams::GetDocURL(char16_t * *aDocURL)
|
||||
{
|
||||
NS_ENSURE_ARG(aDocURL);
|
||||
|
||||
*aDocURL = ToNewUnicode(mDocURL);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsPrintProgressParams::SetDocURL(const char16_t * aDocURL)
|
||||
{
|
||||
mDocURL = aDocURL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1,26 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __nsPrintProgressParams_h
|
||||
#define __nsPrintProgressParams_h
|
||||
|
||||
#include "nsIPrintProgressParams.h"
|
||||
#include "nsString.h"
|
||||
|
||||
class nsPrintProgressParams : public nsIPrintProgressParams
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIPRINTPROGRESSPARAMS
|
||||
|
||||
nsPrintProgressParams();
|
||||
virtual ~nsPrintProgressParams();
|
||||
|
||||
private:
|
||||
nsString mDocTitle;
|
||||
nsString mDocURL;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,288 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* 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 "nsPrintingPromptService.h"
|
||||
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIDialogParamBlock.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// Printing Progress Includes
|
||||
#include "nsPrintProgress.h"
|
||||
#include "nsPrintProgressParams.h"
|
||||
|
||||
// Print Service Includes
|
||||
#include "nsIPrintOptions.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsGfxCIID.h"
|
||||
static const char sPrintOptionsContractID[] = "@mozilla.org/gfx/printsettings-service;1";
|
||||
|
||||
static const char *kPrintDialogURL = "chrome://global/content/printdialog.xul";
|
||||
static const char *kPrintProgressDialogURL = "chrome://global/content/printProgress.xul";
|
||||
static const char *kPrtPrvProgressDialogURL = "chrome://global/content/printPreviewProgress.xul";
|
||||
static const char *kPageSetupDialogURL = "chrome://global/content/printPageSetup.xul";
|
||||
|
||||
/****************************************************************
|
||||
************************* ParamBlock ***************************
|
||||
****************************************************************/
|
||||
|
||||
class ParamBlock {
|
||||
|
||||
public:
|
||||
ParamBlock()
|
||||
{
|
||||
mBlock = 0;
|
||||
}
|
||||
~ParamBlock()
|
||||
{
|
||||
NS_IF_RELEASE(mBlock);
|
||||
}
|
||||
nsresult Init() {
|
||||
return CallCreateInstance(NS_DIALOGPARAMBLOCK_CONTRACTID, &mBlock);
|
||||
}
|
||||
nsIDialogParamBlock * operator->() const { return mBlock; }
|
||||
operator nsIDialogParamBlock * const () { return mBlock; }
|
||||
|
||||
private:
|
||||
nsIDialogParamBlock *mBlock;
|
||||
};
|
||||
|
||||
/****************************************************************
|
||||
***************** nsPrintingPromptService **********************
|
||||
****************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsPrintingPromptService, nsIPrintingPromptService, nsIWebProgressListener)
|
||||
|
||||
nsPrintingPromptService::nsPrintingPromptService()
|
||||
{
|
||||
}
|
||||
|
||||
nsPrintingPromptService::~nsPrintingPromptService()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintingPromptService::Init()
|
||||
{
|
||||
nsresult rv;
|
||||
mWatcher = do_GetService(NS_WINDOWWATCHER_CONTRACTID, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/* void showPrintDialog (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPrintDialog(nsIDOMWindow *parent, nsIWebBrowserPrint *webBrowserPrint, nsIPrintSettings *printSettings)
|
||||
{
|
||||
NS_ENSURE_ARG(webBrowserPrint);
|
||||
NS_ENSURE_ARG(printSettings);
|
||||
|
||||
ParamBlock block;
|
||||
nsresult rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(0, 0);
|
||||
return DoDialog(parent, block, webBrowserPrint, printSettings, kPrintDialogURL);
|
||||
}
|
||||
|
||||
/* void showProgress (in nsIDOMWindow parent, in nsIWebBrowserPrint webBrowserPrint, in nsIPrintSettings printSettings, in nsIObserver openDialogObserver, in boolean isForPrinting, out nsIWebProgressListener webProgressListener, out nsIPrintProgressParams printProgressParams, out boolean notifyOnOpen); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowProgress(nsIDOMWindow* parent,
|
||||
nsIWebBrowserPrint* webBrowserPrint, // ok to be null
|
||||
nsIPrintSettings* printSettings, // ok to be null
|
||||
nsIObserver* openDialogObserver, // ok to be null
|
||||
bool isForPrinting,
|
||||
nsIWebProgressListener** webProgressListener,
|
||||
nsIPrintProgressParams** printProgressParams,
|
||||
bool* notifyOnOpen)
|
||||
{
|
||||
NS_ENSURE_ARG(webProgressListener);
|
||||
NS_ENSURE_ARG(printProgressParams);
|
||||
NS_ENSURE_ARG(notifyOnOpen);
|
||||
|
||||
*notifyOnOpen = false;
|
||||
|
||||
nsPrintProgress* prtProgress = new nsPrintProgress();
|
||||
mPrintProgress = prtProgress;
|
||||
mWebProgressListener = prtProgress;
|
||||
|
||||
nsCOMPtr<nsIPrintProgressParams> prtProgressParams = new nsPrintProgressParams();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> parentWindow = parent;
|
||||
|
||||
if (mWatcher && !parentWindow) {
|
||||
mWatcher->GetActiveWindow(getter_AddRefs(parentWindow));
|
||||
}
|
||||
|
||||
if (parentWindow) {
|
||||
mPrintProgress->OpenProgressDialog(parentWindow,
|
||||
isForPrinting ? kPrintProgressDialogURL : kPrtPrvProgressDialogURL,
|
||||
prtProgressParams, openDialogObserver, notifyOnOpen);
|
||||
}
|
||||
|
||||
prtProgressParams.forget(printProgressParams);
|
||||
nsCOMPtr<nsIWebProgressListener> myWebProgressListener = this;
|
||||
myWebProgressListener.forget(webProgressListener);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void showPageSetup (in nsIDOMWindow parent, in nsIPrintSettings printSettings); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPageSetup(nsIDOMWindow *parent, nsIPrintSettings *printSettings, nsIObserver *aObs)
|
||||
{
|
||||
NS_ENSURE_ARG(printSettings);
|
||||
|
||||
ParamBlock block;
|
||||
nsresult rv = block.Init();
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
block->SetInt(0, 0);
|
||||
return DoDialog(parent, block, nullptr, printSettings, kPageSetupDialogURL);
|
||||
}
|
||||
|
||||
/* void showPrinterProperties (in nsIDOMWindow parent, in wstring printerName, in nsIPrintSettings printSettings); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::ShowPrinterProperties(nsIDOMWindow *parent, const char16_t *printerName, nsIPrintSettings *printSettings)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
nsCOMPtr<nsIPrintOptions> printService = do_GetService(sPrintOptionsContractID, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
bool displayed;
|
||||
rv = printService->DisplayJobProperties(printerName, printSettings, &displayed);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsPrintingPromptService::DoDialog(nsIDOMWindow *aParent,
|
||||
nsIDialogParamBlock *aParamBlock,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint,
|
||||
nsIPrintSettings* aPS,
|
||||
const char *aChromeURL)
|
||||
{
|
||||
NS_ENSURE_ARG(aParamBlock);
|
||||
NS_ENSURE_ARG(aPS);
|
||||
NS_ENSURE_ARG(aChromeURL);
|
||||
|
||||
if (!mWatcher)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// get a parent, if at all possible
|
||||
// (though we'd rather this didn't fail, it's OK if it does. so there's
|
||||
// no failure or null check.)
|
||||
nsCOMPtr<nsIDOMWindow> activeParent; // retain ownership for method lifetime
|
||||
if (!aParent)
|
||||
{
|
||||
mWatcher->GetActiveWindow(getter_AddRefs(activeParent));
|
||||
aParent = activeParent;
|
||||
}
|
||||
|
||||
// create a nsISupportsArray of the parameters
|
||||
// being passed to the window
|
||||
nsCOMPtr<nsISupportsArray> array;
|
||||
NS_NewISupportsArray(getter_AddRefs(array));
|
||||
if (!array) return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsISupports> psSupports(do_QueryInterface(aPS));
|
||||
NS_ASSERTION(psSupports, "PrintSettings must be a supports");
|
||||
array->AppendElement(psSupports);
|
||||
|
||||
if (aWebBrowserPrint) {
|
||||
nsCOMPtr<nsISupports> wbpSupports(do_QueryInterface(aWebBrowserPrint));
|
||||
NS_ASSERTION(wbpSupports, "nsIWebBrowserPrint must be a supports");
|
||||
array->AppendElement(wbpSupports);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsISupports> blkSupps(do_QueryInterface(aParamBlock));
|
||||
NS_ASSERTION(blkSupps, "IOBlk must be a supports");
|
||||
array->AppendElement(blkSupps);
|
||||
|
||||
nsCOMPtr<nsISupports> arguments(do_QueryInterface(array));
|
||||
NS_ASSERTION(array, "array must be a supports");
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> dialog;
|
||||
rv = mWatcher->OpenWindow(aParent, aChromeURL, "_blank",
|
||||
"centerscreen,chrome,modal,titlebar", arguments,
|
||||
getter_AddRefs(dialog));
|
||||
|
||||
// if aWebBrowserPrint is not null then we are printing
|
||||
// so we want to pass back NS_ERROR_ABORT on cancel
|
||||
if (NS_SUCCEEDED(rv) && aWebBrowserPrint)
|
||||
{
|
||||
int32_t status;
|
||||
aParamBlock->GetInt(0, &status);
|
||||
return status == 0?NS_ERROR_ABORT:NS_OK;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
// nsIWebProgressListener
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* void onStateChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long aStateFlags, in nsresult aStatus); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnStateChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t aStateFlags, nsresult aStatus)
|
||||
{
|
||||
if ((aStateFlags & STATE_STOP) && mWebProgressListener) {
|
||||
mWebProgressListener->OnStateChange(aWebProgress, aRequest, aStateFlags, aStatus);
|
||||
if (mPrintProgress) {
|
||||
mPrintProgress->CloseProgressDialog(true);
|
||||
}
|
||||
mPrintProgress = nullptr;
|
||||
mWebProgressListener = nullptr;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onProgressChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in long aCurSelfProgress, in long aMaxSelfProgress, in long aCurTotalProgress, in long aMaxTotalProgress); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnProgressChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, int32_t aCurSelfProgress, int32_t aMaxSelfProgress, int32_t aCurTotalProgress, int32_t aMaxTotalProgress)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onLocationChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsIURI location, in unsigned long aFlags); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnLocationChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsIURI *location, uint32_t aFlags)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnLocationChange(aWebProgress, aRequest, location, aFlags);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onStatusChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in nsresult aStatus, in wstring aMessage); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnStatusChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, nsresult aStatus, const char16_t *aMessage)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnStatusChange(aWebProgress, aRequest, aStatus, aMessage);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void onSecurityChange (in nsIWebProgress aWebProgress, in nsIRequest aRequest, in unsigned long state); */
|
||||
NS_IMETHODIMP
|
||||
nsPrintingPromptService::OnSecurityChange(nsIWebProgress *aWebProgress, nsIRequest *aRequest, uint32_t state)
|
||||
{
|
||||
if (mWebProgressListener) {
|
||||
return mWebProgressListener->OnSecurityChange(aWebProgress, aRequest, state);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef __nsPrintingPromptService_h
|
||||
#define __nsPrintingPromptService_h
|
||||
|
||||
// {E042570C-62DE-4bb6-A6E0-798E3C07B4DF}
|
||||
#define NS_PRINTINGPROMPTSERVICE_CID \
|
||||
{0xe042570c, 0x62de, 0x4bb6, { 0xa6, 0xe0, 0x79, 0x8e, 0x3c, 0x7, 0xb4, 0xdf}}
|
||||
#define NS_PRINTINGPROMPTSERVICE_CONTRACTID \
|
||||
"@mozilla.org/embedcomp/printingprompt-service;1"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIPrintingPromptService.h"
|
||||
#include "nsPIPromptService.h"
|
||||
#include "nsIWindowWatcher.h"
|
||||
|
||||
// Printing Progress Includes
|
||||
#include "nsPrintProgress.h"
|
||||
#include "nsPrintProgressParams.h"
|
||||
#include "nsIWebProgressListener.h"
|
||||
|
||||
class nsIDOMWindow;
|
||||
class nsIDialogParamBlock;
|
||||
|
||||
class nsPrintingPromptService: public nsIPrintingPromptService,
|
||||
public nsIWebProgressListener
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
nsPrintingPromptService();
|
||||
virtual ~nsPrintingPromptService();
|
||||
|
||||
nsresult Init();
|
||||
|
||||
NS_DECL_NSIPRINTINGPROMPTSERVICE
|
||||
NS_DECL_NSIWEBPROGRESSLISTENER
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
private:
|
||||
nsresult DoDialog(nsIDOMWindow *aParent,
|
||||
nsIDialogParamBlock *aParamBlock,
|
||||
nsIWebBrowserPrint *aWebBrowserPrint,
|
||||
nsIPrintSettings* aPS,
|
||||
const char *aChromeURL);
|
||||
|
||||
nsCOMPtr<nsIWindowWatcher> mWatcher;
|
||||
nsCOMPtr<nsIPrintProgress> mPrintProgress;
|
||||
nsCOMPtr<nsIWebProgressListener> mWebProgressListener;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -10,10 +10,6 @@
|
||||
#include "nsIFileStreams.h" // New Necko file streams
|
||||
#include <algorithm>
|
||||
|
||||
#ifdef XP_OS2
|
||||
#include "nsILocalFileOS2.h"
|
||||
#endif
|
||||
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
@ -706,29 +702,9 @@ NS_IMETHODIMP nsWebBrowserPersist::OnStopRequest(
|
||||
if (NS_SUCCEEDED(mPersistResult) && NS_FAILED(status))
|
||||
SendErrorStatusChange(true, status, request, data->mFile);
|
||||
|
||||
#if defined(XP_OS2)
|
||||
// delete 'data'; this will close the stream and let
|
||||
// us tag the file it created with its source URI
|
||||
nsCOMPtr<nsIURI> uriSource = data->mOriginalLocation;
|
||||
nsCOMPtr<nsIFile> localFile;
|
||||
GetLocalFileFromURI(data->mFile, getter_AddRefs(localFile));
|
||||
delete data;
|
||||
mOutputMap.Remove(&key);
|
||||
if (localFile)
|
||||
{
|
||||
nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile);
|
||||
if (localFileOS2)
|
||||
{
|
||||
nsAutoCString url;
|
||||
uriSource->GetSpec(url);
|
||||
localFileOS2->SetFileSource(url);
|
||||
}
|
||||
}
|
||||
#else
|
||||
// This will close automatically close the output stream
|
||||
delete data;
|
||||
mOutputMap.Remove(&key);
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1678,16 +1654,6 @@ nsresult nsWebBrowserPersist::SaveDocumentInternal(
|
||||
cleanupData->mIsDirectory = true;
|
||||
mCleanupList.AppendElement(cleanupData);
|
||||
}
|
||||
#if defined(XP_OS2)
|
||||
// tag the directory with the URI that originated its contents
|
||||
nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localDataPath);
|
||||
if (localFileOS2)
|
||||
{
|
||||
nsAutoCString url;
|
||||
mCurrentBaseURI->GetSpec(url);
|
||||
localFileOS2->SetFileSource(url);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -3787,20 +3753,6 @@ nsWebBrowserPersist::SaveDocumentWithFixup(
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
|
||||
}
|
||||
}
|
||||
#if defined(XP_OS2)
|
||||
else
|
||||
{
|
||||
// close the stream, then tag the file it created with its source URI
|
||||
outputStream->Close();
|
||||
nsCOMPtr<nsILocalFileOS2> localFileOS2 = do_QueryInterface(localFile);
|
||||
if (localFileOS2)
|
||||
{
|
||||
nsAutoCString url;
|
||||
mCurrentBaseURI->GetSpec(url);
|
||||
localFileOS2->SetFileSource(url);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -12,9 +12,6 @@ else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT), windows)
|
||||
AUTOCFG_JS_EXPORTS += $(srcdir)/win/platform.js
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT), os2)
|
||||
AUTOCFG_JS_EXPORTS += $(srcdir)/os2/platform.js
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT), beos)
|
||||
AUTOCFG_JS_EXPORTS += $(srcdir)/beos/platform.js
|
||||
else
|
||||
@ -22,4 +19,3 @@ AUTOCFG_JS_EXPORTS += $(srcdir)/unix/platform.js
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
@ -1,6 +0,0 @@
|
||||
/* 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/. */
|
||||
|
||||
// OS2 specific auto configuration preference defaults
|
||||
platform.value = "windows";
|
@ -56,17 +56,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
|
||||
]
|
||||
else:
|
||||
DEFINES['CAIRO_OMIT_WIN32_PRINTING'] = True
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
|
||||
EXPORTS.cairo += [
|
||||
'cairo-os2-private.h',
|
||||
'cairo-os2.h',
|
||||
]
|
||||
SOURCES += [
|
||||
'cairo-os2-surface.c',
|
||||
]
|
||||
DEFINES['OS2_USE_PLATFORM_ALLOC'] = True
|
||||
if CONFIG['MOZ_OS2_HIGH_MEMORY']:
|
||||
DEFINES['OS2_HIGH_MEMORY'] = True
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
EXPORTS.cairo += [
|
||||
'cairo-quartz-image.h',
|
||||
|
@ -45,10 +45,8 @@ endif
|
||||
ifdef USE_SSE2
|
||||
SSE2_CFLAGS=-msse -msse2 -Winline
|
||||
endif
|
||||
ifneq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
MMX_CFLAGS+=--param inline-unit-growth=10000 --param large-function-growth=10000
|
||||
endif
|
||||
endif
|
||||
ifeq (arm,$(findstring arm,$(OS_TEST)))
|
||||
# Apple's arm assembler doesn't support the same syntax as
|
||||
# the standard GNU assembler, so use the C fallback paths for now.
|
||||
|
@ -11,10 +11,6 @@ ifdef MOZ_WIDGET_GTK
|
||||
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
|
||||
CXXFLAGS += $(MOZ_QT_CFLAGS)
|
||||
endif
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include "gfxPSSurface.h"
|
||||
#elif XP_WIN
|
||||
#include "gfxWindowsSurface.h"
|
||||
#elif defined(XP_OS2)
|
||||
#include "gfxOS2Surface.h"
|
||||
#elif XP_MACOSX
|
||||
#include "gfxQuartzSurface.h"
|
||||
#endif
|
||||
@ -321,15 +319,6 @@ nsDeviceContext::SetDPI()
|
||||
mPrintingScale = float(OSVal) / dpi;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
case gfxSurfaceType::OS2: {
|
||||
LONG lDPI;
|
||||
HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS());
|
||||
if (DevQueryCaps(dc, CAPS_VERTICAL_FONT_RES, 1, &lDPI))
|
||||
dpi = lDPI;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
NS_NOTREACHED("Unexpected printing surface type");
|
||||
@ -698,26 +687,6 @@ nsDeviceContext::CalcPrintingSize()
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef XP_OS2
|
||||
case gfxSurfaceType::OS2:
|
||||
{
|
||||
inPoints = false;
|
||||
// we already set the size in the surface constructor we set for
|
||||
// printing, so just get those values here
|
||||
size = reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetSize();
|
||||
// as they are in pixels we need to scale them to app units
|
||||
size.width = NSFloatPixelsToAppUnits(size.width, AppUnitsPerDevPixel());
|
||||
size.height = NSFloatPixelsToAppUnits(size.height, AppUnitsPerDevPixel());
|
||||
// still need to get the depth from the device context
|
||||
HDC dc = GpiQueryDevice(reinterpret_cast<gfxOS2Surface*>(mPrintingSurface.get())->GetPS());
|
||||
LONG value;
|
||||
if (DevQueryCaps(dc, CAPS_COLOR_BITCOUNT, 1, &value))
|
||||
mDepth = value;
|
||||
else
|
||||
mDepth = 8; // default to 8bpp, should be enough for printers
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default:
|
||||
NS_ERROR("trying to print to unknown surface type");
|
||||
}
|
||||
|
@ -25,10 +25,6 @@ ifdef MOZ_WIDGET_GTK
|
||||
CXXFLAGS += $(MOZ_PANGO_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),os2)
|
||||
CXXFLAGS += $(CAIRO_FT_CFLAGS)
|
||||
endif
|
||||
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),qt)
|
||||
CXXFLAGS += $(CAIRO_FT_CFLAGS) $(MOZ_PANGO_CFLAGS)
|
||||
endif
|
||||
|
@ -1,846 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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 "gfxContext.h"
|
||||
|
||||
#include "gfxOS2Platform.h"
|
||||
#include "gfxOS2Surface.h"
|
||||
#include "gfxOS2Fonts.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
||||
#include "nsIPlatformCharset.h"
|
||||
|
||||
#include "mozilla/Preferences.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
/**********************************************************************
|
||||
* class gfxOS2Font
|
||||
**********************************************************************/
|
||||
|
||||
gfxOS2Font::gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle)
|
||||
: gfxFont(aFontEntry, aFontStyle),
|
||||
mFontFace(nullptr),
|
||||
mMetrics(nullptr), mAdjustedSize(0),
|
||||
mHinting(FC_HINT_MEDIUM), mAntialias(FcTrue)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%p]::gfxOS2Font(%p \"%s\", aFontStyle)\n",
|
||||
(void *)this, (void *)aFontEntry,
|
||||
NS_LossyConvertUTF16toASCII(aFontEntry->Name()).get());
|
||||
#endif
|
||||
// try to get the preferences for hinting, antialias, and embolden options
|
||||
int32_t value;
|
||||
nsresult rv = Preferences::GetInt("gfx.os2.font.hinting", &value);
|
||||
if (NS_SUCCEEDED(rv) && value >= FC_HINT_NONE && value <= FC_HINT_FULL) {
|
||||
mHinting = value;
|
||||
}
|
||||
|
||||
mAntialias = Preferences::GetBool("gfx.os2.font.antialiasing", mAntialias);
|
||||
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf(" font display options: hinting=%d, antialiasing=%s\n",
|
||||
mHinting, mAntialias ? "on" : "off");
|
||||
#endif
|
||||
}
|
||||
|
||||
gfxOS2Font::~gfxOS2Font()
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%#x]::~gfxOS2Font()\n", (unsigned)this);
|
||||
#endif
|
||||
if (mFontFace) {
|
||||
cairo_font_face_destroy(mFontFace);
|
||||
}
|
||||
if (mScaledFont) {
|
||||
cairo_scaled_font_destroy(mScaledFont);
|
||||
}
|
||||
delete mMetrics;
|
||||
mFontFace = nullptr;
|
||||
mScaledFont = nullptr;
|
||||
mMetrics = nullptr;
|
||||
}
|
||||
|
||||
// fill font metrics structure with default values in case of error
|
||||
static void FillMetricsDefaults(gfxFont::Metrics *aMetrics)
|
||||
{
|
||||
aMetrics->emAscent = 0.8 * aMetrics->emHeight;
|
||||
aMetrics->emDescent = 0.2 * aMetrics->emHeight;
|
||||
aMetrics->maxAscent = aMetrics->emAscent;
|
||||
aMetrics->maxDescent = aMetrics->maxDescent;
|
||||
aMetrics->maxHeight = aMetrics->emHeight;
|
||||
aMetrics->internalLeading = 0.0;
|
||||
aMetrics->externalLeading = 0.2 * aMetrics->emHeight;
|
||||
aMetrics->spaceWidth = 0.5 * aMetrics->emHeight;
|
||||
aMetrics->maxAdvance = aMetrics->spaceWidth;
|
||||
aMetrics->aveCharWidth = aMetrics->spaceWidth;
|
||||
aMetrics->zeroOrAveCharWidth = aMetrics->spaceWidth;
|
||||
aMetrics->xHeight = 0.5 * aMetrics->emHeight;
|
||||
aMetrics->underlineSize = aMetrics->emHeight / 14.0;
|
||||
aMetrics->underlineOffset = -aMetrics->underlineSize;
|
||||
aMetrics->strikeoutOffset = 0.25 * aMetrics->emHeight;
|
||||
aMetrics->strikeoutSize = aMetrics->underlineSize;
|
||||
aMetrics->superscriptOffset = aMetrics->xHeight;
|
||||
aMetrics->subscriptOffset = aMetrics->xHeight;
|
||||
}
|
||||
|
||||
// Snap a line to pixels while keeping the center and size of the
|
||||
// line as close to the original position as possible.
|
||||
static void SnapLineToPixels(gfxFloat& aOffset, gfxFloat& aSize)
|
||||
{
|
||||
gfxFloat snappedSize = std::max(floor(aSize + 0.5), 1.0);
|
||||
// Correct offset for change in size
|
||||
gfxFloat offset = aOffset - 0.5 * (aSize - snappedSize);
|
||||
// Snap offset
|
||||
aOffset = floor(offset + 0.5);
|
||||
aSize = snappedSize;
|
||||
}
|
||||
|
||||
// gfxOS2Font::GetMetrics()
|
||||
// return the metrics of the current font using the gfxFont metrics structure.
|
||||
// If the metrics are not available yet, compute them using the FreeType
|
||||
// function on the font. (This is partly based on the respective function from
|
||||
// gfxPangoFonts)
|
||||
const gfxFont::Metrics& gfxOS2Font::GetMetrics()
|
||||
{
|
||||
#ifdef DEBUG_thebes_1
|
||||
printf("gfxOS2Font[%#x]::GetMetrics()\n", (unsigned)this);
|
||||
#endif
|
||||
if (mMetrics) {
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
// whatever happens below, we can always create the metrics
|
||||
mMetrics = new gfxFont::Metrics;
|
||||
mSpaceGlyph = 0;
|
||||
|
||||
// round size to integer pixels, this is to get full pixels for layout
|
||||
// together with internal/external leading (see below)
|
||||
mMetrics->emHeight = floor(GetStyle()->size + 0.5);
|
||||
|
||||
cairo_scaled_font_t* scaledFont = CairoScaledFont();
|
||||
if (!scaledFont) {
|
||||
FillMetricsDefaults(mMetrics);
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
FT_Face face = cairo_ft_scaled_font_lock_face(scaledFont);
|
||||
if (!face) {
|
||||
// Abort here already, otherwise we crash in the following
|
||||
// this can happen if the font-size requested is zero.
|
||||
FillMetricsDefaults(mMetrics);
|
||||
return *mMetrics;
|
||||
}
|
||||
if (!face->charmap) {
|
||||
// Also abort, if the charmap isn't loaded; then the char
|
||||
// lookups won't work. This happens for fonts without Unicode
|
||||
// charmap.
|
||||
cairo_ft_scaled_font_unlock_face(scaledFont);
|
||||
FillMetricsDefaults(mMetrics);
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
// compute font scaling factors
|
||||
gfxFloat emUnit = 1.0 * face->units_per_EM;
|
||||
gfxFloat xScale = face->size->metrics.x_ppem / emUnit;
|
||||
gfxFloat yScale = face->size->metrics.y_ppem / emUnit;
|
||||
|
||||
FT_UInt gid; // glyph ID
|
||||
|
||||
// properties of space
|
||||
gid = FT_Get_Char_Index(face, ' ');
|
||||
if (gid) {
|
||||
// Load glyph into glyph slot. Use load_default here to get results in
|
||||
// 26.6 fractional pixel format which is what is used for all other
|
||||
// characters in gfxOS2FontGroup::CreateGlyphRunsFT.
|
||||
FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT);
|
||||
// glyph width doesn't work for spaces, use advance instead
|
||||
mMetrics->spaceWidth = face->glyph->advance.x >> 6;
|
||||
// save the space glyph
|
||||
mSpaceGlyph = gid;
|
||||
} else {
|
||||
NS_ASSERTION(gid, "this font doesn't have a space glyph!");
|
||||
mMetrics->spaceWidth = face->max_advance_width * xScale;
|
||||
}
|
||||
|
||||
// properties of 'x', also use its width as average width
|
||||
gid = FT_Get_Char_Index(face, 'x'); // select the glyph
|
||||
if (gid) {
|
||||
// Load glyph into glyph slot. Here, use no_scale to get font units.
|
||||
FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE);
|
||||
mMetrics->xHeight = face->glyph->metrics.height * yScale;
|
||||
mMetrics->aveCharWidth = face->glyph->metrics.horiAdvance * xScale;
|
||||
} else {
|
||||
// this font doesn't have an 'x'...
|
||||
// fake these metrics using a fraction of the font size
|
||||
mMetrics->xHeight = mMetrics->emHeight * 0.5;
|
||||
mMetrics->aveCharWidth = mMetrics->emHeight * 0.5;
|
||||
}
|
||||
|
||||
// properties of '0', for 'ch' units
|
||||
gid = FT_Get_Char_Index(face, '0');
|
||||
if (gid) {
|
||||
FT_Load_Glyph(face, gid, FT_LOAD_NO_SCALE);
|
||||
mMetrics->zeroOrAveCharWidth = face->glyph->metrics.horiAdvance * xScale;
|
||||
} else {
|
||||
// this font doesn't have a '0'
|
||||
mMetrics->zeroOrAveCharWidth = mMetrics->aveCharWidth;
|
||||
}
|
||||
|
||||
// compute an adjusted size if we need to
|
||||
if (mAdjustedSize == 0 && GetStyle()->sizeAdjust != 0) {
|
||||
gfxFloat aspect = mMetrics->xHeight / GetStyle()->size;
|
||||
mAdjustedSize = GetStyle()->GetAdjustedSize(aspect);
|
||||
mMetrics->emHeight = mAdjustedSize;
|
||||
}
|
||||
|
||||
// now load the OS/2 TrueType table to access some more properties
|
||||
TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2);
|
||||
if (os2 && os2->version != 0xFFFF) { // should be there if not old Mac font
|
||||
// if we are here we can improve the avgCharWidth
|
||||
mMetrics->aveCharWidth = std::max(mMetrics->aveCharWidth,
|
||||
os2->xAvgCharWidth * xScale);
|
||||
|
||||
mMetrics->superscriptOffset = std::max(os2->ySuperscriptYOffset * yScale, 1.0);
|
||||
// some fonts have the incorrect sign (from gfxPangoFonts)
|
||||
mMetrics->subscriptOffset = std::max(fabs(os2->ySubscriptYOffset * yScale),
|
||||
1.0);
|
||||
mMetrics->strikeoutOffset = os2->yStrikeoutPosition * yScale;
|
||||
mMetrics->strikeoutSize = os2->yStrikeoutSize * yScale;
|
||||
} else {
|
||||
// use fractions of emHeight instead of xHeight for these to be more robust
|
||||
mMetrics->superscriptOffset = mMetrics->emHeight * 0.5;
|
||||
mMetrics->subscriptOffset = mMetrics->emHeight * 0.2;
|
||||
mMetrics->strikeoutOffset = mMetrics->emHeight * 0.3;
|
||||
mMetrics->strikeoutSize = face->underline_thickness * yScale;
|
||||
}
|
||||
SnapLineToPixels(mMetrics->strikeoutOffset, mMetrics->strikeoutSize);
|
||||
|
||||
// seems that underlineOffset really has to be negative
|
||||
mMetrics->underlineOffset = face->underline_position * yScale;
|
||||
mMetrics->underlineSize = face->underline_thickness * yScale;
|
||||
|
||||
// descents are negative in FT but Thebes wants them positive
|
||||
mMetrics->emAscent = face->ascender * yScale;
|
||||
mMetrics->emDescent = -face->descender * yScale;
|
||||
mMetrics->maxHeight = face->height * yScale;
|
||||
// the max units determine frame heights, better be generous
|
||||
mMetrics->maxAscent = std::max(face->bbox.yMax * yScale,
|
||||
mMetrics->emAscent);
|
||||
mMetrics->maxDescent = std::max(-face->bbox.yMin * yScale,
|
||||
mMetrics->emDescent);
|
||||
mMetrics->maxAdvance = std::max(face->max_advance_width * xScale,
|
||||
mMetrics->aveCharWidth);
|
||||
|
||||
// leadings are not available directly (only for WinFNTs);
|
||||
// better compute them on our own, to get integer values and make
|
||||
// layout happy (see // LockedFTFace::GetMetrics in gfxPangoFonts.cpp)
|
||||
mMetrics->internalLeading = floor(mMetrics->maxHeight
|
||||
- mMetrics->emHeight + 0.5);
|
||||
gfxFloat lineHeight = floor(mMetrics->maxHeight + 0.5);
|
||||
mMetrics->externalLeading = lineHeight
|
||||
- mMetrics->internalLeading - mMetrics->emHeight;
|
||||
|
||||
SanitizeMetrics(mMetrics, false);
|
||||
|
||||
#ifdef DEBUG_thebes_1
|
||||
printf("gfxOS2Font[%#x]::GetMetrics():\n"
|
||||
" %s (%s)\n"
|
||||
" emHeight=%f == %f=gfxFont::style.size == %f=adjSz\n"
|
||||
" maxHeight=%f xHeight=%f\n"
|
||||
" aveCharWidth=%f(x) zeroOrAveWidth=%f(0) spaceWidth=%f\n"
|
||||
" supOff=%f SubOff=%f strOff=%f strSz=%f\n"
|
||||
" undOff=%f undSz=%f intLead=%f extLead=%f\n"
|
||||
" emAsc=%f emDesc=%f maxH=%f\n"
|
||||
" maxAsc=%f maxDes=%f maxAdv=%f\n",
|
||||
(unsigned)this,
|
||||
NS_LossyConvertUTF16toASCII(GetName()).get(),
|
||||
os2 && os2->version != 0xFFFF ? "has OS/2 table" : "no OS/2 table!",
|
||||
mMetrics->emHeight, GetStyle()->size, mAdjustedSize,
|
||||
mMetrics->maxHeight, mMetrics->xHeight,
|
||||
mMetrics->aveCharWidth, mMetrics->zeroOrAveCharWidth, mMetrics->spaceWidth,
|
||||
mMetrics->superscriptOffset, mMetrics->subscriptOffset,
|
||||
mMetrics->strikeoutOffset, mMetrics->strikeoutSize,
|
||||
mMetrics->underlineOffset, mMetrics->underlineSize,
|
||||
mMetrics->internalLeading, mMetrics->externalLeading,
|
||||
mMetrics->emAscent, mMetrics->emDescent, mMetrics->maxHeight,
|
||||
mMetrics->maxAscent, mMetrics->maxDescent, mMetrics->maxAdvance
|
||||
);
|
||||
#endif
|
||||
cairo_ft_scaled_font_unlock_face(scaledFont);
|
||||
return *mMetrics;
|
||||
}
|
||||
|
||||
// weight list copied from fontconfig.h
|
||||
// unfortunately, the OS/2 version so far only supports regular and bold
|
||||
static const int8_t nFcWeight = 2; // 10; // length of weight list
|
||||
static const int fcWeight[] = {
|
||||
//FC_WEIGHT_THIN,
|
||||
//FC_WEIGHT_EXTRALIGHT, // == FC_WEIGHT_ULTRALIGHT
|
||||
//FC_WEIGHT_LIGHT,
|
||||
//FC_WEIGHT_BOOK,
|
||||
FC_WEIGHT_REGULAR, // == FC_WEIGHT_NORMAL
|
||||
//FC_WEIGHT_MEDIUM,
|
||||
//FC_WEIGHT_DEMIBOLD, // == FC_WEIGHT_SEMIBOLD
|
||||
FC_WEIGHT_BOLD,
|
||||
//FC_WEIGHT_EXTRABOLD, // == FC_WEIGHT_ULTRABOLD
|
||||
//FC_WEIGHT_BLACK // == FC_WEIGHT_HEAVY
|
||||
};
|
||||
|
||||
// gfxOS2Font::CairoFontFace()
|
||||
// return a font face usable by cairo for font rendering
|
||||
// if none was created yet, use FontConfig patterns based on the current style
|
||||
// to create a new font face
|
||||
cairo_font_face_t *gfxOS2Font::CairoFontFace()
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%#x]::CairoFontFace()\n", (unsigned)this);
|
||||
#endif
|
||||
if (!mFontFace) {
|
||||
#ifdef DEBUG_thebes
|
||||
printf("gfxOS2Font[%#x]::CairoFontFace(): create it for %s, %f\n",
|
||||
(unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size);
|
||||
#endif
|
||||
FcPattern *fcPattern = FcPatternCreate();
|
||||
|
||||
// add (family) name to pattern
|
||||
// convert name because FC stores it in UTF8 while we have it in UTF16
|
||||
FcPatternAddString(fcPattern, FC_FAMILY,
|
||||
(FcChar8 *)NS_ConvertUTF16toUTF8(GetName()).get());
|
||||
|
||||
// The requirements outlined in gfxFont.h are difficult to meet without
|
||||
// having a table of available font weights, so we map the gfxFont
|
||||
// weight to possible FontConfig weights.
|
||||
int8_t weight = GetStyle()->ComputeWeight();
|
||||
// gfxFont weight FC weight
|
||||
// 400 80
|
||||
// 700 200
|
||||
int16_t fcW = 40 * weight - 80; // match gfxFont weight to base FC weight
|
||||
// find the correct weight in the list
|
||||
int8_t i = 0;
|
||||
while (i < nFcWeight && fcWeight[i] < fcW) {
|
||||
i++;
|
||||
}
|
||||
if (i < 0) {
|
||||
i = 0;
|
||||
} else if (i >= nFcWeight) {
|
||||
i = nFcWeight - 1;
|
||||
}
|
||||
fcW = fcWeight[i];
|
||||
|
||||
// add weight to pattern
|
||||
FcPatternAddInteger(fcPattern, FC_WEIGHT, fcW);
|
||||
|
||||
uint8_t fcProperty;
|
||||
// add style to pattern
|
||||
switch (GetStyle()->style) {
|
||||
case NS_FONT_STYLE_ITALIC:
|
||||
fcProperty = FC_SLANT_ITALIC;
|
||||
break;
|
||||
case NS_FONT_STYLE_OBLIQUE:
|
||||
fcProperty = FC_SLANT_OBLIQUE;
|
||||
break;
|
||||
case NS_FONT_STYLE_NORMAL:
|
||||
default:
|
||||
fcProperty = FC_SLANT_ROMAN;
|
||||
}
|
||||
FcPatternAddInteger(fcPattern, FC_SLANT, fcProperty);
|
||||
|
||||
// add the size we want
|
||||
FcPatternAddDouble(fcPattern, FC_PIXEL_SIZE,
|
||||
mAdjustedSize ? mAdjustedSize : GetStyle()->size);
|
||||
|
||||
// finally find a matching font
|
||||
FcResult fcRes;
|
||||
FcPattern *fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
|
||||
|
||||
// Most code that depends on FcFontMatch() assumes it won't fail,
|
||||
// then crashes when it does. For now, at least, substitute the
|
||||
// default serif font when it fails to avoid those crashes.
|
||||
if (!fcMatch) {
|
||||
//#ifdef DEBUG
|
||||
printf("Could not match font for:\n"
|
||||
" family=%s, weight=%d, slant=%d, size=%f\n",
|
||||
NS_LossyConvertUTF16toASCII(GetName()).get(),
|
||||
GetStyle()->weight, GetStyle()->style, GetStyle()->size);
|
||||
//#endif
|
||||
// FcPatternAddString() will free the existing FC_FAMILY string
|
||||
FcPatternAddString(fcPattern, FC_FAMILY, (FcChar8*)"SERIF");
|
||||
fcMatch = FcFontMatch(nullptr, fcPattern, &fcRes);
|
||||
//#ifdef DEBUG
|
||||
printf("Attempt to substitute default SERIF font %s\n",
|
||||
fcMatch ? "succeeded" : "failed");
|
||||
//#endif
|
||||
}
|
||||
FcPatternDestroy(fcPattern);
|
||||
|
||||
if (fcMatch) {
|
||||
int w = FC_WEIGHT_REGULAR;
|
||||
FcPatternGetInteger(fcMatch, FC_WEIGHT, 0, &w);
|
||||
if (fcW >= FC_WEIGHT_DEMIBOLD && w < FC_WEIGHT_DEMIBOLD) {
|
||||
// if we want a bold font, but the selected font doesn't have a
|
||||
// bold counterpart, artificially embolden it
|
||||
FcPatternAddBool(fcMatch, FC_EMBOLDEN, FcTrue);
|
||||
}
|
||||
FcPatternAddBool(fcMatch, FC_ANTIALIAS, mAntialias);
|
||||
FcPatternAddInteger(fcMatch, FC_HINT_STYLE, mHinting);
|
||||
|
||||
// and ask cairo to return a font face for this
|
||||
mFontFace = cairo_ft_font_face_create_for_pattern(fcMatch);
|
||||
|
||||
FcPatternDestroy(fcMatch);
|
||||
}
|
||||
}
|
||||
|
||||
NS_ASSERTION(mFontFace, "Failed to make font face");
|
||||
return mFontFace;
|
||||
}
|
||||
|
||||
cairo_scaled_font_t *gfxOS2Font::CairoScaledFont()
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%#x]::CairoScaledFont()\n", (unsigned)this);
|
||||
#endif
|
||||
if (mScaledFont) {
|
||||
return mScaledFont;
|
||||
}
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%#x]::CairoScaledFont(): create it for %s, %f\n",
|
||||
(unsigned)this, NS_LossyConvertUTF16toASCII(GetName()).get(), GetStyle()->size);
|
||||
#endif
|
||||
|
||||
double size = mAdjustedSize ? mAdjustedSize : GetStyle()->size;
|
||||
cairo_matrix_t identityMatrix;
|
||||
cairo_matrix_init_identity(&identityMatrix);
|
||||
cairo_matrix_t fontMatrix;
|
||||
// synthetic oblique by skewing via the font matrix
|
||||
if (!mFontEntry->mItalic &&
|
||||
(mStyle.style & (NS_FONT_STYLE_ITALIC | NS_FONT_STYLE_OBLIQUE)))
|
||||
{
|
||||
const double kSkewFactor = 0.2126; // 12 deg skew as used in e.g. ftview
|
||||
cairo_matrix_init(&fontMatrix, size, 0, -kSkewFactor*size, size, 0, 0);
|
||||
} else {
|
||||
cairo_matrix_init_scale(&fontMatrix, size, size);
|
||||
}
|
||||
|
||||
cairo_font_face_t * face = CairoFontFace();
|
||||
if (!face)
|
||||
return nullptr;
|
||||
|
||||
cairo_font_options_t *fontOptions = cairo_font_options_create();
|
||||
mScaledFont = cairo_scaled_font_create(face, &fontMatrix,
|
||||
&identityMatrix, fontOptions);
|
||||
cairo_font_options_destroy(fontOptions);
|
||||
|
||||
NS_ASSERTION(cairo_scaled_font_status(mScaledFont) == CAIRO_STATUS_SUCCESS,
|
||||
"Failed to make scaled font");
|
||||
return mScaledFont;
|
||||
}
|
||||
|
||||
bool gfxOS2Font::SetupCairoFont(gfxContext *aContext)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Font[%#x]::SetupCairoFont(%#x)\n",
|
||||
(unsigned)this, (unsigned) aContext);
|
||||
#endif
|
||||
// gfxPangoFont checks the CTM but Windows doesn't so leave away here, too
|
||||
|
||||
// this implicitely ensures that mScaledFont is created if nullptr
|
||||
cairo_scaled_font_t *scaledFont = CairoScaledFont();
|
||||
if (!scaledFont || cairo_scaled_font_status(scaledFont) != CAIRO_STATUS_SUCCESS) {
|
||||
// Don't cairo_set_scaled_font as that would propagate the error to
|
||||
// the cairo_t, precluding any further drawing.
|
||||
return false;
|
||||
}
|
||||
cairo_set_scaled_font(aContext->GetCairo(), scaledFont);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Look up the font in the gfxFont cache. If we don't find it, create one.
|
||||
* In either case, add a ref and return it ---
|
||||
* except for OOM in which case we do nothing and return null.
|
||||
*/
|
||||
already_AddRefed<gfxOS2Font> gfxOS2Font::GetOrMakeFont(const nsAString& aName,
|
||||
const gfxFontStyle *aStyle)
|
||||
{
|
||||
nsRefPtr<gfxOS2FontEntry> fe = new gfxOS2FontEntry(aName);
|
||||
nsRefPtr<gfxFont> font =
|
||||
gfxFontCache::GetCache()->Lookup(static_cast<gfxFontEntry *>(fe), aStyle);
|
||||
if (!font) {
|
||||
font = new gfxOS2Font(fe, aStyle);
|
||||
if (!font)
|
||||
return nullptr;
|
||||
gfxFontCache::GetCache()->AddNew(font);
|
||||
}
|
||||
gfxFont *f = nullptr;
|
||||
font.swap(f);
|
||||
return static_cast<gfxOS2Font *>(f);
|
||||
}
|
||||
|
||||
/**********************************************************************
|
||||
* class gfxOS2FontGroup
|
||||
**********************************************************************/
|
||||
|
||||
gfxOS2FontGroup::gfxOS2FontGroup(const nsAString& aFamilies,
|
||||
const gfxFontStyle* aStyle,
|
||||
gfxUserFontSet *aUserFontSet)
|
||||
: gfxFontGroup(aFamilies, aStyle, aUserFontSet)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2FontGroup[%#x]::gfxOS2FontGroup(\"%s\", %#x)\n",
|
||||
(unsigned)this, NS_LossyConvertUTF16toASCII(aFamilies).get(),
|
||||
(unsigned)aStyle);
|
||||
#endif
|
||||
|
||||
// check for WarpSans and as we cannot display that (yet), replace
|
||||
// it with Workplace Sans
|
||||
int pos = 0;
|
||||
if ((pos = mFamilies.Find("WarpSans", false, 0, -1)) > -1) {
|
||||
mFamilies.Replace(pos, 8, NS_LITERAL_STRING("Workplace Sans"));
|
||||
}
|
||||
|
||||
nsTArray<nsString> familyArray;
|
||||
ForEachFont(FontCallback, &familyArray);
|
||||
|
||||
// To be able to easily search for glyphs in other fonts, append the
|
||||
// Unicode fonts as replacement candidates to the list.
|
||||
nsString fontString;
|
||||
gfxPlatform::GetPlatform()->GetPrefFonts(nsGkAtoms::Unicode, fontString, false);
|
||||
ForEachFont(fontString, nsGkAtoms::Unicode, FontCallback, &familyArray);
|
||||
|
||||
// Should append some default font if there are no available fonts.
|
||||
// Let's use Helv which should be available on any OS/2 system; if
|
||||
// it's not there, Fontconfig replaces it with something else...
|
||||
if (familyArray.Length() == 0) {
|
||||
familyArray.AppendElement(NS_LITERAL_STRING("Helv"));
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < familyArray.Length(); i++) {
|
||||
nsRefPtr<gfxOS2Font> font = gfxOS2Font::GetOrMakeFont(familyArray[i], &mStyle);
|
||||
if (font) {
|
||||
mFonts.AppendElement(font);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
gfxOS2FontGroup::~gfxOS2FontGroup()
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2FontGroup[%#x]::~gfxOS2FontGroup()\n", (unsigned)this);
|
||||
#endif
|
||||
}
|
||||
|
||||
gfxFontGroup *gfxOS2FontGroup::Copy(const gfxFontStyle *aStyle)
|
||||
{
|
||||
return new gfxOS2FontGroup(mFamilies, aStyle, mUserFontSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* We use this to append an LTR or RTL Override character to the start of the
|
||||
* string. This forces Pango to honour our direction even if there are neutral
|
||||
* characters in the string.
|
||||
*/
|
||||
static int32_t AppendDirectionalIndicatorUTF8(bool aIsRTL, nsACString& aString)
|
||||
{
|
||||
static const char16_t overrides[2][2] = { { 0x202d, 0 }, { 0x202e, 0 }}; // LRO, RLO
|
||||
AppendUTF16toUTF8(overrides[aIsRTL], aString);
|
||||
return 3; // both overrides map to 3 bytes in UTF8
|
||||
}
|
||||
|
||||
gfxTextRun *gfxOS2FontGroup::MakeTextRun(const char16_t* aString, uint32_t aLength,
|
||||
const Parameters* aParams, uint32_t aFlags)
|
||||
{
|
||||
NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text");
|
||||
gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags);
|
||||
if (!textRun)
|
||||
return nullptr;
|
||||
|
||||
mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED);
|
||||
|
||||
nsAutoCString utf8;
|
||||
int32_t headerLen = AppendDirectionalIndicatorUTF8(textRun->IsRightToLeft(), utf8);
|
||||
AppendUTF16toUTF8(Substring(aString, aString + aLength), utf8);
|
||||
|
||||
#ifdef DEBUG_thebes_2
|
||||
NS_ConvertUTF8toUTF16 u16(utf8);
|
||||
printf("gfxOS2FontGroup[%#x]::MakeTextRun(char16_t %s, %d, %#x, %d)\n",
|
||||
(unsigned)this, NS_LossyConvertUTF16toASCII(u16).get(), aLength, (unsigned)aParams, aFlags);
|
||||
#endif
|
||||
|
||||
InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen);
|
||||
|
||||
textRun->FetchGlyphExtents(aParams->mContext);
|
||||
|
||||
return textRun;
|
||||
}
|
||||
|
||||
gfxTextRun *gfxOS2FontGroup::MakeTextRun(const uint8_t* aString, uint32_t aLength,
|
||||
const Parameters* aParams, uint32_t aFlags)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
const char *cStr = reinterpret_cast<const char *>(aString);
|
||||
NS_ConvertASCIItoUTF16 us(cStr, aLength);
|
||||
printf("gfxOS2FontGroup[%#x]::MakeTextRun(uint8_t %s, %d, %#x, %d)\n",
|
||||
(unsigned)this, NS_LossyConvertUTF16toASCII(us).get(), aLength, (unsigned)aParams, aFlags);
|
||||
#endif
|
||||
NS_ASSERTION(aLength > 0, "should use MakeEmptyTextRun for zero-length text");
|
||||
NS_ASSERTION(aFlags & TEXT_IS_8BIT, "8bit should have been set");
|
||||
gfxTextRun *textRun = gfxTextRun::Create(aParams, aLength, this, aFlags);
|
||||
if (!textRun)
|
||||
return nullptr;
|
||||
|
||||
mEnableKerning = !(aFlags & gfxTextRunFactory::TEXT_OPTIMIZE_SPEED);
|
||||
|
||||
const char *chars = reinterpret_cast<const char *>(aString);
|
||||
bool isRTL = textRun->IsRightToLeft();
|
||||
if ((aFlags & TEXT_IS_ASCII) && !isRTL) {
|
||||
// We don't need to send an override character here, the characters must be all
|
||||
// LTR
|
||||
InitTextRun(textRun, (uint8_t *)chars, aLength, 0);
|
||||
} else {
|
||||
// Although chars in not necessarily ASCII (as it may point to the low
|
||||
// bytes of any UCS-2 characters < 256), NS_ConvertASCIItoUTF16 seems
|
||||
// to DTRT.
|
||||
NS_ConvertASCIItoUTF16 unicodeString(chars, aLength);
|
||||
nsAutoCString utf8;
|
||||
int32_t headerLen = AppendDirectionalIndicatorUTF8(isRTL, utf8);
|
||||
AppendUTF16toUTF8(unicodeString, utf8);
|
||||
InitTextRun(textRun, (uint8_t *)utf8.get(), utf8.Length(), headerLen);
|
||||
}
|
||||
|
||||
textRun->FetchGlyphExtents(aParams->mContext);
|
||||
|
||||
return textRun;
|
||||
}
|
||||
|
||||
void gfxOS2FontGroup::InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text,
|
||||
uint32_t aUTF8Length,
|
||||
uint32_t aUTF8HeaderLength)
|
||||
{
|
||||
CreateGlyphRunsFT(aTextRun, aUTF8Text + aUTF8HeaderLength,
|
||||
aUTF8Length - aUTF8HeaderLength);
|
||||
}
|
||||
|
||||
// Helper function to return the leading UTF-8 character in a char pointer
|
||||
// as 32bit number. Also sets the length of the current character (i.e. the
|
||||
// offset to the next one) in the second argument
|
||||
uint32_t getUTF8CharAndNext(const uint8_t *aString, uint8_t *aLength)
|
||||
{
|
||||
*aLength = 1;
|
||||
if (aString[0] < 0x80) { // normal 7bit ASCII char
|
||||
return aString[0];
|
||||
}
|
||||
if ((aString[0] >> 5) == 6) { // two leading ones -> two bytes
|
||||
*aLength = 2;
|
||||
return ((aString[0] & 0x1F) << 6) + (aString[1] & 0x3F);
|
||||
}
|
||||
if ((aString[0] >> 4) == 14) { // three leading ones -> three bytes
|
||||
*aLength = 3;
|
||||
return ((aString[0] & 0x0F) << 12) + ((aString[1] & 0x3F) << 6) +
|
||||
(aString[2] & 0x3F);
|
||||
}
|
||||
if ((aString[0] >> 4) == 15) { // four leading ones -> four bytes
|
||||
*aLength = 4;
|
||||
return ((aString[0] & 0x07) << 18) + ((aString[1] & 0x3F) << 12) +
|
||||
((aString[2] & 0x3F) << 6) + (aString[3] & 0x3F);
|
||||
}
|
||||
return aString[0];
|
||||
}
|
||||
|
||||
void gfxOS2FontGroup::CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8,
|
||||
uint32_t aUTF8Length)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2FontGroup::CreateGlyphRunsFT(%#x, _aUTF8_, %d)\n",
|
||||
(unsigned)aTextRun, /*aUTF8,*/ aUTF8Length);
|
||||
for (uint32_t i = 0; i < FontListLength(); i++) {
|
||||
gfxOS2Font *font = GetFontAt(i);
|
||||
printf(" i=%d, name=%s, size=%f\n", i, NS_LossyConvertUTF16toASCII(font->GetName()).get(),
|
||||
font->GetStyle()->size);
|
||||
}
|
||||
#endif
|
||||
uint32_t lastFont = FontListLength()-1;
|
||||
gfxOS2Font *font0 = GetFontAt(0);
|
||||
const uint8_t *p = aUTF8;
|
||||
uint32_t utf16Offset = 0;
|
||||
gfxTextRun::CompressedGlyph g;
|
||||
const uint32_t appUnitsPerDevUnit = aTextRun->GetAppUnitsPerDevUnit();
|
||||
gfxOS2Platform *platform = gfxOS2Platform::GetPlatform();
|
||||
|
||||
aTextRun->AddGlyphRun(font0, gfxTextRange::kFontGroup, 0, false);
|
||||
// a textRun likely has the same font for most of the characters, so we can
|
||||
// lock it before the loop for efficiency
|
||||
FT_Face face0 = cairo_ft_scaled_font_lock_face(font0->CairoScaledFont());
|
||||
while (p < aUTF8 + aUTF8Length) {
|
||||
bool glyphFound = false;
|
||||
// convert UTF-8 character and step to the next one in line
|
||||
uint8_t chLen;
|
||||
uint32_t ch = getUTF8CharAndNext(p, &chLen);
|
||||
p += chLen; // move to next char
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("\'%c\' (%d, %#x, %s) [%#x %#x]:", (char)ch, ch, ch, ch >=0x10000 ? "non-BMP!" : "BMP", ch >=0x10000 ? H_SURROGATE(ch) : 0, ch >=0x10000 ? L_SURROGATE(ch) : 0);
|
||||
#endif
|
||||
|
||||
if (ch == 0 || platform->noFontWithChar(ch)) {
|
||||
// null bytes or missing characters cannot be displayed
|
||||
aTextRun->SetMissingGlyph(utf16Offset, ch);
|
||||
} else {
|
||||
// Try to get a glyph from all fonts available to us.
|
||||
// Once we found it in one of the fonts we quit the loop early.
|
||||
// If we don't find the glyph even in the last font, we will fall
|
||||
// back to searching all fonts on the system and finally set the
|
||||
// missing glyph symbol after trying the last font.
|
||||
for (uint32_t i = 0; i <= lastFont; i++) {
|
||||
gfxOS2Font *font = font0;
|
||||
FT_Face face = face0;
|
||||
if (i > 0) {
|
||||
font = GetFontAt(i);
|
||||
face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont());
|
||||
#ifdef DEBUG_thebes_2
|
||||
if (i == lastFont) {
|
||||
printf("Last font %d (%s) for ch=%#x (pos=%d)",
|
||||
i, NS_LossyConvertUTF16toASCII(font->GetName()).get(), ch, utf16Offset);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (!face || !face->charmap) { // don't try to use fonts with non-Unicode charmaps
|
||||
if (face && face != face0)
|
||||
cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
|
||||
continue; // next font
|
||||
}
|
||||
|
||||
NS_ASSERTION(!IsInvalidChar(ch), "Invalid char detected");
|
||||
FT_UInt gid = FT_Get_Char_Index(face, ch); // find the glyph id
|
||||
|
||||
if (gid == 0 && i == lastFont) {
|
||||
// missing glyph, try to find a replacement in another font
|
||||
nsRefPtr<gfxOS2Font> fontX = platform->FindFontForChar(ch, font0);
|
||||
if (fontX) {
|
||||
font = fontX; // replace current font
|
||||
cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
|
||||
face = cairo_ft_scaled_font_lock_face(fontX->CairoScaledFont());
|
||||
gid = FT_Get_Char_Index(face, ch);
|
||||
// likely to find more chars in this font, append it
|
||||
// to the font list to find it quicker next time
|
||||
mFonts.AppendElement(fontX);
|
||||
lastFont = FontListLength()-1;
|
||||
}
|
||||
}
|
||||
|
||||
// select the current font into the text run
|
||||
aTextRun->AddGlyphRun(font, gfxTextRange::kFontGroup, utf16Offset, false);
|
||||
|
||||
int32_t advance = 0;
|
||||
if (gid == font->GetSpaceGlyph()) {
|
||||
advance = (int)(font->GetMetrics().spaceWidth * appUnitsPerDevUnit);
|
||||
} else if (gid == 0) {
|
||||
advance = -1; // trigger the missing glyphs case below
|
||||
} else {
|
||||
// find next character and its glyph -- in case they exist
|
||||
// and exist in the current font face -- to compute kerning
|
||||
uint32_t chNext = 0;
|
||||
FT_UInt gidNext = 0;
|
||||
FT_Pos lsbDeltaNext = 0;
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("(kerning=%s/%s)", mEnableKerning ? "enable" : "disable", FT_HAS_KERNING(face) ? "yes" : "no");
|
||||
#endif
|
||||
if (mEnableKerning && FT_HAS_KERNING(face) && p < aUTF8 + aUTF8Length) {
|
||||
chNext = getUTF8CharAndNext(p, &chLen);
|
||||
if (chNext) {
|
||||
gidNext = FT_Get_Char_Index(face, chNext);
|
||||
if (gidNext && gidNext != font->GetSpaceGlyph()) {
|
||||
FT_Load_Glyph(face, gidNext, FT_LOAD_DEFAULT);
|
||||
lsbDeltaNext = face->glyph->lsb_delta;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// now load the current glyph
|
||||
FT_Load_Glyph(face, gid, FT_LOAD_DEFAULT); // load glyph into the slot
|
||||
advance = face->glyph->advance.x;
|
||||
|
||||
// now add kerning to the current glyph's advance
|
||||
if (chNext && gidNext) {
|
||||
FT_Vector kerning;
|
||||
FT_Get_Kerning(face, gid, gidNext, FT_KERNING_DEFAULT, &kerning);
|
||||
advance += kerning.x;
|
||||
if (face->glyph->rsb_delta - lsbDeltaNext >= 32) {
|
||||
advance -= 64;
|
||||
} else if (face->glyph->rsb_delta - lsbDeltaNext < -32) {
|
||||
advance += 64;
|
||||
}
|
||||
}
|
||||
|
||||
// now apply unit conversion and scaling
|
||||
advance = (advance >> 6) * appUnitsPerDevUnit;
|
||||
}
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf(" gid=%d, advance=%d (%s)\n", gid, advance,
|
||||
NS_LossyConvertUTF16toASCII(font->GetName()).get());
|
||||
#endif
|
||||
|
||||
if (advance >= 0 &&
|
||||
gfxTextRun::CompressedGlyph::IsSimpleAdvance(advance) &&
|
||||
gfxTextRun::CompressedGlyph::IsSimpleGlyphID(gid))
|
||||
{
|
||||
aTextRun->SetSimpleGlyph(utf16Offset,
|
||||
g.SetSimpleGlyph(advance, gid));
|
||||
glyphFound = true;
|
||||
} else if (gid == 0) {
|
||||
// gid = 0 only happens when the glyph is missing from the font
|
||||
if (i == lastFont) {
|
||||
// set the missing glyph only when it's missing from the very
|
||||
// last font
|
||||
aTextRun->SetMissingGlyph(utf16Offset, ch);
|
||||
}
|
||||
glyphFound = false;
|
||||
} else {
|
||||
gfxTextRun::DetailedGlyph details;
|
||||
details.mGlyphID = gid;
|
||||
NS_ASSERTION(details.mGlyphID == gid, "Seriously weird glyph ID detected!");
|
||||
details.mAdvance = advance;
|
||||
details.mXOffset = 0;
|
||||
details.mYOffset = 0;
|
||||
g.SetComplex(aTextRun->IsClusterStart(utf16Offset), true, 1);
|
||||
aTextRun->SetGlyphs(utf16Offset, g, &details);
|
||||
glyphFound = true;
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
|
||||
}
|
||||
|
||||
if (glyphFound) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} // for all fonts
|
||||
|
||||
NS_ASSERTION(!IS_SURROGATE(ch), "Surrogates shouldn't appear in UTF8");
|
||||
if (ch >= 0x10000) {
|
||||
// This character is a surrogate pair in UTF16
|
||||
++utf16Offset;
|
||||
}
|
||||
|
||||
++utf16Offset;
|
||||
}
|
||||
cairo_ft_scaled_font_unlock_face(font0->CairoScaledFont());
|
||||
}
|
||||
|
||||
// append aFontName to aClosure string array, if not already present
|
||||
bool gfxOS2FontGroup::FontCallback(const nsAString& aFontName,
|
||||
const nsACString& aGenericName,
|
||||
bool aUseFontSet,
|
||||
void *aClosure)
|
||||
{
|
||||
nsTArray<nsString> *sa = static_cast<nsTArray<nsString>*>(aClosure);
|
||||
if (!aFontName.IsEmpty() && !sa->Contains(aFontName)) {
|
||||
sa->AppendElement(aFontName);
|
||||
}
|
||||
return true;
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef GFX_OS2_FONTS_H
|
||||
#define GFX_OS2_FONTS_H
|
||||
|
||||
#include "gfxTypes.h"
|
||||
#include "gfxFont.h"
|
||||
#include "nsDataHashtable.h"
|
||||
|
||||
#define INCL_GPI
|
||||
#include <os2.h>
|
||||
#include <cairo-os2.h>
|
||||
#include "cairo-ft.h" // includes fontconfig.h, too
|
||||
#include <freetype/tttables.h>
|
||||
|
||||
#include "nsICharsetConverterManager.h"
|
||||
|
||||
class gfxOS2FontEntry : public gfxFontEntry {
|
||||
public:
|
||||
gfxOS2FontEntry(const nsAString& aName) : gfxFontEntry(aName) {}
|
||||
~gfxOS2FontEntry() {}
|
||||
};
|
||||
|
||||
class gfxOS2Font : public gfxFont {
|
||||
public:
|
||||
gfxOS2Font(gfxOS2FontEntry *aFontEntry, const gfxFontStyle *aFontStyle);
|
||||
virtual ~gfxOS2Font();
|
||||
|
||||
virtual const gfxFont::Metrics& GetMetrics();
|
||||
cairo_font_face_t *CairoFontFace();
|
||||
cairo_scaled_font_t *CairoScaledFont();
|
||||
|
||||
// Get the glyphID of a space
|
||||
virtual uint32_t GetSpaceGlyph() {
|
||||
if (!mMetrics)
|
||||
GetMetrics();
|
||||
return mSpaceGlyph;
|
||||
}
|
||||
|
||||
static already_AddRefed<gfxOS2Font> GetOrMakeFont(const nsAString& aName,
|
||||
const gfxFontStyle *aStyle);
|
||||
|
||||
protected:
|
||||
virtual bool SetupCairoFont(gfxContext *aContext);
|
||||
|
||||
virtual FontType GetType() const { return FONT_TYPE_OS2; }
|
||||
|
||||
private:
|
||||
cairo_font_face_t *mFontFace;
|
||||
Metrics *mMetrics;
|
||||
gfxFloat mAdjustedSize;
|
||||
uint32_t mSpaceGlyph;
|
||||
int mHinting;
|
||||
bool mAntialias;
|
||||
};
|
||||
|
||||
|
||||
class gfxOS2FontGroup : public gfxFontGroup {
|
||||
public:
|
||||
gfxOS2FontGroup(const nsAString& aFamilies, const gfxFontStyle* aStyle, gfxUserFontSet *aUserFontSet);
|
||||
virtual ~gfxOS2FontGroup();
|
||||
|
||||
virtual gfxFontGroup *Copy(const gfxFontStyle *aStyle);
|
||||
|
||||
// create and initialize the textRun using FreeType font
|
||||
virtual gfxTextRun *MakeTextRun(const char16_t* aString, uint32_t aLength,
|
||||
const Parameters* aParams, uint32_t aFlags);
|
||||
virtual gfxTextRun *MakeTextRun(const uint8_t* aString, uint32_t aLength,
|
||||
const Parameters* aParams, uint32_t aFlags);
|
||||
|
||||
gfxOS2Font *GetFontAt(int32_t i) {
|
||||
// If it turns out to be hard for all clients that cache font
|
||||
// groups to call UpdateFontList at appropriate times, we could
|
||||
// instead consider just calling UpdateFontList from someplace
|
||||
// more central (such as here).
|
||||
NS_ASSERTION(!mUserFontSet || mCurrGeneration == GetGeneration(),
|
||||
"Whoever was caching this font group should have "
|
||||
"called UpdateFontList on it");
|
||||
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2FontGroup[%#x]::GetFontAt(%d), %#x, %#x\n",
|
||||
(unsigned)this, i, (unsigned)&mFonts, (unsigned)&mFonts[i]);
|
||||
#endif
|
||||
return static_cast<gfxOS2Font*>(static_cast<gfxFont*>(mFonts[i]));
|
||||
}
|
||||
|
||||
protected:
|
||||
void InitTextRun(gfxTextRun *aTextRun, const uint8_t *aUTF8Text,
|
||||
uint32_t aUTF8Length, uint32_t aUTF8HeaderLength);
|
||||
void CreateGlyphRunsFT(gfxTextRun *aTextRun, const uint8_t *aUTF8,
|
||||
uint32_t aUTF8Length);
|
||||
static bool FontCallback(const nsAString& aFontName,
|
||||
const nsACString& aGenericName,
|
||||
bool aUseFontSet,
|
||||
void *aClosure);
|
||||
|
||||
private:
|
||||
bool mEnableKerning;
|
||||
};
|
||||
|
||||
#endif /* GFX_OS2_FONTS_H */
|
@ -1,189 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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 "gfxOS2Platform.h"
|
||||
#include "gfxOS2Surface.h"
|
||||
#include "gfxImageSurface.h"
|
||||
#include "gfxOS2Fonts.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "gfxFontconfigUtils.h"
|
||||
//#include <fontconfig/fontconfig.h>
|
||||
|
||||
/**********************************************************************
|
||||
* class gfxOS2Platform
|
||||
**********************************************************************/
|
||||
gfxFontconfigUtils *gfxOS2Platform::sFontconfigUtils = nullptr;
|
||||
|
||||
gfxOS2Platform::gfxOS2Platform()
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
printf("gfxOS2Platform::gfxOS2Platform()\n");
|
||||
#endif
|
||||
// this seems to be reasonably early in the process and only once,
|
||||
// so it's a good place to initialize OS/2 cairo stuff
|
||||
cairo_os2_init();
|
||||
#ifdef DEBUG_thebes
|
||||
printf(" cairo_os2_init() was called\n");
|
||||
#endif
|
||||
if (!sFontconfigUtils) {
|
||||
sFontconfigUtils = gfxFontconfigUtils::GetFontconfigUtils();
|
||||
}
|
||||
}
|
||||
|
||||
gfxOS2Platform::~gfxOS2Platform()
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
printf("gfxOS2Platform::~gfxOS2Platform()\n");
|
||||
#endif
|
||||
gfxFontconfigUtils::Shutdown();
|
||||
sFontconfigUtils = nullptr;
|
||||
|
||||
// clean up OS/2 cairo stuff
|
||||
cairo_os2_fini();
|
||||
#ifdef DEBUG_thebes
|
||||
printf(" cairo_os2_fini() was called\n");
|
||||
#endif
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
gfxOS2Platform::CreateOffscreenSurface(const IntSize& aSize,
|
||||
gfxContentType contentType)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Platform::CreateOffscreenSurface(%d/%d, %d)\n",
|
||||
aSize.width, aSize.height, aImageFormat);
|
||||
#endif
|
||||
nsRefPtr<gfxASurface> newSurface;
|
||||
|
||||
// we only ever seem to get aImageFormat=0 or gfxImageFormat::ARGB32 but
|
||||
// I don't really know if we need to differ between ARGB32 and RGB24 here
|
||||
if (contentType == gfxContentType::COLOR_ALPHA ||
|
||||
contentType == gfxContentType::COLOR)
|
||||
{
|
||||
newSurface = new gfxOS2Surface(ThebesIntSize(aSize),
|
||||
OptimalFormatForContent(contentType));
|
||||
} else if (contentType == gfxContentType::ALPHA) {
|
||||
newSurface = new gfxImageSurface(ThebesIntSize(aSize),
|
||||
OptimalFormatForContent(contentType));
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return newSurface.forget();
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxOS2Platform::GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts)
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
const char *langgroup = "(null)";
|
||||
if (aLangGroup) {
|
||||
aLangGroup->GetUTF8String(&langgroup);
|
||||
}
|
||||
char *family = ToNewCString(aGenericFamily);
|
||||
printf("gfxOS2Platform::GetFontList(%s, %s, ..)\n",
|
||||
langgroup, family);
|
||||
free(family);
|
||||
#endif
|
||||
return sFontconfigUtils->GetFontList(aLangGroup, aGenericFamily,
|
||||
aListOfFonts);
|
||||
}
|
||||
|
||||
nsresult gfxOS2Platform::UpdateFontList()
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
printf("gfxOS2Platform::UpdateFontList()\n");
|
||||
#endif
|
||||
mCodepointsWithNoFonts.reset();
|
||||
|
||||
nsresult rv = sFontconfigUtils->UpdateFontList();
|
||||
|
||||
// initialize ranges of characters for which system-wide font search should be skipped
|
||||
mCodepointsWithNoFonts.SetRange(0,0x1f); // C0 controls
|
||||
mCodepointsWithNoFonts.SetRange(0x7f,0x9f); // C1 controls
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxOS2Platform::ResolveFontName(const nsAString& aFontName,
|
||||
FontResolverCallback aCallback,
|
||||
void *aClosure, bool& aAborted)
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
char *fontname = ToNewCString(aFontName);
|
||||
printf("gfxOS2Platform::ResolveFontName(%s, ...)\n", fontname);
|
||||
free(fontname);
|
||||
#endif
|
||||
return sFontconfigUtils->ResolveFontName(aFontName, aCallback, aClosure,
|
||||
aAborted);
|
||||
}
|
||||
|
||||
nsresult
|
||||
gfxOS2Platform::GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName)
|
||||
{
|
||||
return sFontconfigUtils->GetStandardFamilyName(aFontName, aFamilyName);
|
||||
}
|
||||
|
||||
gfxFontGroup *
|
||||
gfxOS2Platform::CreateFontGroup(const nsAString &aFamilies,
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxUserFontSet *aUserFontSet)
|
||||
{
|
||||
return new gfxOS2FontGroup(aFamilies, aStyle, aUserFontSet);
|
||||
}
|
||||
|
||||
already_AddRefed<gfxOS2Font>
|
||||
gfxOS2Platform::FindFontForChar(uint32_t aCh, gfxOS2Font *aFont)
|
||||
{
|
||||
#ifdef DEBUG_thebes
|
||||
printf("gfxOS2Platform::FindFontForChar(%d, ...)\n", aCh);
|
||||
#endif
|
||||
|
||||
// is codepoint with no matching font? return null immediately
|
||||
if (mCodepointsWithNoFonts.test(aCh)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// the following is not very clever but it's a quick fix to search all fonts
|
||||
// (one should instead cache the charmaps as done on Mac and Win)
|
||||
|
||||
// just continue to append all fonts known to the system
|
||||
nsTArray<nsString> fontList;
|
||||
nsAutoCString generic;
|
||||
nsresult rv = GetFontList(aFont->GetStyle()->language, generic, fontList);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// start at 3 to skip over the generic entries
|
||||
for (uint32_t i = 3; i < fontList.Length(); i++) {
|
||||
#ifdef DEBUG_thebes
|
||||
printf("searching in entry i=%d (%s)\n",
|
||||
i, NS_LossyConvertUTF16toASCII(fontList[i]).get());
|
||||
#endif
|
||||
nsRefPtr<gfxOS2Font> font =
|
||||
gfxOS2Font::GetOrMakeFont(fontList[i], aFont->GetStyle());
|
||||
if (!font)
|
||||
continue;
|
||||
FT_Face face = cairo_ft_scaled_font_lock_face(font->CairoScaledFont());
|
||||
if (!face || !face->charmap) {
|
||||
if (face)
|
||||
cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
|
||||
continue;
|
||||
}
|
||||
|
||||
FT_UInt gid = FT_Get_Char_Index(face, aCh); // find the glyph id
|
||||
if (gid != 0) {
|
||||
// this is the font
|
||||
cairo_ft_scaled_font_unlock_face(font->CairoScaledFont());
|
||||
return font.forget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// no match found, so add to the set of non-matching codepoints
|
||||
mCodepointsWithNoFonts.set(aCh);
|
||||
return nullptr;
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef GFX_OS2_PLATFORM_H
|
||||
#define GFX_OS2_PLATFORM_H
|
||||
|
||||
#define INCL_GPIBITMAPS
|
||||
#include <os2.h>
|
||||
|
||||
#include "gfxPlatform.h"
|
||||
#include "gfxOS2Fonts.h"
|
||||
#include "gfxFontUtils.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
class gfxFontconfigUtils;
|
||||
|
||||
class gfxOS2Platform : public gfxPlatform {
|
||||
|
||||
public:
|
||||
gfxOS2Platform();
|
||||
virtual ~gfxOS2Platform();
|
||||
|
||||
static gfxOS2Platform *GetPlatform() {
|
||||
return (gfxOS2Platform*) gfxPlatform::GetPlatform();
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfxASurface>
|
||||
CreateOffscreenSurface(const IntSize& size,
|
||||
gfxContentType contentType) MOZ_OVERRIDE;
|
||||
|
||||
nsresult GetFontList(nsIAtom *aLangGroup,
|
||||
const nsACString& aGenericFamily,
|
||||
nsTArray<nsString>& aListOfFonts);
|
||||
nsresult UpdateFontList();
|
||||
nsresult ResolveFontName(const nsAString& aFontName,
|
||||
FontResolverCallback aCallback,
|
||||
void *aClosure, bool& aAborted);
|
||||
nsresult GetStandardFamilyName(const nsAString& aFontName, nsAString& aFamilyName);
|
||||
|
||||
gfxFontGroup *CreateFontGroup(const nsAString &aFamilies,
|
||||
const gfxFontStyle *aStyle,
|
||||
gfxUserFontSet *aUserFontSet);
|
||||
|
||||
// Given a string and a font we already have, find the font that
|
||||
// supports the most code points and most closely resembles aFont.
|
||||
// This simple version involves looking at the fonts on the machine to see
|
||||
// which code points they support.
|
||||
already_AddRefed<gfxOS2Font> FindFontForChar(uint32_t aCh, gfxOS2Font *aFont);
|
||||
|
||||
// return true if it's already known that we don't have a font for this char
|
||||
bool noFontWithChar(uint32_t aCh) {
|
||||
return mCodepointsWithNoFonts.test(aCh);
|
||||
}
|
||||
|
||||
protected:
|
||||
static gfxFontconfigUtils *sFontconfigUtils;
|
||||
|
||||
private:
|
||||
// when font lookup fails for a character, cache it to skip future searches
|
||||
gfxSparseBitSet mCodepointsWithNoFonts;
|
||||
};
|
||||
|
||||
#endif /* GFX_OS2_PLATFORM_H */
|
@ -1,203 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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 "gfxOS2Surface.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/**********************************************************************
|
||||
* class gfxOS2Surface
|
||||
**********************************************************************/
|
||||
|
||||
gfxOS2Surface::gfxOS2Surface(const gfxIntSize& aSize,
|
||||
gfxImageFormat aImageFormat)
|
||||
: mWnd(0), mSize(aSize)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::gfxOS2Surface(Size=%dx%d, %d)\n", (unsigned int)this,
|
||||
aSize.width, aSize.height, aImageFormat);
|
||||
#endif
|
||||
// in this case we don't have a window, so we create a memory presentation
|
||||
// space to construct the cairo surface on
|
||||
|
||||
// create a PS, partly taken from nsOffscreenSurface::Init(), i.e. nsDrawingSurfaceOS2.cpp
|
||||
DEVOPENSTRUC dop = { 0, 0, 0, 0, 0 };
|
||||
SIZEL sizel = { 0, 0 }; // use same page size as device
|
||||
mDC = DevOpenDC(0, OD_MEMORY, (PSZ)"*", 5, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||
NS_ASSERTION(mDC != DEV_ERROR, "Could not create memory DC");
|
||||
|
||||
mPS = GpiCreatePS(0, mDC, &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||
NS_ASSERTION(mPS != GPI_ERROR, "Could not create PS on memory DC!");
|
||||
|
||||
// now create a bitmap of the right size
|
||||
BITMAPINFOHEADER2 hdr = { 0 };
|
||||
hdr.cbFix = sizeof(BITMAPINFOHEADER2);
|
||||
hdr.cx = mSize.width;
|
||||
hdr.cy = mSize.height;
|
||||
hdr.cPlanes = 1;
|
||||
|
||||
// find bit depth
|
||||
LONG lBitCount = 0;
|
||||
DevQueryCaps(mDC, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
hdr.cBitCount = (USHORT)lBitCount;
|
||||
|
||||
mBitmap = GpiCreateBitmap(mPS, &hdr, 0, 0, 0);
|
||||
NS_ASSERTION(mBitmap != GPI_ERROR, "Could not create bitmap in memory!");
|
||||
// set final stats & select bitmap into PS
|
||||
GpiSetBitmap(mPS, mBitmap);
|
||||
|
||||
// now we can finally create the cairo surface on the in-memory PS
|
||||
cairo_surface_t *surf = cairo_os2_surface_create(mPS, mSize.width, mSize.height);
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf,
|
||||
cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height);
|
||||
#endif
|
||||
// Normally, OS/2 cairo surfaces have to be forced to redraw completely
|
||||
// by calling cairo_surface_mark_dirty(surf), but Mozilla paints them in
|
||||
// full, so that is not necessary here.
|
||||
|
||||
// manual refresh is done from nsWindow::OnPaint
|
||||
cairo_os2_surface_set_manual_window_refresh(surf, 1);
|
||||
|
||||
Init(surf);
|
||||
}
|
||||
|
||||
gfxOS2Surface::gfxOS2Surface(HWND aWnd)
|
||||
: mWnd(aWnd), mDC(nullptr), mPS(nullptr), mBitmap(nullptr)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::gfxOS2Surface(HWND=%#x)\n", (unsigned int)this,
|
||||
(unsigned int)aWnd);
|
||||
#endif
|
||||
|
||||
RECTL rectl;
|
||||
WinQueryWindowRect(aWnd, &rectl);
|
||||
mSize.width = rectl.xRight - rectl.xLeft;
|
||||
mSize.height = rectl.yTop - rectl.yBottom;
|
||||
if (mSize.width == 0) mSize.width = 1; // fake a minimal surface area to let
|
||||
if (mSize.height == 0) mSize.height = 1; // cairo_os2_surface_create() return something
|
||||
|
||||
// This variation on cairo_os2_surface_create() avoids creating a
|
||||
// persistent HPS that may never be used. It also enables manual
|
||||
// refresh so nsWindow::OnPaint() controls when the screen is updated.
|
||||
cairo_surface_t *surf =
|
||||
cairo_os2_surface_create_for_window(mWnd, mSize.width, mSize.height);
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf,
|
||||
cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height);
|
||||
#endif
|
||||
|
||||
Init(surf);
|
||||
}
|
||||
|
||||
gfxOS2Surface::gfxOS2Surface(HDC aDC, const gfxIntSize& aSize)
|
||||
: mWnd(0), mDC(aDC), mBitmap(nullptr), mSize(aSize)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::gfxOS2Surface(HDC=%#x, Size=%dx%d)\n", (unsigned int)this,
|
||||
(unsigned int)aDC, aSize.width, aSize.height);
|
||||
#endif
|
||||
SIZEL sizel = { 0, 0 }; // use same page size as device
|
||||
mPS = GpiCreatePS(0, mDC, &sizel, PU_PELS | GPIT_MICRO | GPIA_ASSOC);
|
||||
NS_ASSERTION(mPS != GPI_ERROR, "Could not create PS on print DC!");
|
||||
|
||||
// now create a bitmap of the right size
|
||||
BITMAPINFOHEADER2 hdr = { 0 };
|
||||
hdr.cbFix = sizeof(BITMAPINFOHEADER2);
|
||||
hdr.cx = mSize.width;
|
||||
hdr.cy = mSize.height;
|
||||
hdr.cPlanes = 1;
|
||||
|
||||
// find bit depth
|
||||
LONG lBitCount = 0;
|
||||
DevQueryCaps(mDC, CAPS_COLOR_BITCOUNT, 1, &lBitCount);
|
||||
hdr.cBitCount = (USHORT)lBitCount;
|
||||
|
||||
mBitmap = GpiCreateBitmap(mPS, &hdr, 0, 0, 0);
|
||||
NS_ASSERTION(mBitmap != GPI_ERROR, "Could not create bitmap for printer!");
|
||||
// set final stats & select bitmap into PS
|
||||
GpiSetBitmap(mPS, mBitmap);
|
||||
|
||||
// now we can finally create the cairo surface on the in-memory PS
|
||||
cairo_surface_t *surf = cairo_os2_surface_create(mPS, mSize.width, mSize.height);
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf(" type(%#x)=%d (ID=%#x, h/w=%d/%d)\n", (unsigned int)surf,
|
||||
cairo_surface_get_type(surf), (unsigned int)mPS, mSize.width, mSize.height);
|
||||
#endif
|
||||
// Normally, OS/2 cairo surfaces have to be forced to redraw completely
|
||||
// by calling cairo_surface_mark_dirty(surf), but Mozilla paints them in
|
||||
// full, so that is not necessary here.
|
||||
|
||||
Init(surf);
|
||||
}
|
||||
|
||||
gfxOS2Surface::~gfxOS2Surface()
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::~gfxOS2Surface()\n", (unsigned int)this);
|
||||
#endif
|
||||
|
||||
// Surfaces connected to a window were created using WinGetPS so we should
|
||||
// release it again with WinReleasePS. Memory or printer surfaces on the
|
||||
// other hand were created on device contexts with the GPI functions, so
|
||||
// use those to clean up stuff.
|
||||
if (mWnd) {
|
||||
if (mPS) {
|
||||
WinReleasePS(mPS);
|
||||
}
|
||||
} else {
|
||||
if (mBitmap) {
|
||||
GpiSetBitmap(mPS, nullptr);
|
||||
GpiDeleteBitmap(mBitmap);
|
||||
}
|
||||
if (mPS) {
|
||||
GpiDestroyPS(mPS);
|
||||
}
|
||||
if (mDC) {
|
||||
DevCloseDC(mDC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void gfxOS2Surface::Refresh(RECTL *aRect, HPS aPS)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::Refresh(x=%ld,%ld/y=%ld,%ld, HPS=%#x), mPS=%#x\n",
|
||||
(unsigned int)this,
|
||||
aRect->xLeft, aRect->xRight, aRect->yBottom, aRect->yTop,
|
||||
(unsigned int)aPS, (unsigned int)mPS);
|
||||
#endif
|
||||
cairo_os2_surface_refresh_window(CairoSurface(), (aPS ? aPS : mPS), aRect);
|
||||
}
|
||||
|
||||
int gfxOS2Surface::Resize(const gfxIntSize& aSize)
|
||||
{
|
||||
#ifdef DEBUG_thebes_2
|
||||
printf("gfxOS2Surface[%#x]::Resize(%dx%d)\n", (unsigned int)this,
|
||||
aSize.width, aSize.height);
|
||||
#endif
|
||||
mSize = aSize; // record the new size
|
||||
// hardcode mutex timeout to 50ms for now
|
||||
return cairo_os2_surface_set_size(CairoSurface(), mSize.width, mSize.height, 50);
|
||||
}
|
||||
|
||||
HPS gfxOS2Surface::GetPS()
|
||||
{
|
||||
// Creating an HPS on-the-fly should never be needed because GetPS()
|
||||
// is only called for printing surfaces & mPS should only be null for
|
||||
// window surfaces. It would be a bug if Cairo had an HPS but Thebes
|
||||
// didn't, but we'll check anyway to avoid leakage. As a last resort,
|
||||
// if this is a window surface we'll create one & hang on to it.
|
||||
if (!mPS) {
|
||||
cairo_os2_surface_get_hps(CairoSurface(), &mPS);
|
||||
if (!mPS && mWnd) {
|
||||
mPS = WinGetPS(mWnd);
|
||||
cairo_os2_surface_set_hps(CairoSurface(), mPS);
|
||||
}
|
||||
}
|
||||
|
||||
return mPS;
|
||||
}
|
||||
|
@ -1,48 +0,0 @@
|
||||
/* vim: set sw=4 sts=4 et cin: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef GFX_OS2_SURFACE_H
|
||||
#define GFX_OS2_SURFACE_H
|
||||
|
||||
#include "gfxASurface.h"
|
||||
|
||||
#define INCL_GPIBITMAPS
|
||||
#include <os2.h>
|
||||
#include <cairo-os2.h>
|
||||
|
||||
class gfxOS2Surface : public gfxASurface {
|
||||
|
||||
public:
|
||||
// constructor used to create a memory surface of given size
|
||||
gfxOS2Surface(const gfxIntSize& aSize,
|
||||
gfxImageFormat aImageFormat);
|
||||
// constructor for surface connected to an onscreen window
|
||||
gfxOS2Surface(HWND aWnd);
|
||||
// constructor for surface connected to a printing device context
|
||||
gfxOS2Surface(HDC aDC, const gfxIntSize& aSize);
|
||||
virtual ~gfxOS2Surface();
|
||||
|
||||
// Special functions that only make sense for the OS/2 port of cairo:
|
||||
|
||||
// Update the cairo surface.
|
||||
// While gfxOS2Surface keeps track of the presentation handle itself,
|
||||
// use the one from WinBeginPaint() here.
|
||||
void Refresh(RECTL *aRect, HPS aPS);
|
||||
|
||||
// Reset the cairo surface to the given size.
|
||||
int Resize(const gfxIntSize& aSize);
|
||||
|
||||
HPS GetPS();
|
||||
virtual const gfxIntSize GetSize() const { return mSize; }
|
||||
|
||||
private:
|
||||
HWND mWnd; // non-null if created through the HWND constructor
|
||||
HDC mDC; // memory device context
|
||||
HPS mPS; // presentation space connected to window or memory device
|
||||
HBITMAP mBitmap; // bitmap for initialization of memory surface
|
||||
gfxIntSize mSize; // current size of the surface
|
||||
};
|
||||
|
||||
#endif /* GFX_OS2_SURFACE_H */
|
@ -37,8 +37,6 @@
|
||||
#include "gfxPlatformGtk.h"
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
#include "gfxQtPlatform.h"
|
||||
#elif defined(XP_OS2)
|
||||
#include "gfxOS2Platform.h"
|
||||
#elif defined(ANDROID)
|
||||
#include "gfxAndroidPlatform.h"
|
||||
#endif
|
||||
@ -404,8 +402,6 @@ gfxPlatform::Init()
|
||||
gPlatform = new gfxPlatformGtk;
|
||||
#elif defined(MOZ_WIDGET_QT)
|
||||
gPlatform = new gfxQtPlatform;
|
||||
#elif defined(XP_OS2)
|
||||
gPlatform = new gfxOS2Platform;
|
||||
#elif defined(ANDROID)
|
||||
gPlatform = new gfxAndroidPlatform;
|
||||
#else
|
||||
|
@ -22,10 +22,6 @@
|
||||
|
||||
#include "mozilla/layers/CompositorTypes.h"
|
||||
|
||||
#ifdef XP_OS2
|
||||
#undef OS2EMX_PLAIN_CHAR
|
||||
#endif
|
||||
|
||||
class gfxASurface;
|
||||
class gfxImageSurface;
|
||||
class gfxFont;
|
||||
|
@ -132,21 +132,6 @@ elif CONFIG['MOZ_WIDGET_GTK']:
|
||||
'gfxXlibSurface.cpp',
|
||||
]
|
||||
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'os2':
|
||||
EXPORTS += [
|
||||
'gfxOS2Fonts.h',
|
||||
'gfxOS2Platform.h',
|
||||
'gfxOS2Surface.h',
|
||||
'gfxPDFSurface.h',
|
||||
]
|
||||
SOURCES += [
|
||||
'gfxFontconfigUtils.cpp',
|
||||
'gfxOS2Fonts.cpp',
|
||||
'gfxOS2Platform.cpp',
|
||||
'gfxOS2Surface.cpp',
|
||||
'gfxPDFSurface.cpp',
|
||||
'nsUnicodeRange.cpp'
|
||||
]
|
||||
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
EXPORTS += [
|
||||
'gfxFT2FontBase.h',
|
||||
|
@ -32,8 +32,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt':
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
platform = 'win'
|
||||
elif CONFIG['OS_ARCH'] == 'OS2':
|
||||
platform = 'os2'
|
||||
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
|
||||
platform = 'mac'
|
||||
|
@ -1,11 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# 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/.
|
||||
|
||||
SOURCES += [
|
||||
'nsIconChannel.cpp',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'imgicon'
|
@ -1,716 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set sw=2 sts=2 et cin: */
|
||||
/* 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 "nsIconChannel.h"
|
||||
#include "nsIIconURI.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsMemory.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIFileURL.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsIRwsService.h"
|
||||
|
||||
#define INCL_PM
|
||||
#include <os2.h>
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// Due to byte swap, the second nibble is the first pixel of the pair
|
||||
#define FIRSTPEL(x) (0xF & (x >> 4))
|
||||
#define SECONDPEL(x) (0xF & x)
|
||||
|
||||
// nbr of bytes per row, rounded up to the nearest dword boundary
|
||||
#define ALIGNEDBPR(cx,bits) ((( ((cx)*(bits)) + 31) / 32) * 4)
|
||||
|
||||
// nbr of bytes per row, rounded up to the nearest byte boundary
|
||||
#define UNALIGNEDBPR(cx,bits) (( ((cx)*(bits)) + 7) / 8)
|
||||
|
||||
// native icon functions
|
||||
static HPOINTER GetIcon(nsCString& file, bool fExists,
|
||||
bool fMini, bool *fWpsIcon);
|
||||
static void DestroyIcon(HPOINTER hIcon, bool fWpsIcon);
|
||||
|
||||
void ConvertColorBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo,
|
||||
uint8_t *outBuf, bool fShrink);
|
||||
void ConvertMaskBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo,
|
||||
uint8_t *outBuf, bool fShrink);
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// reduces overhead by preventing calls to nsRws when it isn't present
|
||||
static bool sUseRws = true;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsIconChannel methods
|
||||
|
||||
nsIconChannel::nsIconChannel()
|
||||
{
|
||||
}
|
||||
|
||||
nsIconChannel::~nsIconChannel()
|
||||
{}
|
||||
|
||||
NS_IMPL_ISUPPORTS4(nsIconChannel,
|
||||
nsIChannel,
|
||||
nsIRequest,
|
||||
nsIRequestObserver,
|
||||
nsIStreamListener)
|
||||
|
||||
nsresult nsIconChannel::Init(nsIURI* uri)
|
||||
{
|
||||
NS_ASSERTION(uri, "no uri");
|
||||
mUrl = uri;
|
||||
mOriginalURI = uri;
|
||||
nsresult rv;
|
||||
mPump = do_CreateInstance(NS_INPUTSTREAMPUMP_CONTRACTID, &rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsIRequest methods:
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetName(nsACString &result)
|
||||
{
|
||||
return mUrl->GetSpec(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::IsPending(bool *result)
|
||||
{
|
||||
return mPump->IsPending(result);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetStatus(nsresult *status)
|
||||
{
|
||||
return mPump->GetStatus(status);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::Cancel(nsresult status)
|
||||
{
|
||||
return mPump->Cancel(status);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::Suspend(void)
|
||||
{
|
||||
return mPump->Suspend();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::Resume(void)
|
||||
{
|
||||
return mPump->Resume();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetLoadGroup(nsILoadGroup* *aLoadGroup)
|
||||
{
|
||||
*aLoadGroup = mLoadGroup;
|
||||
NS_IF_ADDREF(*aLoadGroup);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetLoadGroup(nsILoadGroup* aLoadGroup)
|
||||
{
|
||||
mLoadGroup = aLoadGroup;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetLoadFlags(uint32_t *aLoadAttributes)
|
||||
{
|
||||
return mPump->GetLoadFlags(aLoadAttributes);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetLoadFlags(uint32_t aLoadAttributes)
|
||||
{
|
||||
return mPump->SetLoadFlags(aLoadAttributes);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsIChannel methods:
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetOriginalURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mOriginalURI;
|
||||
NS_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetOriginalURI(nsIURI* aURI)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
mOriginalURI = aURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetURI(nsIURI* *aURI)
|
||||
{
|
||||
*aURI = mUrl;
|
||||
NS_IF_ADDREF(*aURI);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::Open(nsIInputStream **_retval)
|
||||
{
|
||||
return MakeInputStream(_retval, false);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports *ctxt)
|
||||
{
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
nsresult rv = MakeInputStream(getter_AddRefs(inStream), true);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// Init our streampump
|
||||
rv = mPump->Init(inStream, int64_t(-1), int64_t(-1), 0, 0, false);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = mPump->AsyncRead(this, ctxt);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Store our real listener
|
||||
mListener = aListener;
|
||||
// Add ourself to the load group, if available
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->AddRequest(this, nullptr);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, uint32_t * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
iconURI->GetImageSize(aDesiredImageSize);
|
||||
iconURI->GetContentType(aContentType);
|
||||
iconURI->GetFileExtension(aFileExtension);
|
||||
|
||||
nsCOMPtr<nsIURL> url;
|
||||
rv = iconURI->GetIconURL(getter_AddRefs(url));
|
||||
if (NS_FAILED(rv) || !url) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(url, &rv);
|
||||
if (NS_FAILED(rv) || !fileURL) return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIFile> file;
|
||||
rv = fileURL->GetFile(getter_AddRefs(file));
|
||||
if (NS_FAILED(rv) || !file) return NS_OK;
|
||||
|
||||
*aLocalFile = file;
|
||||
NS_IF_ADDREF(*aLocalFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// retrieves a native icon with 16, 256, or 16M colors and converts it to cairo
|
||||
// format; Note: this implementation ignores the file's MIME-type because
|
||||
// using it virtually guarantees we'll end up with an inappropriate icon (i.e.
|
||||
// an .exe icon)
|
||||
|
||||
nsresult nsIconChannel::MakeInputStream(nsIInputStream **_retval,
|
||||
bool nonBlocking)
|
||||
{
|
||||
|
||||
// get some details about this icon
|
||||
nsCOMPtr<nsIFile> localFile;
|
||||
uint32_t desiredImageSize;
|
||||
nsXPIDLCString contentType;
|
||||
nsAutoCString filePath;
|
||||
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile),
|
||||
&desiredImageSize, contentType,
|
||||
filePath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// if the file exists, get its path
|
||||
bool fileExists = false;
|
||||
if (localFile) {
|
||||
localFile->GetNativePath(filePath);
|
||||
localFile->Exists(&fileExists);
|
||||
}
|
||||
|
||||
// get the file's icon from either the WPS or PM
|
||||
bool fWpsIcon = false;
|
||||
HPOINTER hIcon = GetIcon(filePath, fileExists,
|
||||
desiredImageSize <= 16, &fWpsIcon);
|
||||
if (hIcon == NULLHANDLE)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// get the color & mask bitmaps used by the icon
|
||||
POINTERINFO IconInfo;
|
||||
if (!WinQueryPointerInfo(hIcon, &IconInfo)) {
|
||||
DestroyIcon(hIcon, fWpsIcon);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// if we need a mini-icon, use those bitmaps if present;
|
||||
// otherwise, signal that the icon needs to be shrunk
|
||||
bool fShrink = FALSE;
|
||||
if (desiredImageSize <= 16) {
|
||||
if (IconInfo.hbmMiniPointer) {
|
||||
IconInfo.hbmColor = IconInfo.hbmMiniColor;
|
||||
IconInfo.hbmPointer = IconInfo.hbmMiniPointer;
|
||||
} else {
|
||||
fShrink = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// various resources to be allocated
|
||||
PBITMAPINFO2 pBMInfo = 0;
|
||||
uint8_t* pInBuf = 0;
|
||||
uint8_t* pOutBuf = 0;
|
||||
HDC hdc = 0;
|
||||
HPS hps = 0;
|
||||
|
||||
// using this dummy do{...}while(0) "loop" guarantees that resources will
|
||||
// be deallocated, but eliminates the need for nesting, and generally makes
|
||||
// testing for & dealing with errors pretty painless (just 'break')
|
||||
do {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
// get the details for the color bitmap; if there isn't one
|
||||
// or this is 1-bit color, exit
|
||||
BITMAPINFOHEADER2 BMHeader;
|
||||
BMHeader.cbFix = sizeof(BMHeader);
|
||||
if (!IconInfo.hbmColor ||
|
||||
!GpiQueryBitmapInfoHeader(IconInfo.hbmColor, &BMHeader) ||
|
||||
BMHeader.cBitCount == 1)
|
||||
break;
|
||||
|
||||
// alloc space for the color bitmap's info, including its color table
|
||||
uint32_t cbBMInfo = sizeof(BITMAPINFO2) + (sizeof(RGB2) * 255);
|
||||
pBMInfo = (PBITMAPINFO2)nsMemory::Alloc(cbBMInfo);
|
||||
if (!pBMInfo)
|
||||
break;
|
||||
|
||||
// alloc space for the color bitmap data
|
||||
uint32_t cbInRow = ALIGNEDBPR(BMHeader.cx, BMHeader.cBitCount);
|
||||
uint32_t cbInBuf = cbInRow * BMHeader.cy;
|
||||
pInBuf = (uint8_t*)nsMemory::Alloc(cbInBuf);
|
||||
if (!pInBuf)
|
||||
break;
|
||||
memset(pInBuf, 0, cbInBuf);
|
||||
|
||||
// alloc space for the BGRA32 bitmap we're creating
|
||||
uint32_t cxOut = fShrink ? BMHeader.cx / 2 : BMHeader.cx;
|
||||
uint32_t cyOut = fShrink ? BMHeader.cy / 2 : BMHeader.cy;
|
||||
uint32_t cbOutBuf = 2 + ALIGNEDBPR(cxOut, 32) * cyOut;
|
||||
pOutBuf = (uint8_t*)nsMemory::Alloc(cbOutBuf);
|
||||
if (!pOutBuf)
|
||||
break;
|
||||
memset(pOutBuf, 0, cbOutBuf);
|
||||
|
||||
// create a DC and PS
|
||||
DEVOPENSTRUC dop = {NULL, "DISPLAY", NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
hdc = DevOpenDC((HAB)0, OD_MEMORY, "*", 5L, (PDEVOPENDATA)&dop, NULLHANDLE);
|
||||
if (!hdc)
|
||||
break;
|
||||
|
||||
SIZEL sizel = {0,0};
|
||||
hps = GpiCreatePS((HAB)0, hdc, &sizel, GPIA_ASSOC | PU_PELS | GPIT_MICRO);
|
||||
if (!hps)
|
||||
break;
|
||||
|
||||
// get the color bits
|
||||
memset(pBMInfo, 0, cbBMInfo);
|
||||
*((PBITMAPINFOHEADER2)pBMInfo) = BMHeader;
|
||||
GpiSetBitmap(hps, IconInfo.hbmColor);
|
||||
if (GpiQueryBitmapBits(hps, 0L, (LONG)BMHeader.cy,
|
||||
(BYTE*)pInBuf, pBMInfo) <= 0)
|
||||
break;
|
||||
|
||||
// The first 2 bytes are the width & height of the icon in pixels,
|
||||
// the remaining bytes are BGRA32 (B in first byte, A in last)
|
||||
uint8_t* outPtr = pOutBuf;
|
||||
*outPtr++ = (uint8_t)cxOut;
|
||||
*outPtr++ = (uint8_t)cyOut;
|
||||
|
||||
// convert the color bitmap
|
||||
pBMInfo->cbImage = cbInBuf;
|
||||
ConvertColorBitMap(pInBuf, pBMInfo, outPtr, fShrink);
|
||||
|
||||
// now we need to tack on the alpha data, so jump back to the first
|
||||
// pixel in the output buffer
|
||||
outPtr = pOutBuf+2;
|
||||
|
||||
// Get the mask info
|
||||
BMHeader.cbFix = sizeof(BMHeader);
|
||||
if (!GpiQueryBitmapInfoHeader(IconInfo.hbmPointer, &BMHeader))
|
||||
break;
|
||||
|
||||
// if the existing input buffer isn't large enough, reallocate it
|
||||
cbInRow = ALIGNEDBPR(BMHeader.cx, BMHeader.cBitCount);
|
||||
if ((cbInRow * BMHeader.cy) > cbInBuf) // Need more for mask
|
||||
{
|
||||
cbInBuf = cbInRow * BMHeader.cy;
|
||||
nsMemory::Free(pInBuf);
|
||||
pInBuf = (uint8_t*)nsMemory::Alloc(cbInBuf);
|
||||
memset(pInBuf, 0, cbInBuf);
|
||||
}
|
||||
|
||||
// get the mask/alpha bits
|
||||
memset(pBMInfo, 0, cbBMInfo);
|
||||
*((PBITMAPINFOHEADER2)pBMInfo) = BMHeader;
|
||||
GpiSetBitmap(hps, IconInfo.hbmPointer);
|
||||
if (GpiQueryBitmapBits(hps, 0L, (LONG)BMHeader.cy,
|
||||
(BYTE*)pInBuf, pBMInfo) <= 0)
|
||||
break;
|
||||
|
||||
// convert the mask/alpha bitmap
|
||||
pBMInfo->cbImage = cbInBuf;
|
||||
ConvertMaskBitMap(pInBuf, pBMInfo, outPtr, fShrink);
|
||||
|
||||
// create a pipe
|
||||
nsCOMPtr<nsIInputStream> inStream;
|
||||
nsCOMPtr<nsIOutputStream> outStream;
|
||||
rv = NS_NewPipe(getter_AddRefs(inStream), getter_AddRefs(outStream),
|
||||
cbOutBuf, cbOutBuf, nonBlocking);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
// put our data into the pipe
|
||||
uint32_t written;
|
||||
rv = outStream->Write(reinterpret_cast<const char*>(pOutBuf),
|
||||
cbOutBuf, &written);
|
||||
if (NS_FAILED(rv))
|
||||
break;
|
||||
|
||||
// success! so addref the pipe
|
||||
NS_ADDREF(*_retval = inStream);
|
||||
} while (0);
|
||||
|
||||
// free all the resources we allocated
|
||||
if (pOutBuf)
|
||||
nsMemory::Free(pOutBuf);
|
||||
if (pInBuf)
|
||||
nsMemory::Free(pInBuf);
|
||||
if (pBMInfo)
|
||||
nsMemory::Free(pBMInfo);
|
||||
if (hps) {
|
||||
GpiAssociate(hps, NULLHANDLE);
|
||||
GpiDestroyPS(hps);
|
||||
}
|
||||
if (hdc)
|
||||
DevCloseDC(hdc);
|
||||
if (hIcon)
|
||||
DestroyIcon(hIcon, fWpsIcon);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// get the file's icon from either the WPS or PM
|
||||
|
||||
static HPOINTER GetIcon(nsCString& file, bool fExists,
|
||||
bool fMini, bool *fWpsIcon)
|
||||
{
|
||||
HPOINTER hRtn = 0;
|
||||
*fWpsIcon = false;
|
||||
|
||||
if (file.IsEmpty()) {
|
||||
// append something so that we get at least the generic icon
|
||||
file.Append("pmwrlw");
|
||||
}
|
||||
|
||||
// if RWS is enabled, try to get the icon from the WPS
|
||||
if (sUseRws) {
|
||||
nsCOMPtr<nsIRwsService> rwsSvc(do_GetService("@mozilla.org/rwsos2;1"));
|
||||
if (!rwsSvc)
|
||||
sUseRws = false;
|
||||
else {
|
||||
if (fExists) {
|
||||
rwsSvc->IconFromPath(file.get(), false, fMini, (uint32_t*)&hRtn);
|
||||
} else {
|
||||
const char *ptr = file.get();
|
||||
if (*ptr == '.')
|
||||
ptr++;
|
||||
rwsSvc->IconFromExtension(ptr, fMini, (uint32_t*)&hRtn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if we got an icon from the WPS, set the flag & exit
|
||||
if (hRtn) {
|
||||
*fWpsIcon = true;
|
||||
return hRtn;
|
||||
}
|
||||
|
||||
// if the file exists already, get its icon
|
||||
if (fExists)
|
||||
return WinLoadFileIcon(file.get(), FALSE);
|
||||
|
||||
// otherwise, create a temporary file with the correct extension,
|
||||
// then retrieve whatever icon PM assigns it
|
||||
if (file.First() == '.')
|
||||
file.Insert("moztmp", 0);
|
||||
|
||||
nsCOMPtr<nsIFile> tempPath;
|
||||
if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(tempPath))) ||
|
||||
NS_FAILED(tempPath->AppendNative(file)))
|
||||
return 0;
|
||||
|
||||
nsAutoCString pathStr;
|
||||
tempPath->GetNativePath(pathStr);
|
||||
FILE* fp = fopen(pathStr.get(), "wb+");
|
||||
if (fp) {
|
||||
fclose(fp);
|
||||
hRtn = WinLoadFileIcon(pathStr.get(), FALSE);
|
||||
remove(pathStr.get());
|
||||
}
|
||||
|
||||
return hRtn;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
static void DestroyIcon(HPOINTER hIcon, bool fWpsIcon)
|
||||
{
|
||||
if (fWpsIcon)
|
||||
WinDestroyPointer(hIcon);
|
||||
else
|
||||
WinFreeFileIcon(hIcon);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// converts 16, 256, & 16M color bitmaps to BGRA32 format; the alpha
|
||||
// channel byte is left open & will be filled in by ConvertMaskBitMap();
|
||||
// since the scanlines in OS/2 bitmaps run bottom-to-top, it starts at the
|
||||
// end of the input buffer & works its way back; Note: only 4-bit, 20x20
|
||||
// icons contain input padding that has to be ignored
|
||||
|
||||
void ConvertColorBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo,
|
||||
uint8_t *outBuf, bool fShrink)
|
||||
{
|
||||
uint32_t next = fShrink ? 2 : 1;
|
||||
uint32_t bprIn = ALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount);
|
||||
uint8_t *pIn = inBuf + (pBMInfo->cy - 1) * bprIn;
|
||||
uint8_t *pOut = outBuf;
|
||||
PRGB2 pColorTable = &pBMInfo->argbColor[0];
|
||||
|
||||
if (pBMInfo->cBitCount == 4) {
|
||||
uint32_t ubprIn = UNALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount);
|
||||
uint32_t padIn = bprIn - ubprIn;
|
||||
|
||||
for (uint32_t row = pBMInfo->cy; row > 0; row -= next) {
|
||||
for (uint32_t ndx = 0; ndx < ubprIn; ndx++, pIn++) {
|
||||
pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[FIRSTPEL(*pIn)], 3);
|
||||
if (!fShrink) {
|
||||
pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[SECONDPEL(*pIn)], 3);
|
||||
}
|
||||
}
|
||||
pIn -= ((next + 1) * bprIn) - padIn;
|
||||
}
|
||||
} else if (pBMInfo->cBitCount == 8) {
|
||||
for (uint32_t row = pBMInfo->cy; row > 0; row -= next) {
|
||||
for (uint32_t ndx = 0; ndx < bprIn; ndx += next, pIn += next) {
|
||||
pOut = 4 + (uint8_t*)memcpy(pOut, &pColorTable[*pIn], 3);
|
||||
}
|
||||
pIn -= (next + 1) * bprIn;
|
||||
}
|
||||
} else if (pBMInfo->cBitCount == 24) {
|
||||
uint32_t next3 = next * 3;
|
||||
for (uint32_t row = pBMInfo->cy; row > 0; row -= next) {
|
||||
for (uint32_t ndx = 0; ndx < bprIn; ndx += next3, pIn += next3) {
|
||||
pOut = 4 + (uint8_t*)memcpy(pOut, pIn, 3);
|
||||
}
|
||||
pIn -= (next + 1) * bprIn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// converts an icon's AND mask into 8-bit alpha data and stores it in the
|
||||
// high-order bytes of the BGRA32 bitmap created by ConvertColorBitMap();
|
||||
// the AND mask is the 2nd half of a pair of bitmaps & the scanlines run
|
||||
// bottom-to-top - starting at the end and working back to the midpoint
|
||||
// converts the entire bitmap; since each row is dword-aligned, 16, 20,
|
||||
// and 40-pixel icons all have padding bits at the end of every row that
|
||||
// must be skipped over
|
||||
|
||||
void ConvertMaskBitMap(uint8_t *inBuf, PBITMAPINFO2 pBMInfo,
|
||||
uint8_t *outBuf, bool fShrink)
|
||||
{
|
||||
uint32_t next = (fShrink ? 2 : 1);
|
||||
uint32_t bprIn = ALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount);
|
||||
uint32_t padIn = bprIn - UNALIGNEDBPR(pBMInfo->cx, pBMInfo->cBitCount);
|
||||
uint8_t *pIn = inBuf + (pBMInfo->cy - 1) * bprIn;
|
||||
uint8_t *pOut = outBuf + 3;
|
||||
|
||||
// for each row or every other row
|
||||
for (uint32_t row = pBMInfo->cy/2; row > 0; row -= next) {
|
||||
|
||||
// for all of the non-padding bits in the row
|
||||
for (uint32_t bits = pBMInfo->cx; bits; pIn++) {
|
||||
uint8_t src = ~(*pIn);
|
||||
uint8_t srcMask = 0x80;
|
||||
|
||||
// for each bit or every other bit in the current byte
|
||||
for ( ; srcMask && bits; srcMask >>= next, bits -= next, pOut += 4) {
|
||||
if (src & srcMask) {
|
||||
*pOut = 0xff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if the row just completed had padding, pIn won't be pointing
|
||||
// at the first byte in the next row; padIn compensates for this
|
||||
pIn -= ((next + 1) * bprIn) - padIn;
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentType(nsACString &aContentType)
|
||||
{
|
||||
aContentType.AssignLiteral(IMAGE_ICON_MS);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::SetContentType(const nsACString &aContentType)
|
||||
{
|
||||
// It doesn't make sense to set the content-type on this type
|
||||
// of channel...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentCharset(nsACString &aContentCharset)
|
||||
{
|
||||
aContentCharset.Truncate();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::SetContentCharset(const nsACString &aContentCharset)
|
||||
{
|
||||
// It doesn't make sense to set the content-charset on this type
|
||||
// of channel...
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDisposition(uint32_t *aContentDisposition)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::SetContentDisposition(uint32_t aContentDisposition)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDispositionFilename(nsAString &aContentDispositionFilename)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::SetContentDispositionFilename(const nsAString &aContentDispositionFilename)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsIconChannel::GetContentDispositionHeader(nsACString &aContentDispositionHeader)
|
||||
{
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetContentLength(int64_t *aContentLength)
|
||||
{
|
||||
*aContentLength = mContentLength;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetContentLength(int64_t aContentLength)
|
||||
{
|
||||
NS_NOTREACHED("nsIconChannel::SetContentLength");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetOwner(nsISupports* *aOwner)
|
||||
{
|
||||
*aOwner = mOwner.get();
|
||||
NS_IF_ADDREF(*aOwner);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetOwner(nsISupports* aOwner)
|
||||
{
|
||||
mOwner = aOwner;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetNotificationCallbacks(nsIInterfaceRequestor* *aNotificationCallbacks)
|
||||
{
|
||||
*aNotificationCallbacks = mCallbacks.get();
|
||||
NS_IF_ADDREF(*aNotificationCallbacks);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::SetNotificationCallbacks(nsIInterfaceRequestor* aNotificationCallbacks)
|
||||
{
|
||||
mCallbacks = aNotificationCallbacks;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::GetSecurityInfo(nsISupports * *aSecurityInfo)
|
||||
{
|
||||
*aSecurityInfo = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIRequestObserver methods
|
||||
NS_IMETHODIMP nsIconChannel::OnStartRequest(nsIRequest* aRequest, nsISupports* aContext)
|
||||
{
|
||||
if (mListener)
|
||||
return mListener->OnStartRequest(this, aContext);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsIconChannel::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatus)
|
||||
{
|
||||
if (mListener) {
|
||||
mListener->OnStopRequest(this, aContext, aStatus);
|
||||
mListener = nullptr;
|
||||
}
|
||||
|
||||
// Remove from load group
|
||||
if (mLoadGroup)
|
||||
mLoadGroup->RemoveRequest(this, nullptr, aStatus);
|
||||
|
||||
// Drop notification callbacks to prevent cycles.
|
||||
mCallbacks = nullptr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// nsIStreamListener methods
|
||||
NS_IMETHODIMP nsIconChannel::OnDataAvailable(nsIRequest* aRequest,
|
||||
nsISupports* aContext,
|
||||
nsIInputStream* aStream,
|
||||
uint64_t aOffset,
|
||||
uint32_t aCount)
|
||||
{
|
||||
if (mListener)
|
||||
return mListener->OnDataAvailable(this, aContext, aStream, aOffset, aCount);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@ -1,56 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* 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/. */
|
||||
|
||||
#ifndef nsIconChannel_h___
|
||||
#define nsIconChannel_h___
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsILoadGroup.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsIInputStreamPump.h"
|
||||
#include "nsIStreamListener.h"
|
||||
|
||||
class nsIFile;
|
||||
|
||||
class nsIconChannel MOZ_FINAL : public nsIChannel, public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_THREADSAFE_ISUPPORTS
|
||||
NS_DECL_NSIREQUEST
|
||||
NS_DECL_NSICHANNEL
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsIconChannel();
|
||||
virtual ~nsIconChannel();
|
||||
|
||||
nsresult Init(nsIURI* uri);
|
||||
|
||||
protected:
|
||||
nsCOMPtr<nsIURI> mUrl;
|
||||
nsCOMPtr<nsIURI> mOriginalURI;
|
||||
int64_t mContentLength;
|
||||
nsCOMPtr<nsILoadGroup> mLoadGroup;
|
||||
nsCOMPtr<nsIInterfaceRequestor> mCallbacks;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
|
||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||
nsCOMPtr<nsIStreamListener> mListener;
|
||||
|
||||
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, uint32_t * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension);
|
||||
nsresult MakeInputStream(nsIInputStream** _retval, bool nonBlocking);
|
||||
};
|
||||
|
||||
#define ID_ICO_FILE 5800
|
||||
#define ID_ICO_FOLDER 5801
|
||||
|
||||
#endif /* nsIconChannel_h___ */
|
@ -15,8 +15,6 @@ elif toolkit == 'qt':
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
DIRS += ['icon/win', 'icon']
|
||||
elif CONFIG['OS_ARCH'] == 'OS2':
|
||||
DIRS += ['icon/os2', 'icon']
|
||||
|
||||
if toolkit == 'cocoa':
|
||||
DIRS += ['icon/mac', 'icon']
|
||||
|
@ -72,11 +72,6 @@ NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
NS_DEFINE_NAMED_CID(NS_OS2LOCALE_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_COLLATION_CID);
|
||||
NS_DEFINE_NAMED_CID(NS_DATETIMEFORMAT_CID);
|
||||
#endif
|
||||
|
||||
static const mozilla::Module::CIDEntry kIntlCIDs[] = {
|
||||
{ &kNS_LBRK_CID, false, nullptr, nsJISx4051LineBreakerConstructor },
|
||||
@ -105,11 +100,6 @@ static const mozilla::Module::CIDEntry kIntlCIDs[] = {
|
||||
#ifdef USE_MAC_LOCALE
|
||||
{ &kNS_COLLATION_CID, false, nullptr, nsCollationMacUCConstructor },
|
||||
{ &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatMacConstructor },
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
{ &kNS_OS2LOCALE_CID, false, nullptr, nsOS2LocaleConstructor },
|
||||
{ &kNS_COLLATION_CID, false, nullptr, nsCollationOS2Constructor },
|
||||
{ &kNS_DATETIMEFORMAT_CID, false, nullptr, nsDateTimeFormatOS2Constructor },
|
||||
#endif
|
||||
{ nullptr }
|
||||
};
|
||||
@ -141,11 +131,6 @@ static const mozilla::Module::ContractIDEntry kIntlContracts[] = {
|
||||
#ifdef USE_MAC_LOCALE
|
||||
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
|
||||
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
|
||||
#endif
|
||||
#ifdef XP_OS2
|
||||
{ NS_OS2LOCALE_CONTRACTID, &kNS_OS2LOCALE_CID },
|
||||
{ NS_COLLATION_CONTRACTID, &kNS_COLLATION_CID },
|
||||
{ NS_DATETIMEFORMAT_CONTRACTID, &kNS_DATETIMEFORMAT_CID },
|
||||
#endif
|
||||
{ nullptr }
|
||||
};
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user