зеркало из https://github.com/mozilla/gecko-dev.git
Merge m-c to elm
This commit is contained in:
Коммит
f99f8d5a0d
2
CLOBBER
2
CLOBBER
|
@ -18,4 +18,4 @@
|
|||
# Modifying this file will now automatically clobber the buildbot machines \o/
|
||||
#
|
||||
|
||||
Australis landing.
|
||||
More Windows WebIDL changes.
|
||||
|
|
|
@ -253,13 +253,6 @@ endif
|
|||
ifdef BUILD_JS
|
||||
js/src/Makefile: subsrcdir := js/src
|
||||
|
||||
ifdef ENABLE_TESTS
|
||||
# Incorporate static tier directories into tests. This should be incorporated
|
||||
# into moz.build files someday.
|
||||
check::
|
||||
$(call SUBMAKE,$@,js/src)
|
||||
endif
|
||||
|
||||
ifdef MOZ_PSEUDO_DERECURSE
|
||||
# Interdependencies for parallel export.
|
||||
js/xpconnect/src/export: dom/bindings/export xpcom/xpidl/export
|
||||
|
|
|
@ -7,5 +7,3 @@
|
|||
DIRS += ['public', 'src']
|
||||
TEST_DIRS += ['tests']
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@ DEFINES += -DREGISTER_PROXY_DLL
|
|||
|
||||
GARBAGE += $(MIDL_GENERATED_FILES)
|
||||
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
# Please keep this list in sync with the moz.build file until the rest of this
|
||||
# Makefile is ported over.
|
||||
MIDL_INTERFACES = \
|
||||
|
|
|
@ -4,6 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
LIBRARY_NAME = 'IA2Marshal'
|
||||
|
||||
FORCE_SHARED_LIB = True
|
||||
|
|
|
@ -35,7 +35,7 @@ XPIDL_SOURCES += [
|
|||
'nsIXBLAccessible.idl',
|
||||
]
|
||||
|
||||
MODULE = 'accessibility'
|
||||
XPIDL_MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'nsIAccessibilityService.h',
|
||||
|
|
|
@ -8,8 +8,6 @@ DEFINES += -DREGISTER_PROXY_DLL
|
|||
|
||||
GARBAGE += $(MIDL_GENERATED_FILES) done_gen dlldata.c
|
||||
|
||||
FORCE_SHARED_LIB = 1
|
||||
|
||||
MIDL_GENERATED_FILES = \
|
||||
ISimpleDOMNode.h \
|
||||
ISimpleDOMNode_p.c \
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
LIBRARY_NAME = 'AccessibleMarshal'
|
||||
|
||||
GENERATED_SOURCES += [
|
||||
|
@ -17,3 +15,5 @@ GENERATED_SOURCES += [
|
|||
'ISimpleDOMText_i.c',
|
||||
'ISimpleDOMText_p.c',
|
||||
]
|
||||
|
||||
FORCE_SHARED_LIB = True
|
||||
|
|
|
@ -6,24 +6,9 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIEditor;
|
||||
|
||||
[scriptable, uuid(e242d495-5cde-4b1c-8c84-2525b14939f5)]
|
||||
[scriptable, uuid(93d0ba57-0d20-49d1-aede-8fde6699855d)]
|
||||
interface nsIAccessibleEditableText : nsISupports
|
||||
{
|
||||
/**
|
||||
* Sets the attributes for the text between the two given indices. The old
|
||||
* attributes are replaced by the new list of attributes. For example,
|
||||
* sets font styles, such as italic, bold...
|
||||
*
|
||||
* @param startPos - start index of the text whose attributes are modified.
|
||||
* @param endPos - end index of the text whose attributes are modified.
|
||||
* @param attributes - set of attributes that replaces the old list of
|
||||
* attributes of the specified text portion.
|
||||
*/
|
||||
void setAttributes (in long startPos, in long endPos,
|
||||
in nsISupports attributes);
|
||||
|
||||
/**
|
||||
* Replaces the text represented by this object by the given text.
|
||||
*/
|
||||
|
@ -35,7 +20,8 @@ interface nsIAccessibleEditableText : nsISupports
|
|||
* @param text - text that is inserted.
|
||||
* @param position - index at which to insert the text.
|
||||
*/
|
||||
void insertText (in AString text, in long position);
|
||||
[binaryname(ScriptableInsertText)]
|
||||
void insertText(in AString text, in long position);
|
||||
|
||||
/**
|
||||
* Copies the text range into the clipboard.
|
||||
|
@ -43,7 +29,8 @@ interface nsIAccessibleEditableText : nsISupports
|
|||
* @param startPos - start index of the text to moved into the clipboard.
|
||||
* @param endPos - end index of the text to moved into the clipboard.
|
||||
*/
|
||||
void copyText (in long startPos, in long endPos);
|
||||
[binaryname(ScriptableCopyText)]
|
||||
void copyText(in long startPos, in long endPos);
|
||||
|
||||
/**
|
||||
* Deletes a range of text and copies it to the clipboard.
|
||||
|
@ -51,7 +38,8 @@ interface nsIAccessibleEditableText : nsISupports
|
|||
* @param startPos - start index of the text to be deleted.
|
||||
* @param endOffset - end index of the text to be deleted.
|
||||
*/
|
||||
void cutText (in long startPos, in long endPos);
|
||||
[binaryname(ScriptableCutText)]
|
||||
void cutText(in long startPos, in long endPos);
|
||||
|
||||
/**
|
||||
* Deletes a range of text.
|
||||
|
@ -59,7 +47,8 @@ interface nsIAccessibleEditableText : nsISupports
|
|||
* @param startPos - start index of the text to be deleted.
|
||||
* @param endPos - end index of the text to be deleted.
|
||||
*/
|
||||
void deleteText (in long startPos, in long endPos);
|
||||
[binaryname(ScriptableDeleteText)]
|
||||
void deleteText(in long startPos, in long endPos);
|
||||
|
||||
/**
|
||||
* Pastes text from the clipboard.
|
||||
|
@ -67,5 +56,6 @@ interface nsIAccessibleEditableText : nsISupports
|
|||
* @param position - index at which to insert the text from the system
|
||||
* clipboard into the text represented by this object.
|
||||
*/
|
||||
void pasteText (in long position);
|
||||
[binaryname(ScriptablePasteText)]
|
||||
void pasteText(in long position);
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ typedef long AccessibleTextBoundary;
|
|||
interface nsIAccessible;
|
||||
interface nsIPersistentProperties;
|
||||
|
||||
[scriptable, uuid(43d81eb0-1215-4dc4-9226-a4355bd2d20d)]
|
||||
[scriptable, uuid(1e63dd8b-173d-4a68-8ade-fd671abbe1ee)]
|
||||
interface nsIAccessibleText : nsISupports
|
||||
{
|
||||
// In parameters for character offsets:
|
||||
|
@ -32,6 +32,7 @@ interface nsIAccessibleText : nsISupports
|
|||
* The current current caret offset.
|
||||
* If set < 0 then caret will be placed at the end of the text
|
||||
*/
|
||||
[binaryname(ScriptableCaretOffset)]
|
||||
attribute long caretOffset;
|
||||
|
||||
readonly attribute long characterCount;
|
||||
|
@ -168,6 +169,7 @@ interface nsIAccessibleText : nsISupports
|
|||
* @param scrollType defines how to scroll (see nsIAccessibleScrollType for
|
||||
* available constants)
|
||||
*/
|
||||
[binaryname(ScriptableScrollSubstringTo)]
|
||||
void scrollSubstringTo(in long startIndex, in long endIndex,
|
||||
in unsigned long scrollType);
|
||||
|
||||
|
@ -183,6 +185,7 @@ interface nsIAccessibleText : nsISupports
|
|||
* @param x defines the x coordinate
|
||||
* @param y defines the y coordinate
|
||||
*/
|
||||
[binaryname(ScriptableScrollSubstringToPoint)]
|
||||
void scrollSubstringToPoint(in long startIndex, in long endIndex,
|
||||
in unsigned long coordinateType,
|
||||
in long x, in long y);
|
||||
|
|
|
@ -157,6 +157,7 @@ static const gchar* getNameCB (AtkObject *aAtkObj);
|
|||
const gchar* getDescriptionCB (AtkObject *aAtkObj);
|
||||
static AtkRole getRoleCB(AtkObject *aAtkObj);
|
||||
static AtkAttributeSet* getAttributesCB(AtkObject *aAtkObj);
|
||||
static const gchar* GetLocaleCB(AtkObject*);
|
||||
static AtkObject* getParentCB(AtkObject *aAtkObj);
|
||||
static gint getChildCountCB(AtkObject *aAtkObj);
|
||||
static AtkObject* refChildCB(AtkObject *aAtkObj, gint aChildIndex);
|
||||
|
@ -489,6 +490,7 @@ classInitCB(AtkObjectClass *aClass)
|
|||
aClass->get_index_in_parent = getIndexInParentCB;
|
||||
aClass->get_role = getRoleCB;
|
||||
aClass->get_attributes = getAttributesCB;
|
||||
aClass->get_object_locale = GetLocaleCB;
|
||||
aClass->ref_state_set = refStateSetCB;
|
||||
aClass->ref_relation_set = refRelationSetCB;
|
||||
|
||||
|
@ -754,6 +756,18 @@ getAttributesCB(AtkObject *aAtkObj)
|
|||
return accWrap ? GetAttributeSet(accWrap) : nullptr;
|
||||
}
|
||||
|
||||
const gchar*
|
||||
GetLocaleCB(AtkObject* aAtkObj)
|
||||
{
|
||||
AccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
|
||||
if (!accWrap)
|
||||
return nullptr;
|
||||
|
||||
nsAutoString locale;
|
||||
accWrap->Language(locale);
|
||||
return AccessibleWrap::ReturnString(locale);
|
||||
}
|
||||
|
||||
AtkObject *
|
||||
getParentCB(AtkObject *aAtkObj)
|
||||
{
|
||||
|
@ -982,6 +996,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
|||
{
|
||||
a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
|
||||
if (rootAccWrap && rootAccWrap->mActivated) {
|
||||
atk_focus_tracker_notify(atkObj);
|
||||
// Fire state change event for focus
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_FOCUSED, true);
|
||||
return NS_OK;
|
||||
|
@ -1167,6 +1182,7 @@ AccessibleWrap::HandleAccEvent(AccEvent* aEvent)
|
|||
break;
|
||||
|
||||
case nsIAccessibleEvent::EVENT_MENUPOPUP_START:
|
||||
atk_focus_tracker_notify(atkObj); // fire extra focus event
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_VISIBLE, true);
|
||||
atk_object_notify_state_change(atkObj, ATK_STATE_SHOWING, true);
|
||||
break;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORT_LIBRARY = ..
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifdef MOZ_ENABLE_GTK
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS.mozilla.a11y += [
|
||||
'AccessibleWrap.h',
|
||||
'HyperTextAccessibleWrap.h',
|
||||
|
@ -33,10 +31,6 @@ SOURCES += [
|
|||
'UtilInterface.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
'../generic',
|
||||
|
@ -46,3 +40,4 @@ LOCAL_INCLUDES += [
|
|||
'/other-licenses/atk-1.0',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "InterfaceInitFuncs.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "HyperTextAccessible.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
#include "nsString.h"
|
||||
|
@ -28,7 +28,7 @@ setTextContentsCB(AtkEditableText *aText, const gchar *aString)
|
|||
return;
|
||||
|
||||
NS_ConvertUTF8toUTF16 strContent(aString);
|
||||
text->SetTextContents(strContent);
|
||||
text->ReplaceText(strContent);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -26,7 +26,7 @@ getLinkCB(AtkHypertext *aText, gint aLinkIndex)
|
|||
HyperTextAccessible* hyperText = accWrap->AsHyperText();
|
||||
NS_ENSURE_TRUE(hyperText, nullptr);
|
||||
|
||||
Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
|
||||
Accessible* hyperLink = hyperText->LinkAt(aLinkIndex);
|
||||
if (!hyperLink)
|
||||
return nullptr;
|
||||
|
||||
|
@ -49,7 +49,7 @@ getLinkCountCB(AtkHypertext *aText)
|
|||
HyperTextAccessible* hyperText = accWrap->AsHyperText();
|
||||
NS_ENSURE_TRUE(hyperText, -1);
|
||||
|
||||
return hyperText->GetLinkCount();
|
||||
return hyperText->LinkCount();
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -62,11 +62,7 @@ getLinkIndexCB(AtkHypertext *aText, gint aCharIndex)
|
|||
HyperTextAccessible* hyperText = accWrap->AsHyperText();
|
||||
NS_ENSURE_TRUE(hyperText, -1);
|
||||
|
||||
int32_t index = -1;
|
||||
nsresult rv = hyperText->GetLinkIndexAtOffset(aCharIndex, &index);
|
||||
NS_ENSURE_SUCCESS(rv, -1);
|
||||
|
||||
return index;
|
||||
return hyperText->LinkIndexAtOffset(aCharIndex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "InterfaceInitFuncs.h"
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "HyperTextAccessible.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
#include "nsIAccessibleTypes.h"
|
||||
|
@ -43,8 +43,7 @@ getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
|
|||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
nsresult rv = text->GetText(aStartOffset, aEndOffset, autoStr);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
text->TextSubstring(aStartOffset, aEndOffset, autoStr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
|
@ -68,18 +67,14 @@ getTextAfterOffsetCB(AtkText *aText, gint aOffset,
|
|||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
text->GetTextAfterOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
text->TextAfterOffset(aOffset, aBoundaryType, &startOffset, &endOffset, autoStr);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
}
|
||||
|
||||
static gchar*
|
||||
|
@ -97,14 +92,10 @@ getTextAtOffsetCB(AtkText *aText, gint aOffset,
|
|||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
text->GetTextAtOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
text->TextAtOffset(aOffset, aBoundaryType, &startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
|
@ -148,19 +139,16 @@ getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
|
|||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv =
|
||||
text->GetTextBeforeOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
nsAutoString autoStr;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
text->TextBeforeOffset(aOffset, aBoundaryType,
|
||||
&startOffset, &endOffset, autoStr);
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
ConvertTexttoAsterisks(accWrap, autoStr);
|
||||
NS_ConvertUTF16toUTF8 cautoStr(autoStr);
|
||||
return (cautoStr.get()) ? g_strdup(cautoStr.get()) : nullptr;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -174,9 +162,7 @@ getCaretOffsetCB(AtkText *aText)
|
|||
if (!text || !text->IsTextRole())
|
||||
return 0;
|
||||
|
||||
int32_t offset;
|
||||
nsresult rv = text->GetCaretOffset(&offset);
|
||||
return (NS_FAILED(rv)) ? 0 : static_cast<gint>(offset);
|
||||
return static_cast<gint>(text->CaretOffset());
|
||||
}
|
||||
|
||||
static AtkAttributeSet*
|
||||
|
@ -195,17 +181,14 @@ getRunAttributesCB(AtkText *aText, gint aOffset,
|
|||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv = text->GetTextAttributes(false, aOffset,
|
||||
&startOffset, &endOffset,
|
||||
getter_AddRefs(attributes));
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsCOMPtr<nsIPersistentProperties> attributes =
|
||||
text->TextAttributes(false, aOffset, &startOffset, &endOffset);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
return ConvertToAtkAttributeSet(attributes);
|
||||
return ConvertToAtkAttributeSet(attributes);
|
||||
}
|
||||
|
||||
static AtkAttributeSet*
|
||||
|
@ -219,12 +202,8 @@ getDefaultAttributesCB(AtkText *aText)
|
|||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = text->GetDefaultTextAttributes(getter_AddRefs(attributes));
|
||||
if (NS_FAILED(rv))
|
||||
return nullptr;
|
||||
|
||||
return ConvertToAtkAttributeSet(attributes);
|
||||
nsCOMPtr<nsIPersistentProperties> attributes = text->DefaultTextAttributes();
|
||||
return ConvertToAtkAttributeSet(attributes);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -241,27 +220,17 @@ getCharacterExtentsCB(AtkText *aText, gint aOffset,
|
|||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
int32_t extY = 0, extX = 0;
|
||||
int32_t extWidth = 0, extHeight = 0;
|
||||
|
||||
uint32_t geckoCoordType;
|
||||
if (aCoords == ATK_XY_SCREEN)
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
else
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
text->GetCharacterExtents(aOffset, &extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
*aX = extX;
|
||||
*aY = extY;
|
||||
*aWidth = extWidth;
|
||||
*aHeight = extHeight;
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"MaiInterfaceText::GetCharacterExtents, failed\n");
|
||||
nsIntRect rect = text->CharBounds(aOffset, geckoCoordType);
|
||||
*aX = rect.x;
|
||||
*aY = rect.y;
|
||||
*aWidth = rect.width;
|
||||
*aHeight = rect.height;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -276,28 +245,17 @@ getRangeExtentsCB(AtkText *aText, gint aStartOffset, gint aEndOffset,
|
|||
if (!text || !text->IsTextRole())
|
||||
return;
|
||||
|
||||
int32_t extY = 0, extX = 0;
|
||||
int32_t extWidth = 0, extHeight = 0;
|
||||
|
||||
uint32_t geckoCoordType;
|
||||
if (aCoords == ATK_XY_SCREEN)
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
else
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
text->GetRangeExtents(aStartOffset, aEndOffset,
|
||||
&extX, &extY,
|
||||
&extWidth, &extHeight,
|
||||
geckoCoordType);
|
||||
aRect->x = extX;
|
||||
aRect->y = extY;
|
||||
aRect->width = extWidth;
|
||||
aRect->height = extHeight;
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv),
|
||||
"MaiInterfaceText::GetRangeExtents, failed\n");
|
||||
nsIntRect rect = text->TextBounds(aStartOffset, aEndOffset, geckoCoordType);
|
||||
aRect->x = rect.x;
|
||||
aRect->y = rect.y;
|
||||
aRect->width = rect.width;
|
||||
aRect->height = rect.height;
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -325,15 +283,11 @@ getOffsetAtPointCB(AtkText *aText,
|
|||
if (!text || !text->IsTextRole())
|
||||
return -1;
|
||||
|
||||
int32_t offset = 0;
|
||||
uint32_t geckoCoordType;
|
||||
if (aCoords == ATK_XY_SCREEN)
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE;
|
||||
else
|
||||
geckoCoordType = nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE;
|
||||
|
||||
text->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
return static_cast<gint>(offset);
|
||||
return static_cast<gint>(
|
||||
text->OffsetAtPoint(aX, aY,
|
||||
(aCoords == ATK_XY_SCREEN ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_WINDOW_RELATIVE)));
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -347,10 +301,7 @@ getTextSelectionCountCB(AtkText *aText)
|
|||
if (!text || !text->IsTextRole())
|
||||
return 0;
|
||||
|
||||
int32_t selectionCount;
|
||||
nsresult rv = text->GetSelectionCount(&selectionCount);
|
||||
|
||||
return NS_FAILED(rv) ? 0 : selectionCount;
|
||||
return text->SelectionCount();
|
||||
}
|
||||
|
||||
static gchar*
|
||||
|
@ -365,15 +316,12 @@ getTextSelectionCB(AtkText *aText, gint aSelectionNum,
|
|||
if (!text || !text->IsTextRole())
|
||||
return nullptr;
|
||||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv = text->GetSelectionBounds(aSelectionNum,
|
||||
&startOffset, &endOffset);
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
text->SelectionBoundsAt(aSelectionNum, &startOffset, &endOffset);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
return getTextCB(aText, *aStartOffset, *aEndOffset);
|
||||
}
|
||||
|
||||
|
@ -389,11 +337,9 @@ addTextSelectionCB(AtkText *aText,
|
|||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
nsresult rv = text->AddSelection(aStartOffset, aEndOffset);
|
||||
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
return text->AddToSelection(aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -406,11 +352,9 @@ removeTextSelectionCB(AtkText *aText,
|
|||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
nsresult rv = text->RemoveSelection(aSelectionNum);
|
||||
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
return text->RemoveFromSelection(aSelectionNum);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -423,11 +367,9 @@ setTextSelectionCB(AtkText *aText, gint aSelectionNum,
|
|||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
return FALSE;
|
||||
|
||||
nsresult rv = text->SetSelectionBounds(aSelectionNum,
|
||||
aStartOffset, aEndOffset);
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
return text->SetSelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -438,11 +380,11 @@ setCaretOffsetCB(AtkText *aText, gint aOffset)
|
|||
return FALSE;
|
||||
|
||||
HyperTextAccessible* text = accWrap->AsHyperText();
|
||||
if (!text || !text->IsTextRole())
|
||||
return false;
|
||||
if (!text || !text->IsTextRole() || !text->IsValidOffset(aOffset))
|
||||
return FALSE;
|
||||
|
||||
nsresult rv = text->SetCaretOffset(aOffset);
|
||||
return NS_SUCCEEDED(rv) ? TRUE : FALSE;
|
||||
text->SetCaretOffset(aOffset);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5,11 +5,14 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "InterfaceInitFuncs.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsMai.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
extern "C" {
|
||||
|
@ -21,18 +24,13 @@ getCurrentValueCB(AtkValue *obj, GValue *value)
|
|||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleValue> accValue;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accValue));
|
||||
if (!accValue)
|
||||
return;
|
||||
memset (value, 0, sizeof (GValue));
|
||||
double accValue = accWrap->CurValue();
|
||||
if (IsNaN(accValue))
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
double accDouble;
|
||||
if (NS_FAILED(accValue->GetCurrentValue(&accDouble)))
|
||||
return;
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, accDouble);
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, accValue);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -42,18 +40,13 @@ getMaximumValueCB(AtkValue *obj, GValue *value)
|
|||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleValue> accValue;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accValue));
|
||||
if (!accValue)
|
||||
return;
|
||||
memset(value, 0, sizeof (GValue));
|
||||
double accValue = accWrap->MaxValue();
|
||||
if (IsNaN(accValue))
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
double accDouble;
|
||||
if (NS_FAILED(accValue->GetMaximumValue(&accDouble)))
|
||||
return;
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, accDouble);
|
||||
g_value_init(value, G_TYPE_DOUBLE);
|
||||
g_value_set_double(value, accValue);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -63,18 +56,13 @@ getMinimumValueCB(AtkValue *obj, GValue *value)
|
|||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleValue> accValue;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accValue));
|
||||
if (!accValue)
|
||||
return;
|
||||
memset(value, 0, sizeof (GValue));
|
||||
double accValue = accWrap->MinValue();
|
||||
if (IsNaN(accValue))
|
||||
return;
|
||||
|
||||
memset (value, 0, sizeof (GValue));
|
||||
double accDouble;
|
||||
if (NS_FAILED(accValue->GetMinimumValue(&accDouble)))
|
||||
return;
|
||||
g_value_init (value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (value, accDouble);
|
||||
g_value_init(value, G_TYPE_DOUBLE);
|
||||
g_value_set_double(value, accValue);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -84,18 +72,13 @@ getMinimumIncrementCB(AtkValue *obj, GValue *minimumIncrement)
|
|||
if (!accWrap)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIAccessibleValue> accValue;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accValue));
|
||||
if (!accValue)
|
||||
return;
|
||||
memset(minimumIncrement, 0, sizeof (GValue));
|
||||
double accValue = accWrap->Step();
|
||||
if (IsNaN(accValue))
|
||||
accValue = 0; // zero if the minimum increment is undefined
|
||||
|
||||
memset (minimumIncrement, 0, sizeof (GValue));
|
||||
double accDouble;
|
||||
if (NS_FAILED(accValue->GetMinimumIncrement(&accDouble)))
|
||||
return;
|
||||
g_value_init (minimumIncrement, G_TYPE_DOUBLE);
|
||||
g_value_set_double (minimumIncrement, accDouble);
|
||||
g_value_init(minimumIncrement, G_TYPE_DOUBLE);
|
||||
g_value_set_double(minimumIncrement, accValue);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -105,13 +88,8 @@ setCurrentValueCB(AtkValue *obj, const GValue *value)
|
|||
if (!accWrap)
|
||||
return FALSE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleValue> accValue;
|
||||
accWrap->QueryInterface(NS_GET_IID(nsIAccessibleValue),
|
||||
getter_AddRefs(accValue));
|
||||
NS_ENSURE_TRUE(accValue, FALSE);
|
||||
|
||||
double accDouble =g_value_get_double (value);
|
||||
return !NS_FAILED(accValue->SetCurrentValue(accDouble));
|
||||
double accValue =g_value_get_double(value);
|
||||
return accWrap->SetCurValue(accValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -99,22 +99,19 @@ LogDocShellState(nsIDocument* aDocumentNode)
|
|||
printf("docshell busy: ");
|
||||
|
||||
nsAutoCString docShellBusy;
|
||||
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
|
||||
if (container) {
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
|
||||
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
|
||||
docShell->GetBusyFlags(&busyFlags);
|
||||
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE)
|
||||
printf("'none'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY)
|
||||
printf("'busy'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD)
|
||||
printf(", 'before page load'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)
|
||||
printf(", 'page loading'");
|
||||
} else {
|
||||
nsCOMPtr<nsIDocShell> docShell = aDocumentNode->GetDocShell();
|
||||
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
|
||||
docShell->GetBusyFlags(&busyFlags);
|
||||
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE)
|
||||
printf("'none'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY)
|
||||
printf("'busy'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_BEFORE_PAGE_LOAD)
|
||||
printf(", 'before page load'");
|
||||
if (busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)
|
||||
printf(", 'page loading'");
|
||||
|
||||
printf("[failed]");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -132,8 +129,7 @@ static void
|
|||
LogDocShellTree(nsIDocument* aDocumentNode)
|
||||
{
|
||||
if (aDocumentNode->IsActive()) {
|
||||
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentTreeItem));
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
|
|
|
@ -15,10 +15,6 @@
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// Defines the number of selection add/remove events in the queue when they
|
||||
// aren't packed into single selection within event.
|
||||
const unsigned int kSelChangeCountToPack = 5;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// NotificationCollector
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -130,8 +130,8 @@ SelectionManager::ProcessTextSelChangeEvent(AccEvent* aEvent)
|
|||
if (!caretCntr)
|
||||
return;
|
||||
|
||||
int32_t caretOffset = -1;
|
||||
if (NS_SUCCEEDED(caretCntr->GetCaretOffset(&caretOffset)) && caretOffset != -1) {
|
||||
int32_t caretOffset = caretCntr->CaretOffset();
|
||||
if (caretOffset != -1) {
|
||||
nsRefPtr<AccCaretMoveEvent> caretMoveEvent =
|
||||
new AccCaretMoveEvent(caretCntr, caretOffset, aEvent->FromUserInput());
|
||||
nsEventShell::FireEvent(caretMoveEvent);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
include('../shared.mozbuild')
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'AccEvent.h',
|
||||
'nsAccessibilityService.h'
|
||||
|
@ -29,7 +27,7 @@ if CONFIG['MOZ_DEBUG']:
|
|||
'Logging.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'AccCollector.cpp',
|
||||
'AccEvent.cpp',
|
||||
'AccGroupInfo.cpp',
|
||||
|
@ -56,14 +54,10 @@ SOURCES += [
|
|||
]
|
||||
|
||||
if a11y_log:
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'Logging.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_base_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../content/xbl/src',
|
||||
'../../../ipc/chromium/src',
|
||||
|
@ -95,3 +89,5 @@ else:
|
|||
LOCAL_INCLUDES += [
|
||||
'../other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -200,8 +200,7 @@ nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
|
|||
nsIPresShell* ps = aPresShell;
|
||||
nsIDocument* documentNode = aPresShell->GetDocument();
|
||||
if (documentNode) {
|
||||
nsCOMPtr<nsISupports> container = documentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(documentNode->GetDocShell());
|
||||
if (treeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
|
||||
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
|
||||
|
|
|
@ -305,7 +305,7 @@ nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary, bool* aResult)
|
|||
Accessible* root = GetActiveRoot();
|
||||
while (true) {
|
||||
Accessible* curPosition = tempPosition;
|
||||
HyperTextAccessible* text;
|
||||
HyperTextAccessible* text = nullptr;
|
||||
// Find the nearest text node using a preorder traversal starting from
|
||||
// the current node.
|
||||
if (!(text = tempPosition->AsHyperText())) {
|
||||
|
@ -370,9 +370,8 @@ nsAccessiblePivot::MoveNextByText(TextBoundaryType aBoundary, bool* aResult)
|
|||
|
||||
nsAutoString unusedText;
|
||||
int32_t newStart = 0, newEnd = 0, currentEnd = tempEnd;
|
||||
text->GetTextAtOffset(tempEnd, endBoundary, &newStart, &tempEnd, unusedText);
|
||||
text->GetTextBeforeOffset(tempEnd, startBoundary, &newStart, &newEnd,
|
||||
unusedText);
|
||||
text->TextAtOffset(tempEnd, endBoundary, &newStart, &tempEnd, unusedText);
|
||||
text->TextBeforeOffset(tempEnd, startBoundary, &newStart, &newEnd, unusedText);
|
||||
int32_t potentialStart = newEnd == tempEnd ? newStart : newEnd;
|
||||
tempStart = potentialStart > tempStart ? potentialStart : currentEnd;
|
||||
|
||||
|
@ -494,15 +493,14 @@ nsAccessiblePivot::MovePreviousByText(TextBoundaryType aBoundary, bool* aResult)
|
|||
|
||||
nsAutoString unusedText;
|
||||
int32_t newStart = 0, newEnd = 0, currentStart = tempStart, potentialEnd = 0;
|
||||
text->GetTextBeforeOffset(tempStart, startBoundary, &newStart, &newEnd,
|
||||
unusedText);
|
||||
text->TextBeforeOffset(tempStart, startBoundary, &newStart, &newEnd, unusedText);
|
||||
if (newStart < tempStart)
|
||||
tempStart = newEnd >= currentStart ? newStart : newEnd;
|
||||
else // XXX: In certain odd cases newStart is equal to tempStart
|
||||
text->GetTextBeforeOffset(tempStart - 1, startBoundary, &newStart,
|
||||
&tempStart, unusedText);
|
||||
text->GetTextAtOffset(tempStart, endBoundary, &newStart, &potentialEnd,
|
||||
unusedText);
|
||||
text->TextBeforeOffset(tempStart - 1, startBoundary, &newStart,
|
||||
&tempStart, unusedText);
|
||||
text->TextAtOffset(tempStart, endBoundary, &newStart, &potentialEnd,
|
||||
unusedText);
|
||||
tempEnd = potentialEnd < tempEnd ? potentialEnd : currentStart;
|
||||
|
||||
// The offset range we've obtained might have embedded characters in it,
|
||||
|
|
|
@ -394,17 +394,14 @@ nsCoreUtils::GetDocShellFor(nsINode *aNode)
|
|||
if (!aNode)
|
||||
return nullptr;
|
||||
|
||||
nsCOMPtr<nsISupports> container = aNode->OwnerDoc()->GetContainer();
|
||||
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShell> docShell = aNode->OwnerDoc()->GetDocShell();
|
||||
return docShell.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
|
||||
NS_ASSERTION(docShellTreeItem, "No document shell for document!");
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
|
@ -416,9 +413,7 @@ nsCoreUtils::IsRootDocument(nsIDocument *aDocument)
|
|||
bool
|
||||
nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aDocument->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aDocument->GetDocShell();
|
||||
NS_ASSERTION(docShellTreeItem, "No document shell tree item for document!");
|
||||
|
||||
int32_t contentType;
|
||||
|
@ -429,8 +424,7 @@ nsCoreUtils::IsContentDocument(nsIDocument *aDocument)
|
|||
bool
|
||||
nsCoreUtils::IsTabDocument(nsIDocument* aDocumentNode)
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(aDocumentNode->GetDocShell());
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
treeItem->GetParent(getter_AddRefs(parentTreeItem));
|
||||
|
|
|
@ -78,6 +78,7 @@
|
|||
#endif
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
@ -376,10 +377,8 @@ Accessible::AccessKey() const
|
|||
nsIDocument* document = mContent->GetCurrentDoc();
|
||||
if (!document)
|
||||
return KeyBinding();
|
||||
nsCOMPtr<nsISupports> container = document->GetContainer();
|
||||
if (!container)
|
||||
return KeyBinding();
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem(document->GetDocShell());
|
||||
if (!treeItem)
|
||||
return KeyBinding();
|
||||
|
||||
|
@ -1293,9 +1292,7 @@ Accessible::NativeAttributes()
|
|||
nsCoreUtils::GetRoleContent(doc));
|
||||
|
||||
// Allow ARIA live region markup from outer documents to override
|
||||
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
|
||||
do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = doc->GetDocShell();
|
||||
if (!docShellTreeItem)
|
||||
break;
|
||||
|
||||
|
@ -1672,61 +1669,53 @@ Accessible::Value(nsString& aValue)
|
|||
}
|
||||
}
|
||||
|
||||
// nsIAccessibleValue
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetMaximumValue(double *aMaximumValue)
|
||||
double
|
||||
Accessible::MaxValue() const
|
||||
{
|
||||
return GetAttrValue(nsGkAtoms::aria_valuemax, aMaximumValue);
|
||||
return AttrNumericValue(nsGkAtoms::aria_valuemax);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetMinimumValue(double *aMinimumValue)
|
||||
double
|
||||
Accessible::MinValue() const
|
||||
{
|
||||
return GetAttrValue(nsGkAtoms::aria_valuemin, aMinimumValue);
|
||||
return AttrNumericValue(nsGkAtoms::aria_valuemin);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetMinimumIncrement(double *aMinIncrement)
|
||||
double
|
||||
Accessible::Step() const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aMinIncrement);
|
||||
*aMinIncrement = 0;
|
||||
|
||||
// No mimimum increment in dynamic content spec right now
|
||||
return NS_OK_NO_ARIA_VALUE;
|
||||
return UnspecifiedNaN(); // no mimimum increment (step) in ARIA.
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::GetCurrentValue(double *aValue)
|
||||
double
|
||||
Accessible::CurValue() const
|
||||
{
|
||||
return GetAttrValue(nsGkAtoms::aria_valuenow, aValue);
|
||||
return AttrNumericValue(nsGkAtoms::aria_valuenow);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
Accessible::SetCurrentValue(double aValue)
|
||||
bool
|
||||
Accessible::SetCurValue(double aValue)
|
||||
{
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
|
||||
return NS_OK_NO_ARIA_VALUE;
|
||||
return false;
|
||||
|
||||
const uint32_t kValueCannotChange = states::READONLY | states::UNAVAILABLE;
|
||||
|
||||
if (State() & kValueCannotChange)
|
||||
return NS_ERROR_FAILURE;
|
||||
return false;
|
||||
|
||||
double minValue = 0;
|
||||
if (NS_SUCCEEDED(GetMinimumValue(&minValue)) && aValue < minValue)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
double checkValue = MinValue();
|
||||
if (!IsNaN(checkValue) && aValue < checkValue)
|
||||
return false;
|
||||
|
||||
double maxValue = 0;
|
||||
if (NS_SUCCEEDED(GetMaximumValue(&maxValue)) && aValue > maxValue)
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
checkValue = MaxValue();
|
||||
if (!IsNaN(checkValue) && aValue > checkValue)
|
||||
return false;
|
||||
|
||||
nsAutoString newValue;
|
||||
newValue.AppendFloat(aValue);
|
||||
return mContent->SetAttr(kNameSpaceID_None,
|
||||
nsGkAtoms::aria_valuenow, newValue, true);
|
||||
nsAutoString strValue;
|
||||
strValue.AppendFloat(aValue);
|
||||
|
||||
return NS_SUCCEEDED(
|
||||
mContent->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow, strValue, true));
|
||||
}
|
||||
|
||||
/* void setName (in DOMString name); */
|
||||
|
@ -3116,31 +3105,19 @@ Accessible::GetFirstAvailableAccessible(nsINode *aStartNode) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
Accessible::GetAttrValue(nsIAtom *aProperty, double *aValue)
|
||||
double
|
||||
Accessible::AttrNumericValue(nsIAtom* aAttr) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE; // Node already shut down
|
||||
|
||||
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
|
||||
return NS_OK_NO_ARIA_VALUE;
|
||||
if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue)
|
||||
return UnspecifiedNaN();
|
||||
|
||||
nsAutoString attrValue;
|
||||
mContent->GetAttr(kNameSpaceID_None, aProperty, attrValue);
|
||||
|
||||
// Return zero value if there is no attribute or its value is empty.
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, aAttr, attrValue))
|
||||
return UnspecifiedNaN();
|
||||
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
return NS_FAILED(error) ? UnspecifiedNaN() : value;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
|
||||
#include "nsIAccessible.h"
|
||||
#include "nsIAccessibleHyperLink.h"
|
||||
#include "nsIAccessibleValue.h"
|
||||
#include "nsIAccessibleStates.h"
|
||||
#include "xpcAccessibleSelectable.h"
|
||||
#include "xpcAccessibleValue.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsString.h"
|
||||
|
@ -105,7 +105,7 @@ typedef nsRefPtrHashtable<nsPtrHashKey<const void>, Accessible>
|
|||
class Accessible : public nsIAccessible,
|
||||
public nsIAccessibleHyperLink,
|
||||
public xpcAccessibleSelectable,
|
||||
public nsIAccessibleValue
|
||||
public xpcAccessibleValue
|
||||
{
|
||||
public:
|
||||
Accessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
|
@ -116,7 +116,6 @@ public:
|
|||
|
||||
NS_DECL_NSIACCESSIBLE
|
||||
NS_DECL_NSIACCESSIBLEHYPERLINK
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ACCESSIBLE_IMPL_IID)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -245,6 +244,16 @@ public:
|
|||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return if accessible is unavailable.
|
||||
*/
|
||||
bool Unavailable() const
|
||||
{
|
||||
uint64_t state = NativelyUnavailable() ? states::UNAVAILABLE : 0;
|
||||
ApplyARIAState(&state);
|
||||
return state & states::UNAVAILABLE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the states of accessible, not taking into account ARIA states.
|
||||
* Use State() to get complete set of states.
|
||||
|
@ -688,6 +697,15 @@ public:
|
|||
*/
|
||||
virtual bool UnselectAll();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Value (numeric value interface)
|
||||
|
||||
virtual double MaxValue() const;
|
||||
virtual double MinValue() const;
|
||||
virtual double CurValue() const;
|
||||
virtual double Step() const;
|
||||
virtual bool SetCurValue(double aValue);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Widgets
|
||||
|
||||
|
@ -911,14 +929,12 @@ protected:
|
|||
nsIContent* GetAtomicRegion() const;
|
||||
|
||||
/**
|
||||
* Get numeric value of the given ARIA attribute.
|
||||
* Return numeric value of the given ARIA attribute, NaN if not applicable.
|
||||
*
|
||||
* @param aAriaProperty - the ARIA property we're using
|
||||
* @param aValue - value of the attribute
|
||||
*
|
||||
* @return - NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute
|
||||
* @param aARIAProperty [in] the ARIA property we're using
|
||||
* @return a numeric value
|
||||
*/
|
||||
nsresult GetAttrValue(nsIAtom *aAriaProperty, double *aValue);
|
||||
double AttrNumericValue(nsIAtom* aARIAAttr) const;
|
||||
|
||||
/**
|
||||
* Return the action rule based on ARIA enum constants EActionRule
|
||||
|
|
|
@ -688,8 +688,7 @@ DocAccessible::GetBoundsRect(nsRect& aBounds, nsIFrame** aRelativeFrame)
|
|||
nsresult
|
||||
DocAccessible::AddEventListeners()
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(mDocumentNode->GetDocShell());
|
||||
|
||||
// We want to add a command observer only if the document is content and has
|
||||
// an editor.
|
||||
|
@ -721,8 +720,7 @@ DocAccessible::RemoveEventListeners()
|
|||
if (mDocumentNode) {
|
||||
mDocumentNode->RemoveObserver(this);
|
||||
|
||||
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(do_QueryInterface(container));
|
||||
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem(mDocumentNode->GetDocShell());
|
||||
NS_ASSERTION(docShellTreeItem, "doc should support nsIDocShellTreeItem.");
|
||||
|
||||
if (docShellTreeItem) {
|
||||
|
@ -870,7 +868,12 @@ DocAccessible::AttributeWillChange(nsIDocument* aDocument,
|
|||
aAttribute == nsGkAtoms::aria_pressed) {
|
||||
mARIAAttrOldValue = (aModType != nsIDOMMutationEvent::ADDITION) ?
|
||||
nsAccUtils::GetARIAToken(aElement, aAttribute) : nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
if (aAttribute == nsGkAtoms::aria_disabled ||
|
||||
aAttribute == nsGkAtoms::disabled)
|
||||
mStateBitWasOn = accessible->Unavailable();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -938,22 +941,24 @@ DocAccessible::AttributeChangedImpl(Accessible* aAccessible,
|
|||
|
||||
// Universal boolean properties that don't require a role. Fire the state
|
||||
// change when disabled or aria-disabled attribute is set.
|
||||
// Note. Checking the XUL or HTML namespace would not seem to gain us
|
||||
// anything, because disabled attribute really is going to mean the same
|
||||
// thing in any namespace.
|
||||
// Note. We use the attribute instead of the disabled state bit because
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
if (aAttribute == nsGkAtoms::disabled ||
|
||||
aAttribute == nsGkAtoms::aria_disabled) {
|
||||
|
||||
// Note. Checking the XUL or HTML namespace would not seem to gain us
|
||||
// anything, because disabled attribute really is going to mean the same
|
||||
// thing in any namespace.
|
||||
|
||||
// Note. We use the attribute instead of the disabled state bit because
|
||||
// ARIA's aria-disabled does not affect the disabled state bit.
|
||||
// Do nothing if state wasn't changed (like @aria-disabled was removed but
|
||||
// @disabled is still presented).
|
||||
if (aAccessible->Unavailable() == mStateBitWasOn)
|
||||
return;
|
||||
|
||||
nsRefPtr<AccEvent> enabledChangeEvent =
|
||||
new AccStateChangeEvent(aAccessible, states::ENABLED);
|
||||
new AccStateChangeEvent(aAccessible, states::ENABLED, mStateBitWasOn);
|
||||
FireDelayedEvent(enabledChangeEvent);
|
||||
|
||||
nsRefPtr<AccEvent> sensitiveChangeEvent =
|
||||
new AccStateChangeEvent(aAccessible, states::SENSITIVE);
|
||||
new AccStateChangeEvent(aAccessible, states::SENSITIVE, mStateBitWasOn);
|
||||
FireDelayedEvent(sensitiveChangeEvent);
|
||||
return;
|
||||
}
|
||||
|
@ -1987,8 +1992,7 @@ DocAccessible::ShutdownChildrenInSubtree(Accessible* aAccessible)
|
|||
bool
|
||||
DocAccessible::IsLoadEventTarget() const
|
||||
{
|
||||
nsCOMPtr<nsISupports> container = mDocumentNode->GetContainer();
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = do_QueryInterface(container);
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = mDocumentNode->GetDocShell();
|
||||
NS_ASSERTION(treeItem, "No document shell for document!");
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
|
||||
|
|
|
@ -533,10 +533,16 @@ protected:
|
|||
nsCOMPtr<nsIContent> mAnchorJumpElm;
|
||||
|
||||
/**
|
||||
* Keep the ARIA attribute old value that is initialized by
|
||||
* AttributeWillChange and used by AttributeChanged notifications.
|
||||
* A generic state (see items below) before the attribute value was changed.
|
||||
* @see AttributeWillChange and AttributeChanged notifications.
|
||||
*/
|
||||
nsIAtom* mARIAAttrOldValue;
|
||||
union {
|
||||
// ARIA attribute value
|
||||
nsIAtom* mARIAAttrOldValue;
|
||||
|
||||
// True if the accessible state bit was on
|
||||
bool mStateBitWasOn;
|
||||
};
|
||||
|
||||
nsTArray<nsRefPtr<DocAccessible> > mChildDocuments;
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "FormControlAccessible.h"
|
||||
#include "Role.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "nsIDOMHTMLFormElement.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMXULControlElement.h"
|
||||
|
@ -82,14 +83,12 @@ ProgressMeterAccessible<Max>::Value(nsString& aValue)
|
|||
if (!aValue.IsEmpty())
|
||||
return;
|
||||
|
||||
double maxValue = 0;
|
||||
nsresult rv = GetMaximumValue(&maxValue);
|
||||
if (NS_FAILED(rv) || maxValue == 0)
|
||||
double maxValue = MaxValue();
|
||||
if (IsNaN(maxValue) || maxValue == 0)
|
||||
return;
|
||||
|
||||
double curValue = 0;
|
||||
GetCurrentValue(&curValue);
|
||||
if (NS_FAILED(rv))
|
||||
double curValue = CurValue();
|
||||
if (IsNaN(curValue))
|
||||
return;
|
||||
|
||||
// Treat the current value bigger than maximum as 100%.
|
||||
|
@ -101,77 +100,62 @@ ProgressMeterAccessible<Max>::Value(nsString& aValue)
|
|||
}
|
||||
|
||||
template<int Max>
|
||||
NS_IMETHODIMP
|
||||
ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
|
||||
double
|
||||
ProgressMeterAccessible<Max>::MaxValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMaximumValue(aMaximumValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::MaxValue();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
nsAutoString value;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, value)) {
|
||||
nsAutoString strValue;
|
||||
if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::max, strValue)) {
|
||||
nsresult result = NS_OK;
|
||||
*aMaximumValue = value.ToDouble(&result);
|
||||
return result;
|
||||
value = strValue.ToDouble(&result);
|
||||
if (NS_SUCCEEDED(result))
|
||||
return value;
|
||||
}
|
||||
|
||||
*aMaximumValue = Max;
|
||||
return NS_OK;
|
||||
return Max;
|
||||
}
|
||||
|
||||
template<int Max>
|
||||
NS_IMETHODIMP
|
||||
ProgressMeterAccessible<Max>::GetMinimumValue(double* aMinimumValue)
|
||||
double
|
||||
ProgressMeterAccessible<Max>::MinValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMinimumValue(aMinimumValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
*aMinimumValue = 0;
|
||||
return NS_OK;
|
||||
double value = LeafAccessible::MinValue();
|
||||
return IsNaN(value) ? 0 : value;
|
||||
}
|
||||
|
||||
template<int Max>
|
||||
NS_IMETHODIMP
|
||||
ProgressMeterAccessible<Max>::GetMinimumIncrement(double* aMinimumIncrement)
|
||||
double
|
||||
ProgressMeterAccessible<Max>::Step() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMinimumIncrement(aMinimumIncrement);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
*aMinimumIncrement = 0;
|
||||
return NS_OK;
|
||||
double value = LeafAccessible::Step();
|
||||
return IsNaN(value) ? 0 : value;
|
||||
}
|
||||
|
||||
template<int Max>
|
||||
NS_IMETHODIMP
|
||||
ProgressMeterAccessible<Max>::GetCurrentValue(double* aCurrentValue)
|
||||
double
|
||||
ProgressMeterAccessible<Max>::CurValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetCurrentValue(aCurrentValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::CurValue();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
nsAutoString attrValue;
|
||||
mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue);
|
||||
|
||||
// Return zero value if there is no attribute or its value is empty.
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
if (!mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, attrValue))
|
||||
return UnspecifiedNaN();
|
||||
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_FAILED(error))
|
||||
return NS_OK; // Zero value because of wrong markup.
|
||||
|
||||
*aCurrentValue = value;
|
||||
return NS_OK;
|
||||
value = attrValue.ToDouble(&error);
|
||||
return NS_FAILED(error) ? UnspecifiedNaN() : value;
|
||||
}
|
||||
|
||||
template<int Max>
|
||||
NS_IMETHODIMP
|
||||
ProgressMeterAccessible<Max>::SetCurrentValue(double aValue)
|
||||
bool
|
||||
ProgressMeterAccessible<Max>::SetCurValue(double aValue)
|
||||
{
|
||||
return NS_ERROR_FAILURE; // Progress meters are readonly.
|
||||
return false; // progress meters are readonly.
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -28,13 +28,19 @@ public:
|
|||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
||||
// Accessible
|
||||
virtual void Value(nsString& aValue);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual uint64_t NativeState();
|
||||
|
||||
// Value
|
||||
virtual double MaxValue() const MOZ_OVERRIDE;
|
||||
virtual double MinValue() const MOZ_OVERRIDE;
|
||||
virtual double CurValue() const MOZ_OVERRIDE;
|
||||
virtual double Step() const MOZ_OVERRIDE;
|
||||
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,164 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_HyperTextAccessible_inl_h__
|
||||
#define mozilla_a11y_HyperTextAccessible_inl_h__
|
||||
|
||||
#include "HyperTextAccessible.h"
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
|
||||
#include "nsIClipboard.h"
|
||||
#include "nsIEditor.h"
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsIPlaintextEditor.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
inline bool
|
||||
HyperTextAccessible::IsValidOffset(int32_t aOffset)
|
||||
{
|
||||
int32_t offset = ConvertMagicOffset(aOffset);
|
||||
return offset >= 0 && offset <= static_cast<int32_t>(CharacterCount());
|
||||
}
|
||||
|
||||
inline bool
|
||||
HyperTextAccessible::IsValidRange(int32_t aStartOffset, int32_t aEndOffset)
|
||||
{
|
||||
int32_t startOffset = ConvertMagicOffset(aStartOffset);
|
||||
if (startOffset < 0)
|
||||
return false;
|
||||
|
||||
int32_t endOffset = ConvertMagicOffset(aEndOffset);
|
||||
if (endOffset < 0 || startOffset > endOffset)
|
||||
return false;
|
||||
|
||||
return endOffset <= static_cast<int32_t>(CharacterCount());
|
||||
}
|
||||
|
||||
inline nsIntRect
|
||||
HyperTextAccessible::TextBounds(int32_t aStartOffset, int32_t aEndOffset,
|
||||
uint32_t aCoordType)
|
||||
{
|
||||
nsIntRect bounds;
|
||||
GetPosAndText(aStartOffset, aEndOffset, nullptr, nullptr, &bounds);
|
||||
nsAccUtils::ConvertScreenCoordsTo(&bounds.x, &bounds.y, aCoordType, this);
|
||||
return bounds;
|
||||
}
|
||||
|
||||
inline bool
|
||||
HyperTextAccessible::AddToSelection(int32_t aStartOffset, int32_t aEndOffset)
|
||||
{
|
||||
Selection* domSel = DOMSelection();
|
||||
return domSel &&
|
||||
SetSelectionBoundsAt(domSel->GetRangeCount(), aStartOffset, aEndOffset);
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::ReplaceText(const nsAString& aText)
|
||||
{
|
||||
int32_t numChars = CharacterCount();
|
||||
if (numChars != 0)
|
||||
DeleteText(0, numChars);
|
||||
|
||||
InsertText(aText, 0);
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::InsertText(const nsAString& aText, int32_t aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditor();
|
||||
nsCOMPtr<nsIPlaintextEditor> peditor(do_QueryInterface(editor));
|
||||
if (peditor) {
|
||||
SetSelectionRange(aPosition, aPosition);
|
||||
peditor->InsertText(aText);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::CopyText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditor();
|
||||
if (editor) {
|
||||
SetSelectionRange(aStartPos, aEndPos);
|
||||
editor->Copy();
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::CutText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditor();
|
||||
if (editor) {
|
||||
SetSelectionRange(aStartPos, aEndPos);
|
||||
editor->Cut();
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::DeleteText(int32_t aStartPos, int32_t aEndPos)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditor();
|
||||
if (editor) {
|
||||
SetSelectionRange(aStartPos, aEndPos);
|
||||
editor->DeleteSelection(nsIEditor::eNone, nsIEditor::eStrip);
|
||||
}
|
||||
}
|
||||
|
||||
inline void
|
||||
HyperTextAccessible::PasteText(int32_t aPosition)
|
||||
{
|
||||
nsCOMPtr<nsIEditor> editor = GetEditor();
|
||||
if (editor) {
|
||||
SetSelectionRange(aPosition, aPosition);
|
||||
editor->Paste(nsIClipboard::kGlobalClipboard);
|
||||
}
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
HyperTextAccessible::ConvertMagicOffset(int32_t aOffset)
|
||||
{
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT)
|
||||
return CharacterCount();
|
||||
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET)
|
||||
return CaretOffset();
|
||||
|
||||
return aOffset;
|
||||
}
|
||||
|
||||
inline int32_t
|
||||
HyperTextAccessible::AdjustCaretOffset(int32_t aOffset) const
|
||||
{
|
||||
// It is the same character offset when the caret is visually at the very
|
||||
// end of a line or the start of a new line (soft line break). Getting text
|
||||
// at the line should provide the line with the visual caret, otherwise
|
||||
// screen readers will announce the wrong line as the user presses up or
|
||||
// down arrow and land at the end of a line.
|
||||
if (aOffset > 0) {
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (frameSelection &&
|
||||
frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
|
||||
return aOffset - 1;
|
||||
}
|
||||
}
|
||||
return aOffset;
|
||||
}
|
||||
|
||||
inline Selection*
|
||||
HyperTextAccessible::DOMSelection() const
|
||||
{
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
return frameSelection ?
|
||||
frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL) :
|
||||
nullptr;
|
||||
}
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -6,11 +6,9 @@
|
|||
#ifndef mozilla_a11y_HyperTextAccessible_h__
|
||||
#define mozilla_a11y_HyperTextAccessible_h__
|
||||
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleHyperText.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
|
||||
#include "AccessibleWrap.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "xpcAccessibleHyperText.h"
|
||||
|
||||
#include "nsFrameSelection.h"
|
||||
#include "nsISelectionController.h"
|
||||
|
@ -35,18 +33,13 @@ const PRUnichar kForcedNewLineChar = '\n';
|
|||
* Special Accessible that knows how contain both text and embedded objects
|
||||
*/
|
||||
class HyperTextAccessible : public AccessibleWrap,
|
||||
public nsIAccessibleText,
|
||||
public nsIAccessibleHyperText,
|
||||
public nsIAccessibleEditableText
|
||||
public xpcAccessibleHyperText
|
||||
{
|
||||
public:
|
||||
HyperTextAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
virtual ~HyperTextAccessible() { }
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLETEXT
|
||||
NS_DECL_NSIACCESSIBLEHYPERTEXT
|
||||
NS_DECL_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
// Accessible
|
||||
virtual int32_t GetLevelInternal();
|
||||
|
@ -59,13 +52,13 @@ public:
|
|||
|
||||
// HyperTextAccessible (static helper method)
|
||||
|
||||
// Convert content offset to rendered text offset
|
||||
// Convert content offset to rendered text offset
|
||||
nsresult ContentToRenderedOffset(nsIFrame *aFrame, int32_t aContentOffset,
|
||||
uint32_t *aRenderedOffset);
|
||||
|
||||
uint32_t *aRenderedOffset) const;
|
||||
|
||||
// Convert rendered text offset to content offset
|
||||
nsresult RenderedToContentOffset(nsIFrame *aFrame, uint32_t aRenderedOffset,
|
||||
int32_t *aContentOffset);
|
||||
int32_t *aContentOffset) const;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// HyperLinkAccessible
|
||||
|
@ -73,15 +66,13 @@ public:
|
|||
/**
|
||||
* Return link count within this hypertext accessible.
|
||||
*/
|
||||
uint32_t GetLinkCount()
|
||||
{
|
||||
return EmbeddedChildCount();
|
||||
}
|
||||
uint32_t LinkCount()
|
||||
{ return EmbeddedChildCount(); }
|
||||
|
||||
/**
|
||||
* Return link accessible at the given index.
|
||||
*/
|
||||
Accessible* GetLinkAt(uint32_t aIndex)
|
||||
Accessible* LinkAt(uint32_t aIndex)
|
||||
{
|
||||
return GetEmbeddedChildAt(aIndex);
|
||||
}
|
||||
|
@ -89,7 +80,7 @@ public:
|
|||
/**
|
||||
* Return index for the given link accessible.
|
||||
*/
|
||||
int32_t GetLinkIndex(Accessible* aLink)
|
||||
int32_t LinkIndexOf(Accessible* aLink)
|
||||
{
|
||||
return GetIndexOfEmbeddedChild(aLink);
|
||||
}
|
||||
|
@ -97,10 +88,10 @@ public:
|
|||
/**
|
||||
* Return link accessible at the given text offset.
|
||||
*/
|
||||
int32_t GetLinkIndexAtOffset(uint32_t aOffset)
|
||||
int32_t LinkIndexAtOffset(uint32_t aOffset)
|
||||
{
|
||||
Accessible* child = GetChildAtOffset(aOffset);
|
||||
return child ? GetLinkIndex(child) : -1;
|
||||
return child ? LinkIndexOf(child) : -1;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -134,7 +125,7 @@ public:
|
|||
Accessible* DOMPointToHypertextOffset(nsINode *aNode,
|
||||
int32_t aNodeOffset,
|
||||
int32_t* aHypertextOffset,
|
||||
bool aIsEndOffset = false);
|
||||
bool aIsEndOffset = false) const;
|
||||
|
||||
/**
|
||||
* Turn a start and end hypertext offsets into DOM range.
|
||||
|
@ -208,6 +199,37 @@ public:
|
|||
bool GetCharAt(int32_t aOffset, EGetTextType aShift, nsAString& aChar,
|
||||
int32_t* aStartOffset = nullptr, int32_t* aEndOffset = nullptr);
|
||||
|
||||
/**
|
||||
* Return text between given offsets.
|
||||
*/
|
||||
void TextSubstring(int32_t aStartOffset, int32_t aEndOffset, nsAString& aText);
|
||||
|
||||
/**
|
||||
* Return text before/at/after the given offset corresponding to
|
||||
* the boundary type.
|
||||
*/
|
||||
void TextBeforeOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset,
|
||||
nsAString& aText);
|
||||
void TextAtOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset,
|
||||
nsAString& aText);
|
||||
void TextAfterOffset(int32_t aOffset, AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset,
|
||||
nsAString& aText);
|
||||
|
||||
/**
|
||||
* Return text attributes for the given text range.
|
||||
*/
|
||||
already_AddRefed<nsIPersistentProperties>
|
||||
TextAttributes(bool aIncludeDefAttrs, int32_t aOffset,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset);
|
||||
|
||||
/**
|
||||
* Return text attributes applied to the accessible.
|
||||
*/
|
||||
already_AddRefed<nsIPersistentProperties> DefaultTextAttributes();
|
||||
|
||||
/**
|
||||
* Return text offset of the given child accessible within hypertext
|
||||
* accessible.
|
||||
|
@ -247,14 +269,34 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Return the bounds of the text between given start and end offset.
|
||||
* Return true if the given offset/range is valid.
|
||||
*/
|
||||
nsIntRect GetTextBounds(int32_t aStartOffset, int32_t aEndOffset)
|
||||
{
|
||||
nsIntRect bounds;
|
||||
GetPosAndText(aStartOffset, aEndOffset, nullptr, nullptr, &bounds);
|
||||
return bounds;
|
||||
}
|
||||
bool IsValidOffset(int32_t aOffset);
|
||||
bool IsValidRange(int32_t aStartOffset, int32_t aEndOffset);
|
||||
|
||||
/**
|
||||
* Return an offset at the given point.
|
||||
*/
|
||||
int32_t OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType);
|
||||
|
||||
/**
|
||||
* Return a rect of the given text range relative given coordinate system.
|
||||
*/
|
||||
nsIntRect TextBounds(int32_t aStartOffset, int32_t aEndOffset,
|
||||
uint32_t aCoordType = nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE);
|
||||
|
||||
/**
|
||||
* Return a rect for character at given offset relative given coordinate
|
||||
* system.
|
||||
*/
|
||||
nsIntRect CharBounds(int32_t aOffset, uint32_t aCoordType)
|
||||
{ return TextBounds(aOffset, aOffset + 1, aCoordType); }
|
||||
|
||||
/**
|
||||
* Get/set caret offset, if no caret then -1.
|
||||
*/
|
||||
int32_t CaretOffset() const;
|
||||
void SetCaretOffset(int32_t aOffset) { SetSelectionRange(aOffset, aOffset); }
|
||||
|
||||
/**
|
||||
* Provide the line number for the caret.
|
||||
|
@ -271,9 +313,60 @@ public:
|
|||
*/
|
||||
nsIntRect GetCaretRect(nsIWidget** aWidget);
|
||||
|
||||
/**
|
||||
* Return selected regions count within the accessible.
|
||||
*/
|
||||
int32_t SelectionCount();
|
||||
|
||||
/**
|
||||
* Return the start and end offset of the specified selection.
|
||||
*/
|
||||
bool SelectionBoundsAt(int32_t aSelectionNum,
|
||||
int32_t* aStartOffset, int32_t* aEndOffset);
|
||||
|
||||
/*
|
||||
* Changes the start and end offset of the specified selection.
|
||||
* @return true if succeeded
|
||||
*/
|
||||
bool SetSelectionBoundsAt(int32_t aSelectionNum,
|
||||
int32_t aStartOffset, int32_t aEndOffset);
|
||||
|
||||
/**
|
||||
* Adds a selection bounded by the specified offsets.
|
||||
* @return true if succeeded
|
||||
*/
|
||||
bool AddToSelection(int32_t aStartOffset, int32_t aEndOffset);
|
||||
|
||||
/*
|
||||
* Removes the specified selection.
|
||||
* @return true if succeeded
|
||||
*/
|
||||
bool RemoveFromSelection(int32_t aSelectionNum);
|
||||
|
||||
/**
|
||||
* Scroll the given text range into view.
|
||||
*/
|
||||
void ScrollSubstringTo(int32_t aStartOffset, int32_t aEndOffset,
|
||||
uint32_t aScrollType);
|
||||
|
||||
/**
|
||||
* Scroll the given text range to the given point.
|
||||
*/
|
||||
void ScrollSubstringToPoint(int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
uint32_t aCoordinateType,
|
||||
int32_t aX, int32_t aY);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// EditableTextAccessible
|
||||
|
||||
void ReplaceText(const nsAString& aText);
|
||||
void InsertText(const nsAString& aText, int32_t aPosition);
|
||||
void CopyText(int32_t aStartPos, int32_t aEndPos);
|
||||
void CutText(int32_t aStartPos, int32_t aEndPos);
|
||||
void DeleteText(int32_t aStartPos, int32_t aEndPos);
|
||||
void PasteText(int32_t aPosition);
|
||||
|
||||
/**
|
||||
* Return the editor associated with the accessible.
|
||||
*/
|
||||
|
@ -289,39 +382,12 @@ protected:
|
|||
/**
|
||||
* Transform magic offset into text offset.
|
||||
*/
|
||||
int32_t ConvertMagicOffset(int32_t aOffset)
|
||||
{
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT)
|
||||
return CharacterCount();
|
||||
|
||||
if (aOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
|
||||
int32_t caretOffset = -1;
|
||||
GetCaretOffset(&caretOffset);
|
||||
return caretOffset;
|
||||
}
|
||||
|
||||
return aOffset;
|
||||
}
|
||||
int32_t ConvertMagicOffset(int32_t aOffset);
|
||||
|
||||
/**
|
||||
* Adjust an offset the caret stays at to get a text by line boundary.
|
||||
*/
|
||||
int32_t AdjustCaretOffset(int32_t aOffset)
|
||||
{
|
||||
// It is the same character offset when the caret is visually at the very
|
||||
// end of a line or the start of a new line (soft line break). Getting text
|
||||
// at the line should provide the line with the visual caret, otherwise
|
||||
// screen readers will announce the wrong line as the user presses up or
|
||||
// down arrow and land at the end of a line.
|
||||
if (aOffset > 0) {
|
||||
nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
|
||||
if (frameSelection &&
|
||||
frameSelection->GetHint() == nsFrameSelection::HINTLEFT) {
|
||||
return aOffset - 1;
|
||||
}
|
||||
}
|
||||
return aOffset;
|
||||
}
|
||||
int32_t AdjustCaretOffset(int32_t aOffset) const;
|
||||
|
||||
/**
|
||||
* Return true if the given offset points to terminal empty line if any.
|
||||
|
@ -427,9 +493,10 @@ protected:
|
|||
// Selection helpers
|
||||
|
||||
/**
|
||||
* Return frame selection object for the accessible.
|
||||
* Return frame/DOM selection object for the accessible.
|
||||
*/
|
||||
virtual already_AddRefed<nsFrameSelection> FrameSelection();
|
||||
virtual already_AddRefed<nsFrameSelection> FrameSelection() const;
|
||||
Selection* DOMSelection() const;
|
||||
|
||||
/**
|
||||
* Return selection ranges within the accessible subtree.
|
||||
|
@ -443,7 +510,7 @@ protected:
|
|||
Accessible* aAccessible,
|
||||
mozilla::a11y::DOMPoint* aPoint);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Return hyper text offset for the specified bound of the given DOM range.
|
||||
* If the bound is outside of the hyper text then offset value is either
|
||||
|
@ -466,7 +533,7 @@ protected:
|
|||
* Set 'misspelled' text attribute and return range offsets where the
|
||||
* attibute is stretched. If the text is not misspelled at the given offset
|
||||
* then we expose only range offsets where text is not misspelled. The method
|
||||
* is used by GetTextAttributes() method.
|
||||
* is used by TextAttributes() method.
|
||||
*
|
||||
* @param aIncludeDefAttrs [in] points whether text attributes having default
|
||||
* values of attributes should be included
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS.mozilla.a11y += [
|
||||
'Accessible.h',
|
||||
'DocAccessible.h',
|
||||
'HyperTextAccessible.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'Accessible.cpp',
|
||||
'ApplicationAccessible.cpp',
|
||||
'ARIAGridAccessible.cpp',
|
||||
|
@ -27,10 +25,6 @@ SOURCES += [
|
|||
'TextLeafAccessible.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_generic_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../layout/generic',
|
||||
'../../../layout/xul/base/src',
|
||||
|
@ -56,3 +50,5 @@ else:
|
|||
LOCAL_INCLUDES += [
|
||||
'../other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "nsIServiceManager.h"
|
||||
#include "nsITextControlFrame.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -545,9 +546,6 @@ HTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
|
|||
// HTMLRangeAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(HTMLRangeAccessible, LeafAccessible,
|
||||
nsIAccessibleValue)
|
||||
|
||||
role
|
||||
HTMLRangeAccessible::NativeRole()
|
||||
{
|
||||
|
@ -570,58 +568,53 @@ HTMLRangeAccessible::Value(nsString& aValue)
|
|||
HTMLInputElement::FromContent(mContent)->GetValue(aValue);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLRangeAccessible::GetMaximumValue(double* aMaximumValue)
|
||||
double
|
||||
HTMLRangeAccessible::MaxValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMaximumValue(aMaximumValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::MaxValue();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
*aMaximumValue = HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
|
||||
return NS_OK;
|
||||
return HTMLInputElement::FromContent(mContent)->GetMaximum().toDouble();
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLRangeAccessible::GetMinimumValue(double* aMinimumValue)
|
||||
double
|
||||
HTMLRangeAccessible::MinValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMinimumValue(aMinimumValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::MinValue();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
*aMinimumValue = HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
|
||||
return NS_OK;
|
||||
return HTMLInputElement::FromContent(mContent)->GetMinimum().toDouble();
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLRangeAccessible::GetMinimumIncrement(double* aMinimumIncrement)
|
||||
double
|
||||
HTMLRangeAccessible::Step() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetMinimumIncrement(aMinimumIncrement);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::Step();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
*aMinimumIncrement = HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
|
||||
return NS_OK;
|
||||
return HTMLInputElement::FromContent(mContent)->GetStep().toDouble();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLRangeAccessible::GetCurrentValue(double* aCurrentValue)
|
||||
double
|
||||
HTMLRangeAccessible::CurValue() const
|
||||
{
|
||||
nsresult rv = LeafAccessible::GetCurrentValue(aCurrentValue);
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
double value = LeafAccessible::CurValue();
|
||||
if (!IsNaN(value))
|
||||
return value;
|
||||
|
||||
*aCurrentValue = HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
|
||||
return NS_OK;
|
||||
return HTMLInputElement::FromContent(mContent)->GetValueAsDecimal().toDouble();
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLRangeAccessible::SetCurrentValue(double aValue)
|
||||
bool
|
||||
HTMLRangeAccessible::SetCurValue(double aValue)
|
||||
{
|
||||
ErrorResult er;
|
||||
HTMLInputElement::FromContent(mContent)->SetValueAsNumber(aValue, er);
|
||||
return er.ErrorCode();
|
||||
return !er.Failed();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -172,13 +172,17 @@ public:
|
|||
mStateFlags |= eHasNumericValue;
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
||||
// Accessible
|
||||
virtual void Value(nsString& aValue);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
|
||||
// Value
|
||||
virtual double MaxValue() const MOZ_OVERRIDE;
|
||||
virtual double MinValue() const MOZ_OVERRIDE;
|
||||
virtual double CurValue() const MOZ_OVERRIDE;
|
||||
virtual double Step() const MOZ_OVERRIDE;
|
||||
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
|
||||
|
||||
// Widgets
|
||||
virtual bool IsWidget() const;
|
||||
};
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'HTMLCanvasAccessible.cpp',
|
||||
'HTMLElementAccessibles.cpp',
|
||||
'HTMLFormControlAccessible.cpp',
|
||||
|
@ -17,10 +15,6 @@ SOURCES += [
|
|||
'HTMLTableAccessible.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_html_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../layout/generic',
|
||||
'../../../layout/tables',
|
||||
|
@ -47,3 +41,5 @@ else:
|
|||
LOCAL_INCLUDES += [
|
||||
'../other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -86,7 +86,7 @@ this.AccessFu = {
|
|||
Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
|
||||
Cu.import('resource://gre/modules/accessibility/Presentation.jsm');
|
||||
|
||||
Logger.info('enable');
|
||||
Logger.info('Enabled');
|
||||
|
||||
for each (let mm in Utils.AllMessageManagers) {
|
||||
this._addMessageListeners(mm);
|
||||
|
@ -145,7 +145,7 @@ this.AccessFu = {
|
|||
|
||||
this._enabled = false;
|
||||
|
||||
Logger.info('disable');
|
||||
Logger.info('Disabled');
|
||||
|
||||
Utils.win.document.removeChild(this.stylesheet.get());
|
||||
|
||||
|
@ -524,9 +524,8 @@ var Output = {
|
|||
|
||||
for (let action of aActions) {
|
||||
let window = Utils.win;
|
||||
Logger.info('tts.' + action.method,
|
||||
'"' + action.data + '"',
|
||||
JSON.stringify(action.options));
|
||||
Logger.debug('tts.' + action.method, '"' + action.data + '"',
|
||||
JSON.stringify(action.options));
|
||||
|
||||
if (!action.options.enqueue && this.webspeechEnabled) {
|
||||
window.speechSynthesis.cancel();
|
||||
|
@ -715,8 +714,8 @@ var Input = {
|
|||
|
||||
_handleGesture: function _handleGesture(aGesture) {
|
||||
let gestureName = aGesture.type + aGesture.touches.length;
|
||||
Logger.info('Gesture', aGesture.type,
|
||||
'(fingers: ' + aGesture.touches.length + ')');
|
||||
Logger.debug('Gesture', aGesture.type,
|
||||
'(fingers: ' + aGesture.touches.length + ')');
|
||||
|
||||
switch (gestureName) {
|
||||
case 'dwell1':
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations', 'Filters'];
|
||||
|
||||
function ConstantsMap (aObject, aPrefix) {
|
||||
let offset = aPrefix.length;
|
||||
for (var name in aObject) {
|
||||
if (name.indexOf(aPrefix) === 0) {
|
||||
this[name.slice(offset)] = aObject[name];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this, 'Roles',
|
||||
function() {
|
||||
return new ConstantsMap(Ci.nsIAccessibleRole, 'ROLE_');
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this, 'Events',
|
||||
function() {
|
||||
return new ConstantsMap(Ci.nsIAccessibleEvent, 'EVENT_');
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this, 'Relations',
|
||||
function() {
|
||||
return new ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(
|
||||
this, 'Filters',
|
||||
function() {
|
||||
return new ConstantsMap(Ci.nsIAccessibleTraversalRule, 'FILTER_');
|
||||
});
|
|
@ -7,21 +7,6 @@
|
|||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
const EVENT_VIRTUALCURSOR_CHANGED = Ci.nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
|
||||
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
|
||||
const EVENT_SCROLLING_START = Ci.nsIAccessibleEvent.EVENT_SCROLLING_START;
|
||||
const EVENT_TEXT_CARET_MOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED;
|
||||
const EVENT_TEXT_INSERTED = Ci.nsIAccessibleEvent.EVENT_TEXT_INSERTED;
|
||||
const EVENT_TEXT_REMOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_REMOVED;
|
||||
const EVENT_FOCUS = Ci.nsIAccessibleEvent.EVENT_FOCUS;
|
||||
const EVENT_SHOW = Ci.nsIAccessibleEvent.EVENT_SHOW;
|
||||
const EVENT_HIDE = Ci.nsIAccessibleEvent.EVENT_HIDE;
|
||||
|
||||
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
|
||||
const ROLE_DOCUMENT = Ci.nsIAccessibleRole.ROLE_DOCUMENT;
|
||||
const ROLE_CHROME_WINDOW = Ci.nsIAccessibleRole.ROLE_CHROME_WINDOW;
|
||||
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
|
||||
const TEXT_NODE = 3;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
|
@ -35,6 +20,10 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
|
|||
'resource://gre/modules/accessibility/Presentation.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules',
|
||||
'resource://gre/modules/accessibility/TraversalRules.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['EventManager'];
|
||||
|
||||
|
@ -57,7 +46,7 @@ this.EventManager.prototype = {
|
|||
start: function start() {
|
||||
try {
|
||||
if (!this._started) {
|
||||
Logger.info('EventManager.start', Utils.MozBuildApp);
|
||||
Logger.debug('EventManager.start');
|
||||
|
||||
this._started = true;
|
||||
|
||||
|
@ -84,7 +73,7 @@ this.EventManager.prototype = {
|
|||
if (!this._started) {
|
||||
return;
|
||||
}
|
||||
Logger.info('EventManager.stop', Utils.MozBuildApp);
|
||||
Logger.debug('EventManager.stop');
|
||||
AccessibilityEventObserver.removeListener(this);
|
||||
try {
|
||||
this.webProgress.removeProgressListener(this);
|
||||
|
@ -144,7 +133,7 @@ this.EventManager.prototype = {
|
|||
|
||||
// Don't bother with non-content events in firefox.
|
||||
if (Utils.MozBuildApp == 'browser' &&
|
||||
aEvent.eventType != EVENT_VIRTUALCURSOR_CHANGED &&
|
||||
aEvent.eventType != Events.VIRTUALCURSOR_CHANGED &&
|
||||
// XXX Bug 442005 results in DocAccessible::getDocType returning
|
||||
// NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType ==
|
||||
// 'window' does not currently work.
|
||||
|
@ -154,12 +143,12 @@ this.EventManager.prototype = {
|
|||
}
|
||||
|
||||
switch (aEvent.eventType) {
|
||||
case EVENT_VIRTUALCURSOR_CHANGED:
|
||||
case Events.VIRTUALCURSOR_CHANGED:
|
||||
{
|
||||
let pivot = aEvent.accessible.
|
||||
QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
|
||||
let position = pivot.position;
|
||||
if (position && position.role == ROLE_INTERNAL_FRAME)
|
||||
if (position && position.role == Roles.INTERNAL_FRAME)
|
||||
break;
|
||||
let event = aEvent.
|
||||
QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
|
||||
|
@ -174,7 +163,7 @@ this.EventManager.prototype = {
|
|||
|
||||
break;
|
||||
}
|
||||
case EVENT_STATE_CHANGE:
|
||||
case Events.STATE_CHANGE:
|
||||
{
|
||||
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
|
||||
|
@ -191,13 +180,13 @@ this.EventManager.prototype = {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_SCROLLING_START:
|
||||
case Events.SCROLLING_START:
|
||||
{
|
||||
let vc = Utils.getVirtualCursor(aEvent.accessibleDocument);
|
||||
vc.moveNext(TraversalRules.Simple, aEvent.accessible, true);
|
||||
break;
|
||||
}
|
||||
case EVENT_TEXT_CARET_MOVED:
|
||||
case Events.TEXT_CARET_MOVED:
|
||||
{
|
||||
let acc = aEvent.accessible;
|
||||
let characterCount = acc.
|
||||
|
@ -233,7 +222,7 @@ this.EventManager.prototype = {
|
|||
this.editState = editState;
|
||||
break;
|
||||
}
|
||||
case EVENT_SHOW:
|
||||
case Events.SHOW:
|
||||
{
|
||||
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
|
||||
['additions', 'all']);
|
||||
|
@ -242,14 +231,14 @@ this.EventManager.prototype = {
|
|||
break;
|
||||
}
|
||||
// Show for text is handled by the EVENT_TEXT_INSERTED handler.
|
||||
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
|
||||
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
|
||||
break;
|
||||
}
|
||||
this._dequeueLiveEvent(EVENT_HIDE, liveRegion);
|
||||
this._dequeueLiveEvent(Events.HIDE, liveRegion);
|
||||
this.present(Presentation.liveRegion(liveRegion, isPolite, false));
|
||||
break;
|
||||
}
|
||||
case EVENT_HIDE:
|
||||
case Events.HIDE:
|
||||
{
|
||||
let {liveRegion, isPolite} = this._handleLiveRegion(
|
||||
aEvent.QueryInterface(Ci.nsIAccessibleHideEvent),
|
||||
|
@ -259,14 +248,14 @@ this.EventManager.prototype = {
|
|||
break;
|
||||
}
|
||||
// Hide for text is handled by the EVENT_TEXT_REMOVED handler.
|
||||
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
|
||||
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
|
||||
break;
|
||||
}
|
||||
this._queueLiveEvent(EVENT_HIDE, liveRegion, isPolite);
|
||||
this._queueLiveEvent(Events.HIDE, liveRegion, isPolite);
|
||||
break;
|
||||
}
|
||||
case EVENT_TEXT_INSERTED:
|
||||
case EVENT_TEXT_REMOVED:
|
||||
case Events.TEXT_INSERTED:
|
||||
case Events.TEXT_REMOVED:
|
||||
{
|
||||
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
|
||||
['text', 'all']);
|
||||
|
@ -277,12 +266,12 @@ this.EventManager.prototype = {
|
|||
}
|
||||
break;
|
||||
}
|
||||
case EVENT_FOCUS:
|
||||
case Events.FOCUS:
|
||||
{
|
||||
// Put vc where the focus is at
|
||||
let acc = aEvent.accessible;
|
||||
let doc = aEvent.accessibleDocument;
|
||||
if (acc.role != ROLE_DOCUMENT && doc.role != ROLE_CHROME_WINDOW) {
|
||||
if (acc.role != Roles.DOCUMENT && doc.role != Roles.CHROME_WINDOW) {
|
||||
let vc = Utils.getVirtualCursor(doc);
|
||||
vc.moveNext(TraversalRules.Simple, acc, true);
|
||||
}
|
||||
|
@ -314,11 +303,11 @@ this.EventManager.prototype = {
|
|||
return;
|
||||
}
|
||||
if (aLiveRegion) {
|
||||
if (aEvent.eventType === EVENT_TEXT_REMOVED) {
|
||||
this._queueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion, aIsPolite,
|
||||
if (aEvent.eventType === Events.TEXT_REMOVED) {
|
||||
this._queueLiveEvent(Events.TEXT_REMOVED, aLiveRegion, aIsPolite,
|
||||
modifiedText);
|
||||
} else {
|
||||
this._dequeueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion);
|
||||
this._dequeueLiveEvent(Events.TEXT_REMOVED, aLiveRegion);
|
||||
this.present(Presentation.liveRegion(aLiveRegion, aIsPolite, false,
|
||||
modifiedText));
|
||||
}
|
||||
|
|
|
@ -1,19 +1,3 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
# You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
INSTALL_TARGETS += ACCESSFU
|
||||
|
||||
ACCESSFU_FILES := \
|
||||
AccessFu.jsm \
|
||||
EventManager.jsm \
|
||||
jar.mn \
|
||||
Makefile.in \
|
||||
OutputGenerator.jsm \
|
||||
Presentation.jsm \
|
||||
TouchAdapter.jsm \
|
||||
TraversalRules.jsm \
|
||||
Utils.jsm \
|
||||
$(NULL)
|
||||
|
||||
ACCESSFU_DEST = $(FINAL_TARGET)/modules/accessibility
|
||||
|
|
|
@ -18,10 +18,6 @@ const NAME_FROM_SUBTREE_RULE = 0x10;
|
|||
const OUTPUT_DESC_FIRST = 0;
|
||||
const OUTPUT_DESC_LAST = 1;
|
||||
|
||||
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
|
||||
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
|
||||
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
|
||||
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
|
||||
'resource://gre/modules/accessibility/Utils.jsm');
|
||||
|
@ -31,6 +27,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
|
|||
'resource://gre/modules/accessibility/Utils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm',
|
||||
'resource://gre/modules/PluralForm.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
|
||||
getService(Ci.nsIStringBundleService).
|
||||
|
@ -697,8 +695,8 @@ this.BrailleGenerator = {
|
|||
let braille = this.objectOutputFunctions._generateBaseOutput.apply(this, arguments);
|
||||
|
||||
if (aAccessible.indexInParent === 1 &&
|
||||
aAccessible.parent.role == ROLE_LISTITEM &&
|
||||
aAccessible.previousSibling.role == ROLE_STATICTEXT) {
|
||||
aAccessible.parent.role == Roles.LISTITEM &&
|
||||
aAccessible.previousSibling.role == Roles.STATICTEXT) {
|
||||
if (aAccessible.parent.parent && aAccessible.parent.parent.DOMNode &&
|
||||
aAccessible.parent.parent.DOMNode.nodeName == 'UL') {
|
||||
braille.unshift('*');
|
||||
|
@ -755,7 +753,7 @@ this.BrailleGenerator = {
|
|||
statictext: function statictext(aAccessible, aRoleStr, aStates, aFlags) {
|
||||
// Since we customize the list bullet's output, we add the static
|
||||
// text from the first node in each listitem, so skip it here.
|
||||
if (aAccessible.parent.role == ROLE_LISTITEM) {
|
||||
if (aAccessible.parent.role == Roles.LISTITEM) {
|
||||
return [];
|
||||
}
|
||||
|
||||
|
@ -788,7 +786,7 @@ this.BrailleGenerator = {
|
|||
},
|
||||
|
||||
_getContextStart: function _getContextStart(aContext) {
|
||||
if (aContext.accessible.parent.role == ROLE_LINK) {
|
||||
if (aContext.accessible.parent.role == Roles.LINK) {
|
||||
return [aContext.accessible.parent];
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@ this.TouchAdapter = {
|
|||
SYNTH_ID: -1,
|
||||
|
||||
start: function TouchAdapter_start() {
|
||||
Logger.info('TouchAdapter.start');
|
||||
Logger.debug('TouchAdapter.start');
|
||||
|
||||
this._touchPoints = {};
|
||||
this._dwellTimeout = 0;
|
||||
|
@ -64,7 +64,7 @@ this.TouchAdapter = {
|
|||
},
|
||||
|
||||
stop: function TouchAdapter_stop() {
|
||||
Logger.info('TouchAdapter.stop');
|
||||
Logger.debug('TouchAdapter.stop');
|
||||
|
||||
let target = Utils.win;
|
||||
|
||||
|
|
|
@ -9,61 +9,24 @@ const Ci = Components.interfaces;
|
|||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
const FILTER_IGNORE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
|
||||
const FILTER_MATCH = Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
|
||||
const FILTER_IGNORE_SUBTREE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
|
||||
|
||||
const ROLE_MENUITEM = Ci.nsIAccessibleRole.ROLE_MENUITEM;
|
||||
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
|
||||
const ROLE_PAGETAB = Ci.nsIAccessibleRole.ROLE_PAGETAB;
|
||||
const ROLE_GRAPHIC = Ci.nsIAccessibleRole.ROLE_GRAPHIC;
|
||||
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
|
||||
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
|
||||
const ROLE_PUSHBUTTON = Ci.nsIAccessibleRole.ROLE_PUSHBUTTON;
|
||||
const ROLE_SPINBUTTON = Ci.nsIAccessibleRole.ROLE_SPINBUTTON;
|
||||
const ROLE_CHECKBUTTON = Ci.nsIAccessibleRole.ROLE_CHECKBUTTON;
|
||||
const ROLE_RADIOBUTTON = Ci.nsIAccessibleRole.ROLE_RADIOBUTTON;
|
||||
const ROLE_COMBOBOX = Ci.nsIAccessibleRole.ROLE_COMBOBOX;
|
||||
const ROLE_PROGRESSBAR = Ci.nsIAccessibleRole.ROLE_PROGRESSBAR;
|
||||
const ROLE_BUTTONDROPDOWN = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN;
|
||||
const ROLE_BUTTONMENU = Ci.nsIAccessibleRole.ROLE_BUTTONMENU;
|
||||
const ROLE_CHECK_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM;
|
||||
const ROLE_PASSWORD_TEXT = Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT;
|
||||
const ROLE_RADIO_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM;
|
||||
const ROLE_TOGGLE_BUTTON = Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
|
||||
const ROLE_KEY = Ci.nsIAccessibleRole.ROLE_KEY;
|
||||
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
|
||||
const ROLE_LIST = Ci.nsIAccessibleRole.ROLE_LIST;
|
||||
const ROLE_DEFINITION_LIST = Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST;
|
||||
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
|
||||
const ROLE_BUTTONDROPDOWNGRID = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
|
||||
const ROLE_LISTBOX = Ci.nsIAccessibleRole.ROLE_LISTBOX;
|
||||
const ROLE_OPTION = Ci.nsIAccessibleRole.ROLE_OPTION;
|
||||
const ROLE_SLIDER = Ci.nsIAccessibleRole.ROLE_SLIDER;
|
||||
const ROLE_HEADING = Ci.nsIAccessibleRole.ROLE_HEADING;
|
||||
const ROLE_HEADER = Ci.nsIAccessibleRole.ROLE_HEADER;
|
||||
const ROLE_TERM = Ci.nsIAccessibleRole.ROLE_TERM;
|
||||
const ROLE_SEPARATOR = Ci.nsIAccessibleRole.ROLE_SEPARATOR;
|
||||
const ROLE_TABLE = Ci.nsIAccessibleRole.ROLE_TABLE;
|
||||
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
|
||||
const ROLE_PARAGRAPH = Ci.nsIAccessibleRole.ROLE_PARAGRAPH;
|
||||
const ROLE_SECTION = Ci.nsIAccessibleRole.ROLE_SECTION;
|
||||
const ROLE_LABEL = Ci.nsIAccessibleRole.ROLE_LABEL;
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['TraversalRules'];
|
||||
|
||||
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
|
||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Filters',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
|
||||
|
||||
function BaseTraversalRule(aRoles, aMatchFunc) {
|
||||
this._explicitMatchRoles = new Set(aRoles);
|
||||
this._matchRoles = aRoles;
|
||||
if (aRoles.indexOf(ROLE_LABEL) < 0) {
|
||||
this._matchRoles.push(ROLE_LABEL);
|
||||
if (aRoles.indexOf(Roles.LABEL) < 0) {
|
||||
this._matchRoles.push(Roles.LABEL);
|
||||
}
|
||||
this._matchFunc = aMatchFunc || function (acc) { return FILTER_MATCH; };
|
||||
this._matchFunc = aMatchFunc || function (acc) { return Filters.MATCH; };
|
||||
}
|
||||
|
||||
BaseTraversalRule.prototype = {
|
||||
|
@ -80,20 +43,20 @@ BaseTraversalRule.prototype = {
|
|||
match: function BaseTraversalRule_match(aAccessible)
|
||||
{
|
||||
let role = aAccessible.role;
|
||||
if (role == ROLE_INTERNAL_FRAME) {
|
||||
if (role == Roles.INTERNAL_FRAME) {
|
||||
return (Utils.getMessageManager(aAccessible.DOMNode)) ?
|
||||
FILTER_MATCH | FILTER_IGNORE_SUBTREE : FILTER_IGNORE;
|
||||
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
|
||||
}
|
||||
|
||||
let matchResult = this._explicitMatchRoles.has(role) ?
|
||||
this._matchFunc(aAccessible) : FILTER_IGNORE;
|
||||
this._matchFunc(aAccessible) : Filters.IGNORE;
|
||||
|
||||
// If we are on a label that nests a checkbox/radio we should land on it.
|
||||
// It is a bigger touch target, and it reduces clutter.
|
||||
if (role == ROLE_LABEL && !(matchResult & FILTER_IGNORE_SUBTREE)) {
|
||||
if (role == Roles.LABEL && !(matchResult & Filters.IGNORE_SUBTREE)) {
|
||||
let control = Utils.getEmbeddedControl(aAccessible);
|
||||
if (control && this._explicitMatchRoles.has(control.role)) {
|
||||
matchResult = this._matchFunc(control) | FILTER_IGNORE_SUBTREE;
|
||||
matchResult = this._matchFunc(control) | Filters.IGNORE_SUBTREE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -104,32 +67,32 @@ BaseTraversalRule.prototype = {
|
|||
};
|
||||
|
||||
var gSimpleTraversalRoles =
|
||||
[ROLE_MENUITEM,
|
||||
ROLE_LINK,
|
||||
ROLE_PAGETAB,
|
||||
ROLE_GRAPHIC,
|
||||
ROLE_STATICTEXT,
|
||||
ROLE_TEXT_LEAF,
|
||||
ROLE_PUSHBUTTON,
|
||||
ROLE_CHECKBUTTON,
|
||||
ROLE_RADIOBUTTON,
|
||||
ROLE_COMBOBOX,
|
||||
ROLE_PROGRESSBAR,
|
||||
ROLE_BUTTONDROPDOWN,
|
||||
ROLE_BUTTONMENU,
|
||||
ROLE_CHECK_MENU_ITEM,
|
||||
ROLE_PASSWORD_TEXT,
|
||||
ROLE_RADIO_MENU_ITEM,
|
||||
ROLE_TOGGLE_BUTTON,
|
||||
ROLE_ENTRY,
|
||||
ROLE_KEY,
|
||||
ROLE_HEADER,
|
||||
ROLE_HEADING,
|
||||
ROLE_SLIDER,
|
||||
ROLE_SPINBUTTON,
|
||||
ROLE_OPTION,
|
||||
[Roles.MENUITEM,
|
||||
Roles.LINK,
|
||||
Roles.PAGETAB,
|
||||
Roles.GRAPHIC,
|
||||
Roles.STATICTEXT,
|
||||
Roles.TEXT_LEAF,
|
||||
Roles.PUSHBUTTON,
|
||||
Roles.CHECKBUTTON,
|
||||
Roles.RADIOBUTTON,
|
||||
Roles.COMBOBOX,
|
||||
Roles.PROGRESSBAR,
|
||||
Roles.BUTTONDROPDOWN,
|
||||
Roles.BUTTONMENU,
|
||||
Roles.CHECK_MENU_ITEM,
|
||||
Roles.PASSWORD_TEXT,
|
||||
Roles.RADIO_MENU_ITEM,
|
||||
Roles.TOGGLE_BUTTON,
|
||||
Roles.ENTRY,
|
||||
Roles.KEY,
|
||||
Roles.HEADER,
|
||||
Roles.HEADING,
|
||||
Roles.SLIDER,
|
||||
Roles.SPINBUTTON,
|
||||
Roles.OPTION,
|
||||
// Used for traversing in to child OOP frames.
|
||||
ROLE_INTERNAL_FRAME];
|
||||
Roles.INTERNAL_FRAME];
|
||||
|
||||
this.TraversalRules = {
|
||||
Simple: new BaseTraversalRule(
|
||||
|
@ -146,47 +109,47 @@ this.TraversalRules = {
|
|||
}
|
||||
|
||||
switch (aAccessible.role) {
|
||||
case ROLE_COMBOBOX:
|
||||
case Roles.COMBOBOX:
|
||||
// We don't want to ignore the subtree because this is often
|
||||
// where the list box hangs out.
|
||||
return FILTER_MATCH;
|
||||
case ROLE_TEXT_LEAF:
|
||||
return Filters.MATCH;
|
||||
case Roles.TEXT_LEAF:
|
||||
{
|
||||
// Nameless text leaves are boring, skip them.
|
||||
let name = aAccessible.name;
|
||||
if (name && name.trim())
|
||||
return FILTER_MATCH;
|
||||
return Filters.MATCH;
|
||||
else
|
||||
return FILTER_IGNORE;
|
||||
return Filters.IGNORE;
|
||||
}
|
||||
case ROLE_STATICTEXT:
|
||||
case Roles.STATICTEXT:
|
||||
{
|
||||
let parent = aAccessible.parent;
|
||||
// Ignore prefix static text in list items. They are typically bullets or numbers.
|
||||
if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
|
||||
parent.role == ROLE_LISTITEM)
|
||||
return FILTER_IGNORE;
|
||||
parent.role == Roles.LISTITEM)
|
||||
return Filters.IGNORE;
|
||||
|
||||
return FILTER_MATCH;
|
||||
return Filters.MATCH;
|
||||
}
|
||||
case ROLE_GRAPHIC:
|
||||
case Roles.GRAPHIC:
|
||||
return TraversalRules._shouldSkipImage(aAccessible);
|
||||
case ROLE_LINK:
|
||||
case ROLE_HEADER:
|
||||
case ROLE_HEADING:
|
||||
case Roles.LINK:
|
||||
case Roles.HEADER:
|
||||
case Roles.HEADING:
|
||||
return hasZeroOrSingleChildDescendants() ?
|
||||
(FILTER_MATCH | FILTER_IGNORE_SUBTREE) : (FILTER_IGNORE);
|
||||
(Filters.MATCH | Filters.IGNORE_SUBTREE) : (Filters.IGNORE);
|
||||
default:
|
||||
// Ignore the subtree, if there is one. So that we don't land on
|
||||
// the same content that was already presented by its parent.
|
||||
return FILTER_MATCH |
|
||||
FILTER_IGNORE_SUBTREE;
|
||||
return Filters.MATCH |
|
||||
Filters.IGNORE_SUBTREE;
|
||||
}
|
||||
}
|
||||
),
|
||||
|
||||
Anchor: new BaseTraversalRule(
|
||||
[ROLE_LINK],
|
||||
[Roles.LINK],
|
||||
function Anchor_match(aAccessible)
|
||||
{
|
||||
// We want to ignore links, only focus named anchors.
|
||||
|
@ -194,67 +157,67 @@ this.TraversalRules = {
|
|||
let extraState = {};
|
||||
aAccessible.getState(state, extraState);
|
||||
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
|
||||
return FILTER_IGNORE;
|
||||
return Filters.IGNORE;
|
||||
} else {
|
||||
return FILTER_MATCH;
|
||||
return Filters.MATCH;
|
||||
}
|
||||
}),
|
||||
|
||||
Button: new BaseTraversalRule(
|
||||
[ROLE_PUSHBUTTON,
|
||||
ROLE_SPINBUTTON,
|
||||
ROLE_TOGGLE_BUTTON,
|
||||
ROLE_BUTTONDROPDOWN,
|
||||
ROLE_BUTTONDROPDOWNGRID]),
|
||||
[Roles.PUSHBUTTON,
|
||||
Roles.SPINBUTTON,
|
||||
Roles.TOGGLE_BUTTON,
|
||||
Roles.BUTTONDROPDOWN,
|
||||
Roles.BUTTONDROPDOWNGRID]),
|
||||
|
||||
Combobox: new BaseTraversalRule(
|
||||
[ROLE_COMBOBOX,
|
||||
ROLE_LISTBOX]),
|
||||
[Roles.COMBOBOX,
|
||||
Roles.LISTBOX]),
|
||||
|
||||
Landmark: new BaseTraversalRule(
|
||||
[],
|
||||
function Landmark_match(aAccessible) {
|
||||
return Utils.getLandmarkName(aAccessible) ? FILTER_MATCH :
|
||||
FILTER_IGNORE;
|
||||
return Utils.getLandmarkName(aAccessible) ? Filters.MATCH :
|
||||
Filters.IGNORE;
|
||||
}
|
||||
),
|
||||
|
||||
Entry: new BaseTraversalRule(
|
||||
[ROLE_ENTRY,
|
||||
ROLE_PASSWORD_TEXT]),
|
||||
[Roles.ENTRY,
|
||||
Roles.PASSWORD_TEXT]),
|
||||
|
||||
FormElement: new BaseTraversalRule(
|
||||
[ROLE_PUSHBUTTON,
|
||||
ROLE_SPINBUTTON,
|
||||
ROLE_TOGGLE_BUTTON,
|
||||
ROLE_BUTTONDROPDOWN,
|
||||
ROLE_BUTTONDROPDOWNGRID,
|
||||
ROLE_COMBOBOX,
|
||||
ROLE_LISTBOX,
|
||||
ROLE_ENTRY,
|
||||
ROLE_PASSWORD_TEXT,
|
||||
ROLE_PAGETAB,
|
||||
ROLE_RADIOBUTTON,
|
||||
ROLE_RADIO_MENU_ITEM,
|
||||
ROLE_SLIDER,
|
||||
ROLE_CHECKBUTTON,
|
||||
ROLE_CHECK_MENU_ITEM]),
|
||||
[Roles.PUSHBUTTON,
|
||||
Roles.SPINBUTTON,
|
||||
Roles.TOGGLE_BUTTON,
|
||||
Roles.BUTTONDROPDOWN,
|
||||
Roles.BUTTONDROPDOWNGRID,
|
||||
Roles.COMBOBOX,
|
||||
Roles.LISTBOX,
|
||||
Roles.ENTRY,
|
||||
Roles.PASSWORD_TEXT,
|
||||
Roles.PAGETAB,
|
||||
Roles.RADIOBUTTON,
|
||||
Roles.RADIO_MENU_ITEM,
|
||||
Roles.SLIDER,
|
||||
Roles.CHECKBUTTON,
|
||||
Roles.CHECK_MENU_ITEM]),
|
||||
|
||||
Graphic: new BaseTraversalRule(
|
||||
[ROLE_GRAPHIC],
|
||||
[Roles.GRAPHIC],
|
||||
function Graphic_match(aAccessible) {
|
||||
return TraversalRules._shouldSkipImage(aAccessible);
|
||||
}),
|
||||
|
||||
Heading: new BaseTraversalRule(
|
||||
[ROLE_HEADING]),
|
||||
[Roles.HEADING]),
|
||||
|
||||
ListItem: new BaseTraversalRule(
|
||||
[ROLE_LISTITEM,
|
||||
ROLE_TERM]),
|
||||
[Roles.LISTITEM,
|
||||
Roles.TERM]),
|
||||
|
||||
Link: new BaseTraversalRule(
|
||||
[ROLE_LINK],
|
||||
[Roles.LINK],
|
||||
function Link_match(aAccessible)
|
||||
{
|
||||
// We want to ignore anchors, only focus real links.
|
||||
|
@ -262,50 +225,50 @@ this.TraversalRules = {
|
|||
let extraState = {};
|
||||
aAccessible.getState(state, extraState);
|
||||
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
|
||||
return FILTER_MATCH;
|
||||
return Filters.MATCH;
|
||||
} else {
|
||||
return FILTER_IGNORE;
|
||||
return Filters.IGNORE;
|
||||
}
|
||||
}),
|
||||
|
||||
List: new BaseTraversalRule(
|
||||
[ROLE_LIST,
|
||||
ROLE_DEFINITION_LIST]),
|
||||
[Roles.LIST,
|
||||
Roles.DEFINITION_LIST]),
|
||||
|
||||
PageTab: new BaseTraversalRule(
|
||||
[ROLE_PAGETAB]),
|
||||
[Roles.PAGETAB]),
|
||||
|
||||
Paragraph: new BaseTraversalRule(
|
||||
[ROLE_PARAGRAPH,
|
||||
ROLE_SECTION],
|
||||
[Roles.PARAGRAPH,
|
||||
Roles.SECTION],
|
||||
function Paragraph_match(aAccessible) {
|
||||
for (let child = aAccessible.firstChild; child; child = child.nextSibling) {
|
||||
if (child.role === ROLE_TEXT_LEAF) {
|
||||
return FILTER_MATCH | FILTER_IGNORE_SUBTREE;
|
||||
if (child.role === Roles.TEXT_LEAF) {
|
||||
return Filters.MATCH | Filters.IGNORE_SUBTREE;
|
||||
}
|
||||
}
|
||||
|
||||
return FILTER_IGNORE;
|
||||
return Filters.IGNORE;
|
||||
}),
|
||||
|
||||
RadioButton: new BaseTraversalRule(
|
||||
[ROLE_RADIOBUTTON,
|
||||
ROLE_RADIO_MENU_ITEM]),
|
||||
[Roles.RADIOBUTTON,
|
||||
Roles.RADIO_MENU_ITEM]),
|
||||
|
||||
Separator: new BaseTraversalRule(
|
||||
[ROLE_SEPARATOR]),
|
||||
[Roles.SEPARATOR]),
|
||||
|
||||
Table: new BaseTraversalRule(
|
||||
[ROLE_TABLE]),
|
||||
[Roles.TABLE]),
|
||||
|
||||
Checkbox: new BaseTraversalRule(
|
||||
[ROLE_CHECKBUTTON,
|
||||
ROLE_CHECK_MENU_ITEM]),
|
||||
[Roles.CHECKBUTTON,
|
||||
Roles.CHECK_MENU_ITEM]),
|
||||
|
||||
_shouldSkipImage: function _shouldSkipImage(aAccessible) {
|
||||
if (gSkipEmptyImages.value && aAccessible.name === '') {
|
||||
return FILTER_IGNORE;
|
||||
return Filters.IGNORE;
|
||||
}
|
||||
return FILTER_MATCH;
|
||||
return Filters.MATCH;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -8,19 +8,17 @@ const Cu = Components.utils;
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
|
||||
|
||||
const ROLE_CELL = Ci.nsIAccessibleRole.ROLE_CELL;
|
||||
const ROLE_COLUMNHEADER = Ci.nsIAccessibleRole.ROLE_COLUMNHEADER;
|
||||
const ROLE_ROWHEADER = Ci.nsIAccessibleRole.ROLE_ROWHEADER;
|
||||
|
||||
const RELATION_LABEL_FOR = Ci.nsIAccessibleRelation.RELATION_LABEL_FOR;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Services',
|
||||
'resource://gre/modules/Services.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Rect',
|
||||
'resource://gre/modules/Geometry.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Relations',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache'];
|
||||
|
||||
|
@ -297,7 +295,7 @@ this.Utils = {
|
|||
|
||||
getEmbeddedControl: function getEmbeddedControl(aLabel) {
|
||||
if (aLabel) {
|
||||
let relation = aLabel.getRelationByType(RELATION_LABEL_FOR);
|
||||
let relation = aLabel.getRelationByType(Relations.LABEL_FOR);
|
||||
for (let i = 0; i < relation.targetsCount; i++) {
|
||||
let target = relation.getTarget(i);
|
||||
if (target.parent === aLabel) {
|
||||
|
@ -399,7 +397,7 @@ this.Logger = {
|
|||
|
||||
eventToString: function eventToString(aEvent) {
|
||||
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
|
||||
if (aEvent.eventType == EVENT_STATE_CHANGE) {
|
||||
if (aEvent.eventType == Events.STATE_CHANGE) {
|
||||
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
|
||||
let stateStrings = event.isExtraState ?
|
||||
Utils.AccRetrieval.getStringStates(0, event.state) :
|
||||
|
@ -633,7 +631,7 @@ PivotContext.prototype = {
|
|||
if (!aAccessible) {
|
||||
return null;
|
||||
}
|
||||
if ([ROLE_CELL, ROLE_COLUMNHEADER, ROLE_ROWHEADER].indexOf(
|
||||
if ([Roles.CELL, Roles.COLUMNHEADER, Roles.ROWHEADER].indexOf(
|
||||
aAccessible.role) < 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -694,12 +692,12 @@ PivotContext.prototype = {
|
|||
|
||||
cellInfo.columnHeaders = [];
|
||||
if (cellInfo.columnChanged && cellInfo.current.role !==
|
||||
ROLE_COLUMNHEADER) {
|
||||
Roles.COLUMNHEADER) {
|
||||
cellInfo.columnHeaders = [headers for (headers of getHeaders(
|
||||
cellInfo.current.columnHeaderCells))];
|
||||
}
|
||||
cellInfo.rowHeaders = [];
|
||||
if (cellInfo.rowChanged && cellInfo.current.role === ROLE_CELL) {
|
||||
if (cellInfo.rowChanged && cellInfo.current.role === Roles.CELL) {
|
||||
cellInfo.rowHeaders = [headers for (headers of getHeaders(
|
||||
cellInfo.current.rowHeaderCells))];
|
||||
}
|
||||
|
|
|
@ -5,9 +5,6 @@
|
|||
let Ci = Components.interfaces;
|
||||
let Cu = Components.utils;
|
||||
|
||||
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
|
||||
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
|
||||
|
||||
const MOVEMENT_GRANULARITY_CHARACTER = 1;
|
||||
const MOVEMENT_GRANULARITY_WORD = 2;
|
||||
const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
|
||||
|
@ -25,6 +22,8 @@ XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
|
|||
'resource://gre/modules/accessibility/EventManager.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'ObjectWrapper',
|
||||
'resource://gre/modules/ObjectWrapper.jsm');
|
||||
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
|
||||
'resource://gre/modules/accessibility/Constants.jsm');
|
||||
|
||||
Logger.debug('content-script.js');
|
||||
|
||||
|
@ -137,7 +136,7 @@ function forwardToParent(aMessage) {
|
|||
function forwardToChild(aMessage, aListener, aVCPosition) {
|
||||
let acc = aVCPosition || Utils.getVirtualCursor(content.document).position;
|
||||
|
||||
if (!Utils.isAliveAndVisible(acc) || acc.role != ROLE_INTERNAL_FRAME) {
|
||||
if (!Utils.isAliveAndVisible(acc) || acc.role != Roles.INTERNAL_FRAME) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -165,7 +164,7 @@ function activateCurrent(aMessage) {
|
|||
Logger.debug('activateCurrent');
|
||||
function activateAccessible(aAccessible) {
|
||||
if (aMessage.json.activateIfKey &&
|
||||
aAccessible.role != Ci.nsIAccessibleRole.ROLE_KEY) {
|
||||
aAccessible.role != Roles.KEY) {
|
||||
// Only activate keys, don't do anything on other objects.
|
||||
return;
|
||||
}
|
||||
|
@ -219,7 +218,7 @@ function activateCurrent(aMessage) {
|
|||
}
|
||||
|
||||
let focusedAcc = Utils.AccRetrieval.getAccessibleFor(content.document.activeElement);
|
||||
if (focusedAcc && focusedAcc.role === ROLE_ENTRY) {
|
||||
if (focusedAcc && focusedAcc.role === Roles.ENTRY) {
|
||||
moveCaretTo(focusedAcc, aMessage.json.offset);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -3,3 +3,16 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
JS_MODULES_PATH = 'modules/accessibility'
|
||||
|
||||
EXTRA_JS_MODULES += [
|
||||
'AccessFu.jsm',
|
||||
'Constants.jsm',
|
||||
'EventManager.jsm',
|
||||
'OutputGenerator.jsm',
|
||||
'Presentation.jsm',
|
||||
'TouchAdapter.jsm',
|
||||
'TraversalRules.jsm',
|
||||
'Utils.jsm'
|
||||
]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORT_LIBRARY = ..
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'mozAccessibleProtocol.h',
|
||||
]
|
||||
|
@ -15,9 +13,7 @@ EXPORTS.mozilla.a11y += [
|
|||
'HyperTextAccessibleWrap.h',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_s'
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'AccessibleWrap.mm',
|
||||
'DocAccessibleWrap.mm',
|
||||
'MacUtils.mm',
|
||||
|
@ -30,8 +26,6 @@ SOURCES += [
|
|||
'RootAccessibleWrap.mm',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
'../generic',
|
||||
|
@ -43,3 +37,4 @@ LOCAL_INCLUDES += [
|
|||
'/widget/xpwidgets',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -4,9 +4,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "Accessible-inl.h"
|
||||
#include "AccessibleWrap.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "TextLeafAccessible.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
|
||||
#include "nsCocoaUtils.h"
|
||||
#include "nsObjCExceptions.h"
|
||||
|
@ -213,10 +212,10 @@ ToNSString(id aValue)
|
|||
#endif
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
int32_t start = range.location;
|
||||
int32_t end = start + range.length;
|
||||
nsIntRect bounds = mGeckoTextAccessible->GetTextBounds(start, end);
|
||||
nsIntRect bounds = mGeckoTextAccessible->TextBounds(start, end);
|
||||
|
||||
return [NSValue valueWithRect:nsCocoaUtils::GeckoRectToCocoaRect(bounds)];
|
||||
}
|
||||
|
@ -263,21 +262,13 @@ ToNSString(id aValue)
|
|||
if (!stringValue)
|
||||
return;
|
||||
|
||||
int32_t start = 0;
|
||||
int32_t end = 0;
|
||||
|
||||
nsresult rv = mGeckoTextAccessible->GetSelectionBounds(0, &start, &end);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
|
||||
rv = mGeckoTextAccessible->DeleteText(start, end - start);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
int32_t start = 0, end = 0;
|
||||
mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end);
|
||||
mGeckoTextAccessible->DeleteText(start, end - start);
|
||||
|
||||
nsString text;
|
||||
nsCocoaUtils::GetStringForNSString(stringValue, text);
|
||||
rv = mGeckoTextAccessible->InsertText(text, start);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
|
||||
return;
|
||||
mGeckoTextAccessible->InsertText(text, start);
|
||||
}
|
||||
|
||||
if ([attribute isEqualToString:NSAccessibilitySelectedTextRangeAttribute]) {
|
||||
|
@ -285,10 +276,8 @@ ToNSString(id aValue)
|
|||
if (!ToNSRange(value, &range))
|
||||
return;
|
||||
|
||||
nsresult rv = mGeckoTextAccessible->SetSelectionBounds(0, range.location,
|
||||
range.location + range.length);
|
||||
NS_ENSURE_SUCCESS(rv,);
|
||||
|
||||
mGeckoTextAccessible->SetSelectionBoundsAt(0, range.location,
|
||||
range.location + range.length);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -374,10 +363,9 @@ ToNSString(id aValue)
|
|||
return @"";
|
||||
|
||||
nsAutoString text;
|
||||
nsresult rv = mGeckoTextAccessible->
|
||||
GetText(0, nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT, text);
|
||||
NS_ENSURE_SUCCESS(rv, @"");
|
||||
|
||||
mGeckoTextAccessible->TextSubstring(0,
|
||||
nsIAccessibleText::TEXT_OFFSET_END_OF_TEXT,
|
||||
text);
|
||||
return nsCocoaUtils::ToNSString(text);
|
||||
}
|
||||
|
||||
|
@ -398,11 +386,8 @@ ToNSString(id aValue)
|
|||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN;
|
||||
|
||||
if (mGeckoTextAccessible) {
|
||||
int32_t start, end;
|
||||
start = end = 0;
|
||||
nsresult rv = mGeckoTextAccessible->GetSelectionBounds(0, &start, &end);
|
||||
NS_ENSURE_SUCCESS(rv, 0);
|
||||
|
||||
int32_t start = 0, end = 0;
|
||||
mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end);
|
||||
return (end - start);
|
||||
}
|
||||
return 0;
|
||||
|
@ -415,12 +400,11 @@ ToNSString(id aValue)
|
|||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
|
||||
|
||||
if (mGeckoTextAccessible) {
|
||||
int32_t start, end;
|
||||
start = end = 0;
|
||||
mGeckoTextAccessible->GetSelectionBounds(0, &start, &end);
|
||||
int32_t start = 0, end = 0;
|
||||
mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end);
|
||||
if (start != end) {
|
||||
nsAutoString selText;
|
||||
mGeckoTextAccessible->GetText(start, end, selText);
|
||||
mGeckoTextAccessible->TextSubstring(start, end, selText);
|
||||
return nsCocoaUtils::ToNSString(selText);
|
||||
}
|
||||
}
|
||||
|
@ -436,21 +420,14 @@ ToNSString(id aValue)
|
|||
if (mGeckoTextAccessible) {
|
||||
int32_t start = 0;
|
||||
int32_t end = 0;
|
||||
int32_t count = 0;
|
||||
|
||||
nsresult rv = mGeckoTextAccessible->GetSelectionCount(&count);
|
||||
NS_ENSURE_SUCCESS(rv, nil);
|
||||
int32_t count = mGeckoTextAccessible->SelectionCount();
|
||||
|
||||
if (count) {
|
||||
rv = mGeckoTextAccessible->GetSelectionBounds(0, &start, &end);
|
||||
NS_ENSURE_SUCCESS(rv, nil);
|
||||
|
||||
mGeckoTextAccessible->SelectionBoundsAt(0, &start, &end);
|
||||
return [NSValue valueWithRange:NSMakeRange(start, end - start)];
|
||||
}
|
||||
|
||||
rv = mGeckoTextAccessible->GetCaretOffset(&start);
|
||||
NS_ENSURE_SUCCESS(rv, nil);
|
||||
|
||||
start = mGeckoTextAccessible->CaretOffset();
|
||||
return [NSValue valueWithRange:NSMakeRange(start != -1 ? start : 0, 0)];
|
||||
}
|
||||
return [NSValue valueWithRange:NSMakeRange(0, 0)];
|
||||
|
@ -488,8 +465,8 @@ ToNSString(id aValue)
|
|||
NS_PRECONDITION(mGeckoTextAccessible && range, "no Gecko text accessible or range");
|
||||
|
||||
nsAutoString text;
|
||||
mGeckoTextAccessible->GetText(range->location,
|
||||
range->location + range->length, text);
|
||||
mGeckoTextAccessible->TextSubstring(range->location,
|
||||
range->location + range->length, text);
|
||||
return nsCocoaUtils::ToNSString(text);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORT_LIBRARY = ..
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
ifneq ($(A11Y_LOG),0)
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS.mozilla.a11y += [
|
||||
'AccessibleWrap.h',
|
||||
'HyperTextAccessibleWrap.h',
|
||||
|
@ -16,10 +14,6 @@ SOURCES += [
|
|||
'Platform.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
'../generic',
|
||||
|
@ -27,3 +21,4 @@ LOCAL_INCLUDES += [
|
|||
'../xul',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "ia2AccessibleEditableText.h"
|
||||
|
||||
#include "AccessibleEditableText_i.c"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
@ -26,8 +27,11 @@ ia2AccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->CopyText(aStartOffset, aEndOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -41,8 +45,11 @@ ia2AccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -56,11 +63,14 @@ ia2AccessibleEditableText::insertText(long aOffset, BSTR *aText)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
uint32_t length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
|
||||
nsresult rv = textAcc->InsertText(text, aOffset);
|
||||
return GetHRESULT(rv);
|
||||
textAcc->InsertText(text, aOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -74,8 +84,11 @@ ia2AccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->CutText(aStartOffset, aEndOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -89,8 +102,11 @@ ia2AccessibleEditableText::pasteText(long aOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->PasteText(aOffset);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->PasteText(aOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -105,15 +121,16 @@ ia2AccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->DeleteText(aStartOffset, aEndOffset);
|
||||
|
||||
uint32_t length = ::SysStringLen(*aText);
|
||||
nsAutoString text(*aText, length);
|
||||
textAcc->InsertText(text, aStartOffset);
|
||||
|
||||
rv = textAcc->InsertText(text, aStartOffset);
|
||||
return GetHRESULT(rv);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ ia2AccessibleHypertext::get_nHyperlinks(long* aHyperlinkCount)
|
|||
if (hyperText->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aHyperlinkCount = hyperText->GetLinkCount();
|
||||
*aHyperlinkCount = hyperText->LinkCount();
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -51,7 +51,7 @@ ia2AccessibleHypertext::get_hyperlink(long aLinkIndex,
|
|||
if (hyperText->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
Accessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
|
||||
Accessible* hyperLink = hyperText->LinkAt(aLinkIndex);
|
||||
if (!hyperLink)
|
||||
return E_FAIL;
|
||||
|
||||
|
@ -77,7 +77,7 @@ ia2AccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long* aHyperlinkInde
|
|||
if (hyperAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
*aHyperlinkIndex = hyperAcc->GetLinkIndexAtOffset(aCharIndex);
|
||||
*aHyperlinkIndex = hyperAcc->LinkIndexAtOffset(aCharIndex);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
|
|
@ -11,9 +11,7 @@
|
|||
#include "AccessibleText_i.c"
|
||||
|
||||
#include "HyperTextAccessibleWrap.h"
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
#include "nsIAccessibleTypes.h"
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -28,8 +26,8 @@ ia2AccessibleText::addSelection(long aStartOffset, long aEndOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
return textAcc->AddToSelection(aStartOffset, aEndOffset) ?
|
||||
S_OK : E_INVALIDARG;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -52,13 +50,9 @@ ia2AccessibleText::get_attributes(long aOffset, long *aStartOffset,
|
|||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsCOMPtr<nsIPersistentProperties> attributes;
|
||||
nsresult rv = textAcc->GetTextAttributes(true, aOffset,
|
||||
&startOffset, &endOffset,
|
||||
getter_AddRefs(attributes));
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attributes =
|
||||
textAcc->TextAttributes(true, aOffset, &startOffset, &endOffset);
|
||||
|
||||
HRESULT hr = AccessibleWrap::ConvertToIA2Attributes(attributes,
|
||||
aTextAttributes);
|
||||
if (FAILED(hr))
|
||||
|
@ -86,13 +80,8 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
int32_t offset = 0;
|
||||
nsresult rv = textAcc->GetCaretOffset(&offset);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aOffset = offset;
|
||||
return offset != -1 ? S_OK : S_FALSE;
|
||||
*aOffset = textAcc->CaretOffset();
|
||||
return *aOffset != -1 ? S_OK : S_FALSE;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -100,18 +89,14 @@ ia2AccessibleText::get_caretOffset(long *aOffset)
|
|||
STDMETHODIMP
|
||||
ia2AccessibleText::get_characterExtents(long aOffset,
|
||||
enum IA2CoordinateType aCoordType,
|
||||
long *aX, long *aY,
|
||||
long *aWidth, long *aHeight)
|
||||
long* aX, long* aY,
|
||||
long* aWidth, long* aHeight)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aX || !aY || !aWidth || !aHeight)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aX = 0;
|
||||
*aY = 0;
|
||||
*aWidth = 0;
|
||||
*aHeight = 0;
|
||||
*aX = *aY = *aWidth = *aHeight = 0;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
|
@ -121,41 +106,31 @@ ia2AccessibleText::get_characterExtents(long aOffset,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
int32_t x = 0, y =0, width = 0, height = 0;
|
||||
nsresult rv = textAcc->GetCharacterExtents (aOffset, &x, &y, &width, &height,
|
||||
geckoCoordType);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
nsIntRect rect = textAcc->CharBounds(aOffset, geckoCoordType);
|
||||
|
||||
*aX = x;
|
||||
*aY = y;
|
||||
*aWidth = width;
|
||||
*aHeight = height;
|
||||
*aX = rect.x;
|
||||
*aY = rect.y;
|
||||
*aWidth = rect.width;
|
||||
*aHeight = rect.height;
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
ia2AccessibleText::get_nSelections(long *aNSelections)
|
||||
ia2AccessibleText::get_nSelections(long* aNSelections)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aNSelections)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aNSelections = 0;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
int32_t selCount = 0;
|
||||
nsresult rv = textAcc->GetSelectionCount(&selCount);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aNSelections = selCount;
|
||||
*aNSelections = textAcc->SelectionCount();
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
|
@ -164,13 +139,12 @@ ia2AccessibleText::get_nSelections(long *aNSelections)
|
|||
STDMETHODIMP
|
||||
ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
|
||||
enum IA2CoordinateType aCoordType,
|
||||
long *aOffset)
|
||||
long* aOffset)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aOffset)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aOffset = 0;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
|
@ -181,38 +155,29 @@ ia2AccessibleText::get_offsetAtPoint(long aX, long aY,
|
|||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
int32_t offset = 0;
|
||||
nsresult rv = textAcc->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aOffset = offset;
|
||||
return S_OK;
|
||||
*aOffset = textAcc->OffsetAtPoint(aX, aY, geckoCoordType);
|
||||
return *aOffset == -1 ? S_FALSE : S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
ia2AccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
|
||||
long *aEndOffset)
|
||||
ia2AccessibleText::get_selection(long aSelectionIndex, long* aStartOffset,
|
||||
long* aEndOffset)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aStartOffset || !aEndOffset)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aStartOffset = 0;
|
||||
*aEndOffset = 0;
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
nsresult rv = textAcc->GetSelectionBounds(aSelectionIndex,
|
||||
&startOffset, &endOffset);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->SelectionBoundsAt(aSelectionIndex, &startOffset, &endOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
@ -222,7 +187,7 @@ ia2AccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
|
|||
}
|
||||
|
||||
STDMETHODIMP
|
||||
ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
|
||||
ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR* aText)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
|
@ -235,11 +200,11 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsAutoString text;
|
||||
nsresult rv = textAcc->GetText(aStartOffset, aEndOffset, text);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartOffset, aEndOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsAutoString text;
|
||||
textAcc->TextSubstring(aStartOffset, aEndOffset, text);
|
||||
if (text.IsEmpty())
|
||||
return S_FALSE;
|
||||
|
||||
|
@ -252,40 +217,38 @@ ia2AccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
|
|||
STDMETHODIMP
|
||||
ia2AccessibleText::get_textBeforeOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
long* aStartOffset, long* aEndOffset,
|
||||
BSTR* aText)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aStartOffset || !aEndOffset || !aText)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aStartOffset = 0;
|
||||
*aEndOffset = 0;
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
*aText = nullptr;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsAutoString text;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
endOffset = textAcc->CharacterCount();
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
textAcc->TextSubstring(startOffset, endOffset, text);
|
||||
} else {
|
||||
AccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType == -1)
|
||||
return S_FALSE;
|
||||
rv = textAcc->GetTextBeforeOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
textAcc->TextBeforeOffset(aOffset, boundaryType, &startOffset, &endOffset, text);
|
||||
}
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
@ -302,8 +265,8 @@ ia2AccessibleText::get_textBeforeOffset(long aOffset,
|
|||
STDMETHODIMP
|
||||
ia2AccessibleText::get_textAfterOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
long* aStartOffset, long* aEndOffset,
|
||||
BSTR* aText)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
|
@ -318,25 +281,23 @@ ia2AccessibleText::get_textAfterOffset(long aOffset,
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsAutoString text;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
endOffset = textAcc->CharacterCount();
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
textAcc->TextSubstring(startOffset, endOffset, text);
|
||||
} else {
|
||||
AccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType == -1)
|
||||
return S_FALSE;
|
||||
rv = textAcc->GetTextAfterOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
textAcc->TextAfterOffset(aOffset, boundaryType, &startOffset, &endOffset, text);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
|
@ -352,41 +313,37 @@ ia2AccessibleText::get_textAfterOffset(long aOffset,
|
|||
STDMETHODIMP
|
||||
ia2AccessibleText::get_textAtOffset(long aOffset,
|
||||
enum IA2TextBoundaryType aBoundaryType,
|
||||
long *aStartOffset, long *aEndOffset,
|
||||
BSTR *aText)
|
||||
long* aStartOffset, long* aEndOffset,
|
||||
BSTR* aText)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aStartOffset || !aEndOffset || !aText)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aStartOffset = 0;
|
||||
*aEndOffset = 0;
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
*aText = nullptr;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsAutoString text;
|
||||
int32_t startOffset = 0, endOffset = 0;
|
||||
|
||||
if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
|
||||
startOffset = 0;
|
||||
endOffset = textAcc->CharacterCount();
|
||||
rv = textAcc->GetText(startOffset, endOffset, text);
|
||||
textAcc->TextSubstring(startOffset, endOffset, text);
|
||||
} else {
|
||||
AccessibleTextBoundary boundaryType = GetGeckoTextBoundary(aBoundaryType);
|
||||
if (boundaryType == -1)
|
||||
return S_FALSE;
|
||||
rv = textAcc->GetTextAtOffset(aOffset, boundaryType,
|
||||
&startOffset, &endOffset, text);
|
||||
textAcc->TextAtOffset(aOffset, boundaryType, &startOffset, &endOffset, text);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
|
||||
*aStartOffset = startOffset;
|
||||
*aEndOffset = endOffset;
|
||||
|
||||
|
@ -408,8 +365,8 @@ ia2AccessibleText::removeSelection(long aSelectionIndex)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
|
||||
return GetHRESULT(rv);
|
||||
return textAcc->RemoveFromSelection(aSelectionIndex) ?
|
||||
S_OK : E_INVALIDARG;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -423,8 +380,11 @@ ia2AccessibleText::setCaretOffset(long aOffset)
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->SetCaretOffset(aOffset);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidOffset(aOffset))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->SetCaretOffset(aOffset);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -439,21 +399,19 @@ ia2AccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
|
||||
aStartOffset, aEndOffset);
|
||||
return GetHRESULT(rv);
|
||||
return textAcc->SetSelectionBoundsAt(aSelectionIndex, aStartOffset, aEndOffset) ?
|
||||
S_OK : E_INVALIDARG;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
ia2AccessibleText::get_nCharacters(long *aNCharacters)
|
||||
ia2AccessibleText::get_nCharacters(long* aNCharacters)
|
||||
{
|
||||
A11Y_TRYBLOCK_BEGIN
|
||||
|
||||
if (!aNCharacters)
|
||||
return E_INVALIDARG;
|
||||
|
||||
*aNCharacters = 0;
|
||||
|
||||
HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
|
||||
|
@ -476,8 +434,11 @@ ia2AccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
nsresult rv = textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
|
||||
return GetHRESULT(rv);
|
||||
if (!textAcc->IsValidRange(aStartIndex, aEndIndex))
|
||||
return E_INVALIDARG;
|
||||
|
||||
textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -493,13 +454,16 @@ ia2AccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
|
|||
if (textAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
if (!textAcc->IsValidRange(aStartIndex, aEndIndex))
|
||||
return E_INVALIDARG;
|
||||
|
||||
uint32_t geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
|
||||
nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
|
||||
nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
|
||||
|
||||
nsresult rv = textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
|
||||
geckoCoordType, aX, aY);
|
||||
return GetHRESULT(rv);
|
||||
textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
|
||||
geckoCoordType, aX, aY);
|
||||
return S_OK;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "Accessible-inl.h"
|
||||
#include "IUnknownImpl.h"
|
||||
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
// IUnknown
|
||||
|
@ -55,10 +57,9 @@ ia2AccessibleValue::get_currentValue(VARIANT* aCurrentValue)
|
|||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
double currentValue = 0;
|
||||
nsresult rv = valueAcc->GetCurrentValue(¤tValue);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
double currentValue = valueAcc->CurValue();
|
||||
if (IsNaN(currentValue))
|
||||
return S_FALSE;
|
||||
|
||||
aCurrentValue->vt = VT_R8;
|
||||
aCurrentValue->dblVal = currentValue;
|
||||
|
@ -79,8 +80,7 @@ ia2AccessibleValue::setCurrentValue(VARIANT aValue)
|
|||
if (aValue.vt != VT_R8)
|
||||
return E_INVALIDARG;
|
||||
|
||||
nsresult rv = valueAcc->SetCurrentValue(aValue.dblVal);
|
||||
return GetHRESULT(rv);
|
||||
return valueAcc->SetCurValue(aValue.dblVal) ? S_OK : E_FAIL;
|
||||
|
||||
A11Y_TRYBLOCK_END
|
||||
}
|
||||
|
@ -99,10 +99,9 @@ ia2AccessibleValue::get_maximumValue(VARIANT* aMaximumValue)
|
|||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
double maximumValue = 0;
|
||||
nsresult rv = valueAcc->GetMaximumValue(&maximumValue);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
double maximumValue = valueAcc->MaxValue();
|
||||
if (IsNaN(maximumValue))
|
||||
return S_FALSE;
|
||||
|
||||
aMaximumValue->vt = VT_R8;
|
||||
aMaximumValue->dblVal = maximumValue;
|
||||
|
@ -125,10 +124,9 @@ ia2AccessibleValue::get_minimumValue(VARIANT* aMinimumValue)
|
|||
if (valueAcc->IsDefunct())
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
|
||||
double minimumValue = 0;
|
||||
nsresult rv = valueAcc->GetMinimumValue(&minimumValue);
|
||||
if (NS_FAILED(rv))
|
||||
return GetHRESULT(rv);
|
||||
double minimumValue = valueAcc->MinValue();
|
||||
if (IsNaN(minimumValue))
|
||||
return S_FALSE;
|
||||
|
||||
aMinimumValue->vt = VT_R8;
|
||||
aMinimumValue->dblVal = minimumValue;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'ia2Accessible.h',
|
||||
'ia2AccessibleAction.h',
|
||||
|
@ -32,8 +30,6 @@ SOURCES += [
|
|||
'ia2AccessibleValue.cpp',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../base',
|
||||
'../../generic',
|
||||
|
@ -43,7 +39,4 @@ LOCAL_INCLUDES += [
|
|||
'../msaa',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_ia2_s'
|
||||
|
||||
EXPORT_LIBRARY = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -23,7 +23,7 @@ GetHRESULT(nsresult aResult)
|
|||
case NS_OK:
|
||||
return S_OK;
|
||||
|
||||
case NS_ERROR_INVALID_ARG: case NS_ERROR_INVALID_POINTER:
|
||||
case NS_ERROR_INVALID_ARG:
|
||||
return E_INVALIDARG;
|
||||
|
||||
case NS_ERROR_OUT_OF_MEMORY:
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
#define mozilla_a11y_IUnknownImpl_h_
|
||||
|
||||
#include <windows.h>
|
||||
#undef CreateEvent // thank you windows you're such a helper
|
||||
#include "nsError.h"
|
||||
|
||||
// Avoid warning C4509 like "nonstandard extension used:
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'IUnknownImpl.h',
|
||||
]
|
||||
|
@ -42,8 +40,6 @@ if CONFIG['MOZ_XUL']:
|
|||
'XULTreeGridAccessibleWrap.cpp',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../../content/base/src',
|
||||
'../../../../content/events/src',
|
||||
|
@ -57,9 +53,6 @@ LOCAL_INCLUDES += [
|
|||
'../uia',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_msaa_s'
|
||||
|
||||
EXPORT_LIBRARY = True
|
||||
|
||||
include('/ipc/chromium/chromium-config.mozbuild')
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -4,16 +4,12 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
SOURCES += [
|
||||
'sdnAccessible.cpp',
|
||||
'sdnDocAccessible.cpp',
|
||||
'sdnTextAccessible.cpp',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../base',
|
||||
'../../generic',
|
||||
|
@ -27,7 +23,4 @@ LOCAL_INCLUDES += [
|
|||
# macros which conflicts with std::min/max. Suppress the macros:
|
||||
DEFINES['NOMINMAX'] = True
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_sdn_s'
|
||||
|
||||
EXPORT_LIBRARY = True
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
EXPORT_LIBRARY = ..
|
||||
|
||||
# The midl generated code include Windows headers which defines min and max
|
||||
# macros which conflicts with std::min/max. Suppress the macros:
|
||||
OS_CXXFLAGS += -DNOMINMAX
|
||||
|
|
|
@ -4,14 +4,10 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
SOURCES += [
|
||||
'uiaRawElmProvider.cpp',
|
||||
]
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../base',
|
||||
'../../generic',
|
||||
|
@ -21,5 +17,4 @@ LOCAL_INCLUDES += [
|
|||
'../msaa',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_toolkit_uia_s'
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -4,27 +4,25 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
EXPORTS += [
|
||||
'xpcAccessibleHyperText.h',
|
||||
'xpcAccessibleSelectable.h',
|
||||
'xpcAccessibleValue.h',
|
||||
]
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'nsAccessibleRelation.cpp',
|
||||
'xpcAccessibleHyperText.cpp',
|
||||
'xpcAccessibleSelectable.cpp',
|
||||
'xpcAccessibleTable.cpp',
|
||||
'xpcAccessibleTableCell.cpp',
|
||||
'xpcAccessibleValue.cpp',
|
||||
]
|
||||
|
||||
GENERATED_SOURCES += [
|
||||
'xpcAccEvents.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_xpcom_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../base',
|
||||
'../generic',
|
||||
|
@ -46,3 +44,5 @@ else:
|
|||
LOCAL_INCLUDES += [
|
||||
'../other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -0,0 +1,507 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "xpcAccessibleHyperText.h"
|
||||
|
||||
#include "HyperTextAccessible-inl.h"
|
||||
|
||||
#include "nsIPersistentProperties2.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
nsresult
|
||||
xpcAccessibleHyperText::QueryInterface(REFNSIID aIID, void** aInstancePtr)
|
||||
{
|
||||
*aInstancePtr = nullptr;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (!text->IsTextRole())
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsIAccessibleText)))
|
||||
*aInstancePtr = static_cast<nsIAccessibleText*>(text);
|
||||
else if (aIID.Equals(NS_GET_IID(nsIAccessibleEditableText)))
|
||||
*aInstancePtr = static_cast<nsIAccessibleEditableText*>(text);
|
||||
else if (aIID.Equals(NS_GET_IID(nsIAccessibleHyperText)))
|
||||
*aInstancePtr = static_cast<nsIAccessibleHyperText*>(text);
|
||||
else
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
||||
NS_ADDREF(text);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleText
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetCharacterCount(int32_t* aCharacterCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharacterCount);
|
||||
*aCharacterCount = 0;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aCharacterCount = text->CharacterCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetText(int32_t aStartOffset, int32_t aEndOffset,
|
||||
nsAString& aText)
|
||||
{
|
||||
aText.Truncate();
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->TextSubstring(aStartOffset, aEndOffset, aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetTextBeforeOffset(int32_t aOffset,
|
||||
AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset,
|
||||
nsAString& aText)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
aText.Truncate();
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->TextBeforeOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetTextAtOffset(int32_t aOffset,
|
||||
AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset, nsAString& aText)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
aText.Truncate();
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->TextAtOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetTextAfterOffset(int32_t aOffset,
|
||||
AccessibleTextBoundary aBoundaryType,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset, nsAString& aText)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
aText.Truncate();
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->TextAfterOffset(aOffset, aBoundaryType, aStartOffset, aEndOffset, aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetCharacterAtOffset(int32_t aOffset,
|
||||
PRUnichar* aCharacter)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCharacter);
|
||||
*aCharacter = L'\0';
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsAutoString character;
|
||||
if (text->GetCharAt(aOffset, eGetAt, character)) {
|
||||
*aCharacter = character.First();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetTextAttributes(bool aIncludeDefAttrs,
|
||||
int32_t aOffset,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset,
|
||||
nsIPersistentProperties** aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
*aAttributes = nullptr;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attrs =
|
||||
text->TextAttributes(aIncludeDefAttrs, aOffset, aStartOffset, aEndOffset);
|
||||
attrs.swap(*aAttributes);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetDefaultTextAttributes(nsIPersistentProperties** aAttributes)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAttributes);
|
||||
*aAttributes = nullptr;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIPersistentProperties> attrs = text->DefaultTextAttributes();
|
||||
attrs.swap(*aAttributes);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetCharacterExtents(int32_t aOffset,
|
||||
int32_t* aX, int32_t* aY,
|
||||
int32_t* aWidth, int32_t* aHeight,
|
||||
uint32_t aCoordType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aX);
|
||||
NS_ENSURE_ARG_POINTER(aY);
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
*aX = *aY = *aWidth = *aHeight;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIntRect rect = text->CharBounds(aOffset, aCoordType);
|
||||
*aX = rect.x; *aY = rect.y;
|
||||
*aWidth = rect.width; *aHeight = rect.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetRangeExtents(int32_t aStartOffset, int32_t aEndOffset,
|
||||
int32_t* aX, int32_t* aY,
|
||||
int32_t* aWidth, int32_t* aHeight,
|
||||
uint32_t aCoordType)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aX);
|
||||
NS_ENSURE_ARG_POINTER(aY);
|
||||
NS_ENSURE_ARG_POINTER(aWidth);
|
||||
NS_ENSURE_ARG_POINTER(aHeight);
|
||||
*aX = *aY = *aWidth = *aHeight = 0;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsIntRect rect = text->TextBounds(aStartOffset, aEndOffset, aCoordType);
|
||||
*aX = rect.x; *aY = rect.y;
|
||||
*aWidth = rect.width; *aHeight = rect.height;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetOffsetAtPoint(int32_t aX, int32_t aY,
|
||||
uint32_t aCoordType, int32_t* aOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aOffset);
|
||||
*aOffset = -1;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aOffset = text->OffsetAtPoint(aX, aY, aCoordType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetScriptableCaretOffset(int32_t* aCaretOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCaretOffset);
|
||||
*aCaretOffset = -1;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aCaretOffset = text->CaretOffset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::SetScriptableCaretOffset(int32_t aCaretOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->SetCaretOffset(aCaretOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetSelectionCount(int32_t* aSelectionCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSelectionCount);
|
||||
*aSelectionCount = 0;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aSelectionCount = text->SelectionCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetSelectionBounds(int32_t aSelectionNum,
|
||||
int32_t* aStartOffset,
|
||||
int32_t* aEndOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aStartOffset);
|
||||
NS_ENSURE_ARG_POINTER(aEndOffset);
|
||||
*aStartOffset = *aEndOffset = 0;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aSelectionNum < 0 || aSelectionNum >= text->SelectionCount())
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
text->SelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::SetSelectionBounds(int32_t aSelectionNum,
|
||||
int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
if (aSelectionNum < 0 ||
|
||||
!text->SetSelectionBoundsAt(aSelectionNum, aStartOffset, aEndOffset))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::AddSelection(int32_t aStartOffset, int32_t aEndOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->AddToSelection(aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::RemoveSelection(int32_t aSelectionNum)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->RemoveFromSelection(aSelectionNum);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableScrollSubstringTo(int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
uint32_t aScrollType)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->ScrollSubstringTo(aStartOffset, aEndOffset, aScrollType);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableScrollSubstringToPoint(int32_t aStartOffset,
|
||||
int32_t aEndOffset,
|
||||
uint32_t aCoordinateType,
|
||||
int32_t aX, int32_t aY)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->ScrollSubstringToPoint(aStartOffset, aEndOffset, aCoordinateType, aX, aY);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleEditableText
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::SetTextContents(const nsAString& aText)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->ReplaceText(aText);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableInsertText(const nsAString& aText,
|
||||
int32_t aOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->InsertText(aText, aOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableCopyText(int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->CopyText(aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableCutText(int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->CutText(aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptableDeleteText(int32_t aStartOffset,
|
||||
int32_t aEndOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->DeleteText(aStartOffset, aEndOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::ScriptablePasteText(int32_t aOffset)
|
||||
{
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
text->PasteText(aOffset);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIAccessibleHyperText
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetLinkCount(int32_t* aLinkCount)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLinkCount);
|
||||
*aLinkCount = 0;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aLinkCount = text->LinkCount();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetLinkAt(int32_t aIndex, nsIAccessibleHyperLink** aLink)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLink);
|
||||
*aLink = nullptr;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIAccessibleHyperLink> link = text->LinkAt(aIndex);
|
||||
link.forget(aLink);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetLinkIndex(nsIAccessibleHyperLink* aLink,
|
||||
int32_t* aIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLink);
|
||||
NS_ENSURE_ARG_POINTER(aIndex);
|
||||
*aIndex = -1;
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsRefPtr<Accessible> link(do_QueryObject(aLink));
|
||||
*aIndex = text->LinkIndexOf(link);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleHyperText::GetLinkIndexAtOffset(int32_t aOffset,
|
||||
int32_t* aLinkIndex)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLinkIndex);
|
||||
*aLinkIndex = -1; // API says this magic value means 'not found'
|
||||
|
||||
HyperTextAccessible* text = static_cast<HyperTextAccessible*>(this);
|
||||
if (text->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aLinkIndex = text->LinkIndexAtOffset(aOffset);
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_xpcAccessibleHyperText_h_
|
||||
#define mozilla_a11y_xpcAccessibleHyperText_h_
|
||||
|
||||
#include "nsIAccessibleText.h"
|
||||
#include "nsIAccessibleHyperText.h"
|
||||
#include "nsIAccessibleEditableText.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class xpcAccessibleHyperText : public nsIAccessibleText,
|
||||
public nsIAccessibleEditableText,
|
||||
public nsIAccessibleHyperText
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr);
|
||||
|
||||
NS_DECL_NSIACCESSIBLETEXT
|
||||
NS_DECL_NSIACCESSIBLEHYPERTEXT
|
||||
NS_DECL_NSIACCESSIBLEEDITABLETEXT
|
||||
|
||||
private:
|
||||
xpcAccessibleHyperText() { }
|
||||
friend class HyperTextAccessible;
|
||||
|
||||
xpcAccessibleHyperText(const xpcAccessibleHyperText&) MOZ_DELETE;
|
||||
xpcAccessibleHyperText& operator =(const xpcAccessibleHyperText&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_a11y_xpcAccessibleHyperText_h_
|
|
@ -0,0 +1,90 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "xpcAccessibleValue.h"
|
||||
#include "Accessible.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::GetMaximumValue(double* aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = acc->MaxValue();
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::GetMinimumValue(double* aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = acc->MinValue();
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::GetCurrentValue(double* aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = acc->CurValue();
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::SetCurrentValue(double aValue)
|
||||
{
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
acc->SetCurValue(aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
xpcAccessibleValue::GetMinimumIncrement(double* aValue)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
Accessible* acc = static_cast<Accessible*>(this);
|
||||
if (acc->IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
double value = acc->Step();
|
||||
if (!IsNaN(value))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_a11y_xpcAccessibleValue_h_
|
||||
#define mozilla_a11y_xpcAccessibleValue_h_
|
||||
|
||||
#include "nsIAccessibleValue.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
class xpcAccessibleValue : public nsIAccessibleValue
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD GetMaximumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetMinimumValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetCurrentValue(double* aValue) MOZ_FINAL MOZ_OVERRIDE;
|
||||
NS_IMETHOD SetCurrentValue(double aValue) MOZ_FINAL MOZ_OVERRIDE;
|
||||
NS_IMETHOD GetMinimumIncrement(double* aMinIncrement) MOZ_FINAL MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
xpcAccessibleValue() { }
|
||||
friend class Accessible;
|
||||
|
||||
xpcAccessibleValue(const xpcAccessibleValue&) MOZ_DELETE;
|
||||
xpcAccessibleValue& operator =(const xpcAccessibleValue&) MOZ_DELETE;
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -811,7 +811,7 @@ XULTextFieldAccessible::CacheChildren()
|
|||
// XULTextFieldAccessible: HyperTextAccessible protected
|
||||
|
||||
already_AddRefed<nsFrameSelection>
|
||||
XULTextFieldAccessible::FrameSelection()
|
||||
XULTextFieldAccessible::FrameSelection() const
|
||||
{
|
||||
nsCOMPtr<nsIContent> inputContent(GetInputField());
|
||||
NS_ASSERTION(inputContent, "No input content");
|
||||
|
|
|
@ -250,7 +250,7 @@ protected:
|
|||
virtual void CacheChildren();
|
||||
|
||||
// HyperTextAccessible
|
||||
virtual already_AddRefed<nsFrameSelection> FrameSelection();
|
||||
virtual already_AddRefed<nsFrameSelection> FrameSelection() const;
|
||||
|
||||
// nsXULTextFieldAccessible
|
||||
already_AddRefed<nsIContent> GetInputField() const;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/FloatingPoint.h"
|
||||
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
|
@ -25,12 +26,6 @@ XULSliderAccessible::
|
|||
mStateFlags |= eHasNumericValue;
|
||||
}
|
||||
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(XULSliderAccessible,
|
||||
AccessibleWrap,
|
||||
nsIAccessibleValue)
|
||||
|
||||
// Accessible
|
||||
|
||||
role
|
||||
|
@ -99,64 +94,39 @@ XULSliderAccessible::DoAction(uint8_t aIndex)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// nsIAccessibleValue
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULSliderAccessible::GetMaximumValue(double* aValue)
|
||||
double
|
||||
XULSliderAccessible::MaxValue() const
|
||||
{
|
||||
nsresult rv = AccessibleWrap::GetMaximumValue(aValue);
|
||||
|
||||
// ARIA redefined maximum value.
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
return GetSliderAttr(nsGkAtoms::maxpos, aValue);
|
||||
double value = AccessibleWrap::MaxValue();
|
||||
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::maxpos) : value;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULSliderAccessible::GetMinimumValue(double* aValue)
|
||||
double
|
||||
XULSliderAccessible::MinValue() const
|
||||
{
|
||||
nsresult rv = AccessibleWrap::GetMinimumValue(aValue);
|
||||
|
||||
// ARIA redefined minmum value.
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
return GetSliderAttr(nsGkAtoms::minpos, aValue);
|
||||
double value = AccessibleWrap::MinValue();
|
||||
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::minpos) : value;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULSliderAccessible::GetMinimumIncrement(double* aValue)
|
||||
double
|
||||
XULSliderAccessible::Step() const
|
||||
{
|
||||
nsresult rv = AccessibleWrap::GetMinimumIncrement(aValue);
|
||||
|
||||
// ARIA redefined minimum increment value.
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
return GetSliderAttr(nsGkAtoms::increment, aValue);
|
||||
double value = AccessibleWrap::Step();
|
||||
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::increment) : value;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULSliderAccessible::GetCurrentValue(double* aValue)
|
||||
double
|
||||
XULSliderAccessible::CurValue() const
|
||||
{
|
||||
nsresult rv = AccessibleWrap::GetCurrentValue(aValue);
|
||||
|
||||
// ARIA redefined current value.
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
|
||||
return GetSliderAttr(nsGkAtoms::curpos, aValue);
|
||||
double value = AccessibleWrap::CurValue();
|
||||
return IsNaN(value) ? GetSliderAttr(nsGkAtoms::curpos) : value;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
XULSliderAccessible::SetCurrentValue(double aValue)
|
||||
bool
|
||||
XULSliderAccessible::SetCurValue(double aValue)
|
||||
{
|
||||
nsresult rv = AccessibleWrap::SetCurrentValue(aValue);
|
||||
|
||||
// ARIA redefined current value.
|
||||
if (rv != NS_OK_NO_ARIA_VALUE)
|
||||
return rv;
|
||||
if (AccessibleWrap::SetCurValue(aValue))
|
||||
return true;
|
||||
|
||||
return SetSliderAttr(nsGkAtoms::curpos, aValue);
|
||||
}
|
||||
|
@ -184,7 +154,7 @@ XULSliderAccessible::GetSliderElement() const
|
|||
}
|
||||
|
||||
nsresult
|
||||
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, nsAString& aValue)
|
||||
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, nsAString& aValue) const
|
||||
{
|
||||
aValue.Truncate();
|
||||
|
||||
|
@ -211,35 +181,26 @@ XULSliderAccessible::SetSliderAttr(nsIAtom* aName, const nsAString& aValue)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
XULSliderAccessible::GetSliderAttr(nsIAtom* aName, double* aValue)
|
||||
double
|
||||
XULSliderAccessible::GetSliderAttr(nsIAtom* aName) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aValue);
|
||||
*aValue = 0;
|
||||
|
||||
nsAutoString attrValue;
|
||||
nsresult rv = GetSliderAttr(aName, attrValue);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Return zero value if there is no attribute or its value is empty.
|
||||
if (attrValue.IsEmpty())
|
||||
return NS_OK;
|
||||
if (NS_FAILED(rv))
|
||||
return UnspecifiedNaN();
|
||||
|
||||
nsresult error = NS_OK;
|
||||
double value = attrValue.ToDouble(&error);
|
||||
if (NS_SUCCEEDED(error))
|
||||
*aValue = value;
|
||||
|
||||
return NS_OK;
|
||||
return NS_FAILED(error) ? UnspecifiedNaN() : value;
|
||||
}
|
||||
|
||||
nsresult
|
||||
bool
|
||||
XULSliderAccessible::SetSliderAttr(nsIAtom* aName, double aValue)
|
||||
{
|
||||
nsAutoString value;
|
||||
value.AppendFloat(aValue);
|
||||
|
||||
return SetSliderAttr(aName, value);
|
||||
return NS_SUCCEEDED(SetSliderAttr(aName, value));
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,16 +21,10 @@ class XULSliderAccessible : public AccessibleWrap
|
|||
public:
|
||||
XULSliderAccessible(nsIContent* aContent, DocAccessible* aDoc);
|
||||
|
||||
// nsISupports
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// nsIAccessible
|
||||
NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName);
|
||||
NS_IMETHOD DoAction(uint8_t aIndex);
|
||||
|
||||
// nsIAccessibleValue
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
||||
// Accessible
|
||||
virtual void Value(nsString& aValue);
|
||||
virtual a11y::role NativeRole();
|
||||
|
@ -38,6 +32,13 @@ public:
|
|||
virtual bool NativelyUnavailable() const;
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// Value
|
||||
virtual double MaxValue() const MOZ_OVERRIDE;
|
||||
virtual double MinValue() const MOZ_OVERRIDE;
|
||||
virtual double CurValue() const MOZ_OVERRIDE;
|
||||
virtual double Step() const MOZ_OVERRIDE;
|
||||
virtual bool SetCurValue(double aValue) MOZ_OVERRIDE;
|
||||
|
||||
// ActionAccessible
|
||||
virtual uint8_t ActionCount();
|
||||
|
||||
|
@ -47,11 +48,11 @@ protected:
|
|||
*/
|
||||
nsIContent* GetSliderElement() const;
|
||||
|
||||
nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
|
||||
nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue) const;
|
||||
nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
|
||||
|
||||
nsresult GetSliderAttr(nsIAtom *aName, double *aValue);
|
||||
nsresult SetSliderAttr(nsIAtom *aName, double aValue);
|
||||
double GetSliderAttr(nsIAtom *aName) const;
|
||||
bool SetSliderAttr(nsIAtom *aName, double aValue);
|
||||
|
||||
private:
|
||||
mutable nsCOMPtr<nsIContent> mSliderNode;
|
||||
|
|
|
@ -4,9 +4,7 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'accessibility'
|
||||
|
||||
SOURCES += [
|
||||
UNIFIED_SOURCES += [
|
||||
'XULAlertAccessible.cpp',
|
||||
'XULColorPickerAccessible.cpp',
|
||||
'XULComboboxAccessible.cpp',
|
||||
|
@ -21,10 +19,6 @@ SOURCES += [
|
|||
'XULTreeGridAccessible.cpp',
|
||||
]
|
||||
|
||||
LIBRARY_NAME = 'accessibility_xul_s'
|
||||
|
||||
LIBXUL_LIBRARY = True
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'../../../layout/generic',
|
||||
'../../../layout/xul/base/src',
|
||||
|
@ -52,3 +46,5 @@ else:
|
|||
LOCAL_INCLUDES += [
|
||||
'../other',
|
||||
]
|
||||
|
||||
FINAL_LIBRARY = 'xul'
|
||||
|
|
|
@ -1959,7 +1959,12 @@ var gA11yEventObserver =
|
|||
var type = eventTypeToString(event.eventType);
|
||||
var info = "Event type: " + type;
|
||||
|
||||
if (event instanceof nsIAccessibleTextChangeEvent) {
|
||||
if (event instanceof nsIAccessibleStateChangeEvent) {
|
||||
var stateStr = statesToString(event.isExtraState ? 0 : event.state,
|
||||
event.isExtraState ? event.state : 0);
|
||||
info += ", state: " + stateStr + ", is enabled: " + event.isEnabled;
|
||||
|
||||
} else if (event instanceof nsIAccessibleTextChangeEvent) {
|
||||
info += ", start: " + event.start + ", length: " + event.length +
|
||||
", " + (event.isInserted ? "inserted" : "removed") +
|
||||
" text: " + event.modifiedText;
|
||||
|
|
|
@ -143,18 +143,46 @@
|
|||
new stateChangeChecker(aState, aIsExtraState, true, getNode(aID))
|
||||
];
|
||||
|
||||
this.invoke = function dupeStateChange_invoke()
|
||||
this.invoke = function oppositeStateChange_invoke()
|
||||
{
|
||||
getNode(aID).setAttribute(aAttr, "false");
|
||||
getNode(aID).setAttribute(aAttr, "true");
|
||||
}
|
||||
|
||||
this.getID = function dupeStateChange_getID()
|
||||
this.getID = function oppositeStateChange_getID()
|
||||
{
|
||||
return "opposite state change events";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Change concomitant ARIA and native attribute at once.
|
||||
*/
|
||||
function echoingStateChange(aID, aARIAAttr, aAttr, aValue,
|
||||
aState, aIsExtraState, aIsEnabled)
|
||||
{
|
||||
this.eventSeq = [
|
||||
new stateChangeChecker(aState, aIsExtraState, aIsEnabled, getNode(aID))
|
||||
];
|
||||
|
||||
this.invoke = function echoingStateChange_invoke()
|
||||
{
|
||||
if (aValue == null) {
|
||||
getNode(aID).removeAttribute(aARIAAttr);
|
||||
getNode(aID).removeAttribute(aAttr);
|
||||
|
||||
} else {
|
||||
getNode(aID).setAttribute(aARIAAttr, aValue);
|
||||
getNode(aID).setAttribute(aAttr, aValue);
|
||||
}
|
||||
}
|
||||
|
||||
this.getID = function echoingStateChange_getID()
|
||||
{
|
||||
return "enchoing ARIA and native attributes change";
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// Do tests
|
||||
|
||||
|
@ -193,6 +221,11 @@
|
|||
gQueue.push(new oppositeStateChange("div", "aria-busy",
|
||||
STATE_BUSY, false));
|
||||
|
||||
gQueue.push(new echoingStateChange("text1", "aria-disabled", "disabled", "true",
|
||||
EXT_STATE_ENABLED, true, false));
|
||||
gQueue.push(new echoingStateChange("text1", "aria-disabled", "disabled", null,
|
||||
EXT_STATE_ENABLED, true, true));
|
||||
|
||||
gQueue.invoke(); // Will call SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -223,6 +256,11 @@
|
|||
title="Fire statechange event whenever checked state is changed not depending on focused state">
|
||||
Bug 788389
|
||||
</a>
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=926812"
|
||||
title="State change event not fired when both disabled and aria-disabled are toggled">
|
||||
Bug 926812
|
||||
</a>
|
||||
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
|
@ -242,6 +280,8 @@
|
|||
|
||||
<div id="div"></div>
|
||||
|
||||
<input id="text1">
|
||||
|
||||
<div id="eventdump"></div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -92,6 +92,7 @@ var AccessFuTest = {
|
|||
finish: function AccessFuTest_finish() {
|
||||
// Disable the console service logging.
|
||||
Logger.test = false;
|
||||
Logger.logLevel = Logger.INFO;
|
||||
AccessFu.doneCallback = function doneCallback() {
|
||||
// This is being called once AccessFu has been shut down.
|
||||
// Detach AccessFu from everything it attached itself to.
|
||||
|
@ -136,6 +137,7 @@ var AccessFuTest = {
|
|||
AccessFu.readyCallback = function readyCallback() {
|
||||
// Enable logging to the console service.
|
||||
Logger.test = true;
|
||||
Logger.logLevel = Logger.DEBUG;
|
||||
// This is being called once accessibility has been turned on.
|
||||
|
||||
if (AccessFuTest._waitForExplicitFinish) {
|
||||
|
|
|
@ -415,7 +415,7 @@ function testTextSetSelection(aID, aStartOffset, aEndOffset,
|
|||
var text = acc.getText(0, -1);
|
||||
|
||||
acc.setSelectionBounds(aSelectionIndex, aStartOffset, aEndOffset);
|
||||
|
||||
|
||||
is(acc.selectionCount, aSelectionsCount,
|
||||
text + ": failed to set selection at index '" +
|
||||
aSelectionIndex + "': selectionCount after");
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
function doTest()
|
||||
{
|
||||
// HTML5 progress element tests
|
||||
testValue("pr_indeterminate", "0%", 0, 0, 1, 0);
|
||||
testValue("pr_indeterminate", "", 0, 0, 1, 0);
|
||||
testValue("pr_zero", "0%", 0, 0, 1, 0);
|
||||
testValue("pr_zeropointfive", "50%", 0.5, 0, 1, 0);
|
||||
testValue("pr_one", "100%", 1, 0, 1, 0);
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
// progressmeter
|
||||
testValue("pm1", "50%", 50, 0, 100, 0);
|
||||
testValue("pm2", "50%", 500, 0, 1000, 0);
|
||||
testValue("pm3", "0%", 0, 0, 100, 0);
|
||||
testValue("pm3", "", 0, 0, 100, 0);
|
||||
|
||||
// scale
|
||||
testValue("sc1", "500", 500, 0, 1000, 10);
|
||||
|
|
|
@ -6,5 +6,3 @@
|
|||
|
||||
DIRS += ['mochitest']
|
||||
|
||||
MODULE = 'test_accessibility'
|
||||
|
||||
|
|
|
@ -42,6 +42,12 @@ pref("network.protocol-handler.warn-external.tel", false);
|
|||
pref("network.protocol-handler.warn-external.mailto", false);
|
||||
pref("network.protocol-handler.warn-external.vnd.youtube", false);
|
||||
|
||||
/* protocol expose prefs */
|
||||
// By default, all protocol handlers are exposed. This means that the browser
|
||||
// will response to openURL commands for all URL types. It will also try to open
|
||||
// link clicks inside the browser before failing over to the system handlers.
|
||||
pref("network.protocol-handler.expose.rtsp", false);
|
||||
|
||||
/* http prefs */
|
||||
pref("network.http.pipelining", true);
|
||||
pref("network.http.pipelining.ssl", true);
|
||||
|
|
|
@ -3,16 +3,12 @@
|
|||
// Send these sites a custom user-agent. Bugs to remove each override after
|
||||
// evangelism are included.
|
||||
{
|
||||
// bug 826330, uol.com.br
|
||||
"uol.com.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
|
||||
// bug 826335, globo.com
|
||||
"globo.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 826338, yahoo.com
|
||||
"yahoo.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 826342, mercadolivre.com.br
|
||||
"mercadolivre.com.br": "\\(Mobile#(Android; Mobile",
|
||||
// bug 826343, ig.com.br
|
||||
"ig.com.br": "\\(Mobile#(Android; Mobile",
|
||||
// bug 826344, abril.com.br
|
||||
"abril.com.br": "\\(Mobile#(Android; Mobile",
|
||||
// bug 826347, msn.com
|
||||
|
@ -61,8 +57,6 @@
|
|||
"webmotors.com.br": "\\(Mobile#(Android; Mobile",
|
||||
// bug 827661, mercadolibre.com.co
|
||||
"mercadolibre.com.co": "\\(Mobile#(Android; Mobile",
|
||||
// bug 827664, elespectador.com
|
||||
"elespectador.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 827668, scribd.com
|
||||
"scribd.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 827670, elpais.com.co
|
||||
|
@ -99,8 +93,6 @@
|
|||
"fotocasa.es": "\\(Mobile#(Android; Mobile",
|
||||
// bug 828406, orange.es
|
||||
"orange.es": "\\(Mobile#(Android; Mobile",
|
||||
// bug 828414, paginasamarillas.es
|
||||
"paginasamarillas.es": "\\(Mobile#(Android; Mobile",
|
||||
// bug 828416, loteriasyapuestas.es
|
||||
"loteriasyapuestas.es": "\\(Mobile#(Android; Mobile",
|
||||
// bug 828418, bbva.es
|
||||
|
@ -149,8 +141,6 @@
|
|||
"games.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 843156, orbitz.com
|
||||
"orbitz.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 843158, starwoodhotels.com
|
||||
"starwoodhotels.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 843160, ehow.com
|
||||
"ehow.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 843162, urbanspoon.com
|
||||
|
@ -169,8 +159,6 @@
|
|||
"slashgear.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 843186, chevrolet.com
|
||||
"chevrolet.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 848854, deadline.com
|
||||
"deadline.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 866577, 3g.qq.com
|
||||
"3g.qq.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 878222, arukereso.hu
|
||||
|
@ -219,8 +207,6 @@
|
|||
"naslovi.net": "\\(Mobile#(Android; Mobile",
|
||||
// bug 878284, softonic.com
|
||||
"softonic.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 878286, yandex.ru
|
||||
"yandex.ru": "\\(Mobile#(Android; Mobile",
|
||||
// bug 878630, ask.com
|
||||
"ask.com": "\\(Mobile#(Android; Mobile",
|
||||
// bug 878632, banorte.com
|
||||
|
|
|
@ -191,21 +191,22 @@ let PaymentProvider = {
|
|||
},
|
||||
|
||||
#ifdef MOZ_B2G_RIL
|
||||
// Until bug 814629 is done, we only have support for a single SIM, so we
|
||||
// can only provide information for a single ICC. However, we return an array
|
||||
// so the payment provider facing API won't need to change once we support
|
||||
// multiple SIMs.
|
||||
// Bug 938993. Support Multi-SIM for Payments.
|
||||
get iccInfo() {
|
||||
delete this.iccInfo;
|
||||
return this.iccInfo = iccProvider.getIccInfo(0);
|
||||
},
|
||||
|
||||
get iccIds() {
|
||||
return [iccProvider.iccInfo.iccid];
|
||||
return [this.iccInfo.iccid];
|
||||
},
|
||||
|
||||
get mcc() {
|
||||
return [iccProvider.iccInfo.mcc];
|
||||
return [this.iccInfo.mcc];
|
||||
},
|
||||
|
||||
get mnc() {
|
||||
return [iccProvider.iccInfo.mnc];
|
||||
return [this.iccInfo.mnc];
|
||||
},
|
||||
|
||||
_silentNumbers: null,
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
TEST_DIRS += ['test']
|
||||
|
||||
MODULE = 'B2GComponents'
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'ActivitiesGlue.js',
|
||||
'AlertsService.js',
|
||||
|
|
|
@ -4,9 +4,4 @@
|
|||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
MODULE = 'B2GComponents'
|
||||
|
||||
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"revision": "2e7106da13e91ea119801a50a39c9e7ebb1d912e",
|
||||
"revision": "32c72fb8d857627ed39e4e07e1a4efaa1d3caace",
|
||||
"repo_path": "/integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -659,9 +659,18 @@ pref("plugins.update.notifyUser", false);
|
|||
|
||||
pref("plugins.click_to_play", true);
|
||||
|
||||
// let all plugins except Flash default to click-to-play
|
||||
#ifdef RELEASE_BUILD
|
||||
// For now, plugins other than Java and Flash are enabled in beta/release
|
||||
// and click-to-activate in earlier channels.
|
||||
pref("plugin.default.state", 2);
|
||||
#else
|
||||
pref("plugin.default.state", 1);
|
||||
#endif
|
||||
|
||||
// Flash is enabled by default, and Java is click-to-activate by default on
|
||||
// all channels.
|
||||
pref("plugin.state.flash", 2);
|
||||
pref("plugin.state.java", 1);
|
||||
|
||||
// display door hanger if flash not installed
|
||||
pref("plugins.notifyMissingFlash", true);
|
||||
|
@ -1227,14 +1236,6 @@ pref("devtools.hud.loglimit.console", 200);
|
|||
pref("devtools.editor.tabsize", 4);
|
||||
pref("devtools.editor.expandtab", true);
|
||||
|
||||
// Tells which component you want to use for source editing in developer tools.
|
||||
//
|
||||
// Available components:
|
||||
// "orion" - this is the Orion source code editor from the Eclipse project. It
|
||||
// provides programmer-specific editor features such as syntax highlighting,
|
||||
// indenting and bracket recognition.
|
||||
pref("devtools.editor.component", "orion");
|
||||
|
||||
// Enable the Font Inspector
|
||||
pref("devtools.fontinspector.enabled", true);
|
||||
|
||||
|
|
|
@ -21,17 +21,22 @@ function init(aEvent)
|
|||
distroIdField.value = distroId + " - " + distroVersion;
|
||||
distroIdField.style.display = "block";
|
||||
|
||||
// This must be set last because it might not exist due to bug 895473.
|
||||
var distroAbout = Services.prefs.getComplexValue("distribution.about",
|
||||
Components.interfaces.nsISupportsString);
|
||||
var distroField = document.getElementById("distribution");
|
||||
distroField.value = distroAbout;
|
||||
distroField.style.display = "block";
|
||||
try {
|
||||
// This is in its own try catch due to bug 895473 and bug 900925.
|
||||
var distroAbout = Services.prefs.getComplexValue("distribution.about",
|
||||
Components.interfaces.nsISupportsString);
|
||||
var distroField = document.getElementById("distribution");
|
||||
distroField.value = distroAbout;
|
||||
distroField.style.display = "block";
|
||||
}
|
||||
catch (ex) {
|
||||
// Pref is unset
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// Pref is unset
|
||||
Components.utils.reportError(e);
|
||||
}
|
||||
|
||||
// Include the build ID and display warning if this is an "a#" (nightly or aurora) build
|
||||
|
|
|
@ -24,6 +24,11 @@ const prefs = new Preferences("datareporting.healthreport.");
|
|||
|
||||
let healthReportWrapper = {
|
||||
init: function () {
|
||||
if (!reporter) {
|
||||
healthReportWrapper.handleInitFailure();
|
||||
return;
|
||||
}
|
||||
|
||||
reporter.onInit().then(healthReportWrapper.refreshPayload,
|
||||
healthReportWrapper.handleInitFailure);
|
||||
|
||||
|
|
|
@ -659,6 +659,7 @@ let gHistorySwipeAnimation = {
|
|||
*/
|
||||
stopAnimation: function HSA_stopAnimation() {
|
||||
gHistorySwipeAnimation._removeBoxes();
|
||||
this._historyIndex = gBrowser.webNavigation.sessionHistory.index;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -724,23 +725,27 @@ let gHistorySwipeAnimation = {
|
|||
* An event to process.
|
||||
*/
|
||||
handleEvent: function HSA_handleEvent(aEvent) {
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
switch (aEvent.type) {
|
||||
case "TabClose":
|
||||
let browser = gBrowser.getBrowserForTab(aEvent.target);
|
||||
this._removeTrackedSnapshot(-1, browser);
|
||||
let browserForTab = gBrowser.getBrowserForTab(aEvent.target);
|
||||
this._removeTrackedSnapshot(-1, browserForTab);
|
||||
break;
|
||||
case "DOMModalDialogClosed":
|
||||
this.stopAnimation();
|
||||
break;
|
||||
case "pageshow":
|
||||
if (aEvent.target == browser.contentDocument) {
|
||||
this.stopAnimation();
|
||||
}
|
||||
break;
|
||||
case "popstate":
|
||||
if (aEvent.target != gBrowser.selectedBrowser.contentDocument)
|
||||
break;
|
||||
this.stopAnimation();
|
||||
this._historyIndex = gBrowser.webNavigation.sessionHistory.index;
|
||||
if (aEvent.target == browser.contentDocument.defaultView) {
|
||||
this.stopAnimation();
|
||||
}
|
||||
break;
|
||||
case "pagehide":
|
||||
if (aEvent.target == gBrowser.selectedBrowser.contentDocument) {
|
||||
if (aEvent.target == browser.contentDocument) {
|
||||
// Take and compress a snapshot of a page whenever it's about to be
|
||||
// navigated away from. We already have a snapshot of the page if an
|
||||
// animation is running, so we're left with compressing it.
|
||||
|
|
|
@ -963,6 +963,9 @@ var gPluginHandler = {
|
|||
return;
|
||||
}
|
||||
|
||||
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_SHOWN").
|
||||
add(true);
|
||||
|
||||
let message;
|
||||
// Icons set directly cannot be manipulated using moz-image-region, so
|
||||
// we use CSS classes instead.
|
||||
|
@ -1001,21 +1004,26 @@ var gPluginHandler = {
|
|||
}
|
||||
}
|
||||
|
||||
// These strings are temporary no-string-change for branch uplift
|
||||
let buttons = [
|
||||
{
|
||||
label: gNavigatorBundle.getString("pluginBlockNow.label"),
|
||||
accessKey: gNavigatorBundle.getString("pluginBlockNow.accesskey"),
|
||||
label: gNavigatorBundle.getString("pluginContinueBlocking.label"),
|
||||
accessKey: gNavigatorBundle.getString("pluginContinueBlocking.accesskey"),
|
||||
callback: function() {
|
||||
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_BLOCK").
|
||||
add(true);
|
||||
|
||||
Services.perms.addFromPrincipal(aBrowser.contentDocument.nodePrincipal,
|
||||
"plugin-hidden-notification",
|
||||
Services.perms.DENY_ACTION);
|
||||
}
|
||||
},
|
||||
{
|
||||
label: gNavigatorBundle.getString("offlineApps.allow"),
|
||||
accessKey: gNavigatorBundle.getString("offlineApps.allowAccessKey"),
|
||||
label: gNavigatorBundle.getString("pluginActivateTrigger.label"),
|
||||
accessKey: gNavigatorBundle.getString("pluginActivateTrigger.accesskey"),
|
||||
callback: function() {
|
||||
Services.telemetry.getHistogramById("PLUGINS_INFOBAR_ALLOW").
|
||||
add(true);
|
||||
|
||||
let curNotification =
|
||||
PopupNotifications.getNotification("click-to-play-plugins",
|
||||
aBrowser);
|
||||
|
|
|
@ -119,6 +119,19 @@ tabbrowser {
|
|||
max-width 230ms ease-out;
|
||||
}
|
||||
|
||||
.tab-background {
|
||||
/* Explicitly set the visibility to override the value (collapsed)
|
||||
* we inherit from #TabsToolbar[collapsed] upon opening a browser window. */
|
||||
visibility: visible;
|
||||
/* This transition is only applied when opening a new tab. Closing tabs
|
||||
* are just hidden so we don't need to adjust the delay for that. */
|
||||
transition: visibility 0ms 25ms;
|
||||
}
|
||||
|
||||
.tab-background[selected]:not([fadein]):not([pinned]) {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.tab-throbber:not([fadein]):not([pinned]),
|
||||
.tab-label:not([fadein]):not([pinned]),
|
||||
.tab-icon-image:not([fadein]):not([pinned]),
|
||||
|
@ -185,6 +198,36 @@ toolbar[customizing] > .overflow-button {
|
|||
#titlebar-fullscreen-button {
|
||||
-moz-appearance: -moz-mac-fullscreen-button;
|
||||
}
|
||||
|
||||
/* Because these buttons don't move, they should always be aligned the same,
|
||||
* left and right were deprecated, so we have to do work to get it to mean that: */
|
||||
#titlebar-buttonbox-container:-moz-locale-dir(ltr) {
|
||||
-moz-box-align: start;
|
||||
}
|
||||
|
||||
#titlebar-buttonbox-container:-moz-locale-dir(rtl) {
|
||||
-moz-box-align: end;
|
||||
}
|
||||
|
||||
/* Fullscreen and caption buttons don't move with RTL on OS X so override the automatic ordering. */
|
||||
#titlebar-fullscreen-button:-moz-locale-dir(ltr),
|
||||
#titlebar-buttonbox-container:-moz-locale-dir(rtl),
|
||||
.titlebar-placeholder[type="fullscreen-button"]:-moz-locale-dir(ltr),
|
||||
.titlebar-placeholder[type="caption-buttons"]:-moz-locale-dir(rtl) {
|
||||
-moz-box-ordinal-group: 1000;
|
||||
}
|
||||
|
||||
#titlebar-fullscreen-button:-moz-locale-dir(rtl),
|
||||
#titlebar-buttonbox-container:-moz-locale-dir(ltr),
|
||||
.titlebar-placeholder[type="caption-buttons"]:-moz-locale-dir(ltr),
|
||||
.titlebar-placeholder[type="fullscreen-button"]:-moz-locale-dir(rtl) {
|
||||
-moz-box-ordinal-group: 0;
|
||||
}
|
||||
%else
|
||||
/* On non-OSX, these should be start-aligned */
|
||||
#titlebar-buttonbox-container {
|
||||
-moz-box-align: start;
|
||||
}
|
||||
%endif
|
||||
|
||||
%ifdef XP_WIN
|
||||
|
|
|
@ -6338,14 +6338,21 @@ var gIdentityHandler = {
|
|||
let nsIWebProgressListener = Ci.nsIWebProgressListener;
|
||||
|
||||
// For some URIs like data: we can't get a host and so can't do
|
||||
// anything useful here. Chrome URIs however get special treatment.
|
||||
// anything useful here.
|
||||
let unknown = false;
|
||||
try {
|
||||
uri.host;
|
||||
} catch (e) { unknown = true; }
|
||||
|
||||
if ((uri.scheme == "chrome" || uri.scheme == "about") &&
|
||||
uri.spec !== "about:blank") {
|
||||
// Chrome URIs however get special treatment. Some chrome URIs are
|
||||
// whitelisted to provide a positive security signal to the user.
|
||||
let chromeWhitelist = ["about:addons", "about:app-manager", "about:config",
|
||||
"about:crashes", "about:healthreport", "about:home",
|
||||
"about:newaddon", "about:permissions", "about:preferences",
|
||||
"about:privatebrowsing", "about:sessionstore",
|
||||
"about:support", "about:welcomeback"];
|
||||
let lowercaseSpec = uri.spec.toLowerCase();
|
||||
if (chromeWhitelist.some(function(whitelistedSpec) lowercaseSpec.startsWith(whitelistedSpec))) {
|
||||
this.setMode(this.IDENTITY_MODE_CHROMEUI);
|
||||
} else if (unknown) {
|
||||
this.setMode(this.IDENTITY_MODE_UNKNOWN);
|
||||
|
|
|
@ -423,11 +423,7 @@
|
|||
<vbox id="titlebar">
|
||||
<hbox id="titlebar-content">
|
||||
<spacer id="titlebar-spacer" flex="1"/>
|
||||
<hbox id="titlebar-buttonbox-container" align="start"
|
||||
#ifdef XP_MACOSX
|
||||
ordinal="0"
|
||||
#endif
|
||||
>
|
||||
<hbox id="titlebar-buttonbox-container">
|
||||
<hbox id="titlebar-buttonbox">
|
||||
<toolbarbutton class="titlebar-button" id="titlebar-min" oncommand="window.minimize();"/>
|
||||
<toolbarbutton class="titlebar-button" id="titlebar-max" oncommand="onTitlebarMaxClick();"/>
|
||||
|
@ -435,7 +431,7 @@
|
|||
</hbox>
|
||||
</hbox>
|
||||
#ifdef XP_MACOSX
|
||||
<hbox id="titlebar-fullscreen-button" ordinal="1000"/>
|
||||
<hbox id="titlebar-fullscreen-button"/>
|
||||
#endif
|
||||
</hbox>
|
||||
</vbox>
|
||||
|
|
|
@ -475,8 +475,7 @@ function openCacheEntry(key, cb)
|
|||
},
|
||||
onCacheEntryAvailable: function(entry, isNew, appCache, status) {
|
||||
cb(entry);
|
||||
},
|
||||
get mainThreadOnly() { return true; }
|
||||
}
|
||||
};
|
||||
diskStorage.asyncOpenURI(Services.io.newURI(key, null, null), "", nsICacheStorage.OPEN_READONLY, checkCacheListener);
|
||||
}
|
||||
|
|
|
@ -4643,7 +4643,7 @@
|
|||
|
||||
<content context="tabContextMenu" closetabtext="&closeTab.label;">
|
||||
<xul:stack class="tab-stack" flex="1">
|
||||
<xul:hbox xbl:inherits="pinned,selected,titlechanged"
|
||||
<xul:hbox xbl:inherits="pinned,selected,titlechanged,fadein"
|
||||
class="tab-background">
|
||||
<xul:hbox xbl:inherits="pinned,selected,titlechanged"
|
||||
class="tab-background-start"/>
|
||||
|
|
|
@ -10,6 +10,13 @@ support-files =
|
|||
blockPluginHard.xml
|
||||
blockPluginVulnerableNoUpdate.xml
|
||||
blockPluginVulnerableUpdatable.xml
|
||||
browser_bug479408_sample.html
|
||||
browser_bug678392-1.html
|
||||
browser_bug678392-2.html
|
||||
browser_clearplugindata.html
|
||||
browser_clearplugindata_noage.html
|
||||
browser_registerProtocolHandler_notification.html
|
||||
browser_tab_dragdrop2_frame1.xul
|
||||
bug564387.html
|
||||
bug564387_video1.ogv
|
||||
bug564387_video1.ogv^headers^
|
||||
|
@ -107,6 +114,8 @@ run-if = crashreporter
|
|||
[browser_aboutSyncProgress.js]
|
||||
[browser_addKeywordSearch.js]
|
||||
[browser_alltabslistener.js]
|
||||
[browser_backButtonFitts.js]
|
||||
skip-if = os != "win" # The Fitts Law back button is only supported on Windows (bug 571454)
|
||||
[browser_blob-channelname.js]
|
||||
[browser_bookmark_titles.js]
|
||||
skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (bugs 825739, 841341)
|
||||
|
@ -141,7 +150,6 @@ skip-if = toolkit == "cocoa"
|
|||
[browser_bug462673.js]
|
||||
[browser_bug477014.js]
|
||||
[browser_bug479408.js]
|
||||
[browser_bug479408_sample.html]
|
||||
[browser_bug481560.js]
|
||||
[browser_bug484315.js]
|
||||
[browser_bug491431.js]
|
||||
|
@ -194,8 +202,6 @@ run-if = toolkit == "cocoa"
|
|||
[browser_bug655584.js]
|
||||
[browser_bug664672.js]
|
||||
[browser_bug676619.js]
|
||||
[browser_bug678392-1.html]
|
||||
[browser_bug678392-2.html]
|
||||
[browser_bug678392.js]
|
||||
[browser_bug710878.js]
|
||||
[browser_bug719271.js]
|
||||
|
@ -227,9 +233,7 @@ run-if = toolkit == "cocoa"
|
|||
[browser_bug902156.js]
|
||||
[browser_bug906190.js]
|
||||
[browser_canonizeURL.js]
|
||||
[browser_clearplugindata.html]
|
||||
[browser_clearplugindata.js]
|
||||
[browser_clearplugindata_noage.html]
|
||||
[browser_contentAreaClick.js]
|
||||
[browser_contextSearchTabPosition.js]
|
||||
[browser_ctrlTab.js]
|
||||
|
@ -296,10 +300,8 @@ skip-if = true # disabled until the tree view is added
|
|||
[browser_tab_drag_drop_perwindow.js]
|
||||
[browser_tab_dragdrop.js]
|
||||
[browser_tab_dragdrop2.js]
|
||||
[browser_tab_dragdrop2_frame1.xul]
|
||||
[browser_tabbar_big_widgets.js]
|
||||
skip-if = os == "linux" # No tabs in titlebar on linux
|
||||
|
||||
[browser_tabfocus.js]
|
||||
[browser_tabopen_reflows.js]
|
||||
[browser_tabs_isActive.js]
|
||||
|
@ -325,5 +327,4 @@ skip-if = os == "linux" # No tabs in titlebar on linux
|
|||
[browser_wyciwyg_urlbarCopying.js]
|
||||
[browser_zbug569342.js]
|
||||
[browser_registerProtocolHandler_notification.js]
|
||||
[browser_registerProtocolHandler_notification.html]
|
||||
[browser_no_mcb_on_http_site.js]
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
function test () {
|
||||
waitForExplicitFinish();
|
||||
var firstLocation = "http://example.org/browser/browser/base/content/test/general/dummy_page.html";
|
||||
gBrowser.selectedTab = gBrowser.addTab(firstLocation);
|
||||
gBrowser.selectedBrowser.addEventListener("pageshow", function onPageShow1() {
|
||||
gBrowser.selectedBrowser.removeEventListener("pageshow", onPageShow1);
|
||||
gBrowser.selectedBrowser.contentWindow.history.pushState("page2", "page2", "page2");
|
||||
window.maximize();
|
||||
|
||||
// Find where the nav-bar is vertically.
|
||||
var navBar = document.getElementById("nav-bar");
|
||||
var boundingRect = navBar.getBoundingClientRect();
|
||||
var yPixel = boundingRect.top + Math.floor(boundingRect.height / 2);
|
||||
var xPixel = 0; // Use the first pixel of the screen since it is maximized.
|
||||
|
||||
gBrowser.selectedBrowser.contentWindow.addEventListener("popstate", function onPopState() {
|
||||
gBrowser.selectedBrowser.contentWindow.removeEventListener("popstate", onPopState);
|
||||
is(gBrowser.selectedBrowser.contentDocument.location.href, firstLocation,
|
||||
"Clicking the first pixel should have navigated back.");
|
||||
window.restore();
|
||||
gBrowser.removeCurrentTab();
|
||||
finish();
|
||||
});
|
||||
EventUtils.synthesizeMouseAtPoint(xPixel, yPixel, {}, window);
|
||||
});
|
||||
}
|
|
@ -61,14 +61,16 @@ function test_blank() {
|
|||
function test_chrome() {
|
||||
let oldTab = gBrowser.selectedTab;
|
||||
|
||||
// Since users aren't likely to type in full chrome URLs, we won't show
|
||||
// the positive security indicator on it, but we will show it on about:addons.
|
||||
loadNewTab("chrome://mozapps/content/extensions/extensions.xul", function(aNewTab) {
|
||||
is(getIdentityMode(), "chromeUI", "Identity should be chrome");
|
||||
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
|
||||
|
||||
gBrowser.selectedTab = oldTab;
|
||||
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
|
||||
|
||||
gBrowser.selectedTab = aNewTab;
|
||||
is(getIdentityMode(), "chromeUI", "Identity should be chrome");
|
||||
is(getIdentityMode(), "unknownIdentity", "Identity should be unknown");
|
||||
|
||||
gBrowser.removeTab(aNewTab);
|
||||
|
||||
|
|
|
@ -107,8 +107,6 @@ function test() {
|
|||
aWindow.gBrowser.contentWindow);
|
||||
});
|
||||
});
|
||||
|
||||
aWindow.gBrowser.selectedBrowser.loadURI(testURI);
|
||||
}
|
||||
|
||||
function testOnWindow(aOptions, aCallback) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче