зеркало из https://github.com/mozilla/gecko-dev.git
moved the spacebar handling code from js to c++ so that spacebar works for embedding apps. fixed bug 71760, r=brendan, sr=hyatt, a=blizzard.
This commit is contained in:
Родитель
87a2130326
Коммит
e93a72a5c9
|
@ -30,43 +30,7 @@ Can't yet put script tags in XBL (hyatt has the bug)
|
||||||
-->
|
-->
|
||||||
</handler>
|
</handler>
|
||||||
|
|
||||||
<handler event="keypress" key=" ">
|
<handler event="keypress" key=" " command="cmd_scrollPageDown" />
|
||||||
<![CDATA[
|
|
||||||
var v = document.commandDispatcher.focusedElement;
|
|
||||||
|
|
||||||
if (v) {
|
|
||||||
switch (v.localName) {
|
|
||||||
case 'TEXTAREA':
|
|
||||||
return true;
|
|
||||||
case 'INPUT':
|
|
||||||
switch (v.getAttribute('type').toLowerCase()) {
|
|
||||||
case 'button':
|
|
||||||
case 'image':
|
|
||||||
case 'submit':
|
|
||||||
case 'reset':
|
|
||||||
case 'checkbox':
|
|
||||||
case 'radio':
|
|
||||||
case 'file':
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'BUTTON':
|
|
||||||
switch (v.getAttribute('type').toLowerCase()) {
|
|
||||||
case 'submit':
|
|
||||||
case 'button':
|
|
||||||
case 'reset':
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
var controller =
|
|
||||||
document.commandDispatcher.getControllerForCommand('cmd_scrollPageDown');
|
|
||||||
controller.doCommand('cmd_scrollPageDown');
|
|
||||||
|
|
||||||
return true;
|
|
||||||
]]>
|
|
||||||
</handler>
|
|
||||||
<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" />
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ nsXBLPrototypeHandler::ExecuteHandler(nsIDOMEventReceiver* aReceiver, nsIDOMEven
|
||||||
nsCOMPtr<nsIAtom> tag;
|
nsCOMPtr<nsIAtom> tag;
|
||||||
mHandlerElement->GetTag(*getter_AddRefs(tag));
|
mHandlerElement->GetTag(*getter_AddRefs(tag));
|
||||||
PRBool isXULKey = (tag.get() == nsXULAtoms::key);
|
PRBool isXULKey = (tag.get() == nsXULAtoms::key);
|
||||||
|
|
||||||
PRBool isReceiverCommandElement = PR_FALSE;
|
PRBool isReceiverCommandElement = PR_FALSE;
|
||||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aReceiver));
|
nsCOMPtr<nsIContent> content(do_QueryInterface(aReceiver));
|
||||||
if (isXULKey && content && content.get() != mHandlerElement)
|
if (isXULKey && content && content.get() != mHandlerElement)
|
||||||
|
@ -862,6 +862,20 @@ PRInt32 nsXBLPrototypeHandler::KeyToMask(PRInt32 key)
|
||||||
return cControl; // for warning avoidance
|
return cControl; // for warning avoidance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsXBLPrototypeHandler::GetEventType(nsAWritableString &type)
|
||||||
|
{
|
||||||
|
mHandlerElement->GetAttribute(kNameSpaceID_None, kTypeAtom, type);
|
||||||
|
|
||||||
|
if (type.IsEmpty()) {
|
||||||
|
// If we're a XUL key element, let's assume that we're "keypress".
|
||||||
|
nsCOMPtr<nsIAtom> tag;
|
||||||
|
mHandlerElement->GetTag(*getter_AddRefs(tag));
|
||||||
|
if (tag.get() == kKeyAtom)
|
||||||
|
type = NS_LITERAL_STRING("keypress");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
nsXBLPrototypeHandler::ConstructMask()
|
nsXBLPrototypeHandler::ConstructMask()
|
||||||
{
|
{
|
||||||
|
|
|
@ -84,6 +84,7 @@ protected:
|
||||||
|
|
||||||
inline PRInt32 GetMatchingKeyCode(const nsString& aKeyName);
|
inline PRInt32 GetMatchingKeyCode(const nsString& aKeyName);
|
||||||
void ConstructMask();
|
void ConstructMask();
|
||||||
|
void GetEventType(nsAWritableString& type);
|
||||||
PRBool ModifiersMatchMask(nsIDOMUIEvent* aEvent);
|
PRBool ModifiersMatchMask(nsIDOMUIEvent* aEvent);
|
||||||
|
|
||||||
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
|
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче