зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
4c36660044
Коммит
306fd4d418
|
@ -299,9 +299,6 @@ content/xbl/Makefile
|
|||
content/xbl/public/Makefile
|
||||
content/xbl/src/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/public/Makefile
|
||||
content/shared/Makefile
|
||||
|
|
|
@ -261,7 +261,6 @@ bin/res/charsetData.properties
|
|||
bin/res/langGroups.properties
|
||||
bin/res/language.properties
|
||||
bin/res/entityTables/*
|
||||
bin/res/builtin/htmlBindings.xml
|
||||
bin/res/builtin/platformHTMLBindings.xml
|
||||
|
||||
; [Personal Security Manager]
|
||||
|
|
|
@ -247,7 +247,6 @@ bin\res\charsetData.properties
|
|||
bin\res\langGroups.properties
|
||||
bin\res\language.properties
|
||||
bin\res\entityTables\*
|
||||
bin\res\builtin\htmlBindings.xml
|
||||
bin\res\builtin\platformHTMLBindings.xml
|
||||
|
||||
; [Personal Security Manager]
|
||||
|
|
|
@ -43,26 +43,29 @@ VPATH = @srcdir@
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
ifneq (,$(filter OS2 WINNT,$(OS_ARCH)))
|
||||
DIRS = win
|
||||
PLATFORM_DIR = win
|
||||
else
|
||||
ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
||||
DIRS = mac
|
||||
PLATFORM_DIR = mac
|
||||
else
|
||||
ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
|
||||
DIRS = gtk2
|
||||
PLATFORM_DIR = gtk2
|
||||
else
|
||||
DIRS = unix
|
||||
PLATFORM_DIR = unix
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
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)
|
||||
$(INSTALL) $^ $(DIST)/bin/res/builtin
|
||||
$(DIST)/bin/res/builtin/platformHTMLBindings.xml $(DESTDIR)$(mozappdir)/res/builtin/platformHTMLBindings.xml: $(PLATFORM_BINDINGS) $(wildcard $(srcdir)/*.inc)
|
||||
@mkdir -p $(dir $@)
|
||||
@rm -f $@
|
||||
@$(PREPROCESS_BINDINGS) > $@
|
||||
|
||||
install:: $(_BUILTINS)
|
||||
$(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(mozappdir)/res/builtin
|
||||
libs:: $(DIST)/bin/res/builtin/platformHTMLBindings.xml
|
||||
|
||||
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">
|
||||
<handlers>
|
||||
#include ../browser-base.inc
|
||||
<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"/>
|
||||
|
@ -63,44 +64,10 @@
|
|||
|
||||
<binding id="editor">
|
||||
<handlers>
|
||||
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
|
||||
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
|
||||
<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="z" modifiers="accel" command="cmd_undo"/>
|
||||
<handler event="keypress" key="z" modifiers="accel,shift" 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" 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_F16" command="cmd_copy" />
|
||||
<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: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>
|
||||
|
||||
#include ../input-fields-base.inc
|
||||
<handler event="keypress" keycode="VK_UP" command="cmd_beginLine"/>
|
||||
<handler event="keypress" keycode="VK_DOWN" command="cmd_endLine"/>
|
||||
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectBeginLine"/>
|
||||
|
@ -27,8 +27,9 @@
|
|||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase">
|
||||
<binding id="textAreas">
|
||||
<handlers>
|
||||
#include ../textareas-base.inc
|
||||
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop"/>
|
||||
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom"/>
|
||||
<handler event="keypress" keycode="VK_HOME" modifiers="shift" command="cmd_scrollTop"/>
|
||||
|
@ -61,6 +62,7 @@
|
|||
|
||||
<binding id="browser">
|
||||
<handlers>
|
||||
#include ../browser-base.inc
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp"/>
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown"/>
|
||||
|
||||
|
@ -77,6 +79,7 @@
|
|||
|
||||
<binding id="editor">
|
||||
<handlers>
|
||||
#include ../editor-base.inc
|
||||
<handler event="keypress" keycode="VK_HOME" command="cmd_scrollTop" />
|
||||
<handler event="keypress" keycode="VK_END" command="cmd_scrollBottom" />
|
||||
<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: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>
|
||||
#include ../input-fields-base.inc
|
||||
<!-- Emacsish single-line motion and delete keys -->
|
||||
<handler event="keypress" key="a" modifiers="control"
|
||||
command="cmd_beginLine"/>
|
||||
|
@ -75,9 +76,9 @@
|
|||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase">
|
||||
<binding id="textAreas">
|
||||
<handlers>
|
||||
|
||||
#include ../textareas-base.inc
|
||||
<!-- Emacsish single-line motion and delete keys -->
|
||||
<handler event="keypress" key="a" modifiers="control"
|
||||
command="cmd_beginLine"/>
|
||||
|
@ -165,6 +166,7 @@
|
|||
|
||||
<binding id="browser">
|
||||
<handlers>
|
||||
#include ../browser-base.inc
|
||||
<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"/>
|
||||
|
@ -195,6 +197,7 @@
|
|||
|
||||
<binding id="editor">
|
||||
<handlers>
|
||||
#include ../editor-base.inc
|
||||
<handler event="keypress" key="h" modifiers="control" command="cmd_deleteCharBackward"/>
|
||||
<handler event="keypress" key="d" modifiers="control" command="cmd_deleteCharForward"/>
|
||||
<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: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>
|
||||
#include ../input-fields-base.inc
|
||||
<handler event="keypress" keycode="VK_UP" command="cmd_charPrevious"/>
|
||||
<handler event="keypress" keycode="VK_DOWN" command="cmd_charNext"/>
|
||||
<handler event="keypress" keycode="VK_UP" modifiers="shift" command="cmd_selectCharPrevious"/>
|
||||
|
@ -48,8 +49,9 @@
|
|||
</handlers>
|
||||
</binding>
|
||||
|
||||
<binding id="textAreas" extends="resource://gre/res/builtin/htmlBindings.xml#textAreasBase">
|
||||
<binding id="textAreas">
|
||||
<handlers>
|
||||
#include ../textareas-base.inc
|
||||
<handler event="keypress" keycode="VK_HOME"
|
||||
command="cmd_beginLine"/>
|
||||
<handler event="keypress" keycode="VK_END"
|
||||
|
@ -87,6 +89,7 @@
|
|||
|
||||
<binding id="browser">
|
||||
<handlers>
|
||||
#include ../browser-base.inc
|
||||
<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"/>
|
||||
|
@ -112,6 +115,7 @@
|
|||
|
||||
<binding id="editor">
|
||||
<handlers>
|
||||
#include ../editor-base.inc
|
||||
<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_INSERT" modifiers="control" command="cmd_copy"/>
|
||||
|
|
|
@ -78,15 +78,8 @@ nsXBLWindowDragHandler::WalkHandlers(nsIDOMEvent* aDragEvent, nsIAtom* aEventTyp
|
|||
if (!dragEvent)
|
||||
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);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -72,11 +72,9 @@ class nsXBLSpecialDocInfo
|
|||
{
|
||||
public:
|
||||
nsCOMPtr<nsIXBLDocumentInfo> mHTMLBindings;
|
||||
nsCOMPtr<nsIXBLDocumentInfo> mPlatformHTMLBindings;
|
||||
nsCOMPtr<nsIXBLDocumentInfo> mUserHTMLBindings;
|
||||
|
||||
static const char sHTMLBindingStr[];
|
||||
static const char sPlatformHTMLBindingStr[];
|
||||
static const char sUserHTMLBindingStr[];
|
||||
|
||||
PRBool mInitialized;
|
||||
|
@ -85,7 +83,6 @@ public:
|
|||
void LoadDocInfo();
|
||||
void GetAllHandlers(const char* aType,
|
||||
nsXBLPrototypeHandler** handler,
|
||||
nsXBLPrototypeHandler** platformHandler,
|
||||
nsXBLPrototypeHandler** userHandler);
|
||||
void GetHandlers(nsIXBLDocumentInfo* aInfo,
|
||||
const nsACString& aRef,
|
||||
|
@ -94,8 +91,7 @@ public:
|
|||
nsXBLSpecialDocInfo() : mInitialized(PR_FALSE) {};
|
||||
};
|
||||
|
||||
const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource://gre/res/builtin/htmlBindings.xml";
|
||||
const char nsXBLSpecialDocInfo::sPlatformHTMLBindingStr[] = "resource://gre/res/builtin/platformHTMLBindings.xml";
|
||||
const char nsXBLSpecialDocInfo::sHTMLBindingStr[] = "resource://gre/res/builtin/platformHTMLBindings.xml";
|
||||
// Allow for a userHTMLBindings.xml.
|
||||
// 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";
|
||||
|
@ -112,27 +108,16 @@ void nsXBLSpecialDocInfo::LoadDocInfo()
|
|||
if (NS_FAILED(rv) || !xblService)
|
||||
return;
|
||||
|
||||
// Obtain the XP and platform doc infos
|
||||
// Obtain the platform doc info
|
||||
nsCOMPtr<nsIURI> bindingURI;
|
||||
NS_NewURI(getter_AddRefs(bindingURI), sHTMLBindingStr);
|
||||
if (!bindingURI) {
|
||||
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,
|
||||
bindingURI,
|
||||
PR_TRUE,
|
||||
getter_AddRefs(mPlatformHTMLBindings));
|
||||
getter_AddRefs(mHTMLBindings));
|
||||
|
||||
rv = bindingURI->SetSpec(NS_LITERAL_CSTRING(sUserHTMLBindingStr));
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -168,7 +153,6 @@ nsXBLSpecialDocInfo::GetHandlers(nsIXBLDocumentInfo* aInfo,
|
|||
void
|
||||
nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
|
||||
nsXBLPrototypeHandler** aHandler,
|
||||
nsXBLPrototypeHandler** aPlatformHandler,
|
||||
nsXBLPrototypeHandler** aUserHandler)
|
||||
{
|
||||
if (mUserHTMLBindings) {
|
||||
|
@ -176,14 +160,8 @@ nsXBLSpecialDocInfo::GetAllHandlers(const char* aType,
|
|||
type.Append("User");
|
||||
GetHandlers(mUserHTMLBindings, type, aUserHandler);
|
||||
}
|
||||
if (mPlatformHTMLBindings) {
|
||||
nsCAutoString type(aType);
|
||||
GetHandlers(mPlatformHTMLBindings, type, aPlatformHandler);
|
||||
}
|
||||
if (mHTMLBindings) {
|
||||
nsCAutoString type(aType);
|
||||
type.Append("Base");
|
||||
GetHandlers(mHTMLBindings, type, aHandler);
|
||||
GetHandlers(mHTMLBindings, nsDependentCString(aType), aHandler);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,7 +180,6 @@ nsXBLWindowHandler::nsXBLWindowHandler(nsIDOMElement* aElement,
|
|||
: mElement(aElement),
|
||||
mReceiver(aReceiver),
|
||||
mHandler(nsnull),
|
||||
mPlatformHandler(nsnull),
|
||||
mUserHandler(nsnull)
|
||||
{
|
||||
++sRefCnt;
|
||||
|
@ -339,10 +316,10 @@ nsXBLWindowHandler::WalkHandlersInternal(nsIDOMEvent* aEvent,
|
|||
//
|
||||
// EnsureHandlers
|
||||
//
|
||||
// Lazily load the XP and platform-specific bindings
|
||||
// Lazily load the platform and user bindings
|
||||
//
|
||||
nsresult
|
||||
nsXBLWindowHandler::EnsureHandlers()
|
||||
nsXBLWindowHandler::EnsureHandlers(PRBool *aIsEditor)
|
||||
{
|
||||
if (!sXBLSpecialDocInfo)
|
||||
sXBLSpecialDocInfo = new nsXBLSpecialDocInfo();
|
||||
|
@ -351,15 +328,17 @@ nsXBLWindowHandler::EnsureHandlers()
|
|||
sXBLSpecialDocInfo->LoadDocInfo();
|
||||
|
||||
// Now determine which handlers we should be using.
|
||||
if (IsEditor()) {
|
||||
sXBLSpecialDocInfo->GetAllHandlers("editor", &mHandler, &mPlatformHandler,
|
||||
&mUserHandler);
|
||||
PRBool isEditor = IsEditor();
|
||||
if (isEditor) {
|
||||
sXBLSpecialDocInfo->GetAllHandlers("editor", &mHandler, &mUserHandler);
|
||||
}
|
||||
else {
|
||||
sXBLSpecialDocInfo->GetAllHandlers("browser", &mHandler, &mPlatformHandler,
|
||||
&mUserHandler);
|
||||
sXBLSpecialDocInfo->GetAllHandlers("browser", &mHandler, &mUserHandler);
|
||||
}
|
||||
|
||||
if (aIsEditor)
|
||||
*aIsEditor = isEditor;
|
||||
|
||||
return NS_OK;
|
||||
|
||||
} // EnsureHandlers
|
||||
|
|
|
@ -74,7 +74,7 @@ protected:
|
|||
PRBool IsEditor() ;
|
||||
|
||||
// lazily load the handlers
|
||||
virtual nsresult EnsureHandlers();
|
||||
virtual nsresult EnsureHandlers(PRBool *aIsEditor);
|
||||
|
||||
// walk the handlers, looking for one to handle the event
|
||||
virtual nsresult WalkHandlersInternal(nsIDOMEvent* aKeyEvent,
|
||||
|
@ -91,8 +91,7 @@ protected:
|
|||
|
||||
// these are not owning references; the prototype handlers are owned
|
||||
// by the prototype bindings which are owned by the docinfo.
|
||||
nsXBLPrototypeHandler* mHandler; // XP bindings
|
||||
nsXBLPrototypeHandler* mPlatformHandler; // platform-specific bindings
|
||||
nsXBLPrototypeHandler* mHandler; // platform bindings
|
||||
nsXBLPrototypeHandler* mUserHandler; // user-specific bindings
|
||||
|
||||
static nsXBLSpecialDocInfo* sXBLSpecialDocInfo; // holds document info about bindings
|
||||
|
|
|
@ -54,7 +54,14 @@
|
|||
#include "nsIScriptGlobalObject.h"
|
||||
#include "nsIDOMElement.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)
|
||||
: nsXBLWindowHandler(aElement, aReceiver)
|
||||
|
@ -99,21 +106,54 @@ BuildHandlerChain(nsIContent* aContent, nsXBLPrototypeHandler** aResult)
|
|||
// to a particular element rather than the document
|
||||
//
|
||||
nsresult
|
||||
nsXBLWindowKeyHandler::EnsureHandlers()
|
||||
nsXBLWindowKeyHandler::EnsureHandlers(PRBool *aIsEditor)
|
||||
{
|
||||
if (mElement) {
|
||||
// We are actually a XUL <keyset>.
|
||||
if (mHandler)
|
||||
if (mHandler) {
|
||||
if (aIsEditor)
|
||||
*aIsEditor = PR_FALSE;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(mElement));
|
||||
BuildHandlerChain(content, &mHandler);
|
||||
}
|
||||
else // We are an XBL file of handlers.
|
||||
nsXBLWindowHandler::EnsureHandlers();
|
||||
nsXBLWindowHandler::EnsureHandlers(aIsEditor);
|
||||
|
||||
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
|
||||
nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
|
||||
|
@ -140,25 +180,57 @@ nsXBLWindowKeyHandler::WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType)
|
|||
if (!keyEvent)
|
||||
return NS_OK;
|
||||
|
||||
EnsureHandlers();
|
||||
PRBool isEditor;
|
||||
EnsureHandlers(&isEditor);
|
||||
|
||||
if (!mElement) {
|
||||
if (mUserHandler) {
|
||||
WalkHandlersInternal(aKeyEvent, aEventType, mUserHandler);
|
||||
evt->GetPreventDefault(&prevent);
|
||||
if (prevent)
|
||||
return NS_OK; // Handled by the platform. 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.
|
||||
return NS_OK; // Handled by the user bindings. Our work here is done.
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -195,7 +267,12 @@ nsXBLWindowKeyHandler::EventMatched(nsXBLPrototypeHandler* inHandler,
|
|||
return PR_FALSE;
|
||||
}
|
||||
|
||||
|
||||
/* static */ void
|
||||
nsXBLWindowKeyHandler::ShutDown()
|
||||
{
|
||||
NS_IF_RELEASE(sNativeEditorBindings);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -65,27 +65,20 @@ public:
|
|||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
// release globals
|
||||
static NS_HIDDEN_(void) ShutDown();
|
||||
|
||||
protected:
|
||||
|
||||
NS_IMETHOD WalkHandlers(nsIDOMEvent* aKeyEvent, nsIAtom* aEventType);
|
||||
|
||||
// lazily load the handlers. Overridden to handle being attached
|
||||
// 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
|
||||
PRBool EventMatched(nsXBLPrototypeHandler* inHandler, nsIAtom* inEventType,
|
||||
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
|
||||
|
|
|
@ -243,7 +243,6 @@ res\arrow.gif
|
|||
res\arrowd.gif
|
||||
res\loading-image.gif
|
||||
res\broken-image.gif
|
||||
res\builtin\htmlBindings.xml
|
||||
res\builtin\platformHTMLBindings.xml
|
||||
res\entityTables\html40Special.properties
|
||||
res\entityTables\htmlEntityVersions.properties
|
||||
|
|
|
@ -258,7 +258,6 @@ res\arrow.gif
|
|||
res\arrowd.gif
|
||||
res\loading-image.gif
|
||||
res\broken-image.gif
|
||||
res\builtin\htmlBindings.xml
|
||||
res\builtin\platformHTMLBindings.xml
|
||||
res\entityTables\html40Special.properties
|
||||
res\entityTables\htmlEntityVersions.properties
|
||||
|
|
|
@ -229,6 +229,7 @@ INCLUDES += -I$(srcdir)/../base/src \
|
|||
-I$(srcdir)/../../content/xul/content/src \
|
||||
-I$(srcdir)/../../content/xul/templates/src \
|
||||
-I$(srcdir)/../../content/events/src \
|
||||
-I$(srcdir)/../../content/xbl/src \
|
||||
-I$(topsrcdir)/view/src \
|
||||
-I$(topsrcdir)/dom/src/base \
|
||||
-I$(topsrcdir)/dom/src/jsurl \
|
||||
|
|
|
@ -137,6 +137,7 @@
|
|||
#include "nsViewManager.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsFrame.h"
|
||||
#include "nsXBLWindowKeyHandler.h"
|
||||
|
||||
// DOM includes
|
||||
#include "nsDOMException.h"
|
||||
|
@ -419,6 +420,7 @@ Shutdown()
|
|||
GlobalWindowImpl::ShutDown();
|
||||
nsDOMClassInfo::ShutDown();
|
||||
nsTextControlFrame::ShutDown();
|
||||
nsXBLWindowKeyHandler::ShutDown();
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
|
|
|
@ -64,6 +64,12 @@ NS_NATIVEKEYBINDINGS_CONTRACTID_PREFIX "input"
|
|||
#define NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID \
|
||||
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
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -255,6 +255,10 @@ static const nsModuleComponentInfo components[] =
|
|||
{ "TextArea Native Keybindings",
|
||||
NS_NATIVEKEYBINDINGSTEXTAREA_CID,
|
||||
NS_NATIVEKEYBINDINGSTEXTAREA_CONTRACTID,
|
||||
nsNativeKeyBindingsTextAreaConstructor },
|
||||
{ "Editor Native Keybindings",
|
||||
NS_NATIVEKEYBINDINGSEDITOR_CID,
|
||||
NS_NATIVEKEYBINDINGSEDITOR_CONTRACTID,
|
||||
nsNativeKeyBindingsTextAreaConstructor }
|
||||
};
|
||||
|
||||
|
|
|
@ -366,7 +366,6 @@ bin/res/rdf/loading.gif
|
|||
bin/res/throbber/*
|
||||
;debug menus reference samples dir - remove for actual releases:
|
||||
bin/res/samples/*
|
||||
bin/res/builtin/htmlBindings.xml
|
||||
bin/res/builtin/platformHTMLBindings.xml
|
||||
|
||||
[mail]
|
||||
|
|
|
@ -280,7 +280,6 @@ bin\res\rdf\loading.gif
|
|||
bin\res\throbber\*
|
||||
;debug menus reference samples dir - remove for actual releases:
|
||||
bin\res\samples\*
|
||||
bin\res\builtin\htmlBindings.xml
|
||||
bin\res\builtin\platformHTMLBindings.xml
|
||||
|
||||
[mail]
|
||||
|
|
|
@ -357,7 +357,6 @@ bin/res/fonts/*
|
|||
bin/res/dtd/*
|
||||
;debug menus reference samples dir - remove for actual releases:
|
||||
bin/res/samples/*
|
||||
bin/res/builtin/htmlBindings.xml
|
||||
bin/res/builtin/platformHTMLBindings.xml
|
||||
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче