Hook up gtk2 native keybindings for editor. This gets rid of htmlBindings.xml and instead makes the platform-neutral base bindings be included via the preprocessor, allowing the editorBase bindings to not be applied on gtk2. Also, removed obsolete mac CFM package files. Bug 257405, r=bzbarsky, sr=ben.

This commit is contained in:
bryner%brianryner.com 2004-09-10 07:17:31 +00:00
Родитель 4c36660044
Коммит 306fd4d418
38 изменённых файлов: 241 добавлений и 136 удалений

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

@ -299,9 +299,6 @@ content/xbl/Makefile
content/xbl/public/Makefile content/xbl/public/Makefile
content/xbl/src/Makefile content/xbl/src/Makefile
content/xbl/builtin/Makefile content/xbl/builtin/Makefile
content/xbl/builtin/gtk2/Makefile
content/xbl/builtin/unix/Makefile
content/xbl/builtin/win/Makefile
content/xsl/Makefile content/xsl/Makefile
content/xsl/public/Makefile content/xsl/public/Makefile
content/shared/Makefile content/shared/Makefile

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

@ -261,7 +261,6 @@ bin/res/charsetData.properties
bin/res/langGroups.properties bin/res/langGroups.properties
bin/res/language.properties bin/res/language.properties
bin/res/entityTables/* bin/res/entityTables/*
bin/res/builtin/htmlBindings.xml
bin/res/builtin/platformHTMLBindings.xml bin/res/builtin/platformHTMLBindings.xml
; [Personal Security Manager] ; [Personal Security Manager]

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

@ -247,7 +247,6 @@ bin\res\charsetData.properties
bin\res\langGroups.properties bin\res\langGroups.properties
bin\res\language.properties bin\res\language.properties
bin\res\entityTables\* bin\res\entityTables\*
bin\res\builtin\htmlBindings.xml
bin\res\builtin\platformHTMLBindings.xml bin\res\builtin\platformHTMLBindings.xml
; [Personal Security Manager] ; [Personal Security Manager]

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

@ -43,26 +43,29 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk include $(DEPTH)/config/autoconf.mk
ifneq (,$(filter OS2 WINNT,$(OS_ARCH))) ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
DIRS = win PLATFORM_DIR = win
else else
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
DIRS = mac PLATFORM_DIR = mac
else else
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
DIRS = gtk2 PLATFORM_DIR = gtk2
else else
DIRS = unix PLATFORM_DIR = unix
endif endif
endif endif
endif endif
include $(topsrcdir)/config/rules.mk include $(topsrcdir)/config/rules.mk
_BUILTINS = htmlBindings.xml PLATFORM_BINDINGS = $(srcdir)/$(PLATFORM_DIR)/platformHTMLBindings.xml
PREPROCESS_BINDINGS = $(PERL) $(MOZILLA_DIR)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) $(PLATFORM_BINDINGS)
libs:: $(_BUILTINS) $(DIST)/bin/res/builtin/platformHTMLBindings.xml $(DESTDIR)$(mozappdir)/res/builtin/platformHTMLBindings.xml: $(PLATFORM_BINDINGS) $(wildcard $(srcdir)/*.inc)
$(INSTALL) $^ $(DIST)/bin/res/builtin @mkdir -p $(dir $@)
@rm -f $@
@$(PREPROCESS_BINDINGS) > $@
install:: $(_BUILTINS) libs:: $(DIST)/bin/res/builtin/platformHTMLBindings.xml
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res/builtin
install:: $(DESTDIR)$(mozappdir)/res/builtin/platformHTMLBindings.xml

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

@ -0,0 +1,36 @@
<handler event="draggesture">
<!--
nsDragAndDrop.startDrag(event, contentAreaDNDObserver);
-->
</handler>
<handler event="dragover">
<!--
nsDragAndDrop.dragOver(event, contentAreaDNDObserver);
-->
</handler>
<handler event="dragdrop">
<!--
nsDragAndDrop.drop(event, contentAreaDNDObserver);
-->
</handler>
<handler event="keypress" key=" " modifiers="shift" command="cmd_scrollPageUp" />
<handler event="keypress" key=" " command="cmd_scrollPageDown" />
<handler event="keypress" keycode="VK_UP" command="cmd_scrollLineUp" />
<handler event="keypress" keycode="VK_DOWN" command="cmd_scrollLineDown" />
<handler event="keypress" keycode="VK_LEFT" command="cmd_scrollLeft" />
<handler event="keypress" keycode="VK_RIGHT" command="cmd_scrollRight" />
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
<handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
<handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
<handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
<handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>
<handler event="keypress" key="/" command="cmd_findTypeText"/>
<handler event="keypress" key="'" command="cmd_findTypeLinks"/>

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

@ -0,0 +1,14 @@
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" command="cmd_selectCharPrevious" modifiers="shift"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_selectCharNext" modifiers="shift"/>
<handler event="keypress" keycode="VK_UP" command="cmd_linePrevious"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_lineNext"/>
<handler event="keypress" keycode="VK_UP" command="cmd_selectLinePrevious" modifiers="shift"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_selectLineNext" modifiers="shift"/>
<handler event="keypress" key="z" command="cmd_undo" modifiers="accel"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
<handler event="keypress" key="x" command="cmd_cut" modifiers="accel"/>
<handler event="keypress" key="c" command="cmd_copy" modifiers="accel"/>
<handler event="keypress" key="v" command="cmd_paste" modifiers="accel"/>
<handler event="keypress" key="a" command="cmd_selectAll" modifiers="accel"/>

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

@ -1 +0,0 @@
Makefile

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

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

@ -33,6 +33,7 @@
<binding id="browser"> <binding id="browser">
<handlers> <handlers>
#include ../browser-base.inc
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
@ -63,44 +64,10 @@
<binding id="editor"> <binding id="editor">
<handlers> <handlers>
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/> <handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/> <handler event="keypress" key="z" modifiers="accel,shift" command="cmd_redo"/>
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>
<handler event="keypress" key="u" modifiers="control" command="cmd_deleteToBeginningOfLine"/>
<handler event="keypress" key="a" modifiers="control" command="cmd_beginLine"/>
<handler event="keypress" key="e" modifiers="control" command="cmd_endLine"/>
<handler event="keypress" key="b" modifiers="control" command="cmd_charPrevious"/>
<handler event="keypress" key="f" modifiers="control" command="cmd_charNext"/>
<handler event="keypress" key="p" modifiers="control" command="cmd_linePrevious"/>
<handler event="keypress" key="n" modifiers="control" command="cmd_lineNext"/>
<handler event="keypress" key="x" modifiers="control" command="cmd_cut"/>
<handler event="keypress" key="c" modifiers="control" command="cmd_copy"/>
<handler event="keypress" key="v" modifiers="control" command="cmd_paste"/>
<handler event="keypress" key="z" modifiers="control" command="cmd_undo"/>
<handler event="keypress" key="r" modifiers="accel" command="cmd_redo"/>
<handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/> <handler event="keypress" key="y" modifiers="accel" command="cmd_redo"/>
<handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/> <handler event="keypress" key="a" modifiers="alt" command="cmd_selectAll"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_copyOrDelete"/>
<handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>
<handler event="keypress" keycode="VK_INSERT" modifiers="shift" command="cmd_paste"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="control" command="cmd_wordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="control" command="cmd_wordNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift,control" command="cmd_selectWordPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift,control" command="cmd_selectWordNext"/>
<handler event="keypress" keycode="VK_BACK" modifiers="control" command="cmd_deleteWordBackward"/>
<handler event="keypress" keycode="VK_HOME" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_selectBeginLine"/>
<handler event="keypress" keycode="VK_END" modifiers="shift" command="cmd_selectEndLine"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift,control" command="cmd_selectTop"/>
<handler event="keypress" keycode="VK_END" modifiers="shift,control" command="cmd_selectBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="control" command="cmd_moveTop"/>
<handler event="keypress" keycode="VK_END" modifiers="control" command="cmd_moveBottom"/>
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" modifiers="shift" command="cmd_selectPageDown"/>
<handler event="keypress" keycode="VK_F20" command="cmd_cut" /> <handler event="keypress" keycode="VK_F20" command="cmd_cut" />
<handler event="keypress" keycode="VK_F16" command="cmd_copy" /> <handler event="keypress" keycode="VK_F16" command="cmd_copy" />
<handler event="keypress" keycode="VK_F18" command="cmd_paste" /> <handler event="keypress" keycode="VK_F18" command="cmd_paste" />

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

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

@ -0,0 +1,15 @@
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift"
command="cmd_selectCharPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift"
command="cmd_selectCharNext"/>
<!-- Cut/copy/paste/undo -->
<handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
<handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
<handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>

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

@ -1 +0,0 @@
Makefile

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

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

@ -4,9 +4,9 @@
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="inputFields" extends="resource://gre/res/builtin/htmlBindings.xml#inputFieldsBase"> <binding id="inputFields">
<handlers> <handlers>
#include ../input-fields-base.inc
<handler event="keypress" keycode="VK_UP" command="cmd_beginLine"/> <handler event="keypress" keycode="VK_UP" command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_endLine"/> <handler event="keypress" keycode="VK_DOWN" command="cmd_endLine"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectBeginLine"/> <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectBeginLine"/>
@ -27,8 +27,9 @@
</handlers> </handlers>
</binding> </binding>
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase"> <binding id="textAreas">
<handlers> <handlers>
#include ../textareas-base.inc
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/> <handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/> <handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/> <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/>
@ -61,6 +62,7 @@
<binding id="browser"> <binding id="browser">
<handlers> <handlers>
#include ../browser-base.inc
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/> <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
@ -77,6 +79,7 @@
<binding id="editor"> <binding id="editor">
<handlers> <handlers>
#include ../editor-base.inc
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop" /> <handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop" />
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom" /> <handler event="keypress" keycode="VK_END" command="cmd_scrollBottom" />
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/> <handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/>

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

@ -0,0 +1,20 @@
<handler event="keypress" keycode="VK_LEFT" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_LEFT" modifiers="shift"
command="cmd_selectCharPrevious"/>
<handler event="keypress" keycode="VK_RIGHT" modifiers="shift"
command="cmd_selectCharNext"/>
<handler event="keypress" keycode="VK_UP" command="cmd_linePrevious"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_lineNext"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift"
command="cmd_selectLinePrevious"/>
<handler event="keypress" keycode="VK_DOWN" modifiers="shift"
command="cmd_selectLineNext"/>
<!-- Cut/copy/paste/undo -->
<handler event="keypress" key="c" modifiers="accel" command="cmd_copy"/>
<handler event="keypress" key="x" modifiers="accel" command="cmd_cut"/>
<handler event="keypress" key="v" modifiers="accel" command="cmd_paste"/>
<handler event="keypress" key="z" modifiers="accel" command="cmd_undo"/>
<handler event="keypress" key="z" command="cmd_redo" modifiers="accel,shift" />
<handler event="keypress" key="a" modifiers="accel" command="cmd_selectAll"/>

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

@ -1 +0,0 @@
Makefile

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

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

@ -4,8 +4,9 @@
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="inputFields" extends="resource://gre/res/builtin/htmlBindings.xml#inputFieldsBase"> <binding id="inputFields">
<handlers> <handlers>
#include ../input-fields-base.inc
<!-- Emacsish single-line motion and delete keys --> <!-- Emacsish single-line motion and delete keys -->
<handler event="keypress" key="a" modifiers="control" <handler event="keypress" key="a" modifiers="control"
command="cmd_beginLine"/> command="cmd_beginLine"/>
@ -75,9 +76,9 @@
</handlers> </handlers>
</binding> </binding>
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase"> <binding id="textAreas">
<handlers> <handlers>
#include ../textareas-base.inc
<!-- Emacsish single-line motion and delete keys --> <!-- Emacsish single-line motion and delete keys -->
<handler event="keypress" key="a" modifiers="control" <handler event="keypress" key="a" modifiers="control"
command="cmd_beginLine"/> command="cmd_beginLine"/>
@ -165,6 +166,7 @@
<binding id="browser"> <binding id="browser">
<handlers> <handlers>
#include ../browser-base.inc
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
@ -195,6 +197,7 @@
<binding id="editor"> <binding id="editor">
<handlers> <handlers>
#include ../editor-base.inc
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/> <handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/> <handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
<handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/> <handler event="keypress" key="k" modifiers="control" command="cmd_deleteToEndOfLine"/>

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

@ -1 +0,0 @@
Makefile

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

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

@ -4,8 +4,9 @@
xmlns="http://www.mozilla.org/xbl" xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<binding id="inputFields" extends="resource://gre/res/builtin/htmlBindings.xml#inputFieldsBase"> <binding id="inputFields">
<handlers> <handlers>
#include ../input-fields-base.inc
<handler event="keypress" keycode="VK_UP" command="cmd_charPrevious"/> <handler event="keypress" keycode="VK_UP" command="cmd_charPrevious"/>
<handler event="keypress" keycode="VK_DOWN" command="cmd_charNext"/> <handler event="keypress" keycode="VK_DOWN" command="cmd_charNext"/>
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectCharPrevious"/> <handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectCharPrevious"/>
@ -48,8 +49,9 @@
</handlers> </handlers>
</binding> </binding>
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase"> <binding id="textAreas">
<handlers> <handlers>
#include ../textareas-base.inc
<handler event="keypress" keycode="VK_HOME" <handler event="keypress" keycode="VK_HOME"
command="cmd_beginLine"/> command="cmd_beginLine"/>
<handler event="keypress" keycode="VK_END" <handler event="keypress" keycode="VK_END"
@ -87,6 +89,7 @@
<binding id="browser"> <binding id="browser">
<handlers> <handlers>
#include ../browser-base.inc
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" command="cmd_movePageUp"/>
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/> <handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_movePageDown"/>
<handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/> <handler event="keypress" keycode="VK_PAGE_UP" modifiers="shift" command="cmd_selectPageUp"/>
@ -112,6 +115,7 @@
<binding id="editor"> <binding id="editor">
<handlers> <handlers>
#include ../editor-base.inc
<handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/> <handler event="keypress" keycode="VK_DELETE" modifiers="shift" command="cmd_cutOrDelete"/>
<handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/> <handler event="keypress" keycode="VK_DELETE" modifiers="control" command="cmd_deleteWordForward"/>
<handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/> <handler event="keypress" keycode="VK_INSERT" modifiers="control" command="cmd_copy"/>

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

@ -78,15 +78,8 @@ nsXBLWindowDragHandler::WalkHandlers(nsIDOMEvent* aDragEvent, nsIAtom* aEventTyp
if (!dragEvent) if (!dragEvent)
return NS_OK; return NS_OK;
EnsureHandlers(); EnsureHandlers(nsnull);
if (!mElement) {
WalkHandlersInternal(aDragEvent, aEventType, mPlatformHandler);
evt->GetPreventDefault(&prevent);
if (prevent)
return NS_OK; // Handled by the platform. Our work here is done.
}
WalkHandlersInternal(aDragEvent, aEventType, mHandler); WalkHandlersInternal(aDragEvent, aEventType, mHandler);
return NS_OK; return NS_OK;

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

@ -72,11 +72,9 @@ class nsXBLSpecialDocInfo
{ {
public: public:
nsCOMPtr<nsIXBLDocumentInfo> mHTMLBindings; nsCOMPtr<nsIXBLDocumentInfo> mHTMLBindings;
nsCOMPtr<nsIXBLDocumentInfo> mPlatformHTMLBindings;
nsCOMPtr<nsIXBLDocumentInfo> mUserHTMLBindings; nsCOMPtr<nsIXBLDocumentInfo> mUserHTMLBindings;
static const char sHTMLBindingStr[]; static const char sHTMLBindingStr[];
static const char sPlatformHTMLBindingStr[];
static const char sUserHTMLBindingStr[]; static const char sUserHTMLBindingStr[];
PRBool mInitialized; PRBool mInitialized;
@ -85,7 +83,6 @@ public:
void LoadDocInfo(); void LoadDocInfo();
void GetAllHandlers(const char* aType, void GetAllHandlers(const char* aType,
nsXBLPrototypeHandler** handler, nsXBLPrototypeHandler** handler,
nsXBLPrototypeHandler** platformHandler,
nsXBLPrototypeHandler** userHandler); nsXBLPrototypeHandler** userHandler);
void GetHandlers(nsIXBLDocumentInfo* aInfo, void GetHandlers(nsIXBLDocumentInfo* aInfo,
const nsACString& aRef, const nsACString& aRef,
@ -94,8 +91,7 @@ public:
nsXBLSpecialDocInfo() : mInitialized(PR_FALSE) {}; nsXBLSpecialDocInfo() : mInitialized(PR_FALSE) {};
}; };
const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource://gre/res/builtin/htmlBindings.xml"; const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource://gre/res/builtin/platformHTMLBindings.xml";
const char nsXBLSpecialDocInfo::sPlatformHTMLBindingStr[] = "resource://gre/res/builtin/platformHTMLBindings.xml";
// Allow for a userHTMLBindings.xml. // Allow for a userHTMLBindings.xml.
// XXXbsmedberg Should be in the profile chrome directory, when we have a resource mapping for that // XXXbsmedberg Should be in the profile chrome directory, when we have a resource mapping for that
const char nsXBLSpecialDocInfo::sUserHTMLBindingStr[] = "resource://gre/res/builtin/userHTMLBindings.xml"; const char nsXBLSpecialDocInfo::sUserHTMLBindingStr[] = "resource://gre/res/builtin/userHTMLBindings.xml";
@ -112,27 +108,16 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
if (NS_FAILED(rv) || !xblService) if (NS_FAILED(rv) || !xblService)
return; return;
// Obtain the XP and platform doc infos // Obtain the platform doc info
nsCOMPtr<nsIURI> bindingURI; nsCOMPtr<nsIURI> bindingURI;
NS_NewURI(getter_AddRefs(bindingURI), sHTMLBindingStr); NS_NewURI(getter_AddRefs(bindingURI), sHTMLBindingStr);
if (!bindingURI) { if (!bindingURI) {
return; return;
} }
xblService->LoadBindingDocumentInfo(nsnull, nsnull,
bindingURI,
PR_TRUE,
getter_AddRefs(mHTMLBindings));
rv = bindingURI->SetSpec(NS_LITERAL_CSTRING(sPlatformHTMLBindingStr));
if (NS_FAILED(rv)) {
NS_ERROR("Shouldn't fail to set spec here");
return;
}
xblService->LoadBindingDocumentInfo(nsnull, nsnull, xblService->LoadBindingDocumentInfo(nsnull, nsnull,
bindingURI, bindingURI,
PR_TRUE, PR_TRUE,
getter_AddRefs(mPlatformHTMLBindings)); getter_AddRefs(mHTMLBindings));
rv = bindingURI->SetSpec(NS_LITERAL_CSTRING(sUserHTMLBindingStr)); rv = bindingURI->SetSpec(NS_LITERAL_CSTRING(sUserHTMLBindingStr));
if (NS_FAILED(rv)) { if (NS_FAILED(rv)) {
@ -168,7 +153,6 @@ nsXBLSpecialDocInfo::GetHandlers(nsIXBLDocumentInfo* aInfo,
void void
nsXBLSpecialDocInfo::GetAllHandlers(const char* aType, nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
nsXBLPrototypeHandler** aHandler, nsXBLPrototypeHandler** aHandler,
nsXBLPrototypeHandler** aPlatformHandler,
nsXBLPrototypeHandler** aUserHandler) nsXBLPrototypeHandler** aUserHandler)
{ {
if (mUserHTMLBindings) { if (mUserHTMLBindings) {
@ -176,14 +160,8 @@ nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
type.Append("User"); type.Append("User");
GetHandlers(mUserHTMLBindings, type, aUserHandler); GetHandlers(mUserHTMLBindings, type, aUserHandler);
} }
if (mPlatformHTMLBindings) {
nsCAutoString type(aType);
GetHandlers(mPlatformHTMLBindings, type, aPlatformHandler);
}
if (mHTMLBindings) { if (mHTMLBindings) {
nsCAutoString type(aType); GetHandlers(mHTMLBindings, nsDependentCString(aType), aHandler);
type.Append("Base");
GetHandlers(mHTMLBindings, type, aHandler);
} }
} }
@ -202,7 +180,6 @@ nsXBLWindowHandler::nsXBLWindowHandler(nsIDOMElement* aElement,
: mElement(aElement), : mElement(aElement),
mReceiver(aReceiver), mReceiver(aReceiver),
mHandler(nsnull), mHandler(nsnull),
mPlatformHandler(nsnull),
mUserHandler(nsnull) mUserHandler(nsnull)
{ {
++sRefCnt; ++sRefCnt;
@ -339,10 +316,10 @@ nsXBLWindowHandler::WalkHandlersInternal(nsIDOMEvent* aEvent,
// //
// EnsureHandlers // EnsureHandlers
// //
// Lazily load the XP and platform-specific bindings // Lazily load the platform and user bindings
// //
nsresult nsresult
nsXBLWindowHandler::EnsureHandlers() nsXBLWindowHandler::EnsureHandlers(PRBool *aIsEditor)
{ {
if (!sXBLSpecialDocInfo) if (!sXBLSpecialDocInfo)
sXBLSpecialDocInfo = new nsXBLSpecialDocInfo(); sXBLSpecialDocInfo = new nsXBLSpecialDocInfo();
@ -351,15 +328,17 @@ nsXBLWindowHandler::EnsureHandlers()
sXBLSpecialDocInfo->LoadDocInfo(); sXBLSpecialDocInfo->LoadDocInfo();
// Now determine which handlers we should be using. // Now determine which handlers we should be using.
if (IsEditor()) { PRBool isEditor = IsEditor();
sXBLSpecialDocInfo->GetAllHandlers("editor", &mHandler, &mPlatformHandler, if (isEditor) {
&mUserHandler); sXBLSpecialDocInfo->GetAllHandlers("editor", &mHandler, &mUserHandler);
} }
else { else {
sXBLSpecialDocInfo->GetAllHandlers("browser", &mHandler, &mPlatformHandler, sXBLSpecialDocInfo->GetAllHandlers("browser", &mHandler, &mUserHandler);
&mUserHandler);
} }
if (aIsEditor)
*aIsEditor = isEditor;
return NS_OK; return NS_OK;
} // EnsureHandlers } // EnsureHandlers

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

@ -74,7 +74,7 @@ protected:
PRBool IsEditor() ; PRBool IsEditor() ;
// lazily load the handlers // lazily load the handlers
virtual nsresult EnsureHandlers(); virtual nsresult EnsureHandlers(PRBool *aIsEditor);
// walk the handlers, looking for one to handle the event // walk the handlers, looking for one to handle the event
virtual nsresult WalkHandlersInternal(nsIDOMEvent* aKeyEvent, virtual nsresult WalkHandlersInternal(nsIDOMEvent* aKeyEvent,
@ -91,8 +91,7 @@ protected:
// these are not owning references; the prototype handlers are owned // these are not owning references; the prototype handlers are owned
// by the prototype bindings which are owned by the docinfo. // by the prototype bindings which are owned by the docinfo.
nsXBLPrototypeHandler* mHandler; // XP bindings nsXBLPrototypeHandler* mHandler; // platform bindings
nsXBLPrototypeHandler* mPlatformHandler; // platform-specific bindings
nsXBLPrototypeHandler* mUserHandler; // user-specific bindings nsXBLPrototypeHandler* mUserHandler; // user-specific bindings
static nsXBLSpecialDocInfo* sXBLSpecialDocInfo; // holds document info about bindings static nsXBLSpecialDocInfo* sXBLSpecialDocInfo; // holds document info about bindings

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

@ -54,7 +54,14 @@
#include "nsIScriptGlobalObject.h" #include "nsIScriptGlobalObject.h"
#include "nsIDOMElement.h" #include "nsIDOMElement.h"
#include "nsXBLAtoms.h" #include "nsXBLAtoms.h"
#include "nsINativeKeyBindings.h"
#include "nsIController.h"
#include "nsIControllers.h"
#include "nsIDOMWindowInternal.h"
#include "nsIFocusController.h"
#include "nsPIWindowRoot.h"
static nsINativeKeyBindings *sNativeEditorBindings = nsnull;
nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver) nsXBLWindowKeyHandler::nsXBLWindowKeyHandler(nsIDOMElement* aElement, nsIDOMEventReceiver* aReceiver)
: nsXBLWindowHandler(aElement, aReceiver) : nsXBLWindowHandler(aElement, aReceiver)
@ -99,21 +106,54 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
// to a particular element rather than the document // to a particular element rather than the document
// //
nsresult nsresult
nsXBLWindowKeyHandler::EnsureHandlers() nsXBLWindowKeyHandler::EnsureHandlers(PRBool *aIsEditor)
{ {
if (mElement) { if (mElement) {
// We are actually a XUL <keyset>. // We are actually a XUL <keyset>.
if (mHandler) if (mHandler) {
if (aIsEditor)
*aIsEditor = PR_FALSE;
return NS_OK; return NS_OK;
}
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement)); nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
BuildHandlerChain(content, &mHandler); BuildHandlerChain(content, &mHandler);
} }
else // We are an XBL file of handlers. else // We are an XBL file of handlers.
nsXBLWindowHandler::EnsureHandlers(); nsXBLWindowHandler::EnsureHandlers(aIsEditor);
return NS_OK; return NS_OK;
} }
static nsINativeKeyBindings*
GetEditorKeyBindings()
{
static PRBool noBindings = PR_FALSE;
if (!sNativeEditorBindings && !noBindings) {
CallGetService(NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "editor",
&sNativeEditorBindings);
if (!sNativeEditorBindings) {
noBindings = PR_TRUE;
}
}
return sNativeEditorBindings;
}
static void
DoCommandCallback(const char *aCommand, void *aData)
{
nsIControllers *controllers = NS_STATIC_CAST(nsIControllers*, aData);
if (controllers) {
nsCOMPtr<nsIController> controller;
controllers->GetControllerForCommand(aCommand, getter_AddRefs(controller));
if (controller) {
controller->DoCommand(aCommand);
}
}
}
NS_IMETHODIMP NS_IMETHODIMP
nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType) nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
@ -140,25 +180,57 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
if (!keyEvent) if (!keyEvent)
return NS_OK; return NS_OK;
EnsureHandlers(); PRBool isEditor;
EnsureHandlers(&isEditor);
if (!mElement) { if (!mElement) {
if (mUserHandler) { if (mUserHandler) {
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler); WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler);
evt->GetPreventDefault(&prevent); evt->GetPreventDefault(&prevent);
if (prevent) if (prevent)
return NS_OK; // Handled by the platform. Our work here is done. return NS_OK; // Handled by the user bindings. Our work here is done.
}
if (mPlatformHandler) {
WalkHandlersInternal(aKeyEvent, aEventType, mPlatformHandler);
evt->GetPreventDefault(&prevent);
if (prevent)
return NS_OK; // Handled by the platform. Our work here is done.
} }
} }
WalkHandlersInternal(aKeyEvent, aEventType, mHandler); WalkHandlersInternal(aKeyEvent, aEventType, mHandler);
nsINativeKeyBindings *nativeBindings;
if (isEditor && (nativeBindings = GetEditorKeyBindings())) {
nsNativeKeyEvent nativeEvent;
keyEvent->GetCharCode(&nativeEvent.charCode);
keyEvent->GetKeyCode(&nativeEvent.keyCode);
keyEvent->GetAltKey(&nativeEvent.altKey);
keyEvent->GetCtrlKey(&nativeEvent.ctrlKey);
keyEvent->GetShiftKey(&nativeEvent.shiftKey);
keyEvent->GetMetaKey(&nativeEvent.metaKey);
// get the DOM window we're attached to
nsCOMPtr<nsIControllers> controllers;
nsCOMPtr<nsPIWindowRoot> root = do_QueryInterface(mReceiver);
if (root) {
nsCOMPtr<nsIFocusController> fc;
root->GetFocusController(getter_AddRefs(fc));
if (fc) {
fc->GetControllers(getter_AddRefs(controllers));
}
}
PRBool handled;
if (aEventType == nsXBLAtoms::keyup) {
handled = sNativeEditorBindings->KeyUp(nativeEvent,
DoCommandCallback, controllers);
} else if (aEventType == nsXBLAtoms::keypress) {
handled = sNativeEditorBindings->KeyPress(nativeEvent,
DoCommandCallback, controllers);
} else {
handled = sNativeEditorBindings->KeyDown(nativeEvent,
DoCommandCallback, controllers);
}
if (handled)
aKeyEvent->PreventDefault();
}
return NS_OK; return NS_OK;
} }
@ -195,7 +267,12 @@ nsXBLWindowKeyHandler::EventMatched(nsXBLPrototypeHandler* inHandler,
return PR_FALSE; return PR_FALSE;
} }
/* static */ void
nsXBLWindowKeyHandler::ShutDown()
{
NS_IF_RELEASE(sNativeEditorBindings);
}
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
nsresult nsresult

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

@ -65,27 +65,20 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// release globals
static NS_HIDDEN_(void) ShutDown();
protected: protected:
NS_IMETHOD WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType); NS_IMETHOD WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType);
// lazily load the handlers. Overridden to handle being attached // lazily load the handlers. Overridden to handle being attached
// to a particular element rather than the document // to a particular element rather than the document
virtual nsresult EnsureHandlers(); virtual nsresult EnsureHandlers(PRBool *aIsEditor);
// check if the given handler cares about the given key event // check if the given handler cares about the given key event
PRBool EventMatched(nsXBLPrototypeHandler* inHandler, nsIAtom* inEventType, PRBool EventMatched(nsXBLPrototypeHandler* inHandler, nsIAtom* inEventType,
nsIDOMEvent* inEvent); nsIDOMEvent* inEvent);
// We need our own refcount (even though our base class has one) because
// we have our own statics that need to be initialized and the creation of
// other subclasses would cause us to miss things if we shared the counter.
static PRUint32 gRefCnt;
static nsIAtom* kKeyUpAtom;
static nsIAtom* kKeyDownAtom;
static nsIAtom* kKeyPressAtom;
}; };
nsresult nsresult

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

@ -243,7 +243,6 @@ res\arrow.gif
res\arrowd.gif res\arrowd.gif
res\loading-image.gif res\loading-image.gif
res\broken-image.gif res\broken-image.gif
res\builtin\htmlBindings.xml
res\builtin\platformHTMLBindings.xml res\builtin\platformHTMLBindings.xml
res\entityTables\html40Special.properties res\entityTables\html40Special.properties
res\entityTables\htmlEntityVersions.properties res\entityTables\htmlEntityVersions.properties

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

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

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

@ -258,7 +258,6 @@ res\arrow.gif
res\arrowd.gif res\arrowd.gif
res\loading-image.gif res\loading-image.gif
res\broken-image.gif res\broken-image.gif
res\builtin\htmlBindings.xml
res\builtin\platformHTMLBindings.xml res\builtin\platformHTMLBindings.xml
res\entityTables\html40Special.properties res\entityTables\html40Special.properties
res\entityTables\htmlEntityVersions.properties res\entityTables\htmlEntityVersions.properties

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

@ -229,6 +229,7 @@ INCLUDES += -I$(srcdir)/../base/src \
-I$(srcdir)/../../content/xul/content/src \ -I$(srcdir)/../../content/xul/content/src \
-I$(srcdir)/../../content/xul/templates/src \ -I$(srcdir)/../../content/xul/templates/src \
-I$(srcdir)/../../content/events/src \ -I$(srcdir)/../../content/events/src \
-I$(srcdir)/../../content/xbl/src \
-I$(topsrcdir)/view/src \ -I$(topsrcdir)/view/src \
-I$(topsrcdir)/dom/src/base \ -I$(topsrcdir)/dom/src/base \
-I$(topsrcdir)/dom/src/jsurl \ -I$(topsrcdir)/dom/src/jsurl \

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

@ -137,6 +137,7 @@
#include "nsViewManager.h" #include "nsViewManager.h"
#include "nsContentCreatorFunctions.h" #include "nsContentCreatorFunctions.h"
#include "nsFrame.h" #include "nsFrame.h"
#include "nsXBLWindowKeyHandler.h"
// DOM includes // DOM includes
#include "nsDOMException.h" #include "nsDOMException.h"
@ -419,6 +420,7 @@ Shutdown()
GlobalWindowImpl::ShutDown(); GlobalWindowImpl::ShutDown();
nsDOMClassInfo::ShutDown(); nsDOMClassInfo::ShutDown();
nsTextControlFrame::ShutDown(); nsTextControlFrame::ShutDown();
nsXBLWindowKeyHandler::ShutDown();
} }
#ifdef NS_DEBUG #ifdef NS_DEBUG

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

@ -64,6 +64,12 @@ NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "input"
#define NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID \ #define NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID \
NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "textarea" NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "textarea"
#define NS_NATIVEKEYBINDINGSEDITOR_CID \
{0xf916ebfb, 0x78ef, 0x464b, {0x94, 0xd0, 0xa6, 0xf2, 0xca, 0x32, 0x00, 0xae}}
#define NS_NATIVEKEYBINDINGSEDITOR_CONTRACTID \
NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "editor"
class nsNativeKeyBindings : public nsINativeKeyBindings class nsNativeKeyBindings : public nsINativeKeyBindings
{ {
public: public:

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

@ -255,6 +255,10 @@ static const nsModuleComponentInfo components[] =
{ "TextArea Native Keybindings", { "TextArea Native Keybindings",
NS_NATIVEKEYBINDINGSTEXTAREA_CID, NS_NATIVEKEYBINDINGSTEXTAREA_CID,
NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID, NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID,
nsNativeKeyBindingsTextAreaConstructor },
{ "Editor Native Keybindings",
NS_NATIVEKEYBINDINGSEDITOR_CID,
NS_NATIVEKEYBINDINGSEDITOR_CONTRACTID,
nsNativeKeyBindingsTextAreaConstructor } nsNativeKeyBindingsTextAreaConstructor }
}; };

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

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

@ -366,7 +366,6 @@ bin/res/rdf/loading.gif
bin/res/throbber/* bin/res/throbber/*
;debug menus reference samples dir - remove for actual releases: ;debug menus reference samples dir - remove for actual releases:
bin/res/samples/* bin/res/samples/*
bin/res/builtin/htmlBindings.xml
bin/res/builtin/platformHTMLBindings.xml bin/res/builtin/platformHTMLBindings.xml
[mail] [mail]

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

@ -280,7 +280,6 @@ bin\res\rdf\loading.gif
bin\res\throbber\* bin\res\throbber\*
;debug menus reference samples dir - remove for actual releases: ;debug menus reference samples dir - remove for actual releases:
bin\res\samples\* bin\res\samples\*
bin\res\builtin\htmlBindings.xml
bin\res\builtin\platformHTMLBindings.xml bin\res\builtin\platformHTMLBindings.xml
[mail] [mail]

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

@ -357,7 +357,6 @@ bin/res/fonts/*
bin/res/dtd/* bin/res/dtd/*
;debug menus reference samples dir - remove for actual releases: ;debug menus reference samples dir - remove for actual releases:
bin/res/samples/* bin/res/samples/*
bin/res/builtin/htmlBindings.xml
bin/res/builtin/platformHTMLBindings.xml bin/res/builtin/platformHTMLBindings.xml