mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 739889 - densify nsOuterDocAccessible, r=surkov, tbsaunde
--HG-- rename : accessible/src/base/nsOuterDocAccessible.cpp => accessible/src/generic/OuterDocAccessible.cpp rename : accessible/src/base/nsOuterDocAccessible.h => accessible/src/generic/OuterDocAccessible.h rename : accessible/tests/mochitest/test_nsOuterDocAccessible.html => accessible/tests/mochitest/test_OuterDocAccessible.html
This commit is contained in:
parent
d73cbd10ed
commit
0e8c2ee5e7
@ -58,6 +58,7 @@ LOCAL_INCLUDES = -I$(srcdir)/../src
|
||||
|
||||
SHARED_LIBRARY_LIBS = \
|
||||
../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \
|
||||
../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \
|
||||
../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \
|
||||
../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \
|
||||
../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \
|
||||
|
@ -61,6 +61,7 @@ DIRS += $(PLATFORM_DIR)
|
||||
|
||||
DIRS += \
|
||||
base \
|
||||
generic \
|
||||
html \
|
||||
xpcom \
|
||||
xforms \
|
||||
|
@ -60,7 +60,6 @@ CPPSRCS = \
|
||||
nsARIAGridAccessible.cpp \
|
||||
nsARIAMap.cpp \
|
||||
nsDocAccessible.cpp \
|
||||
nsOuterDocAccessible.cpp \
|
||||
nsCoreUtils.cpp \
|
||||
nsAccUtils.cpp \
|
||||
nsAccessibilityService.cpp \
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "nsAccessibilityService.h"
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsApplicationAccessible.h"
|
||||
#include "nsOuterDocAccessible.h"
|
||||
#include "nsRootAccessibleWrap.h"
|
||||
#include "States.h"
|
||||
|
||||
|
@ -79,7 +79,6 @@
|
||||
#include "nsNPAPIPluginInstance.h"
|
||||
#include "nsISupportsUtils.h"
|
||||
#include "nsObjectFrame.h"
|
||||
#include "nsOuterDocAccessible.h"
|
||||
#include "nsRootAccessibleWrap.h"
|
||||
#include "nsTextFragment.h"
|
||||
#include "mozilla/Services.h"
|
||||
@ -110,6 +109,7 @@
|
||||
|
||||
#include "nsXFormsFormControlsAccessible.h"
|
||||
#include "nsXFormsWidgetsAccessible.h"
|
||||
#include "OuterDocAccessible.h"
|
||||
|
||||
#include "mozilla/FunctionTimer.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
@ -210,9 +210,9 @@ already_AddRefed<nsAccessible>
|
||||
nsAccessibilityService::CreateOuterDocAccessible(nsIContent* aContent,
|
||||
nsIPresShell* aPresShell)
|
||||
{
|
||||
nsAccessible* accessible =
|
||||
new nsOuterDocAccessible(aContent,
|
||||
nsAccUtils::GetDocAccessibleFor(aPresShell));
|
||||
nsAccessible* accessible =
|
||||
new OuterDocAccessible(aContent,
|
||||
nsAccUtils::GetDocAccessibleFor(aPresShell));
|
||||
NS_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
@ -1356,7 +1356,7 @@ nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
|
||||
return nsnull;
|
||||
|
||||
if (type == nsIAccessibleProvider::OuterDoc) {
|
||||
nsAccessible* accessible = new nsOuterDocAccessible(aContent, aDoc);
|
||||
nsAccessible* accessible = new OuterDocAccessible(aContent, aDoc);
|
||||
NS_IF_ADDREF(accessible);
|
||||
return accessible;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ nsAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
// point. Skip offscreen or invisible accessibles. This takes care of cases
|
||||
// where layout won't walk into things for us, such as image map areas and
|
||||
// sub documents (XXX: subdocuments should be handled by methods of
|
||||
// nsOuterDocAccessibles).
|
||||
// OuterDocAccessibles).
|
||||
PRInt32 childCount = GetChildCount();
|
||||
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
||||
nsAccessible *child = GetChildAt(childIdx);
|
||||
|
31
accessible/src/generic/Makefile.in
Normal file
31
accessible/src/generic/Makefile.in
Normal file
@ -0,0 +1,31 @@
|
||||
# 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/.
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = accessibility
|
||||
LIBRARY_NAME = accessibility_generic_s
|
||||
LIBXUL_LIBRARY = 1
|
||||
|
||||
|
||||
CPPSRCS = \
|
||||
OuterDocAccessible.cpp \
|
||||
$(NULL)
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
FORCE_STATIC_LIB = 1
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../xpcom \
|
||||
-I$(srcdir)/../base \
|
||||
-I$(srcdir)/../../../layout/generic \
|
||||
-I$(srcdir)/../../../layout/xul/base/src \
|
||||
$(NULL)
|
@ -36,43 +36,48 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsOuterDocAccessible.h"
|
||||
#include "OuterDocAccessible.h"
|
||||
|
||||
#include "nsAccUtils.h"
|
||||
#include "nsDocAccessible.h"
|
||||
#include "Role.h"
|
||||
#include "States.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::a11y;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsOuterDocAccessible
|
||||
// OuterDocAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsOuterDocAccessible::
|
||||
nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
||||
OuterDocAccessible::
|
||||
OuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
||||
nsAccessibleWrap(aContent, aDoc)
|
||||
{
|
||||
}
|
||||
|
||||
OuterDocAccessible::~OuterDocAccessible()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
|
||||
NS_IMPL_ISUPPORTS_INHERITED0(OuterDocAccessible,
|
||||
nsAccessible)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsAccessible public (DON'T add methods here)
|
||||
|
||||
role
|
||||
nsOuterDocAccessible::NativeRole()
|
||||
OuterDocAccessible::NativeRole()
|
||||
{
|
||||
return roles::INTERNAL_FRAME;
|
||||
}
|
||||
|
||||
nsAccessible*
|
||||
nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
OuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
EWhichChildAtPoint aWhichChild)
|
||||
{
|
||||
PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0;
|
||||
nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight);
|
||||
@ -92,7 +97,7 @@ nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
|
||||
OuterDocAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
|
||||
{
|
||||
nsAutoString tag;
|
||||
aAttributes->GetStringProperty(NS_LITERAL_CSTRING("tag"), tag);
|
||||
@ -108,14 +113,14 @@ nsOuterDocAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes
|
||||
// nsIAccessible
|
||||
|
||||
PRUint8
|
||||
nsOuterDocAccessible::ActionCount()
|
||||
OuterDocAccessible::ActionCount()
|
||||
{
|
||||
// Internal frame, which is the doc's parent, should not have a click action.
|
||||
return 0;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
OuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
{
|
||||
aName.Truncate();
|
||||
|
||||
@ -123,7 +128,8 @@ nsOuterDocAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescription)
|
||||
OuterDocAccessible::GetActionDescription(PRUint8 aIndex,
|
||||
nsAString& aDescription)
|
||||
{
|
||||
aDescription.Truncate();
|
||||
|
||||
@ -131,7 +137,7 @@ nsOuterDocAccessible::GetActionDescription(PRUint8 aIndex, nsAString& aDescripti
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsOuterDocAccessible::DoAction(PRUint8 aIndex)
|
||||
OuterDocAccessible::DoAction(PRUint8 aIndex)
|
||||
{
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
@ -140,7 +146,7 @@ nsOuterDocAccessible::DoAction(PRUint8 aIndex)
|
||||
// nsAccessNode public
|
||||
|
||||
void
|
||||
nsOuterDocAccessible::Shutdown()
|
||||
OuterDocAccessible::Shutdown()
|
||||
{
|
||||
// XXX: sometimes outerdoc accessible is shutdown because of layout style
|
||||
// change however the presshell of underlying document isn't destroyed and
|
||||
@ -149,7 +155,7 @@ nsOuterDocAccessible::Shutdown()
|
||||
NS_LOG_ACCDOCDESTROY_MSG("A11y outerdoc shutdown")
|
||||
NS_LOG_ACCDOCDESTROY_ACCADDRESS("outerdoc", this)
|
||||
|
||||
nsAccessible *childAcc = mChildren.SafeElementAt(0, nsnull);
|
||||
nsAccessible* childAcc = mChildren.SafeElementAt(0, nsnull);
|
||||
if (childAcc) {
|
||||
NS_LOG_ACCDOCDESTROY("outerdoc's child document shutdown",
|
||||
childAcc->GetDocumentNode())
|
||||
@ -163,7 +169,7 @@ nsOuterDocAccessible::Shutdown()
|
||||
// nsAccessible public
|
||||
|
||||
void
|
||||
nsOuterDocAccessible::InvalidateChildren()
|
||||
OuterDocAccessible::InvalidateChildren()
|
||||
{
|
||||
// Do not invalidate children because nsAccDocManager is responsible for
|
||||
// document accessible lifetime when DOM document is created or destroyed. If
|
||||
@ -178,7 +184,7 @@ nsOuterDocAccessible::InvalidateChildren()
|
||||
}
|
||||
|
||||
bool
|
||||
nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
|
||||
OuterDocAccessible::AppendChild(nsAccessible* aAccessible)
|
||||
{
|
||||
// We keep showing the old document for a bit after creating the new one,
|
||||
// and while building the new DOM and frame tree. That's done on purpose
|
||||
@ -199,9 +205,9 @@ nsOuterDocAccessible::AppendChild(nsAccessible *aAccessible)
|
||||
}
|
||||
|
||||
bool
|
||||
nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
|
||||
OuterDocAccessible::RemoveChild(nsAccessible* aAccessible)
|
||||
{
|
||||
nsAccessible *child = mChildren.SafeElementAt(0, nsnull);
|
||||
nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
|
||||
if (child != aAccessible) {
|
||||
NS_ERROR("Wrong child to remove!");
|
||||
return false;
|
||||
@ -224,7 +230,7 @@ nsOuterDocAccessible::RemoveChild(nsAccessible *aAccessible)
|
||||
// nsAccessible protected
|
||||
|
||||
void
|
||||
nsOuterDocAccessible::CacheChildren()
|
||||
OuterDocAccessible::CacheChildren()
|
||||
{
|
||||
// Request document accessible for the content document to make sure it's
|
||||
// created. It will appended to outerdoc accessible children asynchronously.
|
@ -36,24 +36,28 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _nsOuterDocAccessible_H_
|
||||
#define _nsOuterDocAccessible_H_
|
||||
#ifndef MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
|
||||
#define MOZILLA_A11Y_OUTERDOCACCESSIBLE_H_
|
||||
|
||||
#include "nsAccessibleWrap.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace a11y {
|
||||
|
||||
/**
|
||||
* Used for <browser>, <frame>, <iframe>, <page> or editor> elements.
|
||||
*
|
||||
* In these variable names, "outer" relates to the nsOuterDocAccessible as
|
||||
* In these variable names, "outer" relates to the OuterDocAccessible as
|
||||
* opposed to the nsDocAccessibleWrap which is "inner". The outer node is
|
||||
* a something like tags listed above, whereas the inner node corresponds to
|
||||
* the inner document root.
|
||||
*/
|
||||
|
||||
class nsOuterDocAccessible : public nsAccessibleWrap
|
||||
class OuterDocAccessible : public nsAccessibleWrap
|
||||
{
|
||||
public:
|
||||
nsOuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
||||
OuterDocAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
||||
virtual ~OuterDocAccessible();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
@ -83,4 +87,7 @@ protected:
|
||||
virtual void CacheChildren();
|
||||
};
|
||||
|
||||
} // namespace a11y
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
@ -101,7 +101,7 @@ _TEST_FILES =\
|
||||
test_descr.html \
|
||||
test_nsIAccessibleDocument.html \
|
||||
test_nsIAccessibleImage.html \
|
||||
test_nsOuterDocAccessible.html \
|
||||
test_OuterDocAccessible.html \
|
||||
test_role_nsHyperTextAcc.html \
|
||||
test_textboxes.html \
|
||||
test_textboxes.xul \
|
||||
|
Loading…
Reference in New Issue
Block a user