зеркало из https://github.com/mozilla/pjs.git
implement accessible objects for xforms date input controls, r=aaronr, aaronlev, sr=neil, b=349644. Patch by Alexander Surkov <surkov.alexander@gmail.com>
This commit is contained in:
Родитель
4bd5ffc000
Коммит
692d5d8271
|
@ -56,7 +56,7 @@ interface nsIPersistentProperties;
|
|||
*
|
||||
* @status UNDER_REVIEW
|
||||
*/
|
||||
[scriptable, uuid(1b9596e8-d7bf-4b99-b032-53a1bf9be1c3)]
|
||||
[scriptable, uuid(09078872-bc66-4854-a9b7-e3d145ca5cd7)]
|
||||
interface nsIAccessible : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -487,7 +487,8 @@ interface nsIAccessible : nsISupports
|
|||
const unsigned long ROLE_IME = 110;
|
||||
const unsigned long ROLE_APP_ROOT = 111;
|
||||
const unsigned long ROLE_PARENT_MENUITEM = 112;
|
||||
const unsigned long ROLE_LAST_ENTRY = 113; // Important -- helps ensure nsRoleMap's are synchronized
|
||||
const unsigned long ROLE_CALENDAR = 113;
|
||||
const unsigned long ROLE_LAST_ENTRY = 114; // Important -- helps ensure nsRoleMap's are synchronized
|
||||
|
||||
// MSAA relationship extensions to accNavigate
|
||||
const unsigned long NAVRELATION_CONTROLLED_BY = 0x1000;
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
object. For that XBL binding of element should implement the interface.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(1a57d854-12df-4b7b-8552-a3cd1fa90618)]
|
||||
[scriptable, uuid(18797ea7-44cc-469e-8923-bd5d1c144461)]
|
||||
interface nsIAccessibleProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -108,6 +108,11 @@ interface nsIAccessibleProvider : nsISupports
|
|||
* Constants set is used by XForms elements.
|
||||
*/
|
||||
|
||||
/** Used for xforms elements that provide accessible object for itself as
|
||||
* well for anonymous content. This property are used for upload,
|
||||
* input[type="xsd:gDay"] and input[type="xsd:gMonth"] */
|
||||
const long XFormsContainer = 0x00002000;
|
||||
|
||||
/** Used for label element */
|
||||
const long XFormsLabel = 0x00002001;
|
||||
/** Used for output element */
|
||||
|
@ -118,19 +123,22 @@ interface nsIAccessibleProvider : nsISupports
|
|||
const long XFormsInput = 0x00002004;
|
||||
/** Used for input[xsd:boolean] element */
|
||||
const long XFormsInputBoolean = 0x00002005;
|
||||
/** Used for input[xsd:date] element */
|
||||
const long XFormsInputDate = 0x00002006;
|
||||
/** Used for secret element */
|
||||
const long XFormsSecret = 0x00002006;
|
||||
const long XFormsSecret = 0x00002007;
|
||||
/** Used for range element represented by slider */
|
||||
const long XFormsSliderRange = 0x00002007;
|
||||
/** Used for xforms elements that provide accessible object for itself as
|
||||
* well for anonymous content. This property are used for upload,
|
||||
* input[type="xsd:gDay"] and input[type="xsd:gMonth"] */
|
||||
const long XFormsContainer = 0x00002008;
|
||||
const long XFormsSliderRange = 0x00002008;
|
||||
/** Used for select and select1 that are implemented using host document's
|
||||
* native widget. For example, a select1 in a xhtml document may be
|
||||
* represented by the native html control html:select */
|
||||
const long XFormsSelect = 0x00002009;
|
||||
|
||||
/** Used for dropmarker widget that is used by xforms elements */
|
||||
const long XFormsDropmarkerWidget = 0x00002101;
|
||||
/** Used for calendar widget that is used by xforms elements */
|
||||
const long XFormsCalendarWidget = 0x00002102;
|
||||
|
||||
/**
|
||||
* Return one of constants declared above.
|
||||
*/
|
||||
|
|
|
@ -93,7 +93,7 @@ PRUint32 atkRoleMap[] = {
|
|||
ATK_ROLE_CHECK_BOX, // nsIAccessible::ROLE_CHECKBUTTON 44
|
||||
ATK_ROLE_RADIO_BUTTON, // nsIAccessible::ROLE_RADIOBUTTON 45
|
||||
ATK_ROLE_COMBO_BOX, // nsIAccessible::ROLE_COMBOBOX 46
|
||||
ATK_ROLE_CALENDAR, // nsIAccessible::ROLE_DROPLIST 47
|
||||
ATK_ROLE_COMBO_BOX, // nsIAccessible::ROLE_DROPLIST 47
|
||||
ATK_ROLE_PROGRESS_BAR, // nsIAccessible::ROLE_PROGRESSBAR 48
|
||||
ATK_ROLE_DIAL, // nsIAccessible::ROLE_DIAL 49
|
||||
ATK_ROLE_UNKNOWN, // nsIAccessible::ROLE_HOTKEYFIELD 50
|
||||
|
@ -159,6 +159,7 @@ PRUint32 atkRoleMap[] = {
|
|||
ATK_ROLE_INPUT_METHOD_WINDOW, // nsIAccessible::ROLE_IME 110
|
||||
ATK_ROLE_APPLICATION, // nsIAccessible::ROLE_APP_ROOT 111
|
||||
ATK_ROLE_MENU, // nsIAccessible::ROLE_PARENT_MENUITEM 112
|
||||
ATK_ROLE_CALENDAR, // nsIAccessible::ROLE_CALENDAR 113
|
||||
kROLE_ATK_LAST_ENTRY // nsIAccessible::ROLE_LAST_ENTRY
|
||||
};
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@
|
|||
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
#include "nsXFormsFormControlsAccessible.h"
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
#endif
|
||||
|
||||
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
|
||||
|
@ -1238,28 +1239,21 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!content->IsNodeOfType(nsINode::eHTML)) {
|
||||
// --- Try creating accessible non-HTML (XUL, etc.) ---
|
||||
// XUL elements may implement nsIAccessibleProvider via XBL
|
||||
// This allows them to say what kind of accessible to create
|
||||
// Non-HTML elements must have an nsIAccessibleProvider, tabindex
|
||||
// or role attribute or they're not in the accessible tree.
|
||||
// Elements may implement nsIAccessibleProvider via XBL. This allows them to
|
||||
// say what kind of accessible to create.
|
||||
nsresult rv = GetAccessibleByType(aNode, getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsresult rv = GetAccessibleByType(aNode, getter_AddRefs(newAcc));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (!newAcc) {
|
||||
if (content->GetNameSpaceID() == kNameSpaceID_SVG &&
|
||||
content->Tag() == nsAccessibilityAtoms::svg) {
|
||||
newAcc = new nsEnumRoleAccessible(aNode, aWeakShell, nsIAccessible::ROLE_DIAGRAM);
|
||||
}
|
||||
else if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
|
||||
content->Tag() == nsAccessibilityAtoms::math) {
|
||||
newAcc = new nsEnumRoleAccessible(aNode, aWeakShell, nsIAccessible::ROLE_EQUATION);
|
||||
}
|
||||
if (!newAcc && !content->IsNodeOfType(nsINode::eHTML)) {
|
||||
if (content->GetNameSpaceID() == kNameSpaceID_SVG &&
|
||||
content->Tag() == nsAccessibilityAtoms::svg) {
|
||||
newAcc = new nsEnumRoleAccessible(aNode, aWeakShell, nsIAccessible::ROLE_DIAGRAM);
|
||||
}
|
||||
}
|
||||
else { // HTML accessibles
|
||||
else if (content->GetNameSpaceID() == kNameSpaceID_MathML &&
|
||||
content->Tag() == nsAccessibilityAtoms::math) {
|
||||
newAcc = new nsEnumRoleAccessible(aNode, aWeakShell, nsIAccessible::ROLE_EQUATION);
|
||||
}
|
||||
} else if (!newAcc) { // HTML accessibles
|
||||
// Prefer to use markup (mostly tag name, perhaps attributes) to
|
||||
// decide if and what kind of accessible to create.
|
||||
CreateHTMLAccessibleByMarkup(frame, aWeakShell, aNode, role, getter_AddRefs(newAcc));
|
||||
|
@ -1550,6 +1544,10 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
|
|||
|
||||
#ifndef DISABLE_XFORMS_HOOKS
|
||||
// XForms elements
|
||||
case nsIAccessibleProvider::XFormsContainer:
|
||||
*aAccessible = new nsXFormsContainerAccessible(aNode, weakShell);
|
||||
break;
|
||||
|
||||
case nsIAccessibleProvider::XFormsLabel:
|
||||
*aAccessible = new nsXFormsLabelAccessible(aNode, weakShell);
|
||||
break;
|
||||
|
@ -1565,18 +1563,25 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
|
|||
case nsIAccessibleProvider::XFormsInputBoolean:
|
||||
*aAccessible = new nsXFormsInputBooleanAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsInputDate:
|
||||
*aAccessible = new nsXFormsInputDateAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsSecret:
|
||||
*aAccessible = new nsXFormsSecretAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsSliderRange:
|
||||
*aAccessible = new nsXFormsRangeAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsContainer:
|
||||
*aAccessible = new nsXFormsContainerAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsSelect:
|
||||
*aAccessible = new nsXFormsSelectAccessible(aNode, weakShell);
|
||||
break;
|
||||
|
||||
case nsIAccessibleProvider::XFormsDropmarkerWidget:
|
||||
*aAccessible = new nsXFormsDropmarkerWidgetAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XFormsCalendarWidget:
|
||||
*aAccessible = new nsXFormsCalendarWidgetAccessible(aNode, weakShell);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
|
|
|
@ -122,7 +122,7 @@ void nsAccessibleTreeWalker::GetKids(nsIDOMNode *aParentNode)
|
|||
// Walk anonymous content? Not currently used for HTML -- anonymous content there uses frame walking
|
||||
mState.siblingIndex = 0; // Indicates our index into the sibling list
|
||||
if (parentContent) {
|
||||
if (mBindingManager && !parentContent->IsNodeOfType(nsINode::eHTML)) {
|
||||
if (mBindingManager) {
|
||||
// Walk anonymous content
|
||||
mBindingManager->GetXBLChildNodesFor(parentContent, getter_AddRefs(mState.siblingList)); // returns null if no anon nodes
|
||||
}
|
||||
|
|
|
@ -155,5 +155,6 @@ static const NSString* AXRoles [] = {
|
|||
NSAccessibilityUnknownRole, // ROLE_IME
|
||||
NSAccessibilityUnknownRole, // ROLE_APP_ROOT. unused on OS X
|
||||
NSAccessibilityMenuItemRole, // ROLE_PARENT_MENUITEM
|
||||
NSAccessibilityGroupRole, // ROLE_CALENDAR
|
||||
@"ROLE_LAST_ENTRY" // ROLE_LAST_ENTRY. bogus role that will never be shown (just marks the end of this array)!
|
||||
};
|
||||
|
|
|
@ -172,5 +172,7 @@ PRUint32 msaaRoleMap[] = {
|
|||
USE_ROLE_STRING, // nsIAccessible::ROLE_IME
|
||||
ROLE_SYSTEM_APPLICATION, // nsIAccessible::ROLE_APP_ROOT
|
||||
ROLE_SYSTEM_MENUITEM, // nsIAccessible::ROLE_PARENT_MENUITEM
|
||||
ROLE_SYSTEM_CLIENT, // nsIAccessible::ROLE_CALENDAR
|
||||
ROLE_MSAA_LAST_ENTRY // nsIAccessible::ROLE_LAST_ENTRY
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ endif
|
|||
CPPSRCS = \
|
||||
nsXFormsAccessible.cpp \
|
||||
nsXFormsFormControlsAccessible.cpp \
|
||||
nsXFormsWidgetsAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -45,13 +45,11 @@
|
|||
#include "nsIXFormsUtilityService.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
|
||||
// nsXFormsAccessible
|
||||
// nsXFormsAccessibleBase
|
||||
|
||||
nsIXFormsUtilityService *nsXFormsAccessible::sXFormsService = nsnull;
|
||||
nsIXFormsUtilityService *nsXFormsAccessibleBase::sXFormsService = nsnull;
|
||||
|
||||
nsXFormsAccessible::
|
||||
nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
nsXFormsAccessibleBase::nsXFormsAccessibleBase()
|
||||
{
|
||||
if (!sXFormsService) {
|
||||
nsresult rv = CallGetService("@mozilla.org/xforms-utility-service;1",
|
||||
|
@ -61,6 +59,14 @@ nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
|||
}
|
||||
}
|
||||
|
||||
// nsXFormsAccessible
|
||||
|
||||
nsXFormsAccessible::
|
||||
nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsHyperTextAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName,
|
||||
nsAString& aValue)
|
||||
|
|
|
@ -44,12 +44,30 @@
|
|||
|
||||
#define NS_NAMESPACE_XFORMS "http://www.w3.org/2002/xforms"
|
||||
|
||||
/**
|
||||
* Utility class that provides access to nsIXFormsUtilityService.
|
||||
*/
|
||||
class nsXFormsAccessibleBase
|
||||
{
|
||||
public:
|
||||
nsXFormsAccessibleBase();
|
||||
|
||||
protected:
|
||||
// Used in GetActionName() methods.
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
// Service allows to get some xforms functionality.
|
||||
static nsIXFormsUtilityService *sXFormsService;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Every XForms element that is bindable to XForms model or is able to contain
|
||||
* XForms hint and XForms label elements should have accessible object. This
|
||||
* class is base class for accessible objects for these XForms elements.
|
||||
*/
|
||||
class nsXFormsAccessible : public nsHyperTextAccessible
|
||||
class nsXFormsAccessible : public nsHyperTextAccessible,
|
||||
public nsXFormsAccessibleBase
|
||||
{
|
||||
public:
|
||||
nsXFormsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
|
||||
|
@ -72,16 +90,10 @@ public:
|
|||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
protected:
|
||||
// Used in GetActionName() methods.
|
||||
enum { eAction_Click = 0 };
|
||||
|
||||
// Returns value of first child xforms element by tagname that is bound to
|
||||
// instance node.
|
||||
nsresult GetBoundChildElementValue(const nsAString& aTagName,
|
||||
nsAString& aValue);
|
||||
|
||||
// Service allows to get some xforms functionality.
|
||||
static nsIXFormsUtilityService *sXFormsService;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -257,6 +257,23 @@ nsXFormsInputBooleanAccessible::DoAction(PRUint8 aIndex)
|
|||
return DoCommand();
|
||||
}
|
||||
|
||||
// nsXFormsInputDateAccessible
|
||||
|
||||
nsXFormsInputDateAccessible::
|
||||
nsXFormsInputDateAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
|
||||
nsXFormsContainerAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsInputDateAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRole);
|
||||
|
||||
*aRole = ROLE_DROPLIST;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsXFormsSecretAccessible
|
||||
|
||||
nsXFormsSecretAccessible::
|
||||
|
|
|
@ -115,6 +115,18 @@ public:
|
|||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
};
|
||||
|
||||
/**
|
||||
* Accessible object for xforms:input[type="xsd:date"].
|
||||
*/
|
||||
|
||||
class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible
|
||||
{
|
||||
public:
|
||||
nsXFormsInputDateAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
};
|
||||
|
||||
/**
|
||||
* Accessible object for xforms:secret.
|
||||
*/
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
|
||||
// nsXFormsDropmarkerWidgetAccessible
|
||||
|
||||
nsXFormsDropmarkerWidgetAccessible::
|
||||
nsXFormsDropmarkerWidgetAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsLeafAccessible(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsDropmarkerWidgetAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRole);
|
||||
|
||||
*aRole = ROLE_PUSHBUTTON;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsDropmarkerWidgetAccessible::GetState(PRUint32 *aState)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aState);
|
||||
|
||||
*aState = 0;
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isOpen)
|
||||
*aState = STATE_PRESSED;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsDropmarkerWidgetAccessible::GetNumActions(PRUint8 *aCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCount);
|
||||
|
||||
*aCount = 1;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsDropmarkerWidgetAccessible::GetActionName(PRUint8 aIndex,
|
||||
nsAString& aName)
|
||||
{
|
||||
if (aIndex != eAction_Click)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsresult rv = sXFormsService->IsDropmarkerOpen(mDOMNode, &isOpen);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (isOpen)
|
||||
aName.AssignLiteral("close");
|
||||
else
|
||||
aName.AssignLiteral("open");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsDropmarkerWidgetAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
if (aIndex != eAction_Click)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
return sXFormsService->ToggleDropmarkerState(mDOMNode);
|
||||
}
|
||||
|
||||
|
||||
// nsXFormsCalendarWidgetAccessible
|
||||
|
||||
nsXFormsCalendarWidgetAccessible::
|
||||
nsXFormsCalendarWidgetAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
|
||||
nsAccessibleWrap(aNode, aShell)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsCalendarWidgetAccessible::GetRole(PRUint32 *aRole)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRole);
|
||||
|
||||
*aRole = ROLE_CALENDAR;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsXFormsWidgetsAccessible_H_
|
||||
#define _nsXFormsWidgetsAccessible_H_
|
||||
|
||||
#include "nsXFormsAccessible.h"
|
||||
#include "nsBaseWidgetAccessible.h"
|
||||
|
||||
/**
|
||||
* Accessible object for dropmarker widget that is used inside xforms elements
|
||||
* of combobox representation. For example, these are xforms:select1,
|
||||
* xforms:input[type="xsd:date"].
|
||||
*/
|
||||
class nsXFormsDropmarkerWidgetAccessible : public nsLeafAccessible,
|
||||
public nsXFormsAccessibleBase
|
||||
{
|
||||
public:
|
||||
nsXFormsDropmarkerWidgetAccessible(nsIDOMNode *aNode,
|
||||
nsIWeakReference *aShell);
|
||||
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
NS_IMETHOD GetState(PRUint32 *aState);
|
||||
|
||||
NS_IMETHOD GetNumActions(PRUint8 *aCount);
|
||||
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(PRUint8 aIndex);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Accessible object for calendar widget. It is used by xforms:input[xsd:date].
|
||||
*/
|
||||
class nsXFormsCalendarWidgetAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsXFormsCalendarWidgetAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
|
||||
|
||||
NS_IMETHOD GetRole(PRUint32 *aRole);
|
||||
};
|
||||
|
||||
#endif
|
|
@ -130,7 +130,20 @@ public:
|
|||
* Return nsIEditor for xforms element if element is editable, null if it is
|
||||
* not editable. Failure if given element doesn't support editing.
|
||||
*/
|
||||
NS_IMETHOD GetEditor(nsIDOMNode *aElemenet, nsIEditor **aEditor) = 0;
|
||||
NS_IMETHOD GetEditor(nsIDOMNode *aElement, nsIEditor **aEditor) = 0;
|
||||
|
||||
/**
|
||||
* Return true if dropmarker is in open state, otherwise false. Failure if
|
||||
* given element is not dropmarker or its parent element isn't supposed to
|
||||
* have dropmarker.
|
||||
*/
|
||||
NS_IMETHOD IsDropmarkerOpen(nsIDOMNode *aElement, PRBool* aIsOpen) = 0;
|
||||
|
||||
/**
|
||||
* Toggles dropmarker state. Failure if given element is not dropmarker or
|
||||
* its parent element isn't supposed to have dropmarker.
|
||||
*/
|
||||
NS_IMETHOD ToggleDropmarkerState(nsIDOMNode *aElement) = 0;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIXFormsUtilityService,
|
||||
|
|
|
@ -151,6 +151,7 @@ XPIDLSRCS = \
|
|||
nsIXFormsEphemeralMessageUI.idl \
|
||||
nsIXFormsRangeConditionAccessors.idl \
|
||||
nsIXFormsNSEditableElement.idl \
|
||||
nsIXFormsComboboxUIWidget.idl \
|
||||
nsIXFormsXPathFunctions.idl \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -38,4 +38,5 @@ xforms.jar:
|
|||
* skin/xforms/contents.rdf (resources/skin/contents.rdf)
|
||||
skin/xforms/widgets-xhtml.css (resources/skin/widgets-xhtml.css)
|
||||
skin/xforms/widgets-xul.css (resources/skin/widgets-xul.css)
|
||||
skin/xforms/input-xul.css (resources/skin/input-xul.css)
|
||||
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla XForms support.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Interface should be implemented by XFroms elements that are represented by
|
||||
* combobox widgets. This interface is used by accessibility module.
|
||||
*
|
||||
* For example, select1[appearance="minimal"] or input[type="xsd:date"].
|
||||
*/
|
||||
[scriptable, uuid(87960cb4-c8da-4727-9db9-4c2232d7018f)]
|
||||
interface nsIXFormsComboboxUIWidget : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get/set open state of popup.
|
||||
*/
|
||||
attribute boolean open;
|
||||
};
|
||||
|
|
@ -39,11 +39,14 @@
|
|||
|
||||
#include "nsXFormsUtilityService.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
|
||||
#include "nsIXFormsDelegate.h"
|
||||
#include "nsIXFormsAccessors.h"
|
||||
#include "nsIXFormsRangeConditionAccessors.h"
|
||||
#include "nsIXFormsRangeAccessors.h"
|
||||
#include "nsIXFormsUIWidget.h"
|
||||
#include "nsIXFormsComboboxUIWidget.h"
|
||||
#include "nsIXFormsNSEditableElement.h"
|
||||
#include "nsXFormsUtils.h"
|
||||
|
||||
|
@ -62,6 +65,13 @@ NS_ENSURE_ARG_POINTER(aElement);\
|
|||
nsCOMPtr<nsIXFormsUIWidget> widget(do_QueryInterface(aElement));\
|
||||
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);\
|
||||
|
||||
#define GET_COMBOBOX_UIWIDGET \
|
||||
NS_ENSURE_ARG_POINTER(aElement);\
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(aElement));\
|
||||
nsCOMPtr<nsIContent> parent(content->GetBindingParent());\
|
||||
nsCOMPtr<nsIXFormsComboboxUIWidget> widget(do_QueryInterface(parent));\
|
||||
NS_ENSURE_TRUE(widget, NS_ERROR_FAILURE);\
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsUtilityService::IsReadonly(nsIDOMNode *aElement, PRBool *aState)
|
||||
{
|
||||
|
@ -179,3 +189,22 @@ nsXFormsUtilityService::GetEditor(nsIDOMNode *aElement, nsIEditor **aEditor)
|
|||
return editable->GetEditor(aEditor);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsUtilityService::IsDropmarkerOpen(nsIDOMNode *aElement, PRBool* aIsOpen)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aIsOpen);
|
||||
|
||||
GET_COMBOBOX_UIWIDGET
|
||||
return widget->GetOpen(aIsOpen);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXFormsUtilityService::ToggleDropmarkerState(nsIDOMNode *aElement)
|
||||
{
|
||||
GET_COMBOBOX_UIWIDGET
|
||||
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsresult rv = widget->GetOpen(&isOpen);
|
||||
return widget->SetOpen(!isOpen);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,5 +64,8 @@ public:
|
|||
NS_IMETHOD GetRangeStep(nsIDOMNode *aElement, nsAString& aValue);
|
||||
|
||||
NS_IMETHOD GetEditor(nsIDOMNode *aElement, nsIEditor **aEditor);
|
||||
|
||||
NS_IMETHOD IsDropmarkerOpen(nsIDOMNode *aElement, PRBool* aIsOpen);
|
||||
NS_IMETHOD ToggleDropmarkerState(nsIDOMNode *aElement);
|
||||
};
|
||||
|
||||
|
|
|
@ -208,16 +208,39 @@
|
|||
extends="#xformswidget-input-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<html:input anonid="control" xbl:inherits="accesskey" size="10"
|
||||
class="xf-value"/>
|
||||
<html:input type="button" anonid="dropmarker"
|
||||
title="&xforms.datepicker.title;"/>
|
||||
<html:span class="-moz-date-container">
|
||||
<html:input anonid="control" xbl:inherits="accesskey" size="10"
|
||||
class="-moz-xforms-date-input xf-value"/>
|
||||
<html:input mozType:dropmarker="true"
|
||||
type="button" anonid="dropmarker"
|
||||
title="&xforms.datepicker.title;"/>
|
||||
</html:span>
|
||||
<html:span mozType:calendar="true" anonid="picker"
|
||||
style="position:absolute; display:none;"/>
|
||||
<children/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<implementation implements="nsIXFormsComboboxUIWidget, nsIAccessibleProvider">
|
||||
<!-- nsIXFormsComboboxUIWidget -->
|
||||
<property name="open">
|
||||
<getter>
|
||||
return this._isPickerVisible;
|
||||
</getter>
|
||||
<setter>
|
||||
if (val)
|
||||
this.showPicker();
|
||||
else
|
||||
this.hidePicker();
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<!-- nsIAccessibleProvider -->
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsInputDate;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="getControlElement">
|
||||
<body>
|
||||
return {
|
||||
|
@ -534,7 +557,7 @@
|
|||
|
||||
<!-- INPUT: <DATE, APPEARANCE='FULL' -->
|
||||
<binding id="xformswidget-input-date-full"
|
||||
extends="chrome://xforms/content/input.xml#xformswidget-input-base">
|
||||
extends="chrome://xforms/content/input.xml#xformswidget-input-date-calendar-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<html:span mozType:calendar="true" anonid="control"/>
|
||||
|
|
|
@ -48,7 +48,8 @@
|
|||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:mozType="http://www.mozilla.org/projects/xforms/2005/type">
|
||||
xmlns:mozType="http://www.mozilla.org/projects/xforms/2005/type"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
|
||||
<!-- INPUT: base widget for input: <default>, textarea: <default> and
|
||||
|
@ -184,17 +185,53 @@
|
|||
<binding id="xformswidget-input-date"
|
||||
extends="#xformswidget-input-base">
|
||||
|
||||
<resources>
|
||||
<stylesheet src="chrome://xforms/skin/input-xul.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<xul:textbox anonid="control" xbl:inherits="accesskey" flex="1"/>
|
||||
<xul:toolbarbutton anonid="dropmarker"/>
|
||||
<xul:hbox class="-moz-menulist-container" flex="1">
|
||||
<html:input anonid="control" xbl:inherits="accesskey" flex="1"
|
||||
class="-moz-menulist-textfield"
|
||||
allowevents="true"/>
|
||||
<xul:dropmarker mozType:dropmarker="true" anonid="dropmarker"
|
||||
xbl:inherits="disabled"/>
|
||||
</xul:hbox>
|
||||
<xul:popup anonid="popup" ignorekeys="true">
|
||||
<xul:box mozType:calendar="true" anonid="picker"/>
|
||||
</xul:popup>
|
||||
<children/>
|
||||
</content>
|
||||
|
||||
<implementation>
|
||||
<implementation implements="nsIXFormsComboboxUIWidget, nsIAccessibleProvider">
|
||||
<!-- nsIXFormsComboboxUIWidget -->
|
||||
<property name="open">
|
||||
<getter>
|
||||
return this._isPickerVisible;
|
||||
</getter>
|
||||
<setter>
|
||||
if (val)
|
||||
this.showPicker();
|
||||
else
|
||||
this.hidePicker();
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<!-- nsIAccessibleProvider -->
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsInputDate;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<method name="getControlElement">
|
||||
<body>
|
||||
return this.ownerDocument.
|
||||
getAnonymousElementByAttribute(this, 'anonid', 'control');
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<constructor>
|
||||
var pickerChangeHandler = {
|
||||
inputControl: this,
|
||||
|
@ -287,9 +324,10 @@
|
|||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- INPUT: <DATE, APPEARANCE='FULL'> -->
|
||||
<binding id="xformswidget-input-date-full"
|
||||
extends="chrome://xforms/content/input.xml#xformswidget-input-base">
|
||||
extends="chrome://xforms/content/input.xml#xformswidget-input-date-calendar-base">
|
||||
<content>
|
||||
<children includes="label"/>
|
||||
<xul:box mozType:calendar="true" anonid="control"/>
|
||||
|
|
|
@ -207,6 +207,19 @@
|
|||
</binding>
|
||||
|
||||
|
||||
<!-- INPUT: Calendar -->
|
||||
<binding id="xformswidget-input-date-calendar-base"
|
||||
extends="#xformswidget-input-base">
|
||||
<implementation>
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsContainer;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- INPUT: Month
|
||||
The input[type="xsd:gMonth"] widget assumes successors bindings implement
|
||||
getElementControl() method what returns the object:
|
||||
|
|
|
@ -42,12 +42,13 @@
|
|||
xmlns:html="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms">
|
||||
xmlns:xforms="http://www.w3.org/2002/xforms"
|
||||
xmlns:mozType="http://www.mozilla.org/projects/xforms/2005/type">
|
||||
|
||||
<!-- select1 -->
|
||||
<binding id="xformswidget-select1"
|
||||
extends="chrome://xforms/content/xforms.xml#xformswidget-base">
|
||||
|
||||
|
||||
<!-- The strange indentation is because of the whitespace nodes.-->
|
||||
<content>
|
||||
<children includes="label|hint"/>
|
||||
|
@ -68,7 +69,7 @@
|
|||
onclick="this.parentNode.parentNode.handleControlClick();"
|
||||
onkeypress="this.parentNode.parentNode.handleKeyPress(event);"
|
||||
oninput="this.parentNode.parentNode.handleInput();"
|
||||
/><html:input class="-moz-xforms-select1-dropdown"
|
||||
/><html:input mozType:dropmarker="true"
|
||||
type="button"
|
||||
anonid="dropmarker"
|
||||
tabindex="-1"
|
||||
|
@ -78,7 +79,7 @@
|
|||
this.previousSibling.focus();"
|
||||
/></html:span></content>
|
||||
|
||||
<implementation implements="nsIXFormsUIWidget, nsIXFormsNSSelect1Element, nsIXFormsNSEditableElement">
|
||||
<implementation implements="nsIXFormsUIWidget, nsIXFormsNSSelect1Element, nsIXFormsNSEditableElement, nsIXFormsComboboxUIWidget">
|
||||
|
||||
<!-- nsIXFormsNSEditableElement -->
|
||||
<property name="editor" readonly="true"
|
||||
|
@ -106,6 +107,19 @@
|
|||
</setter>
|
||||
</property>
|
||||
|
||||
<!-- nsIXFormsComboboxUIWidget -->
|
||||
<property name="open">
|
||||
<getter>
|
||||
return this.popupOpen;
|
||||
</getter>
|
||||
<setter>
|
||||
if (val)
|
||||
this.showPopup();
|
||||
else
|
||||
this.hidePopup();
|
||||
</setter>
|
||||
</property>
|
||||
|
||||
<field name="_inputField">null</field>
|
||||
<field name="_dropMarker">null</field>
|
||||
<field name="_popup">null</field>
|
||||
|
@ -487,13 +501,6 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body>
|
||||
this.popup.style.visibility = "hidden";
|
||||
this.popupOpen = false;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="refreshWidth">
|
||||
<body>
|
||||
<![CDATA[
|
||||
|
@ -518,87 +525,101 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<method name="hidePopup">
|
||||
<body>
|
||||
this.popup.style.visibility = "hidden";
|
||||
this.popupOpen = false;
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="showPopup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (this.popupOpen || this.accessors.isReadonly())
|
||||
return;
|
||||
|
||||
// Calculating the size and position of the popup.
|
||||
var style = "";
|
||||
var containerBox = document.getBoxObjectFor(this.container);
|
||||
var x;
|
||||
var y;
|
||||
var adjust = 0;
|
||||
var absolute = false;
|
||||
var absoluteOffsetY = 0;
|
||||
var p = this.container.offsetParent;
|
||||
var compStyle =
|
||||
document.defaultView.getComputedStyle(p, null);
|
||||
if (compStyle.getPropertyValue("position") != "absolute" &&
|
||||
compStyle.getPropertyValue("position") != "relative") {
|
||||
adjust = document.documentElement.offsetTop;
|
||||
x = containerBox.x;
|
||||
y = containerBox.y;
|
||||
} else {
|
||||
absolute = true;
|
||||
x = this.container.offsetLeft;
|
||||
y = this.container.offsetTop;
|
||||
absoluteOffsetY = y;
|
||||
while (p) {
|
||||
absoluteOffsetY += p.offsetTop;
|
||||
p = p.offsetParent;
|
||||
}
|
||||
}
|
||||
|
||||
var h = containerBox.height;
|
||||
var w = containerBox.width;
|
||||
var targetY = y + h;
|
||||
this.popup.style.maxHeight = "none";
|
||||
var popupBox = document.getBoxObjectFor(this.popup);
|
||||
var popupHeight = popupBox.height;
|
||||
var pY = window.pageYOffset;
|
||||
var iH = window.innerHeight;
|
||||
var belowSelect = absolute
|
||||
? (iH - (absoluteOffsetY + h) - h)
|
||||
: (iH - (y - pY + h - adjust) - h);
|
||||
|
||||
if (belowSelect < popupHeight) {
|
||||
if ((y - pY) > popupHeight) {
|
||||
targetY = y - popupHeight;
|
||||
} else if (belowSelect < (y - pY)) {
|
||||
style = style + "max-height:" + (y - pY - adjust) + "px;";
|
||||
targetY = pY + adjust;
|
||||
} else {
|
||||
style = style + "max-height:" + belowSelect + "px;";
|
||||
}
|
||||
}
|
||||
style = style + "left:" + x + "px;";
|
||||
style = style + "top:" + targetY + "px;";
|
||||
|
||||
style = style + "width:";
|
||||
if (this.selectionOpen) {
|
||||
style = style + w + "px;";
|
||||
} else if (this._width < 0) {
|
||||
style = style + "auto;"
|
||||
} else {
|
||||
style = style + this._width + "px;";
|
||||
}
|
||||
|
||||
style = style + "visibility:visible;";
|
||||
this.popup.setAttribute("style", style);
|
||||
this.popupOpen = true;
|
||||
this._tmpSelected = this._selected;
|
||||
|
||||
if (this._selected) {
|
||||
var el = this._selected.QueryInterface(Components.interfaces.nsIDOMElement);
|
||||
if ("scrollIntoView" in el) {
|
||||
el.scrollIntoView(false);
|
||||
}
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="togglePopup">
|
||||
<body>
|
||||
<![CDATA[
|
||||
if (!this.popupOpen && !this.accessors.isReadonly()) {
|
||||
// Calculating the size and position of the popup.
|
||||
var style = "";
|
||||
var containerBox = document.getBoxObjectFor(this.container);
|
||||
var x;
|
||||
var y;
|
||||
var adjust = 0;
|
||||
var absolute = false;
|
||||
var absoluteOffsetY = 0;
|
||||
var p = this.container.offsetParent;
|
||||
var compStyle =
|
||||
document.defaultView.getComputedStyle(p, null);
|
||||
if (compStyle.getPropertyValue("position") != "absolute" &&
|
||||
compStyle.getPropertyValue("position") != "relative") {
|
||||
adjust = document.documentElement.offsetTop;
|
||||
x = containerBox.x;
|
||||
y = containerBox.y;
|
||||
} else {
|
||||
absolute = true;
|
||||
x = this.container.offsetLeft;
|
||||
y = this.container.offsetTop;
|
||||
absoluteOffsetY = y;
|
||||
while (p) {
|
||||
absoluteOffsetY += p.offsetTop;
|
||||
p = p.offsetParent;
|
||||
}
|
||||
}
|
||||
|
||||
var h = containerBox.height;
|
||||
var w = containerBox.width;
|
||||
var targetY = y + h;
|
||||
this.popup.style.maxHeight = "none";
|
||||
var popupBox = document.getBoxObjectFor(this.popup);
|
||||
var popupHeight = popupBox.height;
|
||||
var pY = window.pageYOffset;
|
||||
var iH = window.innerHeight;
|
||||
var belowSelect = absolute
|
||||
? (iH - (absoluteOffsetY + h) - h)
|
||||
: (iH - (y - pY + h - adjust) - h);
|
||||
|
||||
if (belowSelect < popupHeight) {
|
||||
if ((y - pY) > popupHeight) {
|
||||
targetY = y - popupHeight;
|
||||
} else if (belowSelect < (y - pY)) {
|
||||
style = style + "max-height:" + (y - pY - adjust) + "px;";
|
||||
targetY = pY + adjust;
|
||||
} else {
|
||||
style = style + "max-height:" + belowSelect + "px;";
|
||||
}
|
||||
}
|
||||
style = style + "left:" + x + "px;";
|
||||
style = style + "top:" + targetY + "px;";
|
||||
|
||||
style = style + "width:";
|
||||
if (this.selectionOpen) {
|
||||
style = style + w + "px;";
|
||||
} else if (this._width < 0) {
|
||||
style = style + "auto;"
|
||||
} else {
|
||||
style = style + this._width + "px;";
|
||||
}
|
||||
|
||||
style = style + "visibility:visible;";
|
||||
this.popup.setAttribute("style", style);
|
||||
this.popupOpen = true;
|
||||
this._tmpSelected = this._selected;
|
||||
|
||||
if (this._selected) {
|
||||
var el = this._selected.QueryInterface(Components.interfaces.nsIDOMElement);
|
||||
if ("scrollIntoView" in el) {
|
||||
el.scrollIntoView(false);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!this.popupOpen)
|
||||
this.showPopup();
|
||||
else
|
||||
this.hidePopup();
|
||||
return;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
|
|
|
@ -63,8 +63,8 @@
|
|||
<stylesheet src="chrome://xforms/skin/widgets-xhtml.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<html:table>
|
||||
<content xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#">
|
||||
<html:table role="wairole:grid">
|
||||
<html:tbody anonid="dayContainer"/>
|
||||
</html:table>
|
||||
</content>
|
||||
|
@ -121,6 +121,7 @@
|
|||
var header;
|
||||
for (var i = 0; i < 7; i++) {
|
||||
header = this.ownerDocument.createElementNS(this.XHTML_NS, "th");
|
||||
header.setAttribute("role", "wairole:columnheader");
|
||||
header.textContent = dayOfWeekNames[i];
|
||||
row.appendChild(header);
|
||||
}
|
||||
|
@ -133,6 +134,7 @@
|
|||
|
||||
for (var y = 0; y < 7; y++) {
|
||||
cell = this.ownerDocument.createElementNS(this.XHTML_NS, "td");
|
||||
cell.setAttribute("role", "wairole:gridcell");
|
||||
cell.setAttribute("tabindex", "-1");
|
||||
this._dayElements.push(cell);
|
||||
row.appendChild(cell);
|
||||
|
@ -175,8 +177,8 @@
|
|||
|
||||
<!-- FULL CALENDAR -->
|
||||
<binding id="calendar-full" extends="#calendar-compact">
|
||||
<content>
|
||||
<html:table>
|
||||
<content xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#">
|
||||
<html:table role="wairole:grid">
|
||||
<html:tbody anonid="dayContainer">
|
||||
<html:tr>
|
||||
<html:td colspan="1">
|
||||
|
@ -737,4 +739,21 @@
|
|||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- DROPMARKER -->
|
||||
<binding id="dropmarker">
|
||||
<resources>
|
||||
<stylesheet src="chrome://xforms/skin/widgets-xhtml.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsDropmarkerWidget;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
|
|
@ -62,8 +62,9 @@
|
|||
<stylesheet src="chrome://xforms/skin/widgets-xul.css"/>
|
||||
</resources>
|
||||
|
||||
<content>
|
||||
<xul:grid>
|
||||
<content xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<xul:grid xhtml:role="wairole:grid">
|
||||
<xul:columns>
|
||||
<xul:column flex="1"/>
|
||||
<xul:column flex="1"/>
|
||||
|
@ -135,6 +136,8 @@
|
|||
"description");
|
||||
description.setAttribute("value", dayOfWeekNames[i]);
|
||||
description.setAttribute("class", "header");
|
||||
description.setAttributeNS(this.XHTML_NS, "role",
|
||||
"wairole:columnheader");
|
||||
row.appendChild(description);
|
||||
}
|
||||
this.dayContainer.appendChild(row);
|
||||
|
@ -148,6 +151,7 @@
|
|||
var button = this.ownerDocument.createElementNS(this.XUL_NS,
|
||||
"toolbarbutton");
|
||||
button.setAttribute("tabindex", "-1");
|
||||
button.setAttributeNS(this.XHTML_NS, "role", "wairole:gridcell");
|
||||
this._dayElements.push(button);
|
||||
row.appendChild(button);
|
||||
}
|
||||
|
@ -163,6 +167,9 @@
|
|||
</body>
|
||||
</method>
|
||||
|
||||
<property name="XHTML_NS" readonly="true"
|
||||
onget="return 'http://www.w3.org/1999/xhtml';"/>
|
||||
|
||||
<property name="XUL_NS" readonly="true"
|
||||
onget="return 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';"/>
|
||||
|
||||
|
@ -204,7 +211,9 @@
|
|||
|
||||
<!-- FULL CALENDAR -->
|
||||
<binding id="calendar-full" extends="#calendar-compact">
|
||||
<content orient="vertical">
|
||||
<content orient="vertical"
|
||||
xmlns:wairole="http://www.w3.org/2005/01/wai-rdf/GUIRoleTaxonomy#"
|
||||
xmlns:xhtml="http://www.w3.org/1999/xhtml">
|
||||
<xul:hbox>
|
||||
<!-- month selection section -->
|
||||
<xul:hbox class="list" flex="1">
|
||||
|
@ -229,7 +238,7 @@
|
|||
</xul:hbox>
|
||||
|
||||
<!-- calendar days container-->
|
||||
<xul:grid>
|
||||
<xul:grid xhtml:role="wairole:grid">
|
||||
<xul:columns>
|
||||
<xul:column flex="1"/>
|
||||
<xul:column flex="1"/>
|
||||
|
@ -353,4 +362,20 @@
|
|||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
||||
<!-- DROPMARKER -->
|
||||
<binding id="dropmarker"
|
||||
extends="chrome://global/content/bindings/general.xml#dropmarker">
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsDropmarkerWidget;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
||||
|
|
|
@ -55,9 +55,15 @@
|
|||
currentDay - return day of current date.
|
||||
-->
|
||||
<binding id="calendar-base">
|
||||
<implementation>
|
||||
<!-- interface -->
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<!-- nsIAccessibleProvider -->
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XFormsCalendarWidget;
|
||||
</getter>
|
||||
</property>
|
||||
|
||||
<!-- interface -->
|
||||
<!-- Set/get readonly state -->
|
||||
<property name="readonly">
|
||||
<getter>
|
||||
|
@ -487,4 +493,5 @@
|
|||
</handler>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
</bindings>
|
||||
|
|
|
@ -277,20 +277,6 @@ html|*:root input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] {
|
|||
-moz-binding: url('chrome://xforms/content/input-xhtml.xml#xformswidget-input-date');
|
||||
}
|
||||
|
||||
html|*:root input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] html|input[anonid="dropmarker"] {
|
||||
min-width:27px;
|
||||
min-height: 1.3em;
|
||||
background-image: url(chrome://xforms/content/calendar.png) !important;
|
||||
background-position: center !important;
|
||||
background-repeat: no-repeat !important;
|
||||
}
|
||||
|
||||
xul|*:root input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] xul|toolbarbutton[anonid="dropmarker"] {
|
||||
min-width:27px;
|
||||
min-height: 1.3em;
|
||||
list-style-image: url('chrome://xforms/content/calendar.png');
|
||||
}
|
||||
|
||||
xul|*:root input[mozType|typelist~="http://www.w3.org/2001/XMLSchema#date"] {
|
||||
-moz-binding: url('chrome://xforms/content/input-xul.xml#xformswidget-input-date');
|
||||
}
|
||||
|
@ -569,33 +555,8 @@ xul|*:root select1[appearance="full"] item xul|radio {
|
|||
/* select1[appearance='minimal'] for xhtml styles (most of the select1 specific
|
||||
CSS is copied from forms.css) */
|
||||
|
||||
html|*:root html|input.-moz-xforms-date-dropdown,
|
||||
html|*:root html|input.-moz-xforms-select1-dropdown {
|
||||
width: 12px;
|
||||
height: 1.3em;
|
||||
white-space: nowrap;
|
||||
position: static !important;
|
||||
background-image: url("data:image/gif;base64,R0lGODlhBwAEAIAAAAAAAP%2F%2F%2FyH5BAEAAAEALAAAAAAHAAQAAAIIhA%2BBGWoNWSgAOw%3D%3D") !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: center !important;
|
||||
-moz-appearance: menulist-button;
|
||||
-moz-user-select: none !important;
|
||||
-moz-user-focus: ignore !important;
|
||||
-moz-binding: none;
|
||||
vertical-align: text-top;
|
||||
margin: 0px !important;
|
||||
margin-top: -1px !important;
|
||||
}
|
||||
|
||||
html|*:root html|input.-moz-xforms-select1-dropdown::-moz-focus-inner {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
html|*:root html|input.-moz-xforms-select1-dropdown:active:hover {
|
||||
border-style: outset;
|
||||
}
|
||||
|
||||
html|*:root html|input.-moz-xforms-select1-input {
|
||||
html|*:root html|input.-moz-xforms-select1-input,
|
||||
html|*:root html|input.-moz-xforms-date-input {
|
||||
border: 1px dotted transparent;
|
||||
margin-right: 0px;
|
||||
padding: 0px;
|
||||
|
@ -783,3 +744,12 @@ xul|*:root repeat .xf-repeat-item {
|
|||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
/* native widgets */
|
||||
html|*:root html|input[mozType|dropmarker] {
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xhtml.xml#dropmarker');
|
||||
}
|
||||
|
||||
xul|*:root xul|dropmarker[mozType|dropmarker] {
|
||||
-moz-binding: url('chrome://xforms/content/widgets-xul.xml#dropmarker');
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is Mozilla XForms support.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2006
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
|
||||
|
||||
*|*.-moz-menulist-container {
|
||||
-moz-appearance: menulist;
|
||||
margin: 2px 4px;
|
||||
border: 2px solid;
|
||||
-moz-border-top-colors: ThreeDShadow ThreeDDarkShadow;
|
||||
-moz-border-right-colors: ThreeDHighlight ThreeDLightShadow;
|
||||
-moz-border-bottom-colors: ThreeDHighlight ThreeDLightShadow;
|
||||
-moz-border-left-colors: ThreeDShadow ThreeDDarkShadow;
|
||||
background-color: -moz-Field;
|
||||
color: -moz-FieldText;
|
||||
}
|
||||
|
||||
*|*.-moz-menulist-textfield {
|
||||
margin: 0px !important;
|
||||
border: none !important;
|
||||
padding: 0px !important;
|
||||
background: inherit;
|
||||
font: inherit;
|
||||
}
|
||||
|
|
@ -108,3 +108,30 @@ span[mozType|slider] canvas {
|
|||
margin: 2px;
|
||||
}
|
||||
|
||||
/* dropmarker */
|
||||
|
||||
input[mozType|dropmarker] {
|
||||
width: 12px;
|
||||
height: 1.3em;
|
||||
white-space: nowrap;
|
||||
position: static !important;
|
||||
background-image: url("data:image/gif;base64,R0lGODlhBwAEAIAAAAAAAP%2F%2F%2FyH5BAEAAAEALAAAAAAHAAQAAAIIhA%2BBGWoNWSgAOw%3D%3D") !important;
|
||||
background-repeat: no-repeat !important;
|
||||
background-position: center !important;
|
||||
-moz-appearance: menulist-button;
|
||||
-moz-user-select: none !important;
|
||||
-moz-user-focus: ignore !important;
|
||||
-moz-binding: none;
|
||||
vertical-align: text-top;
|
||||
margin: 0px !important;
|
||||
margin-top: -1px !important;
|
||||
}
|
||||
|
||||
input[mozType|dropmarker]::-moz-focus-inner {
|
||||
border: 0 !important;
|
||||
}
|
||||
|
||||
input[mozType|dropmarker]:active:hover {
|
||||
border-style: outset;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче