Bug 459973 - rename nsAccUtils to nsCoreUtils, r=aaronlev

--HG--
rename : accessible/src/base/nsAccessibilityUtils.cpp => accessible/src/base/nsCoreUtils.cpp
rename : accessible/src/base/nsAccessibilityUtils.h => accessible/src/base/nsCoreUtils.h
This commit is contained in:
Alexander Surkov 2008-10-16 09:52:58 +08:00
parent 138305807b
commit f698d055b3
28 changed files with 289 additions and 277 deletions

View File

@ -76,7 +76,7 @@ refAccessibleAtPointCB(AtkComponent *aComponent,
if (aCoordType == ATK_XY_WINDOW) {
nsCOMPtr<nsIDOMNode> domNode;
accWrap->GetDOMNode(getter_AddRefs(domNode));
nsIntPoint winCoords = nsAccUtils::GetScreenCoordsForWindow(domNode);
nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(domNode);
aAccX += winCoords.x;
aAccY += winCoords.y;
}
@ -117,7 +117,7 @@ getExtentsCB(AtkComponent *aComponent,
if (aCoordType == ATK_XY_WINDOW) {
nsCOMPtr<nsIDOMNode> domNode;
accWrap->GetDOMNode(getter_AddRefs(domNode));
nsIntPoint winCoords = nsAccUtils::GetScreenCoordsForWindow(domNode);
nsIntPoint winCoords = nsCoreUtils::GetScreenCoordsForWindow(domNode);
nsAccX -= winCoords.x;
nsAccY -= winCoords.y;
}

View File

@ -79,7 +79,7 @@ CPPSRCS = \
nsDocAccessible.cpp \
nsOuterDocAccessible.cpp \
nsAccessibilityAtoms.cpp \
nsAccessibilityUtils.cpp \
nsCoreUtils.cpp \
nsAccessibilityService.cpp \
nsAccessible.cpp \
nsAccessibleRelation.cpp \

View File

@ -378,7 +378,7 @@ already_AddRefed<nsIAccessibleDocument> nsAccessNode::GetDocAccessible()
already_AddRefed<nsRootAccessible> nsAccessNode::GetRootAccessible()
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
NS_ASSERTION(docShellTreeItem, "No docshell tree item for mDOMNode");
if (!docShellTreeItem) {
return nsnull;
@ -469,7 +469,7 @@ nsAccessNode::ScrollTo(PRUint32 aScrollType)
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
PRInt16 vPercent, hPercent;
nsAccUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
return shell->ScrollContentIntoView(content, vPercent, hPercent);
}
@ -481,13 +481,13 @@ nsAccessNode::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
return NS_ERROR_FAILURE;
nsIntPoint coords;
nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
nsresult rv = nsCoreUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
nsIFrame *parentFrame = frame;
while ((parentFrame = parentFrame->GetParent()))
nsAccUtils::ScrollFrameToPoint(parentFrame, frame, coords);
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
return NS_OK;
}
@ -652,7 +652,7 @@ nsAccessNode::GetComputedStyleDeclaration(const nsAString& aPseudoElt,
{
*aCssDecl = nsnull;
nsCOMPtr<nsIDOMElement> domElement = nsAccUtils::GetDOMElementFor(aNode);
nsCOMPtr<nsIDOMElement> domElement = nsCoreUtils::GetDOMElementFor(aNode);
if (!domElement)
return;
@ -886,7 +886,7 @@ nsAccessNode::GetLanguage(nsAString& aLanguage)
}
}
nsAccUtils::GetLanguageFor(content, nsnull, aLanguage);
nsCoreUtils::GetLanguageFor(content, nsnull, aLanguage);
if (aLanguage.IsEmpty()) { // Nothing found, so use document's language
nsIDocument *doc = content->GetOwnerDoc();

View File

@ -45,7 +45,7 @@
#include "nsCOMPtr.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleTypes.h"
#include "nsIAccessNode.h"

View File

@ -39,7 +39,7 @@
// NOTE: alphabetically ordered
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityService.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsARIAMap.h"
#include "nsIContentViewer.h"
#include "nsCURILoader.h"
@ -453,7 +453,7 @@ nsAccessibilityService::CreateRootAccessible(nsIPresShell *aShell,
nsCOMPtr<nsPIAccessNode> privateAccessNode(do_QueryInterface(*aRootAcc));
privateAccessNode->Init();
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(rootNode);
nsRoleMapEntry *roleMapEntry = nsCoreUtils::GetRoleMapEntry(rootNode);
nsCOMPtr<nsPIAccessible> privateAccessible =
do_QueryInterface(privateAccessNode);
privateAccessible->SetRoleMapEntry(roleMapEntry);
@ -591,7 +591,7 @@ nsAccessibilityService::CreateHyperTextAccessible(nsISupports *aFrame, nsIAccess
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
NS_ENSURE_TRUE(content, NS_ERROR_FAILURE);
if (nsAccUtils::HasListener(content, NS_LITERAL_STRING("click"))) {
if (nsCoreUtils::HasListener(content, NS_LITERAL_STRING("click"))) {
// nsLinkableAccessible inherits from nsHyperTextAccessible, but
// it also includes code for dealing with the onclick
*aAccessible = new nsLinkableAccessible(node, weakShell);
@ -1270,7 +1270,7 @@ nsresult nsAccessibilityService::InitAccessible(nsIAccessible *aAccessibleIn,
static PRBool HasRelatedContent(nsIContent *aContent)
{
nsAutoString id;
if (!aContent || !nsAccUtils::GetID(aContent, id) || id.IsEmpty()) {
if (!aContent || !nsCoreUtils::GetID(aContent, id) || id.IsEmpty()) {
return PR_FALSE;
}
@ -1279,7 +1279,8 @@ static PRBool HasRelatedContent(nsIContent *aContent)
nsAccessibilityAtoms::aria_owns,
nsAccessibilityAtoms::aria_controls,
nsAccessibilityAtoms::aria_flowto};
if (nsAccUtils::FindNeighbourPointingToNode(aContent, relationAttrs, NS_ARRAY_LENGTH(relationAttrs))) {
if (nsCoreUtils::FindNeighbourPointingToNode(aContent, relationAttrs,
NS_ARRAY_LENGTH(relationAttrs))) {
return PR_TRUE;
}
@ -1479,7 +1480,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
NS_ENSURE_SUCCESS(rv, rv);
}
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aNode);
nsRoleMapEntry *roleMapEntry = nsCoreUtils::GetRoleMapEntry(aNode);
if (roleMapEntry && !nsCRT::strcmp(roleMapEntry->roleString, "presentation") &&
!content->IsFocusable()) { // For presentation only
// Only create accessible for role of "presentation" if it is focusable --
@ -1527,7 +1528,8 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
GetAccessibleInShell(tableNode, aPresShell, getter_AddRefs(tableAccessible));
if (!tableAccessible && !content->IsFocusable()) {
#ifdef DEBUG
nsRoleMapEntry *tableRoleMapEntry = nsAccUtils::GetRoleMapEntry(tableNode);
nsRoleMapEntry *tableRoleMapEntry =
nsCoreUtils::GetRoleMapEntry(tableNode);
NS_ASSERTION(tableRoleMapEntry &&
!nsCRT::strcmp(tableRoleMapEntry->roleString, "presentation"),
"No accessible for parent table and it didn't have role of presentation");
@ -1594,9 +1596,9 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
// correspond to the doc accessible and will be created in any case
if (!newAcc && content->Tag() != nsAccessibilityAtoms::body && content->GetParent() &&
(frame->IsFocusable() ||
(isHTML && nsAccUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
(isHTML && nsCoreUtils::HasListener(content, NS_LITERAL_STRING("click"))) ||
HasUniversalAriaProperty(content, aWeakShell) || roleMapEntry ||
HasRelatedContent(content) || nsAccUtils::IsXLink(content))) {
HasRelatedContent(content) || nsCoreUtils::IsXLink(content))) {
// This content is focusable or has an interesting dynamic content accessibility property.
// If it's interesting we need it in the accessibility hierarchy so that events or
// other accessibles can point to it, or so that it can hold a state, etc.

View File

@ -341,8 +341,9 @@ NS_IMETHODIMP nsAccessible::GetDescription(nsAString& aDescription)
if (isXUL) {
// Try XUL <description control="[id]">description text</description>
nsIContent *descriptionContent =
nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::description);
nsCoreUtils::FindNeighbourPointingToNode(content,
nsAccessibilityAtoms::control,
nsAccessibilityAtoms::description);
if (descriptionContent) {
// We have a description content node
@ -436,14 +437,14 @@ nsAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
if (!content)
return NS_ERROR_FAILURE;
PRUint32 key = nsAccUtils::GetAccessKeyFor(content);
PRUint32 key = nsCoreUtils::GetAccessKeyFor(content);
if (!key && content->IsNodeOfType(nsIContent::eELEMENT)) {
// Copy access key from label node unless it is labeled
// via an ancestor <label>, in which case that would be redundant
nsCOMPtr<nsIContent> labelContent(GetLabelContent(content));
nsCOMPtr<nsIDOMNode> labelNode = do_QueryInterface(labelContent);
if (labelNode && !nsAccUtils::IsAncestorOf(labelNode, mDOMNode))
key = nsAccUtils::GetAccessKeyFor(labelContent);
if (labelNode && !nsCoreUtils::IsAncestorOf(labelNode, mDOMNode))
key = nsCoreUtils::GetAccessKeyFor(labelContent);
}
if (!key)
@ -1070,7 +1071,7 @@ nsAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
*aState |= nsIAccessibleStates::STATE_FLOATING;
// Add 'linked' state for simple xlink.
if (nsAccUtils::IsXLink(content))
if (nsCoreUtils::IsXLink(content))
*aState |= nsIAccessibleStates::STATE_LINKED;
return NS_OK;
@ -1495,7 +1496,7 @@ nsAccessible::TakeFocus()
// the ID of the desired element.
if (!frame->IsFocusable()) {
nsAutoString id;
if (content && nsAccUtils::GetID(content, id)) {
if (content && nsCoreUtils::GetID(content, id)) {
nsCOMPtr<nsIContent> ancestorContent = content;
while ((ancestorContent = ancestorContent->GetParent()) &&
@ -1768,8 +1769,8 @@ nsAccessible::AppendFlatStringFromSubtreeRecurse(nsIContent *aContent,
nsIContent *nsAccessible::GetLabelContent(nsIContent *aForNode)
{
if (aForNode->IsNodeOfType(nsINode::eXUL))
return nsAccUtils::FindNeighbourPointingToNode(aForNode, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::label);
return nsCoreUtils::FindNeighbourPointingToNode(aForNode, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::label);
return GetHTMLLabelContent(aForNode);
}
@ -1793,12 +1794,12 @@ nsIContent* nsAccessible::GetHTMLLabelContent(nsIContent *aForNode)
// for="control_id" attribute. To save computing time, only
// look for those inside of a form element
nsAutoString forId;
if (!nsAccUtils::GetID(aForNode, forId)) {
if (!nsCoreUtils::GetID(aForNode, forId)) {
break;
}
// Actually we'll be walking down the content this time, with a depth first search
return nsAccUtils::FindDescendantPointingToID(&forId, walkUpContent,
nsAccessibilityAtoms::_for);
return nsCoreUtils::FindDescendantPointingToID(&forId, walkUpContent,
nsAccessibilityAtoms::_for);
}
}
@ -1950,8 +1951,8 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
if (NS_FAILED(rv) || label.IsEmpty()) {
label.Truncate();
nsIContent *labelContent =
nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::label);
nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::control,
nsAccessibilityAtoms::label);
nsCOMPtr<nsIDOMXULLabelElement> xulLabel(do_QueryInterface(labelContent));
// Check if label's value attribute is used
@ -2125,7 +2126,7 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
nsAutoString id;
nsAutoString oldValueUnused;
if (nsAccUtils::GetID(content, id)) {
if (nsCoreUtils::GetID(content, id)) {
// Expose ID. If an <iframe id> exists override the one on the <body> of the source doc,
// because the specific instance is what makes the ID useful for scripts
attributes->SetStringProperty(NS_LITERAL_CSTRING("id"), id, oldValueUnused);
@ -2168,7 +2169,7 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
}
// Level/setsize/posinset
if (!nsAccUtils::HasAccGroupAttrs(attributes)) {
if (!nsCoreUtils::HasAccGroupAttrs(attributes)) {
// The role of an accessible can be pointed by ARIA attribute but ARIA
// posinset, level, setsize may be skipped. Therefore we calculate here
// these properties to map them into description.
@ -2253,8 +2254,8 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
}
}
nsAccUtils::SetAccGroupAttrs(attributes, groupLevel, positionInGroup,
setSize);
nsCoreUtils::SetAccGroupAttrs(attributes, groupLevel, positionInGroup,
setSize);
}
}
@ -2268,7 +2269,7 @@ nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
attrAtom->GetUTF8String(&attrStr);
if (PL_strncmp(attrStr, "aria-", 5))
continue; // Not ARIA
if (!nsAccUtils::IsARIAPropForObjectAttr(attrAtom))
if (!nsCoreUtils::IsARIAPropForObjectAttr(attrAtom))
continue; // No need to expose obj attribute -- will be exposed some other way
nsAutoString value;
if (content->GetAttr(kNameSpaceID_None, attrAtom, value)) {
@ -2303,7 +2304,7 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
// Let the class from an iframe's document be exposed, don't override from <iframe class>
nsAutoString _class;
if (content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::_class, _class))
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::_class, _class);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::_class, _class);
// Get container-foo computed live region properties based on the closest container with
// the live region attribute.
@ -2320,7 +2321,8 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
NS_ENSURE_STATE(docNode);
nsIContent *topContent = GetRoleContent(docNode);
NS_ENSURE_STATE(topContent);
nsAccUtils::GetLiveContainerAttributes(aAttributes, startContent, topContent);
nsCoreUtils::GetLiveContainerAttributes(aAttributes, startContent,
topContent);
// Allow ARIA live region markup from outer documents to override
nsCOMPtr<nsISupports> container = doc->GetContainer();
nsIDocShellTreeItem *docShellTreeItem = nsnull;
@ -2344,8 +2346,8 @@ nsAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
NS_LITERAL_STRING("display"),
displayValue);
if (NS_SUCCEEDED(rv))
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::display,
displayValue);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::display,
displayValue);
return NS_OK;
}
@ -2376,7 +2378,7 @@ nsAccessible::GroupPosition(PRInt32 *aGroupLevel,
return NS_ERROR_FAILURE;
}
PRInt32 level, posInSet, setSize;
nsAccUtils::GetAccGroupAttrs(attributes, &level, &posInSet, &setSize);
nsCoreUtils::GetAccGroupAttrs(attributes, &level, &posInSet, &setSize);
if (!posInSet && !setSize)
return NS_OK;
@ -2444,7 +2446,7 @@ nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
tabPanelAccessNode->GetDOMNode(getter_AddRefs(tabPanelNode));
NS_ENSURE_STATE(tabPanelNode);
if (nsAccUtils::IsAncestorOf(tabPanelNode, gLastFocusedNode))
if (nsCoreUtils::IsAncestorOf(tabPanelNode, gLastFocusedNode))
*aState |= nsIAccessibleStates::STATE_SELECTED;
}
}
@ -2481,7 +2483,7 @@ nsAccessible::GetFinalState(PRUint32 *aState, PRUint32 *aExtraState)
// is the current one that would get focus if the user navigates to the container widget.
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
nsAutoString id;
if (content && nsAccUtils::GetID(content, id)) {
if (content && nsCoreUtils::GetID(content, id)) {
nsIContent *ancestorContent = content;
nsAutoString activeID;
while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
@ -2641,7 +2643,7 @@ nsAccessible::GetValue(nsAString& aValue)
return NS_OK;
// Check if it's a simple xlink.
if (nsAccUtils::IsXLink(content)) {
if (nsCoreUtils::IsXLink(content)) {
nsCOMPtr<nsIPresShell> presShell(do_QueryReferent(mWeakShell));
if (presShell)
return presShell->GetLinkLocation(mDOMNode, aValue);
@ -2755,7 +2757,7 @@ NS_IMETHODIMP nsAccessible::GetRole(PRUint32 *aRole)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (nsAccUtils::IsXLink(content))
if (nsCoreUtils::IsXLink(content))
*aRole = nsIAccessibleRole::ROLE_LINK;
return NS_OK;
@ -2938,7 +2940,7 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
}
if (relatedID.IsEmpty()) {
relatedNode =
do_QueryInterface(nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_labelledby));
do_QueryInterface(nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_labelledby));
}
break;
}
@ -2953,14 +2955,14 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
{
if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_describedby, relatedID)) {
relatedNode = do_QueryInterface(
nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::control, nsAccessibilityAtoms::description));
nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::control, nsAccessibilityAtoms::description));
}
break;
}
case nsIAccessibleRelation::RELATION_DESCRIPTION_FOR:
{
relatedNode =
do_QueryInterface(nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_describedby));
do_QueryInterface(nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_describedby));
if (!relatedNode && content->Tag() == nsAccessibilityAtoms::description &&
content->IsNodeOfType(nsINode::eXUL)) {
@ -2975,10 +2977,10 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
case nsIAccessibleRelation::RELATION_NODE_CHILD_OF:
{
relatedNode =
do_QueryInterface(nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_owns));
do_QueryInterface(nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_owns));
if (!relatedNode && mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
// This is an ARIA tree that doesn't use owns, so we need to get the parent the hard way
nsAccUtils::GetARIATreeItemParent(this, content, aRelated);
nsCoreUtils::GetARIATreeItemParent(this, content, aRelated);
return NS_OK;
}
// If accessible is in its own Window then we should provide NODE_CHILD_OF relation
@ -3001,7 +3003,7 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
case nsIAccessibleRelation::RELATION_CONTROLLED_BY:
{
relatedNode =
do_QueryInterface(nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_controls));
do_QueryInterface(nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_controls));
break;
}
case nsIAccessibleRelation::RELATION_CONTROLLER_FOR:
@ -3017,7 +3019,7 @@ NS_IMETHODIMP nsAccessible::GetAccessibleRelated(PRUint32 aRelationType, nsIAcce
case nsIAccessibleRelation::RELATION_FLOWS_FROM:
{
relatedNode =
do_QueryInterface(nsAccUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_flowto));
do_QueryInterface(nsCoreUtils::FindNeighbourPointingToNode(content, nsAccessibilityAtoms::aria_flowto));
break;
}
case nsIAccessibleRelation::RELATION_DEFAULT_BUTTON:
@ -3199,12 +3201,12 @@ void nsAccessible::DoCommandCallback(nsITimer *aTimer, void *aClosure)
NS_PRESSHELL_SCROLL_ANYWHERE);
// Fire mouse down and mouse up events.
PRBool res = nsAccUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
content);
PRBool res = nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_DOWN, presShell,
content);
if (!res)
return;
nsAccUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, content);
nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, content);
}
/*
@ -3445,7 +3447,7 @@ nsAccessible::GetURI(PRInt32 aIndex, nsIURI **aURI)
// Check if it's a simple xlink.
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (nsAccUtils::IsXLink(content)) {
if (nsCoreUtils::IsXLink(content)) {
nsAutoString href;
content->GetAttr(kNameSpaceID_XLink, nsAccessibilityAtoms::href, href);
@ -3714,12 +3716,12 @@ nsAccessible::GetActionRule(PRUint32 aStates)
// Check if it's simple xlink.
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
if (nsAccUtils::IsXLink(content))
if (nsCoreUtils::IsXLink(content))
return eJumpAction;
// Has registered 'click' event handler.
PRBool isOnclick = nsAccUtils::HasListener(content,
NS_LITERAL_STRING("click"));
PRBool isOnclick = nsCoreUtils::HasListener(content,
NS_LITERAL_STRING("click"));
if (isOnclick)
return eClickAction;

View File

@ -38,7 +38,7 @@
#include "nsAccessibleEventData.h"
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibilityService.h"
#include "nsIAccessNode.h"
#include "nsIDocument.h"
@ -322,8 +322,8 @@ nsAccEvent::ApplyEventRules(nsCOMArray<nsIAccessibleEvent> &aEventsToFire)
thisEvent->mEventRule = nsAccEvent::eDoNotEmit;
continue;
}
if (nsAccUtils::IsAncestorOf(tailEvent->mDOMNode,
thisEvent->mDOMNode)) {
if (nsCoreUtils::IsAncestorOf(tailEvent->mDOMNode,
thisEvent->mDOMNode)) {
// thisDOMNode is a descendant of tailDOMNode
// Do not emit thisEvent, also apply this result to sibling
// nodes of thisDOMNode.
@ -332,8 +332,8 @@ nsAccEvent::ApplyEventRules(nsCOMArray<nsIAccessibleEvent> &aEventsToFire)
thisEvent->mDOMNode, nsAccEvent::eDoNotEmit);
continue;
}
if (nsAccUtils::IsAncestorOf(thisEvent->mDOMNode,
tailEvent->mDOMNode)) {
if (nsCoreUtils::IsAncestorOf(thisEvent->mDOMNode,
tailEvent->mDOMNode)) {
// tailDOMNode is a descendant of thisDOMNode
// Do not emit tailEvent, also apply this result to sibling
// nodes of tailDOMNode.
@ -381,7 +381,7 @@ nsAccEvent::ApplyToSiblings(nsCOMArray<nsIAccessibleEvent> &aEventsToFire,
nsRefPtr<nsAccEvent> accEvent = GetAccEventPtr(aEventsToFire[index]);
if (accEvent->mEventType == aEventType &&
accEvent->mEventRule != nsAccEvent::eDoNotEmit &&
nsAccUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) {
nsCoreUtils::AreSiblings(accEvent->mDOMNode, aDOMNode)) {
accEvent->mEventRule = aEventRule;
}
}

View File

@ -42,7 +42,7 @@
#include "nsIAccessibilityService.h"
#include "nsIAccessibleDocument.h"
#include "nsAccessibleWrap.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsIDOMNSHTMLElement.h"
#include "nsGUIEvent.h"
#include "nsHyperTextAccessibleWrap.h"
@ -256,8 +256,8 @@ void
nsLinkableAccessible::CacheActionContent()
{
nsCOMPtr<nsIContent> walkUpContent(do_QueryInterface(mDOMNode));
PRBool isOnclick = nsAccUtils::HasListener(walkUpContent,
NS_LITERAL_STRING("click"));
PRBool isOnclick = nsCoreUtils::HasListener(walkUpContent,
NS_LITERAL_STRING("click"));
if (isOnclick) {
mActionContent = walkUpContent;
@ -266,8 +266,8 @@ nsLinkableAccessible::CacheActionContent()
}
while ((walkUpContent = walkUpContent->GetParent())) {
isOnclick = nsAccUtils::HasListener(walkUpContent,
NS_LITERAL_STRING("click"));
isOnclick = nsCoreUtils::HasListener(walkUpContent,
NS_LITERAL_STRING("click"));
nsCOMPtr<nsIDOMNode> walkUpNode(do_QueryInterface(walkUpContent));

View File

@ -36,7 +36,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsIAccessibleStates.h"
#include "nsIAccessibleTypes.h"
@ -77,8 +77,8 @@
static NS_DEFINE_IID(kRangeCID, NS_RANGE_CID);
void
nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
nsAString& aAttrValue)
nsCoreUtils::GetAccAttr(nsIPersistentProperties *aAttributes,
nsIAtom *aAttrName, nsAString& aAttrValue)
{
aAttrValue.Truncate();
@ -88,8 +88,8 @@ nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
}
void
nsAccUtils::SetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
const nsAString& aAttrValue)
nsCoreUtils::SetAccAttr(nsIPersistentProperties *aAttributes,
nsIAtom *aAttrName, const nsAString& aAttrValue)
{
nsAutoString oldValue;
nsCAutoString attrName;
@ -99,9 +99,9 @@ nsAccUtils::SetAccAttr(nsIPersistentProperties *aAttributes, nsIAtom *aAttrName,
}
void
nsAccUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 *aLevel, PRInt32 *aPosInSet,
PRInt32 *aSetSize)
nsCoreUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 *aLevel, PRInt32 *aPosInSet,
PRInt32 *aSetSize)
{
*aLevel = 0;
*aPosInSet = 0;
@ -133,7 +133,7 @@ nsAccUtils::GetAccGroupAttrs(nsIPersistentProperties *aAttributes,
}
PRBool
nsAccUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
nsCoreUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
{
nsAutoString value;
@ -147,9 +147,9 @@ nsAccUtils::HasAccGroupAttrs(nsIPersistentProperties *aAttributes)
}
void
nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 aLevel, PRInt32 aPosInSet,
PRInt32 aSetSize)
nsCoreUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
PRInt32 aLevel, PRInt32 aPosInSet,
PRInt32 aSetSize)
{
nsAutoString value;
@ -170,8 +170,8 @@ nsAccUtils::SetAccGroupAttrs(nsIPersistentProperties *aAttributes,
}
void
nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
nsCoreUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aNode));
if (!item)
@ -209,8 +209,8 @@ nsAccUtils::SetAccAttrsForXULSelectControlItem(nsIDOMNode *aNode,
}
void
nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
nsCoreUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aNode));
if (!item)
@ -285,7 +285,7 @@ nsAccUtils::SetAccAttrsForXULContainerItem(nsIDOMNode *aNode,
}
PRBool
nsAccUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
nsCoreUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
{
NS_ENSURE_TRUE(aContent, PR_FALSE);
nsCOMPtr<nsIEventListenerManager> listenerManager;
@ -295,9 +295,9 @@ nsAccUtils::HasListener(nsIContent *aContent, const nsAString& aEventType)
}
PRBool
nsAccUtils::DispatchMouseEvent(PRUint32 aEventType,
nsIPresShell *aPresShell,
nsIContent *aContent)
nsCoreUtils::DispatchMouseEvent(PRUint32 aEventType,
nsIPresShell *aPresShell,
nsIContent *aContent)
{
nsIFrame *frame = aPresShell->GetPrimaryFrameFor(aContent);
if (!frame)
@ -337,7 +337,7 @@ nsAccUtils::DispatchMouseEvent(PRUint32 aEventType,
}
PRUint32
nsAccUtils::GetAccessKeyFor(nsIContent *aContent)
nsCoreUtils::GetAccessKeyFor(nsIContent *aContent)
{
if (!aContent)
return 0;
@ -370,8 +370,8 @@ nsAccUtils::GetAccessKeyFor(nsIContent *aContent)
}
nsresult
nsAccUtils::FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
PRBool aIsAsynch)
nsCoreUtils::FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
PRBool aIsAsynch)
{
NS_ENSURE_ARG(aAccessible);
@ -386,7 +386,7 @@ nsAccUtils::FireAccEvent(PRUint32 aEventType, nsIAccessible *aAccessible,
}
already_AddRefed<nsIDOMElement>
nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode)
nsCoreUtils::GetDOMElementFor(nsIDOMNode *aNode)
{
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
nsIDOMElement *element = nsnull;
@ -416,8 +416,8 @@ nsAccUtils::GetDOMElementFor(nsIDOMNode *aNode)
}
PRBool
nsAccUtils::IsAncestorOf(nsIDOMNode *aPossibleAncestorNode,
nsIDOMNode *aPossibleDescendantNode)
nsCoreUtils::IsAncestorOf(nsIDOMNode *aPossibleAncestorNode,
nsIDOMNode *aPossibleDescendantNode)
{
NS_ENSURE_TRUE(aPossibleAncestorNode && aPossibleDescendantNode, PR_FALSE);
@ -434,8 +434,8 @@ nsAccUtils::IsAncestorOf(nsIDOMNode *aPossibleAncestorNode,
}
PRBool
nsAccUtils::AreSiblings(nsIDOMNode *aDOMNode1,
nsIDOMNode *aDOMNode2)
nsCoreUtils::AreSiblings(nsIDOMNode *aDOMNode1,
nsIDOMNode *aDOMNode2)
{
NS_ENSURE_TRUE(aDOMNode1 && aDOMNode2, PR_FALSE);
@ -449,7 +449,7 @@ nsAccUtils::AreSiblings(nsIDOMNode *aDOMNode1,
}
already_AddRefed<nsIAccessible>
nsAccUtils::GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole)
nsCoreUtils::GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole)
{
nsCOMPtr<nsIAccessible> parentAccessible = aDescendant, testRoleAccessible;
while (NS_SUCCEEDED(parentAccessible->GetParent(getter_AddRefs(testRoleAccessible))) &&
@ -471,8 +471,9 @@ nsAccUtils::GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole)
}
void
nsAccUtils::GetARIATreeItemParent(nsIAccessible *aStartTreeItem, nsIContent *aStartContent,
nsIAccessible **aTreeItemParentResult)
nsCoreUtils::GetARIATreeItemParent(nsIAccessible *aStartTreeItem,
nsIContent *aStartContent,
nsIAccessible **aTreeItemParentResult)
{
*aTreeItemParentResult = nsnull;
nsAutoString levelStr;
@ -546,10 +547,10 @@ nsAccUtils::GetARIATreeItemParent(nsIAccessible *aStartTreeItem, nsIContent *aSt
}
nsresult
nsAccUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
PRUint32 aScrollType)
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
PRUint32 aScrollType)
{
PRInt16 vPercent, hPercent;
ConvertScrollTypeToPercents(aScrollType, &vPercent, &hPercent);
@ -559,10 +560,10 @@ nsAccUtils::ScrollSubstringTo(nsIFrame *aFrame,
}
nsresult
nsAccUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
PRInt16 aVPercent, PRInt16 aHPercent)
nsCoreUtils::ScrollSubstringTo(nsIFrame *aFrame,
nsIDOMNode *aStartNode, PRInt32 aStartIndex,
nsIDOMNode *aEndNode, PRInt32 aEndIndex,
PRInt16 aVPercent, PRInt16 aHPercent)
{
if (!aFrame || !aStartNode || !aEndNode)
return NS_ERROR_FAILURE;
@ -598,9 +599,9 @@ nsAccUtils::ScrollSubstringTo(nsIFrame *aFrame,
}
void
nsAccUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint& aPoint)
nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
nsIFrame *aFrame,
const nsIntPoint& aPoint)
{
nsIScrollableFrame *scrollableFrame = nsnull;
CallQueryInterface(aScrollableFrame, &scrollableFrame);
@ -624,9 +625,9 @@ nsAccUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame,
}
void
nsAccUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
PRInt16 *aVPercent,
PRInt16 *aHPercent)
nsCoreUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
PRInt16 *aVPercent,
PRInt16 *aHPercent)
{
switch (aScrollType)
{
@ -661,10 +662,10 @@ nsAccUtils::ConvertScrollTypeToPercents(PRUint32 aScrollType,
}
nsresult
nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordinateType,
nsIAccessNode *aAccessNode,
nsIntPoint *aCoords)
nsCoreUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
PRUint32 aCoordinateType,
nsIAccessNode *aAccessNode,
nsIntPoint *aCoords)
{
NS_ENSURE_ARG_POINTER(aCoords);
@ -696,9 +697,9 @@ nsAccUtils::ConvertToScreenCoords(PRInt32 aX, PRInt32 aY,
}
nsresult
nsAccUtils::ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
PRUint32 aCoordinateType,
nsIAccessNode *aAccessNode)
nsCoreUtils::ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
PRUint32 aCoordinateType,
nsIAccessNode *aAccessNode)
{
switch (aCoordinateType) {
case nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE:
@ -730,7 +731,7 @@ nsAccUtils::ConvertScreenCoordsTo(PRInt32 *aX, PRInt32 *aY,
}
nsIntPoint
nsAccUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
nsCoreUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
{
nsIntPoint coords(0, 0);
nsCOMPtr<nsIDocShellTreeItem> treeItem(GetDocShellTreeItemFor(aNode));
@ -756,7 +757,7 @@ nsAccUtils::GetScreenCoordsForWindow(nsIDOMNode *aNode)
}
nsIntPoint
nsAccUtils::GetScreenCoordsForWindow(nsIAccessNode *aAccessNode)
nsCoreUtils::GetScreenCoordsForWindow(nsIAccessNode *aAccessNode)
{
nsCOMPtr<nsIDOMNode> DOMNode;
aAccessNode->GetDOMNode(getter_AddRefs(DOMNode));
@ -767,7 +768,7 @@ nsAccUtils::GetScreenCoordsForWindow(nsIAccessNode *aAccessNode)
}
nsIntPoint
nsAccUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
nsCoreUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
{
nsCOMPtr<nsPIAccessNode> parent;
nsCOMPtr<nsIAccessible> accessible(do_QueryInterface(aAccessNode));
@ -793,7 +794,7 @@ nsAccUtils::GetScreenCoordsForParent(nsIAccessNode *aAccessNode)
}
already_AddRefed<nsIDocShellTreeItem>
nsAccUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
nsCoreUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
{
if (!aNode)
return nsnull;
@ -816,7 +817,7 @@ nsAccUtils::GetDocShellTreeItemFor(nsIDOMNode *aNode)
}
nsIFrame*
nsAccUtils::GetFrameFor(nsIDOMElement *aElm)
nsCoreUtils::GetFrameFor(nsIDOMElement *aElm)
{
nsCOMPtr<nsIPresShell> shell = nsAccessNode::GetPresShellFor(aElm);
if (!shell)
@ -830,14 +831,14 @@ nsAccUtils::GetFrameFor(nsIDOMElement *aElm)
}
PRBool
nsAccUtils::GetID(nsIContent *aContent, nsAString& aID)
nsCoreUtils::GetID(nsIContent *aContent, nsAString& aID)
{
nsIAtom *idAttribute = aContent->GetIDAttributeName();
return idAttribute ? aContent->GetAttr(kNameSpaceID_None, idAttribute, aID) : PR_FALSE;
}
PRBool
nsAccUtils::IsXLink(nsIContent *aContent)
nsCoreUtils::IsXLink(nsIContent *aContent)
{
if (!aContent)
return PR_FALSE;
@ -848,23 +849,23 @@ nsAccUtils::IsXLink(nsIContent *aContent)
}
nsIContent*
nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom *aRelationAttr,
nsIAtom *aTagName,
PRUint32 aAncestorLevelsToSearch)
nsCoreUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom *aRelationAttr,
nsIAtom *aTagName,
PRUint32 aAncestorLevelsToSearch)
{
return FindNeighbourPointingToNode(aForNode, &aRelationAttr, 1, aTagName, aAncestorLevelsToSearch);
}
nsIContent*
nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIAtom *aTagName,
PRUint32 aAncestorLevelsToSearch)
nsCoreUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIAtom *aTagName,
PRUint32 aAncestorLevelsToSearch)
{
nsAutoString controlID;
if (!nsAccUtils::GetID(aForNode, controlID)) {
if (!nsCoreUtils::GetID(aForNode, controlID)) {
if (!aForNode->IsInAnonymousSubtree())
return nsnull;
@ -931,12 +932,12 @@ nsAccUtils::FindNeighbourPointingToNode(nsIContent *aForNode,
// Pass in aAriaProperty = null and aRelationAttr == nsnull if any <label> will do
nsIContent*
nsAccUtils::FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
nsCoreUtils::FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
{
// Surround id with spaces for search
nsCAutoString idWithSpaces(' ');
@ -948,22 +949,22 @@ nsAccUtils::FindDescendantPointingToID(const nsString *aId,
}
nsIContent*
nsAccUtils::FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
nsIAtom *aRelationAttr,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
nsCoreUtils::FindDescendantPointingToID(const nsString *aId,
nsIContent *aLookContent,
nsIAtom *aRelationAttr,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
{
return FindDescendantPointingToID(aId, aLookContent, &aRelationAttr, 1, aExcludeContent, aTagType);
}
nsIContent*
nsAccUtils::FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
nsIContent *aLookContent,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
nsCoreUtils::FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
nsIContent *aLookContent,
nsIAtom **aRelationAttrs,
PRUint32 aAttrNum,
nsIContent *aExcludeContent,
nsIAtom *aTagType)
{
NS_ENSURE_TRUE(aLookContent, nsnull);
NS_ENSURE_TRUE(aRelationAttrs && *aRelationAttrs, nsnull);
@ -1010,8 +1011,8 @@ nsAccUtils::FindDescendantPointingToIDImpl(nsCString& aIdWithSpaces,
}
void
nsAccUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
nsAString& aLanguage)
nsCoreUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
nsAString& aLanguage)
{
aLanguage.Truncate();
@ -1023,7 +1024,7 @@ nsAccUtils::GetLanguageFor(nsIContent *aContent, nsIContent *aRootContent,
}
nsRoleMapEntry*
nsAccUtils::GetRoleMapEntry(nsIDOMNode *aNode)
nsCoreUtils::GetRoleMapEntry(nsIDOMNode *aNode)
{
nsIContent *content = nsAccessible::GetRoleContent(aNode);
nsAutoString roleString;
@ -1059,7 +1060,7 @@ nsAccUtils::GetRoleMapEntry(nsIDOMNode *aNode)
}
PRBool
nsAccUtils::IsARIAPropForObjectAttr(nsIAtom *aAtom)
nsCoreUtils::IsARIAPropForObjectAttr(nsIAtom *aAtom)
{
return aAtom != nsAccessibilityAtoms::aria_activedescendant &&
aAtom != nsAccessibilityAtoms::aria_checked &&
@ -1085,8 +1086,9 @@ nsAccUtils::IsARIAPropForObjectAttr(nsIAtom *aAtom)
aAtom != nsAccessibilityAtoms::aria_valuetext;
}
void nsAccUtils::GetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
nsIContent *aStartContent, nsIContent *aTopContent)
void nsCoreUtils::GetLiveContainerAttributes(nsIPersistentProperties *aAttributes,
nsIContent *aStartContent,
nsIContent *aTopContent)
{
nsAutoString atomic, live, relevant, channel, busy;
nsIContent *ancestor = aStartContent;

View File

@ -36,8 +36,8 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsAccessibilityUtils_h_
#define nsAccessibilityUtils_h_
#ifndef nsCoreUtils_h_
#define nsCoreUtils_h_
#include "nsAccessibilityAtoms.h"
#include "nsIAccessible.h"
@ -52,7 +52,7 @@
#include "nsPoint.h"
#include "nsIAccessibleDocument.h"
class nsAccUtils
class nsCoreUtils
{
public:
/**

View File

@ -117,7 +117,7 @@ nsDocAccessible::nsDocAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell)
mAccessNodeCache.Init(kDefaultCacheSize);
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(docShellTreeItem);
if (docShell) {
PRUint32 busyFlags;
@ -203,7 +203,7 @@ NS_IMETHODIMP nsDocAccessible::GetRole(PRUint32 *aRole)
*aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
if (docShellTreeItem) {
nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
@ -247,7 +247,7 @@ NS_IMETHODIMP nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
nsIContent *ownerContent = parentDoc->FindContentForSubDocument(mDocument);
nsCOMPtr<nsIDOMNode> ownerNode(do_QueryInterface(ownerContent));
if (ownerNode) {
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(ownerNode);
nsRoleMapEntry *roleMapEntry = nsCoreUtils::GetRoleMapEntry(ownerNode);
if (roleMapEntry)
mRoleMapEntry = roleMapEntry; // Override
}
@ -371,7 +371,7 @@ NS_IMETHODIMP nsDocAccessible::TakeFocus()
}
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(treeItem);
NS_ENSURE_TRUE(docShell, NS_ERROR_FAILURE);
@ -507,7 +507,7 @@ NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
if (!mDocument->HasFlag(NODE_IS_EDITABLE)) {
nsCOMPtr<nsIDOMNode> DOMDocument(do_QueryInterface(mDocument));
nsCOMPtr<nsIDOMElement> DOMElement =
nsAccUtils::GetDOMElementFor(DOMDocument);
nsCoreUtils::GetDOMElementFor(DOMDocument);
nsCOMPtr<nsIContent> content(do_QueryInterface(DOMElement));
if (!content->HasFlag(NODE_IS_EDITABLE))
@ -617,7 +617,7 @@ NS_IMETHODIMP nsDocAccessible::Shutdown()
}
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
ShutdownChildDocuments(treeItem);
RemoveEventListeners();
@ -873,7 +873,7 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
}
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
if (!treeItem) {
return NS_OK;
}
@ -897,7 +897,7 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
// Fire STATE_CHANGE event for doc load finish if focus is in same doc tree
if (gLastFocusedNode) {
nsCOMPtr<nsIDocShellTreeItem> focusedTreeItem =
nsAccUtils::GetDocShellTreeItemFor(gLastFocusedNode);
nsCoreUtils::GetDocShellTreeItemFor(gLastFocusedNode);
if (focusedTreeItem) {
nsCOMPtr<nsIDocShellTreeItem> sameTypeRootOfFocus;
focusedTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRootOfFocus));
@ -922,7 +922,7 @@ NS_IMETHODIMP nsDocAccessible::FireDocLoadEvents(PRUint32 aEventType)
FireAccessibleEvent(accEvent);
}
nsAccUtils::FireAccEvent(aEventType, this);
nsCoreUtils::FireAccEvent(aEventType, this);
}
return NS_OK;
}
@ -937,7 +937,7 @@ void nsDocAccessible::ScrollTimerCallback(nsITimer *aTimer, void *aClosure)
// We only want to fire accessibilty scroll event when scrolling stops or pauses
// Therefore, we wait for no scroll events to occur between 2 ticks of this timer
// That indicates a pause in scrolling, so we fire the accessibilty scroll event
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_END, docAcc);
docAcc->mScrollPositionChangedTicks = 0;
if (docAcc->mScrollWatchTimer) {
@ -1480,7 +1480,7 @@ nsDocAccessible::CreateTextChangeEventForNode(nsIAccessible *aContainerAccessibl
do_QueryInterface(changeAccessible);
nsCOMPtr<nsIDOMNode> childNode;
childAccessNode->GetDOMNode(getter_AddRefs(childNode));
if (!nsAccUtils::IsAncestorOf(aChangeNode, childNode)) {
if (!nsCoreUtils::IsAncestorOf(aChangeNode, childNode)) {
break; // We only want accessibles with DOM nodes as children of this node
}
length += TextLength(child);
@ -1677,7 +1677,7 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
// line-number object attribute on it
nsCOMPtr<nsIAccessible> accForFocus;
GetAccService()->GetAccessibleFor(gLastFocusedNode, getter_AddRefs(accForFocus));
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ALERT, accForFocus);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ALERT, accForFocus);
#endif
nsCOMPtr<nsIAccessibleCaretMoveEvent> caretMoveEvent =
new nsAccCaretMoveEvent(accessible, caretOffset);
@ -1689,8 +1689,8 @@ NS_IMETHODIMP nsDocAccessible::FlushPendingEvents()
PRInt32 selectionCount;
accessibleText->GetSelectionCount(&selectionCount);
if (selectionCount) { // There's a selection so fire selection change as well
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED,
accessible, PR_TRUE);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_TEXT_SELECTION_CHANGED,
accessible, PR_TRUE);
}
}
}
@ -1773,8 +1773,8 @@ void nsDocAccessible::RefreshNodes(nsIDOMNode *aStartNode)
if (!popup) {
// Popup elements already fire these via DOMMenuInactive
// handling in nsRootAccessible::HandleEvent
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
}
nsCOMPtr<nsPIAccessible> privateAccessible = do_QueryInterface(accessible);
@ -2013,7 +2013,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
// Check to see change occured in an ARIA menu, and fire
// an EVENT_MENUPOPUP_START if it did.
nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(childNode);
nsRoleMapEntry *roleMapEntry = nsCoreUtils::GetRoleMapEntry(childNode);
if (roleMapEntry && roleMapEntry->role == nsIAccessibleRole::ROLE_MENUPOPUP) {
FireDelayedToolkitEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
childNode, nsAccEvent::eRemoveDupes,
@ -2034,7 +2034,7 @@ NS_IMETHODIMP nsDocAccessible::InvalidateCacheSubtree(nsIContent *aChild,
if (!ancestorNode) {
break;
}
roleMapEntry = nsAccUtils::GetRoleMapEntry(ancestorNode);
roleMapEntry = nsCoreUtils::GetRoleMapEntry(ancestorNode);
}
}

View File

@ -135,7 +135,7 @@ nsRootAccessible::GetName(nsAString& aName)
}
nsCOMPtr<nsIDocShellTreeItem> docShellAsItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
NS_ENSURE_TRUE(docShellAsItem, NS_ERROR_FAILURE);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
@ -195,7 +195,7 @@ PRUint32 nsRootAccessible::GetChromeFlags()
// by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
// Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
NS_ENSURE_TRUE(treeItem, 0);
nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
treeItem->GetTreeOwner(getter_AddRefs(treeOwner));
@ -386,7 +386,7 @@ void nsRootAccessible::TryFireEarlyLoadEvent(nsIDOMNode *aDocNode)
// This also works for firing events for error pages
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(aDocNode);
nsCoreUtils::GetDocShellTreeItemFor(aDocNode);
NS_ASSERTION(treeItem, "No docshelltreeitem for aDocNode");
if (!treeItem) {
return;
@ -498,12 +498,14 @@ PRBool nsRootAccessible::FireAccessibleFocusEvent(nsIAccessible *aAccessible,
finalFocusAccessible->GetRole(&naturalRole);
if (role != naturalRole) { // Must be a DHTML menuitem
nsCOMPtr<nsIAccessible> menuBarAccessible =
nsAccUtils::GetAncestorWithRole(finalFocusAccessible, nsIAccessibleRole::ROLE_MENUBAR);
nsCoreUtils::GetAncestorWithRole(finalFocusAccessible,
nsIAccessibleRole::ROLE_MENUBAR);
nsCOMPtr<nsIAccessNode> menuBarAccessNode = do_QueryInterface(menuBarAccessible);
if (menuBarAccessNode) {
menuBarAccessNode->GetDOMNode(getter_AddRefs(mCurrentARIAMenubar));
if (mCurrentARIAMenubar) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START, menuBarAccessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START,
menuBarAccessible);
}
}
}
@ -653,7 +655,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
// It's also the case when a popup gets focus in ATK -- when it closes
// we need to fire an event to restore focus to where it was
if (!gLastFocusedNode ||
!nsAccUtils::IsAncestorOf(aTargetNode, gLastFocusedNode)) {
!nsCoreUtils::IsAncestorOf(aTargetNode, gLastFocusedNode)) {
return NS_OK; // And was not focused on an item inside the popup
}
// Focus was on or inside of a popup that's being hidden
@ -768,12 +770,12 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
// for each tree item. Perhaps each tree item will need to cache its
// selection state and fire an event after a DOM "select" event when
// that state changes. nsXULTreeAccessible::UpdateTreeSelection();
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
accessible);
return nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
accessible);
}
return nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION,
treeItemAccessible);
return nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION,
treeItemAccessible);
}
}
else
@ -824,7 +826,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
FireAccessibleFocusEvent(accessible, focusedItem, aEvent);
}
else if (eventType.EqualsLiteral("AlertActive")) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
}
else if (eventType.EqualsLiteral("popupshown")) {
// Don't fire menupopup events for combobox and autocomplete lists
@ -841,13 +843,13 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
event = nsIAccessibleEvent::EVENT_ASYNCH_SHOW;
}
if (event) {
nsAccUtils::FireAccEvent(event, accessible);
nsCoreUtils::FireAccEvent(event, accessible);
}
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
accessible);
}
}
else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
@ -912,11 +914,13 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
}
else if (eventType.EqualsLiteral("DOMMenuBarActive")) { // Always asynch, always from user input
nsAccEvent::PrepareForEvent(aTargetNode, PR_TRUE);
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START, accessible, PR_TRUE);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_START,
accessible, PR_TRUE);
}
else if (eventType.EqualsLiteral("DOMMenuBarInactive")) { // Always asynch, always from user input
nsAccEvent::PrepareForEvent(aTargetNode, PR_TRUE);
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_END, accessible, PR_TRUE);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENU_END,
accessible, PR_TRUE);
FireCurrentFocusEvent();
}
else if (eventType.EqualsLiteral("ValueChange")) {
@ -924,7 +928,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
}
#ifdef DEBUG
else if (eventType.EqualsLiteral("mouseover")) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START, accessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START,
accessible);
}
#endif
return NS_OK;
@ -1057,7 +1062,7 @@ NS_IMETHODIMP nsRootAccessible::GetAccessibleRelated(PRUint32 aRelationType,
}
nsCOMPtr<nsIDocShellTreeItem> treeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIDocShellTreeItem> contentTreeItem = GetContentDocShell(treeItem);
// there may be no content area, so we need a null check
if (contentTreeItem) {
@ -1078,7 +1083,7 @@ NS_IMETHODIMP nsRootAccessible::FireDocLoadEvents(PRUint32 aEventType)
}
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
NS_ASSERTION(docShellTreeItem, "No doc shell tree item for document");
NS_ENSURE_TRUE(docShellTreeItem, NS_ERROR_FAILURE);
PRInt32 contentType;

View File

@ -39,7 +39,7 @@
#include "nsTextUtils.h"
#include "nsAccessNode.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsLangTextAttr
@ -52,7 +52,7 @@ nsLangTextAttr::Equal(nsIDOMElement *aElm)
return PR_FALSE;
nsAutoString lang;
nsAccUtils::GetLanguageFor(content, mRootContent, lang);
nsCoreUtils::GetLanguageFor(content, mRootContent, lang);
return lang == mLang;
}
@ -191,7 +191,7 @@ nsBackgroundTextAttr::nsBackgroundTextAttr(nsIFrame *aFrame,
PRBool
nsBackgroundTextAttr::Equal(nsIDOMElement *aElm)
{
nsIFrame *frame = nsAccUtils::GetFrameFor(aElm);
nsIFrame *frame = nsCoreUtils::GetFrameFor(aElm);
if (!frame)
return PR_FALSE;

View File

@ -215,7 +215,7 @@ nsHTMLRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
}
}
nsAccUtils::SetAccGroupAttrs(aAttributes, 0, indexOf, count);
nsCoreUtils::SetAccGroupAttrs(aAttributes, 0, indexOf, count);
return NS_OK;
}

View File

@ -332,7 +332,7 @@ nsHTMLImageAccessible::GetImagePosition(PRUint32 aCoordType,
if (NS_FAILED(rv))
return rv;
return nsAccUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
return nsCoreUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
}
NS_IMETHODIMP
@ -376,7 +376,7 @@ nsHTMLImageAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
nsAutoString src;
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::src, src);
if (!src.IsEmpty())
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::src, src);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::src, src);
return NS_OK;
}

View File

@ -110,8 +110,8 @@ nsHTMLLinkAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
// This is a either named anchor (a link with also a name attribute) or
// it doesn't have any attributes. Check if 'click' event handler is
// registered, otherwise bail out.
PRBool isOnclick = nsAccUtils::HasListener(content,
NS_LITERAL_STRING("click"));
PRBool isOnclick = nsCoreUtils::HasListener(content,
NS_LITERAL_STRING("click"));
if (!isOnclick)
return NS_OK;
}

View File

@ -578,8 +578,8 @@ nsHTMLSelectOptionAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
}
}
nsAccUtils::SetAccGroupAttrs(aAttributes, level, posInSet,
static_cast<PRInt32>(setSize));
nsCoreUtils::SetAccGroupAttrs(aAttributes, level, posInSet,
static_cast<PRInt32>(setSize));
return NS_OK;
}
@ -861,8 +861,8 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
return;
}
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
multiSelect);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
multiSelect);
PRUint32 state = State(optionAccessible);
PRUint32 eventType;
@ -873,7 +873,7 @@ void nsHTMLSelectOptionAccessible::SelectionChangedIfOption(nsIContent *aPossibl
eventType = nsIAccessibleEvent::EVENT_SELECTION_REMOVE;
}
nsAccUtils::FireAccEvent(eventType, optionAccessible);
nsCoreUtils::FireAccEvent(eventType, optionAccessible);
}
nsIContent* nsHTMLSelectOptionAccessible::GetSelectState(PRUint32* aState,

View File

@ -124,8 +124,8 @@ nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttri
nsAutoString stringIdx;
stringIdx.AppendInt(idx);
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::tableCellIndex,
stringIdx);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::tableCellIndex,
stringIdx);
return NS_OK;
}

View File

@ -1201,7 +1201,7 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
if (!mDOMNode)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMElement> element = nsAccUtils::GetDOMElementFor(mDOMNode);
nsCOMPtr<nsIDOMElement> element = nsCoreUtils::GetDOMElementFor(mDOMNode);
nsCSSTextAttr textAttr(PR_TRUE, element, nsnull);
while (textAttr.Iterate()) {
@ -1211,14 +1211,14 @@ nsHyperTextAccessible::GetDefaultTextAttributes(nsIPersistentProperties **aAttri
attributes->SetStringProperty(name, value, oldValue);
}
nsIFrame *sourceFrame = nsAccUtils::GetFrameFor(element);
nsIFrame *sourceFrame = nsCoreUtils::GetFrameFor(element);
if (sourceFrame) {
nsBackgroundTextAttr backgroundTextAttr(sourceFrame, nsnull);
nsAutoString value;
if (backgroundTextAttr.Get(value)) {
nsAccUtils::SetAccAttr(attributes,
nsAccessibilityAtoms::backgroundColor, value);
nsCoreUtils::SetAccAttr(attributes,
nsAccessibilityAtoms::backgroundColor, value);
}
}
@ -1256,8 +1256,8 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
if (headLevel) {
nsAutoString strHeadLevel;
strHeadLevel.AppendInt(headLevel);
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::level,
strHeadLevel);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::level,
strHeadLevel);
}
// Indicate when the current object uses block-level formatting
@ -1276,8 +1276,8 @@ nsHyperTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribute
if (lineNumber >= 1) {
nsAutoString strLineNumber;
strLineNumber.AppendInt(lineNumber);
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::lineNumber,
strLineNumber);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::lineNumber,
strLineNumber);
}
}
@ -1314,7 +1314,7 @@ NS_IMETHODIMP nsHyperTextAccessible::GetRangeExtents(PRInt32 aStartOffset, PRInt
*aWidth = boundsRect.width;
*aHeight = boundsRect.height;
return nsAccUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
return nsCoreUtils::ConvertScreenCoordsTo(aX, aY, aCoordType, this);
}
/*
@ -1337,8 +1337,8 @@ nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
nsIntRect frameScreenRect = hyperFrame->GetScreenRectExternal();
nsIntPoint coords;
nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordType,
this, &coords);
nsresult rv = nsCoreUtils::ConvertToScreenCoords(aX, aY, aCoordType,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
// coords are currently screen coordinates, and we need to turn them into
@ -1572,7 +1572,7 @@ nsHyperTextAccessible::GetAssociatedEditor(nsIEditor **aEditor)
}
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
nsAccUtils::GetDocShellTreeItemFor(mDOMNode);
nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
nsCOMPtr<nsIEditingSession> editingSession(do_GetInterface(docShellTreeItem));
if (!editingSession)
return NS_OK; // No editing session interface
@ -1667,7 +1667,7 @@ PRInt32 nsHyperTextAccessible::GetCaretLineNumber()
nsCOMPtr<nsIDOMNode> caretNode;
domSel->GetFocusNode(getter_AddRefs(caretNode));
nsCOMPtr<nsIContent> caretContent = do_QueryInterface(caretNode);
if (!caretContent || !nsAccUtils::IsAncestorOf(mDOMNode, caretNode)) {
if (!caretContent || !nsCoreUtils::IsAncestorOf(mDOMNode, caretNode)) {
return -1;
}
@ -1987,8 +1987,8 @@ nsHyperTextAccessible::ScrollSubstringTo(PRInt32 aStartIndex, PRInt32 aEndIndex,
&endOffset);
NS_ENSURE_SUCCESS(rv, rv);
return nsAccUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset, aScrollType);
return nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset, aScrollType);
}
// void nsIAccessibleText::
@ -2006,8 +2006,8 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
return NS_ERROR_FAILURE;
nsIntPoint coords;
nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
nsresult rv = nsCoreUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
this, &coords);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 startOffset, endOffset;
@ -2028,7 +2028,7 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
if (scrollableFrame) {
if (!initialScrolled) {
// Scroll substring to the given point. Turn the point into percents
// relative scrollable area to use nsAccUtils::ScrollSubstringTo.
// relative scrollable area to use nsCoreUtils::ScrollSubstringTo.
nsIntRect frameRect = parentFrame->GetScreenRectExternal();
PRInt32 devOffsetX = coords.x - frameRect.x;
PRInt32 devOffsetY = coords.y - frameRect.y;
@ -2040,9 +2040,9 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
PRInt16 hPercent = offsetPoint.x * 100 / size.width;
PRInt16 vPercent = offsetPoint.y * 100 / size.height;
rv = nsAccUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset,
vPercent, hPercent);
rv = nsCoreUtils::ScrollSubstringTo(GetFrame(), startNode, startOffset,
endNode, endOffset,
vPercent, hPercent);
NS_ENSURE_SUCCESS(rv, rv);
initialScrolled = PR_TRUE;
@ -2051,7 +2051,7 @@ nsHyperTextAccessible::ScrollSubstringToPoint(PRInt32 aStartIndex,
// scrollable area. If there are nested scrollable areas then make
// sure we scroll lower areas to the given point inside currently
// traversed scrollable area.
nsAccUtils::ScrollFrameToPoint(parentFrame, frame, coords);
nsCoreUtils::ScrollFrameToPoint(parentFrame, frame, coords);
}
}
frame = parentFrame;
@ -2266,8 +2266,8 @@ nsHyperTextAccessible::GetSpellTextAttribute(nsIDOMNode *aNode,
*aHTEndOffset = endHTOffset;
if (aAttributes) {
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::invalid,
NS_LITERAL_STRING("spelling"));
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::invalid,
NS_LITERAL_STRING("spelling"));
}
return NS_OK;
@ -2285,13 +2285,13 @@ nsHyperTextAccessible::GetLangTextAttributes(PRBool aIncludeDefAttrs,
PRInt32 *aEndHTOffset,
nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMElement> sourceElm(nsAccUtils::GetDOMElementFor(aSourceNode));
nsCOMPtr<nsIDOMElement> sourceElm(nsCoreUtils::GetDOMElementFor(aSourceNode));
nsCOMPtr<nsIContent> content(do_QueryInterface(sourceElm));
nsCOMPtr<nsIContent> rootContent(do_QueryInterface(mDOMNode));
nsAutoString lang;
nsAccUtils::GetLanguageFor(content, rootContent, lang);
nsCoreUtils::GetLanguageFor(content, rootContent, lang);
nsAutoString rootLang;
nsresult rv = GetLanguage(rootLang);
@ -2303,8 +2303,8 @@ nsHyperTextAccessible::GetLangTextAttributes(PRBool aIncludeDefAttrs,
// element or we should include default values of text attribute.
const nsAString& resultLang = lang.IsEmpty() ? rootLang : lang;
if (!resultLang.IsEmpty() && (aIncludeDefAttrs || lang != rootLang))
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::language,
resultLang);
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::language,
resultLang);
}
nsLangTextAttr textAttr(lang, rootContent);
@ -2320,8 +2320,8 @@ nsHyperTextAccessible::GetCSSTextAttributes(PRBool aIncludeDefAttrs,
PRInt32 *aEndHTOffset,
nsIPersistentProperties *aAttributes)
{
nsCOMPtr<nsIDOMElement> sourceElm(nsAccUtils::GetDOMElementFor(aSourceNode));
nsCOMPtr<nsIDOMElement> rootElm(nsAccUtils::GetDOMElementFor(mDOMNode));
nsCOMPtr<nsIDOMElement> sourceElm(nsCoreUtils::GetDOMElementFor(aSourceNode));
nsCOMPtr<nsIDOMElement> rootElm(nsCoreUtils::GetDOMElementFor(mDOMNode));
nsCSSTextAttr textAttr(aIncludeDefAttrs, sourceElm, rootElm);
while (textAttr.Iterate()) {
@ -2335,18 +2335,18 @@ nsHyperTextAccessible::GetCSSTextAttributes(PRBool aIncludeDefAttrs,
NS_ENSURE_SUCCESS(rv, rv);
}
nsIFrame *sourceFrame = nsAccUtils::GetFrameFor(sourceElm);
nsIFrame *sourceFrame = nsCoreUtils::GetFrameFor(sourceElm);
if (sourceFrame) {
nsIFrame *rootFrame = nsnull;
if (!aIncludeDefAttrs)
rootFrame = nsAccUtils::GetFrameFor(rootElm);
rootFrame = nsCoreUtils::GetFrameFor(rootElm);
nsBackgroundTextAttr backgroundTextAttr(sourceFrame, rootFrame);
nsAutoString value;
if (backgroundTextAttr.Get(value)) {
nsAccUtils::SetAccAttr(aAttributes,
nsAccessibilityAtoms::backgroundColor, value);
nsCoreUtils::SetAccAttr(aAttributes,
nsAccessibilityAtoms::backgroundColor, value);
}
nsresult rv = GetRangeForTextAttr(aSourceNode, &backgroundTextAttr,
@ -2364,7 +2364,7 @@ nsHyperTextAccessible::GetRangeForTextAttr(nsIDOMNode *aNode,
PRInt32 *aStartHTOffset,
PRInt32 *aEndHTOffset)
{
nsCOMPtr<nsIDOMElement> rootElm(nsAccUtils::GetDOMElementFor(mDOMNode));
nsCOMPtr<nsIDOMElement> rootElm(nsCoreUtils::GetDOMElementFor(mDOMNode));
NS_ENSURE_STATE(rootElm);
nsCOMPtr<nsIDOMNode> tmpNode(aNode);
@ -2380,7 +2380,7 @@ nsHyperTextAccessible::GetRangeForTextAttr(nsIDOMNode *aNode,
// Navigate backwards (find the start offset).
while (currNode && currNode != rootElm) {
nsCOMPtr<nsIDOMElement> currElm(nsAccUtils::GetDOMElementFor(currNode));
nsCOMPtr<nsIDOMElement> currElm(nsCoreUtils::GetDOMElementFor(currNode));
NS_ENSURE_STATE(currElm);
if (currNode != aNode && !aComparer->Equal(currElm)) {
@ -2414,7 +2414,7 @@ nsHyperTextAccessible::GetRangeForTextAttr(nsIDOMNode *aNode,
PRBool moveIntoSubtree = PR_TRUE;
currNode = aNode;
while (currNode && currNode != rootElm) {
nsCOMPtr<nsIDOMElement> currElm(nsAccUtils::GetDOMElementFor(currNode));
nsCOMPtr<nsIDOMElement> currElm(nsCoreUtils::GetDOMElementFor(currNode));
NS_ENSURE_STATE(currElm);
// Stop new end offset searching if the given text attribute changes its
@ -2460,7 +2460,7 @@ nsHyperTextAccessible::FindEndOffsetInSubtree(nsIDOMNode *aCurrNode,
if (!aCurrNode)
return PR_FALSE;
nsCOMPtr<nsIDOMElement> currElm(nsAccUtils::GetDOMElementFor(aCurrNode));
nsCOMPtr<nsIDOMElement> currElm(nsCoreUtils::GetDOMElementFor(aCurrNode));
NS_ENSURE_STATE(currElm);
// If the given text attribute (pointed by nsTextAttr object) changes its
@ -2511,7 +2511,7 @@ nsHyperTextAccessible::FindStartOffsetInSubtree(nsIDOMNode *aCurrNode,
return PR_TRUE;
}
nsCOMPtr<nsIDOMElement> currElm(nsAccUtils::GetDOMElementFor(aCurrNode));
nsCOMPtr<nsIDOMElement> currElm(nsCoreUtils::GetDOMElementFor(aCurrNode));
NS_ENSURE_STATE(currElm);
// If the given text attribute (pointed by nsTextAttr object) changes its

View File

@ -379,8 +379,8 @@ __try {
PRInt32 groupLevel = 0;
PRInt32 itemsInGroup = 0;
PRInt32 positionInGroup = 0;
nsAccUtils::GetAccGroupAttrs(attributes, &groupLevel, &positionInGroup,
&itemsInGroup);
nsCoreUtils::GetAccGroupAttrs(attributes, &groupLevel, &positionInGroup,
&itemsInGroup);
if (positionInGroup > 0) {
if (groupLevel > 0) {

View File

@ -192,8 +192,8 @@ NS_IMETHODIMP nsDocAccessibleWrap::FireAnchorJumpEvent()
}
nsCOMPtr<nsIAccessible> accessible = GetFirstAvailableAccessible(focusNode, PR_TRUE);
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
accessible);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_SCROLLING_START,
accessible);
return NS_OK;
}

View File

@ -172,9 +172,10 @@ STDMETHODIMP nsTextAccessibleWrap::scrollToSubstring(
/* [in] */ unsigned int aEndIndex)
{
__try {
nsresult rv = nsAccUtils::ScrollSubstringTo(GetFrame(), mDOMNode, aStartIndex,
mDOMNode, aEndIndex,
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
nsresult rv =
nsCoreUtils::ScrollSubstringTo(GetFrame(), mDOMNode, aStartIndex,
mDOMNode, aEndIndex,
nsIAccessibleScrollType::SCROLL_TYPE_ANYWHERE);
if (NS_FAILED(rv))
return E_FAIL;
} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }

View File

@ -582,7 +582,7 @@ nsXULRadioButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAttr
nsresult rv = nsFormControlAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
nsCoreUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}
@ -684,7 +684,7 @@ nsXULToolbarButtonAccessible::GetAttributesInternal(nsIPersistentProperties *aAt
}
}
nsAccUtils::SetAccGroupAttrs(aAttributes, 0, posInSet, setSize);
nsCoreUtils::SetAccGroupAttrs(aAttributes, 0, posInSet, setSize);
return NS_OK;
}

View File

@ -419,7 +419,7 @@ nsXULMenuitemAccessible::GetKeyboardShortcut(nsAString& aAccessKey)
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(mDOMNode));
if (elt) {
nsAutoString accesskey;
// We do not use nsAccUtils::GetAccesskeyFor() because accesskeys for
// We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
// menu are't registered by nsIEventStateManager.
elt->GetAttribute(NS_LITERAL_STRING("accesskey"), accesskey);
if (accesskey.IsEmpty())
@ -513,7 +513,7 @@ nsXULMenuitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
nsresult rv = nsAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttrsForXULContainerItem(mDOMNode, aAttributes);
nsCoreUtils::SetAccAttrsForXULContainerItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -970,7 +970,7 @@ nsXULListitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
nsresult rv = nsAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
nsCoreUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -233,7 +233,7 @@ nsXULTabAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
nsresult rv = nsLeafAccessible::GetAttributesInternal(aAttributes);
NS_ENSURE_SUCCESS(rv, rv);
nsAccUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
nsCoreUtils::SetAccAttrsForXULSelectControlItem(mDOMNode, aAttributes);
return NS_OK;
}

View File

@ -39,7 +39,7 @@
// NOTE: alphabetically ordered
#include "nsAccessibilityAtoms.h"
#include "nsAccessibilityUtils.h"
#include "nsCoreUtils.h"
#include "nsBaseWidgetAccessible.h"
#include "nsIDOMXULDescriptionElement.h"
#include "nsINameSpaceManager.h"

View File

@ -706,7 +706,7 @@ nsXULTreeAccessible::TreeViewInvalidated(PRInt32 aStartRow, PRInt32 aEndRow,
NS_ENSURE_SUCCESS(rv, rv);
if (name != cachedName) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, acc);
nsCoreUtils::FireAccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, acc);
treeItemAcc->SetCachedName(name);
}
}
@ -1041,14 +1041,14 @@ nsXULTreeitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
PRInt32 posInSet = topCount;
// set the group attributes
nsAccUtils::SetAccGroupAttrs(aAttributes, level + 1, posInSet, setSize);
nsCoreUtils::SetAccGroupAttrs(aAttributes, level + 1, posInSet, setSize);
// set the "cycles" attribute
PRBool isCycler;
mColumn->GetCycler(&isCycler);
if (isCycler) {
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::cycles,
NS_LITERAL_STRING("true"));
nsCoreUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::cycles,
NS_LITERAL_STRING("true"));
}
return NS_OK;