зеркало из 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 event="keypress" key=" ">
|
||||
<![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" key=" " command="cmd_scrollPageDown" />
|
||||
<handler event="keypress" keycode="VK_PAGE_UP" command="cmd_scrollPageUp" />
|
||||
<handler event="keypress" keycode="VK_PAGE_DOWN" command="cmd_scrollPageDown" />
|
||||
|
||||
|
|
|
@ -862,6 +862,20 @@ PRInt32 nsXBLPrototypeHandler::KeyToMask(PRInt32 key)
|
|||
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
|
||||
nsXBLPrototypeHandler::ConstructMask()
|
||||
{
|
||||
|
|
|
@ -84,6 +84,7 @@ protected:
|
|||
|
||||
inline PRInt32 GetMatchingKeyCode(const nsString& aKeyName);
|
||||
void ConstructMask();
|
||||
void GetEventType(nsAWritableString& type);
|
||||
PRBool ModifiersMatchMask(nsIDOMUIEvent* aEvent);
|
||||
|
||||
inline PRBool KeyEventMatched(nsIDOMKeyEvent* aKeyEvent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче